htseq-count cannot find pysam
3
0
Entering edit mode
9.0 years ago
Gary ▴ 480

Hi,

I use htseq-count to quantify a RNA-Seq bam file, using Terminal on a Mac BookPro. However, it cannot find the pysam, even I have already installed and upgraded the pysam (the detail below). Could you help me? Thanks a lot.

Best,
Gary

gary > pwd
/Users/gary/Downloads/htseq

gary > ll
total 9379312
-rw-r-----@ 1 gary  staff   4.3G Dec 14 13:38 T7_Early_R.bam
-rw-r--r--  1 gary  staff   161M Dec 15 13:07 hg19refGene.gtf

gary > htseq-count -f bam -s no -t exon -i gene_id -m union T7_Early_R.bam hg19refGene.gtf > T7_Early_R.txt
100000 GFF lines processed.
200000 GFF lines processed.
300000 GFF lines processed.
400000 GFF lines processed.
500000 GFF lines processed.
600000 GFF lines processed.
700000 GFF lines processed.
800000 GFF lines processed.
900000 GFF lines processed.
1000000 GFF lines processed.
1015586 GFF lines processed.

Please Install PySam to use the BAM_Reader Class (http://code.google.com/p/pysam/)Error occured when reading beginning of SAM/BAM file.
  No module named pysam
  [Exception type: ImportError, raised in __init__.py:937]

gary > pip install pysam
Requirement already satisfied (use --upgrade to upgrade): pysam in /Users/gary/anaconda/lib/python2.7/site-packages

gary > pip install pysam --upgrade
Requirement already up-to-date: pysam in /Users/gary/anaconda/lib/python2.7/site-packages
htseq-count RNA-Seq quantification HTSeq • 9.0k views
ADD COMMENT
4
Entering edit mode

What does which htseq-count report? My guess is that htseq-count isn't using anaconda's python. Anyway, you might just try setting the $PYTHON_PATH.

ADD REPLY
0
Entering edit mode

Thanks a lot. My htseq-count on /usr/local/bin/htseq-count. Could you teach me how to set the $PYTHON_PATH? Thanks again.

ADD REPLY
0
Entering edit mode

Hi,

After google, I try to set the $PYTHON_PATH, but it doesn’t work below. Could you teach me how to set $PYTHON_PATH correctly? Many thanks.

gary > pwd
/Users/gary

gary > source ~/.bash_profile
Welcome gary, the current time is 

gary > cat .bash_profile
…
export PATH=$PATH:/Users/gary/anaconda/pkgs/pysam-0.8.4-py27_0/lib/python2.7/site-packages/pysam/
PYTHONPATH="${PYTHONPATH}:/Users/gary/anaconda/pkgs/pysam-0.8.4-py27_0/lib/python2.7/site-packages/pysam/"
export PYTHONPATH
…


gary > ll
…
-rwxr-xr-x@ 1 gary  staff   966M Mar 14 08:41 Chuong569.bam
-rw-r--r--  1 gary  staff   429K Mar 15 21:00 L_FE9D_R569.txt
galGal4UCSCensGene81_TableBrowser.gtf

gary > htseq-count -f bam -s no -a 10 -t exon -i gene_id -m union Chuong569.bam galGal4UCSCensGene81_TableBrowser.gtf > Chuong569_bam.txt

100000 GFF lines processed.
200000 GFF lines processed.
300000 GFF lines processed.
386159 GFF lines processed.

Please Install PySam to use the BAM_Reader Class (http://code.google.com/p/pysam/) Error occured when reading beginning of SAM/BAM file.

  No module named pysam
  [Exception type: ImportError, raised in __init__.py:937]

gary >
ADD REPLY
1
Entering edit mode

is your htseq upgraded? I have usually found using this command helps more:

python -m HTSeq.scripts.count -f bam -s no -idattr=ID /bam.file/ /gff3.file/
ADD REPLY
2
Entering edit mode
8.9 years ago
UnivStudent ▴ 440

I had a similar problem using the latest version of pysam and HTSeq. I had to go back a version, and use https://pypi.python.org/pypi/pysam/0.8.3 to get it to work again.

ADD COMMENT
1
Entering edit mode

Downgrading pysam helped me as well. Thanks!

ADD REPLY
0
Entering edit mode

This works. Thanks!!

ADD REPLY
1
Entering edit mode
8.6 years ago

I had the same problem but for me the following worked:

sudo pip install pysam
ADD COMMENT
0
Entering edit mode

Thanks a lot. However, it doesn't work on my MacBook Pro as the below.

gary > pwd
/Users/gary

gary > sudo pip install pysam
The directory '/Users/gary/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/gary/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: pysam in ./anaconda/lib/python2.7/site-packages
ADD REPLY
1
Entering edit mode
4.8 years ago
Payal ▴ 160

conda install pysam worked for me.

ADD COMMENT

Login before adding your answer.

Traffic: 1832 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6