From f03c70ff24062373a0bdbdb9e0fa43b7b3d2bb48 Mon Sep 17 00:00:00 2001 From: Peter van 't Hof <p.j.van_t_hof@lumc.nl> Date: Mon, 12 Oct 2015 15:25:28 +0200 Subject: [PATCH] Added a thread correction var --- .../sasc/biopet/core/CommandLineResources.scala | 4 +++- .../sasc/biopet/pipelines/mapping/Mapping.scala | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/CommandLineResources.scala b/public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/CommandLineResources.scala index 300cd4cdb..0fdc946e3 100644 --- a/public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/CommandLineResources.scala +++ b/public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/CommandLineResources.scala @@ -85,9 +85,11 @@ trait CommandLineResources extends CommandLineFunction with Configurable { this.freeze() } + var threadsCorrection = 0 + protected def combineResources(commands: List[CommandLineResources]): Unit = { commands.foreach(_.setResources()) - nCoresRequest = Some(commands.map(_.threads).sum) + nCoresRequest = Some(commands.map(_.threads).sum + threadsCorrection) _coreMemory = commands.map(cmd => cmd.coreMemeory * (cmd.threads.toDouble / threads.toDouble)).sum memoryLimit = Some(_coreMemory * threads) diff --git a/public/mapping/src/main/scala/nl/lumc/sasc/biopet/pipelines/mapping/Mapping.scala b/public/mapping/src/main/scala/nl/lumc/sasc/biopet/pipelines/mapping/Mapping.scala index 2f16008f6..4d051300a 100644 --- a/public/mapping/src/main/scala/nl/lumc/sasc/biopet/pipelines/mapping/Mapping.scala +++ b/public/mapping/src/main/scala/nl/lumc/sasc/biopet/pipelines/mapping/Mapping.scala @@ -316,7 +316,10 @@ class Mapping(val root: Configurable) extends QScript with SummaryQScript with S bwaCommand.R = Some(getReadGroupBwa) val sortSam = new SortSam(this) sortSam.output = output - add(bwaCommand | sortSam, chunking || !skipMarkduplicates) + val pipe = bwaCommand | sortSam + pipe.isIntermediate = chunking || !skipMarkduplicates + pipe.threadsCorrection = -1 + add(pipe) output } @@ -334,6 +337,9 @@ class Mapping(val root: Configurable) extends QScript with SummaryQScript with S val ar = addAddOrReplaceReadGroups(reorderSam.output, output) val pipe = new BiopetFifoPipe(this, (zcatR1._1 :: (if (paired) zcatR2.get._1 else None) :: Some(gsnapCommand) :: Some(ar._1) :: Some(reorderSam) :: Nil).flatten) + pipe.threadsCorrection = -1 + zcatR1._1.foreach(x => pipe.threadsCorrection -= 1) + zcatR2.foreach(_._1.foreach(x => pipe.threadsCorrection -= 1)) add(pipe) ar._2 } @@ -399,7 +405,7 @@ class Mapping(val root: Configurable) extends QScript with SummaryQScript with S if (paired) stampyCmd.R2 = R2.get stampyCmd.readgroup = RG stampyCmd.sanger = true - stampyCmd.output = this.swapExt(output.getParent, output, ".bam", ".sam") + stampyCmd.output = this.swapExt(output.getParentFile, output, ".bam", ".sam") stampyCmd.isIntermediate = true add(stampyCmd) val sortSam = SortSam(this, stampyCmd.output, output) @@ -421,6 +427,7 @@ class Mapping(val root: Configurable) extends QScript with SummaryQScript with S bowtie.isIntermediate = true val ar = addAddOrReplaceReadGroups(bowtie.output, output) val pipe = new BiopetFifoPipe(this, (Some(bowtie) :: Some(ar._1) :: Nil).flatten) + pipe.threadsCorrection = -1 add(pipe) ar._2 } @@ -433,6 +440,9 @@ class Mapping(val root: Configurable) extends QScript with SummaryQScript with S val ar = addAddOrReplaceReadGroups(starCommand.outputSam, output) val pipe = new BiopetFifoPipe(this, (zcatR1._1 :: (if (paired) zcatR2.get._1 else None) :: Some(starCommand) :: Some(ar._1) :: Nil).flatten) + pipe.threadsCorrection = -1 + zcatR1._1.foreach(x => pipe.threadsCorrection -= 1) + zcatR2.foreach(_._1.foreach(x => pipe.threadsCorrection -= 1)) add(pipe) ar._2 } -- GitLab