This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Is PICARD CollectInsertSizeMetrics use soft-clipping information to compute the insert size ?

Hi,

I've a basic question concerning picard CollectInsertSizeMetrics (tool that computes insert size metrics). Are the soft-clipping bases take into account for the insert size measure ?

Here's a quick draw of my question. So is the insert size computed x (without soft-clipping) or y (with soft-clipping)

Thanks

enter image description here

picard insert size soft-clipping

1 answer

it uses the information stored in the BAM file (TLEN): so it's not dependent of picard.

https://github.com/broadinstitute/picard/blob/master/src/main/java/picard/analysis/directed/InsertSizeMetricsCollector.java#L53

        final int insertSize = Math.abs(samRecord.getInferredInsertSize());

So is the insert size computed x (without soft-clipping)

in bwa mem; the cigar string is used: https://github.com/lh3/bwa/blob/master/bwamem.c , but I would say that clipping is ignored (?).

int64_t p0 = p->pos + (p->is_rev? get_rlen(p->n_cigar, p->cigar) - 1 : 0);
int64_t p1 = m->pos + (m->is_rev? get_rlen(m->n_cigar, m->cigar) - 1 : 0);


static inline int get_rlen(int n_cigar, const uint32_t *cigar)
{
    int k, l;
    for (k = l = 0; k < n_cigar; ++k) {
        int op = cigar[k]&0xf;
        if (op == 0 || op == 2)
            l += cigar[k]>>4;
    }
    return l;
}

Log in to answer this question.