When reading the header of a bam file with a DS fields in a PG record a
ValueError is thrown:
In [1]: import pysam
In [2]: s = pysam.Samfile('file.bam')
In [3]: s.header
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-3-694a9732a0b6> in <module>()
----> 1 s.header
/Users/val/anaconda/lib/python2.7/site-packages/pysam/csamtools.so in
pysam.csamtools.Samfile.header.__get__ (pysam/csamtools.c:16139)()
ValueError: unknown field code 'DS' in record 'PG'
It turns out "DS" is not listed under "PG" in VALID_HEADER_FIELDS in the file
csamtools.pyx, this is inconsistent with the SAM spec:
http://samtools.sourceforge.net/SAMv1.pdf
The problem is fixed by modifying line 367 of pysam/csamtools.pyx from
"PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str, "PP" : str},
to
"PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str, "PP" : str , "DS" : str},
Original issue reported on code.google.com by valentin...@gmail.com on 22 Jan 2014 at 10:39
Original issue reported on code.google.com by
valentin...@gmail.com
on 22 Jan 2014 at 10:39