brittneybrinsfield / pysam

Automatically exported from code.google.com/p/pysam
0 stars 0 forks source link

Read header of new bwa output fails #57

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create a bam with bwa 0.5.9 / samtools 0.1.9
2. read the header with pysam

What is the expected output? What do you see instead?

File "csamtools.pyx", line 702, in csamtools.Samfile.header.__get__ 
(pysam/csamtools.c:7760)
ValueError: unknown field code 'PN' in record 'PG'

What version of the product are you using? On what operating system?

pysam-0.3.1
python 2.6
$ uname -a
Linux scurbat 2.6.35-24-server #42-Ubuntu SMP Thu Dec 2 03:58:11 UTC 2010 
x86_64 GNU/Linux

Please provide any additional information below.
Solved modifying pysam/csamtools.pyx like this

$ diff -u pysam/csamtools.pyx*
--- pysam/csamtools.pyx 2011-02-02 17:26:21.175371231 +0100
+++ pysam/csamtools.pyx.old     2011-02-02 17:31:16.615345139 +0100
@@ -200,13 +200,13 @@
 VALID_HEADER_FIELDS = { "HD" : { "VN" : str, "SO" : str, "GO" : str },
                         "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str },
                         "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str, "CN" : str, "DT" : str, "PL" : str, },
-                        "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : 
str }, }
+                        "PG" : { "ID" : str, "VN" : str, "CL" : str }, }

 # output order of fields within records
 VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ),
                        "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ),
-                       "PG" : ( "PN", "ID", "VN", "CL" ), }
+                       "PG" : ( "ID", "VN", "CL" ), }

 ######################################################################

Original issue reported on code.google.com by daweonline on 2 Feb 2011 at 4:31

GoogleCodeExporter commented 9 years ago
Thanks,

added the changes to dev-0.4.

Bw,
Andreas

Original comment by andreas....@gmail.com on 10 Feb 2011 at 10:40

GoogleCodeExporter commented 9 years ago
I've been having similar problems with the FO tag from our lab's Ion Torrent.  

Forgive me if this is a silly question, but if I make similar additions to my 
local copy, do I need to re-compile it or anything?  I've never worked with PYX 
or PYD files before.

Thanks,
Brett

Original comment by bnbow...@gmail.com on 21 Jun 2012 at 12:24

GoogleCodeExporter commented 9 years ago
Hi Brett,

I believe you'd need to change the pyx file, install Cython [1], and compile 
it[2] to replace the .so file. (I haven't tried it though)

[1] http://docs.cython.org/src/quickstart/install.html
[2] http://docs.cython.org/src/reference/compilation.html

Original comment by gregpin...@gmail.com on 9 Nov 2012 at 2:01