Debian Codegraph @

doc/installation.rst

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