Question: htseq-count cannot find pysam
0
gravatar for Gary
5.0 years ago by
Gary480
Taiwan/Taichung/China Medical University Hospital
Gary480 wrote:

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

ADD COMMENTlink modified 10 months ago by Payal100 • written 5.0 years ago by Gary480
4

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 REPLYlink written 5.0 years ago by Devon Ryan97k

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 REPLYlink written 3.7 years ago by Gary480

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 REPLYlink modified 11 months ago by _r_am31k • written 3.7 years ago by Gary480
1

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 REPLYlink modified 11 months ago by _r_am31k • written 5.0 years ago by kanika.15180
2
gravatar for UnivStudent
5.0 years ago by
UnivStudent380
Canada
UnivStudent380 wrote:

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 COMMENTlink modified 11 months ago by _r_am31k • written 5.0 years ago by UnivStudent380
1

Downgrading pysam helped me as well. Thanks!

ADD REPLYlink modified 4.6 years ago • written 4.6 years ago by chana10

This works. Thanks!!

ADD REPLYlink written 3.3 years ago by komal.rathi3.7k
1
gravatar for Bioinformatist Newbie
4.6 years ago by
Germany
Bioinformatist Newbie250 wrote:

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

sudo pip install pysam
ADD COMMENTlink modified 11 months ago by _r_am31k • written 4.6 years ago by Bioinformatist Newbie250

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 REPLYlink modified 11 months ago by _r_am31k • written 3.7 years ago by Gary480
1
gravatar for Payal
10 months ago by
Payal100
Payal100 wrote:

conda install pysam worked for me.

ADD COMMENTlink modified 10 months ago • written 10 months ago by Payal100
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1846 users visited in the last hour