Post-RPSBLAST Processing Utility        (revised 26 September 2019)
-- source code archive      
================================================================================
                                       
The rpsbproc source archive is available at:
https://ftp.ncbi.nih.gov/pub/mmdb/cdd/rpsbproc/
------------------------------------------------- 
1. HOW TO INSTALL A LOCAL COPY OF THE SPARCLBL COMMAND LINE UTILITY
-------------------------------------------------
-----------------------------
1.1 Precompiled binaries available for x64-linux and x64-Windows
-----------------------------

The rpsbproc source archive can be used to build and install a local copy of the rpsbproc command line utility. It is an addition to the standalone version of Reverse Position-Specific BLAST (RPS-BLAST) and post-processes the RPS-BLAST results. It is therefore necessary to also download BLAST binaries in order to run rpsbproc. 

Precompiled binaries are available for x64-linux and x64-Windows platforms, and the README file noted above provides setup instructions, as described in a separate readme file about the rpsbproc command line utility (https://ftp.ncbi.nih.gov/pub/mmdb/cdd/rpsbproc/README). 

-----------------------------
1.2 Download rpsbproc source archive for other platforms 
-----------------------------

For other platforms, download the source package (RpsbProc-src.tar.gz), unpack it, and follow instructions in this README file to build both rpsblast and rpsbproc.

To begin, download the source code tarballs. The rpsbproc program, as well as rpsblast and rpstblastn programs, are NCBI C++ toolkit applications and therefore require the NCBI C++ toolkit to build. 

The blast source archive is actually a subset of NCBI C++ toolkit, with all blast programs added in. It is recommended to download it, insert the rpsbproc source code as an additional application, and then build all programs together, with the following steps:

======================== 
Download and extract source archives for rpsbproc and blast:
======================== 

	1. Download rpsbproc source archive (RpsbProc-src.tar.gz) and extract all files:
		$ wget https://ftp.ncbi.nih.gov/pub/mmdb/cdd/rpsbproc/RpsbProc-src.tar.gz && tar -xzf RpsbProc-src.tar.gz
		$ ls -l
		
			drwxr-xr-x 4 shlu structure   4096 Sep 26 15:49 RpsbProc
			-rw-r--r-- 1 shlu structure 133702 Sep 26 15:49 RpsbProc-src.tar.gz
			
		$ cd RpsbProc
		
		$ ls -l
			-rwxr-xr-x 1 shlu structure 6392 Sep 26 15:47 README
			drwxr-xr-x 3 shlu structure 4096 Sep 26 15:49 src
			drwxr-xr-x 2 shlu structure 4096 Sep 26 10:24 utils
			
(You should have already completed step 1 as you are reading this README file, which is packaged into the rpsbproc source archive)
	

	2. Download blast source and extract:
		$ wget https://ftp.ncbi.nih.gov/blast/executables/LATEST/ncbi-blast-2.9.0+-src.tar.gz && tar -xzf ncbi-blast-2.9.0+-src.tar.gz && rm -f ncbi-blast-2.9.0+-src.tar.gz
		$ ls -l
			-rwxr-xr-x 1 shlu structure 6392 Sep 26 15:47 README
			drwxr-xr-x 3 shlu structure 4096 Mar 11  2019 ncbi-blast-2.9.0+-src
			drwxr-xr-x 3 shlu structure 4096 Sep 26 15:49 src
			drwxr-xr-x 2 shlu structure 4096 Sep 26 10:24 utils

As of this revision, the lastest blast version is 2.9.0, so the archive decompresses into a tree:

ncbi-blast-2.9.0+-src
`-- c++
    |-- compilers
    |   |-- cygwin
    |   |   ........
    |   |-- unix
    |   |   ........
    |   |-- vs2015
    |   |   ........
    |   |-- vs2017
	|	............
    |-- configure
    |-- configure.orig
    |-- include
	|	............
    `-- src
        |-- CMakeLists.txt
        |-- Makefile.in
        |-- algo
		|	..........
        |-- app
	..................

NOTE: On linux system with bash, step 2 can be done automatically by running:

		$ utils/getblsrc.sh. 

This script will automatically download the latest version of blast source code.
======================== 
Insert the rpsbproc source code into the blast directory
as an additional application:
========================  

	3. Create a subdirectory "RpsbProc" under "ncbi-blast-2.9.0+-src/c++/src/app" and copy all files and subdirectories
	   under "src" to "ncbi-blast-2.9.0+-src/c++/src/app/RpsbProc":
	   
		$ mkdir "ncbi-blast-2.9.0+-src/c++/src/app/RpsbProc"
		$ cp -r src/* ncbi-blast-2.9.0+-src/c++/src/app/RpsbProc/
	
	
	4. Edit ncbi-blast-2.9.0+-src/c++/src/app/Makefile.in to append "RpsbProc" (case sensitive)
	   to the "SUB_PROJ" line:
		$ vi ncbi-blast-2.9.0+-src/c++/src/app/Makefile.in

NOTE: On linux system with bash, step 3 and 4 can be done automatically by running:

		$ utils/embedsrc.sh -b ncbi-blast-2.9.0+-src

Now the source code is ready to be built.

======================== 
Build On *ix systems
======================== 

Go to ncbi-blast-2.9.0+-src/c++ and run ./configure script and then make:

	5. Build the source code, it may take a while:
		$ cd ncbi-blast-2.9.0+-src/c++
		$ ./configure
		$ make -k -j10
		
	6. If successful, all built binaries are under ncbi-blast-2.9.0+-src/c++/ReleaseMT/bin/.

======================== 
Build On Windows systems
======================== 

It is recommended to build the project with proper versions of Microsoft Visual Studio. As of this moment, the proper version is vs2015.
It is also recommended to copy the whole source tree to a windows system local disk, otherwise VS may complain about untrusted location.
To turn this complaint off, go to the Tools menu->Options->Project and Solutions->General,
and uncheck the "Warn user when the project location is untrusted" item.

	5. Launch vs2015, and open the ncbi_cpp.sln solution under ncbi-blast-2.9.0+-src\c++\compilers\vs2015\static\build\
	6. Select the solution configuration "ReleaseDLL" and solution platform "x64"
	7. Build the _CONFIGURE_ project.

		**Note: VS will prompt to reload solutions as it has been changed, but please leave the prompt window open and wait until the project is completely built
		and print out message that it is safe to reload.

		After the build is complete, new projects are created. Click the "Reload All" button on the prompt window to reload all projects. It may take several minutes to complete.
	
	6. After all projects are loaded, build the _BUILD_ALL_ project. It may take some time to complete.
	
	7. If successful, all built binaries should be under ncbi-blast-2.9.0+-src\c++\compilers\vs2015\static\bin\ReleaseMT\.
	
------------------------------------------------- 
[end] 

