pip安装pysam

pysam - a python module for reading, manipulating and writing genomic data sets.

pysam is a lightweight wrapper of the htslib C-API and provides facilities to read and write SAM/BAM/VCF/BCF/BED/GFF/GTF/FASTA/FASTQ files as well as access to the command line functionality of the samtools and bcftools packages. The module supports compression and random access through indexing.

This module provides a low-level wrapper around the htslib C-API as using cython and a high-level API for convenient access to the data within standard genomic file formats.

See:

http://www.htslib.org

https://github.com/pysam-developers/pysam

http://pysam.readthedocs.org/en/stable


pip install pysam

pip install pysam==0.9.1
pip install https://github.com/pysam-developers/pysam/archive/master.zip
conda install -c bioconda pysam

REF

https://pypi.org/project/pysam/

https://github.com/pysam-developers/pysam

=====================================================

ModuleNotFoundError: No module named 'pysam'

$ python
Python 3.6.7 | packaged by conda-forge | (default, Feb 28 2019, 09:07:38)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pysam
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pysam'
>>>

---------------------

Make sure you install pysam for the right python version. In your case, I suggest:
python2.7 -m pip install pysam

/home/software/Python-3.8.5/python -m pip install pysam

[root@ibiomed aimin]# /home/software/Python-3.8.5/python -m pip install pysam
Collecting pysam
  Downloading pysam-0.16.0.1-cp38-cp38-manylinux1_x86_64.whl (10.2 MB)
     |████████████████████████████████| 10.2 MB 10.6 MB/s
Installing collected packages: pysam
Successfully installed pysam-0.16.0.1
WARNING: You are using pip version 20.1.1; however, version 20.2.2 is available.
You should consider upgrading via the '/home/software/Python-3.8.5/python -m pip install --upgrade pip' command.
您在 /var/spool/mail/root 中有新邮件

----------------------

>>> import pysam
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/python3/lib/python3.8/site-packages/pysam/__init__.py", line 16, in <module>
    import pysam.libcsamfile as libcsamfile
  File "pysam/libcsamfile.pyx", line 1, in init pysam.libcsamfile
  File "pysam/libcalignedsegment.pyx", line 60, in init pysam.libcalignedsegment
  File "/home/software/Python-3.8.5/Lib/ctypes/__init__.py", line 7, in <module>
    from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'

-----------------------

>>> import pysam
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/python3/lib/python3.8/site-packages/pysam/__init__.py", line 16, in <module>
    import pysam.libcsamfile as libcsamfile
  File "pysam/libcsamfile.pyx", line 1, in init pysam.libcsamfile
  File "pysam/libcalignedsegment.pyx", line 60, in init pysam.libcalignedsegment
  File "/usr/local/python3/lib/python3.8/ctypes/__init__.py", line 7, in <module>
    from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'


vim /etc/profile
export PYTHON_HOME=/usr/local/python3/
export PATH=$PYTHON_HOME/bin:$PATH
source /etc/profile

-----------------------







原文地址:https://www.cnblogs.com/emanlee/p/13576349.html