File: installation.rst

package info (click to toggle)
python-pysam 0.23.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 18,468 kB
  • sloc: ansic: 158,936; python: 8,604; sh: 338; makefile: 264; perl: 41
file content (112 lines) | stat: -rw-r--r-- 3,521 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
.. _installation:

================
Installing pysam
================

Pysam can be installed through conda_, PyPI_ and from the repository.
The recommended way to install pysam is through conda/bioconda.

Conda installation
==================

To install pysam in your current conda_ environment, type::

   conda config --add channels r
   conda config --add channels bioconda
   conda install pysam

This will install pysam from the bioconda_ channel and automatically
makes sure that dependencies are installed. Also, compilation flags
will be set automatically, which will potentially save a lot of
trouble on OS X.

PyPI installation
=================

Pysam provides a python interface to the functionality contained
within the htslib_ C library. There are two ways that these two
can be combined, ``builtin`` and ``external``.

Builtin
-------

The typical installation will be through PyPI_::

   pip install pysam

Generally you will have the ``wheel`` package installed and
this command will speedily install pysam from a pre-built wheel.
Otherwise, or if you use pip's ``--no-binary`` option, this will
compile the ``builtin`` htslib source code within pysam and allow
the configuration facilities described below to be used.

htslib_ can be configured at compilation to turn on additional
features such support using encrypted configurations, enable plugins,
and more. See the htslib_ project for more information on these.

Pysam will attempt to configure htslib_ to turn on some advanced
features. If these fail, for example due to missing library
dependencies (`libcurl`, `libcrypto`), it will fall back to
conservative defaults.

Options can be passed to the configure script explicitly by
setting the environment variable `HTSLIB_CONFIGURE_OPTIONS`.
For example::

  export HTSLIB_CONFIGURE_OPTIONS=--enable-plugins
  pip install pysam

External
--------

pysam can be combined with an externally installed htslib_
library. This is a good way to avoid duplication of libraries. To link
against an externally installed library, set the environment variables
`HTSLIB_LIBRARY_DIR` and `HTSLIB_INCLUDE_DIR` before installing::

   export HTSLIB_LIBRARY_DIR=/usr/local/lib
   export HTSLIB_INCLUDE_DIR=/usr/local/include
   pip install pysam

Note that the location of the file :file:`libhts.so` needs to be known
to the linker once you run pysam, for example by setting the
environment-varirable `LD_LIBRARY_PATH`.

Note that generally the pysam and htslib version need to be
compatible. See the release notes for more information.

Installation from repository
============================

pysam depends on cython_ to provide the connectivity to the htslib_ C
library. The installation of the source tarball (:file:`.tar.gz`)
contains pre-built C-files and cython needs not be present
during installation. However, when installing from the repository,
cython needs to be installed beforehand.

To install from repository, type::

    python setup.py install

For compilation options, see the section on PyPI installation above.

Requirements
============

Depending on the installation method, requirements for building pysam differ.

When installing through conda_, dependencies will be resolved by the
package manager. The pip_ installation and installation from source
require a C compiler and its standard libraries as well as all
requirements for building htslib. Htslib requirements are listed in
the htslib/INSTALL file.

Installing from the repository will require cython_ to be installed.