Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OffTargetDetector should not pass primer pairs when no amplicons are … #6

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,19 @@ class OffTargetDetector(val bwaExecutable: FilePath = BwaAlnInteractive.DefaultB
else {
val amps = toAmplicons(p1.hits, p2.hits, this.maxAmpliconSize)

OffTargetResult(
primerPair = pp,
passes = amps.lengthCompare(maxPrimerPairHits) <= 0,
mappings = if (keepMappings) amps else Seq.empty,
leftPrimerMappings = if (keepPrimerMappings) p1.hits.map(hitToMapping) else Seq.empty,
rightPrimerMappings = if (keepPrimerMappings) p2.hits.map(hitToMapping) else Seq.empty
)
// In some cases, when map left and right primers independently and they multi-map, sometimes `bwa` may not return a mapping to the
// "on-target" (designed) location, and if none of the other combinations generate ("amplifiable") amplicons, then there are no
// off-target amplicons. In such a case, we return an empty OffTargetResult
if (amps.isEmpty) OffTargetResult(primerPair=pp, passes=false, mappings=Nil)
else {
OffTargetResult(
primerPair = pp,
passes = amps.lengthCompare(maxPrimerPairHits) <= 0,
mappings = if (keepMappings) amps else Seq.empty,
leftPrimerMappings = if (keepPrimerMappings) p1.hits.map(hitToMapping) else Seq.empty,
rightPrimerMappings = if (keepPrimerMappings) p2.hits.map(hitToMapping) else Seq.empty
)
}
}

progress.foreach(_.record())
Expand Down