Skip to content

bug: the logic for the PileupBuilder includeMapPositionsOutsideFrInsert filter is wrong #980

Closed
@jrm5100

Description

positionIsOutsideFrInsert is actually positionIsInsideFrInsert

private def positionIsOutsideFrInsert(rec: SamRecord, refIndex: Int, pos: Int): Boolean = {
rec.isFrPair && {
val (start, end) = Bams.insertCoordinates(rec)
rec.refIndex == refIndex && pos >= start && pos <= end
}
}

The filter is used in a way that is reversed so that the current tests still work as designed.

if (compare) compare = if (!includeMapPositionsOutsideFrInsert && rec.isFrPair) {
PileupBuilder.positionIsOutsideFrInsert(rec, refIndex = refIndex, pos = pos)
} else { compare }

Additionally there is a redundant rec.isFrPair call (this is done inside the method).

I came across this because I was tracking down some aberrant alleles in a pileup. Should reads mapped to separate chromosomes be rejected by this filter, or should that be a separate filter (likely in quickAcceptRecord)? Currently these are accepted even if includeMapPositionsOutsideFrInsert is false, which i think may be misleading.

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions