lixin6135 / pysam

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

Wrong .bai file => segmentation fault #152

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When a wrong index of a BAM file is used, segmentation fault occurs (instead of 
some Python exception). It was quite difficult to find out that the reason was 
the old index (which I forgot to update). Python exception would really help in 
debugging.

Original issue reported on code.google.com by karel.brinda@gmail.com on 7 Jul 2014 at 12:46

GoogleCodeExporter commented 8 years ago
The relevant part of the source code:

{{{
#! /usr/bin/env python

from Bio import SeqIO
from Bio.Seq import Seq
import pysam

reference = "ref.fa"
aln = "aln.bam"

handle = open(reference, "rU")
samfile = pysam.Samfile(aln, "rb")

obj = SeqIO.parse(handle,"fasta")

for record in obj:
        seqname = record.id
        print "Processing", seqname

        for pileupcolumn in samfile.pileup(seqname):
                print "position", pileupcolumn.pos
}}}

Original comment by karel.brinda@gmail.com on 7 Jul 2014 at 12:54