Closed GoogleCodeExporter closed 8 years ago
yes I got the similar problem
>>> import pysam
>>> infile = 'test.bam'
>>> a = pysam.Samfile(infile, 'rb')
>>> len(list(a.fetch()))
4008
>>> b = pysam.Samfile('test.bam', 'rb')
>>> len(list(b.fetch()))
Segmentation fault
Original comment by xi11w...@gmail.com
on 24 Nov 2010 at 5:45
BTW, the testing files for above case were attached. renamed 'test.bam' to
'test_pysam.bam'
Original comment by xi11w...@gmail.com
on 24 Nov 2010 at 5:58
Attachments:
Thanks, can't reproduce with latest branches in default and dev-0.4.
Fixed a bug on how filenames were stored internally in pysam. That might have
fixed it. Please let me know if it reappears.
Bw,
Andreas
Original comment by andreas....@gmail.com
on 1 Feb 2011 at 9:53
I'm afraid I can still provoke in in revision 5b19336f381d on the dev-0.4
branch.
Trying to track this down, it crashes in IteratorRow.cnext(), more specifically
inside bam_iter_read(). Alas, printf() and fprintf(stderr,...) inside of
bam_iter_read only output something if I'm not running in interactive mode...
and of course, then it doesn't crash.
What I can see though is that self.fp.x.bam is different. In interactive mode
it's 0x8, while in non-interactive mode it's a nicely 'random' pointer.
Original comment by finkerna...@mathematik.uni-marburg.de
on 9 Feb 2011 at 5:11
Ok, I'm almost certain it's the filename issue.
If I do
store = StderrStore()
print "opening sam", samfile.filename, mode
self.fp = samopen( samfile.filename, mode, NULL )
printf("%p %p %p\n", &self.fp ,&self.fp.x, &self.fp.x.bam)
store.release()
in IteratorRow.__cinit__,
I see the correct filename in no interactive mode, and garbage (close by
garbage.. sometimes my region, sometimes environment variables, sometimes
binary data) in interactive mode.
Original comment by finkerna...@mathematik.uni-marburg.de
on 9 Feb 2011 at 5:22
Nevermind.
closer inspection of the dev-0.4 track reveals the filename fix isn't in there,
and the problem indeed disappears in revision 52154bc9d8 (default branch).
Original comment by finkerna...@mathematik.uni-marburg.de
on 9 Feb 2011 at 5:32
Original issue reported on code.google.com by
finkerna...@mathematik.uni-marburg.de
on 15 Nov 2010 at 5:25