How to get SAP running on your own machine

The web server replaces the graphical user interfaces, which I will no longer maintain. If you want to run a lot of analyses using SAP you should install the command line tool on your own machine. Even if you have never used a command line tool before you will be up and running in half an hour. Once SAP is installed you run can run it on sequences in a fasta file mydata.fasta like this:

sap --project myanalysis  mydata.fasta 

and your results will end up in a folder named myanalysis.

Install dependencies

To run SAP you need Python (version 2.7 not 3.*) on your machine. If you are on a Mac or Unix/Linux system you already have that. If you are on Windows you need a Python distribution that comes with the mingw package because Python needs this to compile SAP. I recommend the Anaconda distribution from Continuum Analytics. SAP also needs clustalw2 and blast for alignments and database search so you need to install them on your on your machine too.

Get the source code

The latest stable version of the source code is always available on Github where you can download a zipped version of the code. If you have git installed you can clone the proejct this way:

git clone https://github.com/kaspermunch/sap.git

Compile and install SAP

If you downloaded a zipped package you must first unpack it (not open it). Right-click and select unpack.

On Mac/Linux open the Terminal application. On Windows right-click on the Cmd application and click "Open as administrator". Then navigate into the unpacked directory containing the file setup.py. If you are unfamiliar with the Cmd on Windows you can look herefor a guide.

On Windows execute the following commands:

python setup.py setopt --command=build --option=compiler --set-value=mingw32
python setup.py install

On Mac/Linux you execute the following command:

sudo python setup.py install
If you prefer pip you can do this instead:
sudo pip install .

Compiling the program issues a lot of warnings. Do not worry about this. If you don't get any error messages at the end you are fine.

If you do not have admin privileges or just want to install in some non-default directory some_dir you first make sure the following set of nested directories exist: some_dir/lib/python2.7/site-packages (if your python is 2.7). You then just type:

python setup.py install --prefix=<some_dir>
Or you can just install in your user directory with pip:
pip install --user .

If you install in a non-default location you need to ensure that the install directory for the scripts is included in your PATH environmental variable and that the package install directory is included in the PYTHONPATH environmental variable . These variables are usually set in your .bachrc or .profile file like this:

On Windows you need to help you operating system find the sap script by doing the following:

  1. Using the mouse, right-click on the "My Computer" and choose "Properties".
  2. Click on the "Advanced" tab or "Advanced system settings".
  3. Click on the "Environment Variables..." button.
  4. Highlight the "Path" System variable (bottom).
  5. Click on the "Edit..." button.
  6. Append the line with ";C:Python27\Scripts\;" (if you are running python 2.7).
  7. Click OK on your way out.