| 1 |
An online version of the installation instructions can be found here: |
| 2 |
http://pysam.readthedocs.io/en/latest/installation.html |
| 3 |
|
| 4 |
================ |
| 5 |
Installing pysam |
| 6 |
================ |
| 7 |
|
| 8 |
Pysam can be installed through conda_, PyPI_ and from the repository. |
| 9 |
The recommended way to install pysam is through conda/bioconda. |
| 10 |
|
| 11 |
Conda installation |
| 12 |
================== |
| 13 |
|
| 14 |
To install pysam in your current conda_ environment, type:: |
| 15 |
|
| 16 |
conda config --add channels bioconda |
| 17 |
conda config --add channels conda-forge |
| 18 |
conda install pysam |
| 19 |
|
| 20 |
This will install pysam from the bioconda_ channel and automatically |
| 21 |
makes sure that dependencies are installed. Also, compilation flags |
| 22 |
will be set automatically, which will potentially save a lot of |
| 23 |
trouble on OS X. |
| 24 |
|
| 25 |
PyPI installation |
| 26 |
================= |
| 27 |
|
| 28 |
Pysam provides a python interface to the functionality contained |
| 29 |
within the htslib_ C library. There are two ways that these two |
| 30 |
can be combined, ``builtin`` and ``external``. |
| 31 |
|
| 32 |
Builtin |
| 33 |
------- |
| 34 |
|
| 35 |
The typical installation will be through PyPI_:: |
| 36 |
|
| 37 |
pip install pysam |
| 38 |
|
| 39 |
This will compile the ``builtin`` htslib source code within pysam. |
| 40 |
|
| 41 |
htslib_ can be configured at compilation to turn on additional |
| 42 |
features such support using encrypted configurations, enable plugins, |
| 43 |
and more. See the htslib_ project for more information on these. |
| 44 |
|
| 45 |
Pysam will attempt to configure htslib_ to turn on some advanced |
| 46 |
features. If these fail, for example due to missing library |
| 47 |
dependencies (`libcurl`, `libcrypto`), it will fall back to |
| 48 |
conservative defaults. |
| 49 |
|
| 50 |
Options can be passed to the configure script explicitly by |
| 51 |
setting the environment variable `HTSLIB_CONFIGURE_OPTIONS`. |
| 52 |
For example:: |
| 53 |
|
| 54 |
export HTSLIB_CONFIGURE_OPTIONS=--enable-plugins |
| 55 |
pip install pysam |
| 56 |
|
| 57 |
External |
| 58 |
-------- |
| 59 |
|
| 60 |
pysam can be combined with an externally installed htslib_ |
| 61 |
library. This is a good way to avoid duplication of libraries. To link |
| 62 |
against an externally installed library, set the environment variables |
| 63 |
`HTSLIB_LIBRARY_DIR` and `HTSLIB_INCLUDE_DIR` before installing:: |
| 64 |
|
| 65 |
export HTSLIB_LIBRARY_DIR=/usr/local/lib |
| 66 |
export HTSLIB_INCLUDE_DIR=/usr/local/include |
| 67 |
pip install pysam |
| 68 |
|
| 69 |
Note that the location of the file :file:`libhts.so` needs to be known |
| 70 |
to the linker once you run pysam, for example by setting the |
| 71 |
environment-varirable `LD_LIBRARY_PATH`. |
| 72 |
|
| 73 |
Note that generally the pysam and htslib version need to be compatible. See |
| 74 |
the release notes for more information. |
| 75 |
|
| 76 |
Installation from repository |
| 77 |
============================ |
| 78 |
|
| 79 |
pysam depends on cython_ to provide the connectivity to the htslib_ C |
| 80 |
library. The installation of the source tarball (:file:`.tar.gz`) |
| 81 |
contains pre-built C-files and cython needs not be present |
| 82 |
during installation. However, when installing from the repository, |
| 83 |
cython needs to be installed beforehand. |
| 84 |
|
| 85 |
To install from repository, type:: |
| 86 |
|
| 87 |
python setup.py install |
| 88 |
|
| 89 |
For compilation options, see the section on PyPI installation above. |
| 90 |
|
| 91 |
Requirements |
| 92 |
============ |
| 93 |
|
| 94 |
Depending on the installation method, requirements for building pysam differ. |
| 95 |
|
| 96 |
When installing through conda_, dependencies will be resolved by the |
| 97 |
package manager. The pip_ installation and installation from source |
| 98 |
require a C compiler and its standard libraries as well as all |
| 99 |
requirements for building htslib. Htslib requirements are listed in |
| 100 |
the htslib/INSTALL file. |
| 101 |
|
| 102 |
Installing from the repository will require cython_ to be installed. |