MaciekAber / pysam

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

segfaults for non existing tags #32

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. load a BAM file
2. get undefined tags for an AlignedReads

i.e:

consider these two reads:

11II-08F1-GA:1:73:53:1317#0     0       rDNA    249     25      36M     *       
0       0       GTGCAAACACACACACACACACACACACACACACAC    
a_aaaaa`aaaaaaa`aaaaaaa`a`a``_`__\_Y    XT:A:U  NM:i:2  X0:i:1  X1:i:0  XM:i:2  
XO:i:0  XG:i:0  MD:Z:0T1C33
11II-08F1-GA:1:77:1776:708#0    16      rDNA    249     0       4M1D32M *       
0       0       TTTCAACACACACACACACACACACACACACACACA    
BBBBBBBBB_`^baa_aaaabab``_a_b`baba`a    XT:A:R  NM:i:2  X0:i:6  X1:i:0  XM:i:1  
XO:i:1  XG:i:1  MD:Z:2C1^A32    
XA:Z:rDNA,+29314,30M1D6M,2;rDNA,+26529,31M1D5M,2;rDNA,+31363,31M1D5M,2;rDNA,+381
33,31M1D5M,2;rDNA,+42194,31M1D5M,2;

>>> import pysam
>>> a = pysam.Samfile('myfile.bam', 'rb')
>>> for i in a.fetch():
    ...:  if i.qname=='11II-08F1-GA:1:77:1776:708#0':
   ...:     xatag = i
   ...:   if i.qname == '11II-08F1-GA:1:73:53:1317#0':
   ...:     noxatag = i
>>> xatag.opt('XA')
'rDNA,+29314,30M1D6M,2;rDNA,+26529,31M1D5M,2;rDNA,+31363,31M1D5M,2;rDNA,+38133,3
1M1D5M,2;rDNA,+42194,31M1D5M,2;'
>>> noxatag.opt('XA')
Segmentation fault

What is the expected output? What do you see instead?
Well, not 

What version of the product are you using? On what operating system?
pysam-0.2
$ python -V
Python 2.6.2
$ uname -srvpio
Linux 2.6.18-164.9.1.el5 #1 SMP Tue Dec 15 20:57:57 EST 2009 x86_64 x86_64 
GNU/Linux

Please provide any additional information below.

Original issue reported on code.google.com by daweonline on 12 May 2010 at 10:28

GoogleCodeExporter commented 8 years ago
Thanks, this has been fixed since 0.1. Both Pysam-0.2 and dev-0.3 raise

KeyError: "tag 'XA' not present"

Can't see why it does not work for you, though.

Original comment by andreas....@gmail.com on 18 Jul 2010 at 7:00

GoogleCodeExporter commented 8 years ago
Could not replicate it.

Original comment by andreas....@gmail.com on 10 Sep 2010 at 1:24