[Biopython] comparing bam files

Peter Cock p.j.a.cock at googlemail.com
Sat Sep 17 21:44:03 UTC 2011


On Fri, Sep 16, 2011 at 11:42 PM, Abhishek Pratap
<abhishek.vit at gmail.com> wrote:
> Hi All
>
> This is my first post to the biopython mailing list. Basically I am
> new to both Python and BioP.
>

Welcome.

>
> So I have two bam files one contains the properly paired reads (file
> A) and the other has some of the singeltons (file B) either (read 1 /
> read 2).
>
> I have to find the mates of all the singletons from the properly
> paired bam file (file A) and then generate a bam file  (file C)which
> has all the proper pairs for all the singletons I had.
>
> PS: Also the file A is guaranteed to have all the pairs which might
> exist as a singleton in file B.

I don't understand what you're trying to do - why are there
singletons in file A if that is the file of properly paired reads?

> I want to do this on the binary files and avoid reading in the sam
> files. Is that something I can do using some of the bam readers in
> biopython ?

Biopython doesn't have a SAM/BAM interface, instead there
is pysam which binds the samtools C API:

http://code.google.com/p/pysam/

Try that.

Peter




More information about the Biopython mailing list