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

ZipperBams to produce mate score ("ms") for samtools markdup #952

Merged
merged 4 commits into from
Feb 9, 2024
Merged
Changes from 3 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
7 changes: 6 additions & 1 deletion src/main/scala/com/fulcrumgenomics/bam/Bams.scala
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,21 @@ case class Template(r1: Option[SamRecord],
Template(x1, x2)
}

/** Fixes mate information and sets mate cigar on all primary and supplementary (but not secondary) records. */
/** Fixes mate information and sets mate cigar and mate score on all primary and supplementary (but not secondary) records. */
def fixMateInfo(): Unit = {
// Developer note: the mate score ("ms") tag is used by samtools markdup
for (primary <- r1; supp <- r2Supplementals) {
SamPairUtil.setMateInformationOnSupplementalAlignment(supp.asSam, primary.asSam, true)
primary.get[Int]("AS").foreach(supp("ms") = _)
}
for (primary <- r2; supp <- r1Supplementals) {
SamPairUtil.setMateInformationOnSupplementalAlignment(supp.asSam, primary.asSam, true)
primary.get[Int]("AS").foreach(supp("ms") = _)
}
for (first <- r1; second <- r2) {
SamPairUtil.setMateInfo(first.asSam, second.asSam, true)
first.get[Int]("AS").foreach(second("ms") = _)
second.get[Int]("AS").foreach(first("ms") = _)
}
}

Expand Down
Loading