Hi,

I'm in the process of adding (optional) support for using alignments to [our tool for RNA-seq quantification][1], and I'm currently trying to model the fragment size distribution of aligned fragments in a set of reads. I'm a bit confused about exactly where this information is stored in a bam/sam file. According to the spec, the SAM file has a TLEN field that gives the "template length" of an alignment, which seems to me like it would be equivalent to the fragment length (except in the case of e.g. a chimeric alignment). However, the API doesn't expose this field directly, and instead in SAM and BAM files parsed via samtools, you have access to an isize field, which, from various online sources seems to be the "insert size" of the aligned fragment.

My question is how do these two fields relate? Are they different? Is the insert size the fragment size, the mate inner distance (frag. size - read lengths), or something else entirely? Unfortunately, the documentation on this isn't too clear, so I'm reaching out to someone whose dealt with this in practice before.

Thanks!

Rob

 [1]: https://github.com/kingsfordgroup/sailfish
<p>The TLEN value itself is actually isize. Yes, this can be a bit confusing.</p>

<p><strong>Edit:</strong> I removed an incorrect part about TLEN.</p>
