lixin6135 / pysam

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

Tags should return empty list instead of None if no tags are defined #70

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. my_read.tags += [('XX', 23)] on a read without tags (for example in testing 
when creating reads out of thin air).

What is the expected output? 
my_read.tags == [('XX', 23)]

What do you see instead?
TypeError: unsupported operand type(s) for +=: 'NoneType' and 'list'

Suggested fix:
Replace 
            src = self._delegate
            if src.l_aux == 0: return None
with
            src = self._delegate
            if src.l_aux == 0: return []

round about line 2237 in csamtools.pyx

Thanks!

Please provide any additional information below.

Original issue reported on code.google.com by f.finker...@googlemail.com on 26 Sep 2011 at 12:19

GoogleCodeExporter commented 8 years ago
(This will allow the my_reads.tags += [...] idom to work regardless of whether 
there were tags in the first place.)

Original comment by f.finker...@googlemail.com on 26 Sep 2011 at 12:22

GoogleCodeExporter commented 8 years ago
Thanks, this will be changed in the next release.

Original comment by andreas....@gmail.com on 7 Oct 2011 at 7:01

GoogleCodeExporter commented 8 years ago
Fixed in version 0.6

Original comment by andreas....@gmail.com on 17 Oct 2011 at 8:52

GoogleCodeExporter commented 8 years ago
This issue was closed by revision 160050bbfc32.

Original comment by andreas....@gmail.com on 19 Oct 2011 at 9:37