Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
Add the "-K" option from bwa
Browse files Browse the repository at this point in the history
  • Loading branch information
nh13 committed Feb 10, 2020
1 parent a0a77fb commit c842b96
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tasks/src/main/scala/dagr/tasks/bwa/Bwa.scala
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,16 @@ object Bwa extends Configuration {
mergeBamAlignmentMem: String = "2G",
fifoBufferMem: String = "512M",
processAltMappings: Boolean = false,
orientation: PairOrientation = PairOrientation.FR
orientation: PairOrientation = PairOrientation.FR,
numFixedBases: Option[Int] = None
): Pipe[SamOrBam,SamOrBam] = {
val alt = PathUtil.pathTo(s"${ref}.alt")
val doAlt = Files.exists(alt) && processAltMappings
val fifoMem: Memory = Memory(fifoBufferMem)

val samToFastq = SamToFastq(in=unmappedBam, out=Io.StdOut).requires(Cores(samToFastqCores), Memory(samToFastqMem))
val fqBuffer = new FifoBuffer[Fastq].requires(memory=fifoMem)
val bwaMem = new BwaMem(fastq=Io.StdIn, ref=ref, minThreads=minThreads, maxThreads=maxThreads, memory=Memory(bwaMemMemory))
val bwaMem = new BwaMem(fastq=Io.StdIn, ref=ref, numFixedBases=numFixedBases, minThreads=minThreads, maxThreads=maxThreads, memory=Memory(bwaMemMemory))
val bwaBuffer = new FifoBuffer[Sam].requires(memory=fifoMem)
val altPipe = if (doAlt) new BwaK8AltProcessor(altFile=alt) | new FifoBuffer[Sam].requires(memory=fifoMem) else Pipes.empty[Sam]
val mergeBam = new MergeBamAlignment(unmapped=unmappedBam, mapped=Io.StdIn, out=mappedBam, ref=ref, sortOrder=sortOrder, orientation=orientation)
Expand Down
2 changes: 2 additions & 0 deletions tasks/src/main/scala/dagr/tasks/bwa/BwaMem.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class BwaMem(fastq: PathToFastq = Io.StdIn,
clippingPenalties: Option[(Int,Int)] = None,
minScore: Option[Int] = None,
smartPairing: Boolean = true,
numFixedBases: Option[Int] = None,
minThreads: Int = 1,
maxThreads: Int = 32,
memory: Memory = Memory("8G")
Expand All @@ -64,6 +65,7 @@ class BwaMem(fastq: PathToFastq = Io.StdIn,
gapExtensionPenalties.foreach { case (del, ins) => buffer.append("-E", s"$del,$ins") }
clippingPenalties.foreach { case (five, three) => buffer.append("-L", s"$five,$three") }
minScore.foreach(s => buffer.append("-T", s))
numFixedBases.foreach(n => buffer.append("-K", n))

buffer.append(ref, fastq)
out.foreach(f => buffer.append("> " + f))
Expand Down

0 comments on commit c842b96

Please sign in to comment.