Closed GoogleCodeExporter closed 8 years ago
Actually, I suspect that this issue is behind some of the other segfault bugs.
Gotta make sure your C objects implement the basic set of python builtins, or
funny things happen.
Original comment by rynec...@gmail.com
on 19 Jan 2011 at 2:43
Thanks,
I can't reproduce it. Cython adds most of the object interface.
>>> samfile = pysam.Samfile( 'ex1.bam','rb')
>>> for pc in samfile.pileup( 'chr1', 100, 120 )
... print 'coverage @ base %s = %s' % (pc.pos, pc.n)
---
>>> dir(pc.pileups)
['__add__', '__class__', '__contains__', '__delattr__', '__delitem__',
'__delslice__', '__doc__', '__eq__', '__format__', '__ge__',
'__getattribute__', '__getitem__', '__getslice__', '__gt__', '__hash__',
'__iadd__', '__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__',
'__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__',
'__reversed__', '__rmul__', '__setattr__', '__setitem__', '__setslice__',
'__sizeof__', '__str__', '__subclasshook__', 'append', 'count', 'extend',
'index', 'insert', 'pop', 'remove', 'reverse', 'sort']
Two issues might apply here:
1. pc.pileups is undefined out of the loop. For reasons of efficiency, the
iterator
variable is only a proxy towards a C construct. This might become invalidated
at the
end the iteration. I will keep an eye on this.
2. the filename bug.
Bw,
Andreas
Original comment by andreas....@gmail.com
on 10 Feb 2011 at 10:51
Original issue reported on code.google.com by
rynec...@gmail.com
on 19 Jan 2011 at 2:39