Monday, September 21, 2015

Install DEXSeq and HTSeq

Install DEXSeq and HTSeq:

Please do not follow the instruction in manual of HTSeq. It does not work for mac.

My mac is OSX(lion), mac pro.

Simply install pip and type "sudo pip install HTSeq"

gjin:~ gjin$ sudo pip install HTSeq
The directory '/Users/gjin/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/gjin/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.
Collecting HTSeq
  Downloading HTSeq-0.6.1.tar.gz (226kB)
    100% |████████████████████████████████| 229kB 1.4MB/s 
Installing collected packages: HTSeq
  Running setup.py install for HTSeq
Successfully installed HTSeq-0.6.1
gjin:~ gjin$ python
Python 2.7.10 |Continuum Analytics, Inc.| (default, Sep 15 2015, 14:29:08) 
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import HTSeq

>>> 

That is it.

DEXSeq: alternative exon usage

step 1: transfer annotation file and generate read count file:

gff:
python /Library/Frameworks/R.framework/Versions/3.2/Resources/library/DEXSeq/python_scripts/dexseq_prepare_annotation.py Homo_sapiens.GRCh37.66.gtf Homo_sapiens.GRCh37.66.gff


read count:
python ~/dexseq_count.py -f bam file.gff file.bam file.txt

pip install pysam

* the "-f bam" does not work.

Alternatively, using samtools to transfer .bam to .sam

samtools index .bam

samtools view -bh .bam -chr15 > .sam

> pythonScriptsDir = system.file( "python_scripts", package="DEXSeq" )
> pythonScriptsDir
[1] "/Library/Frameworks/R.framework/Versions/3.2/Resources/library/DEXSeq/python_scripts"
>

The dexseq_count.py is really messy. with two errors:


KeyError: 'SAM optional field tag NH not found'

ValueError: ("Malformed SAM line: MRNM == '*' although flag bit &0x0008 cleared", 'line 63 of file sample2_sorted.sam')