This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Insert Size For Each Bam Entry

Hi,

I've a bam file and I want to know the insert size for each entry. I know that picard CollectInsertSizeMetrics gives me statistics about insert size, but is it possible to have it for every entry ?

thanks

bam

2 answers

The ninth column of the SAM file (TLEN) approximately represents the insert size. Subtract length of a read (For example 75 bp or 100 bp) from TLEN to get the insert size.

See this earlier post from me:

estimating Insert size from paired end data.

Please see Bio::DB::Sam perl API for accessing SAM and BAM files. It has an explicit function to fetch the insert size for each mapped read pair. http://search.cpan.org/~lds/Bio-SamTools/lib/Bio/DB/Sam.pm#BAM_Files

Log in to answer this question.