Commit 112a7299 authored by Peter van 't Hof's avatar Peter van 't Hof

Fixing temp files

parent 42e2ffe3
......@@ -22,6 +22,8 @@ import org.broadinstitute.gatk.queue.function.CommandLineFunction
*/
trait CommandLineResources extends CommandLineFunction with Configurable {
lazy val maxThreads: Option[Int] = config("max_threads")
def defaultThreads = 1
final def threads = nCoresRequest match {
case Some(i) => i
......@@ -72,7 +74,6 @@ trait CommandLineResources extends CommandLineFunction with Configurable {
* @return number of threads
*/
private def getThreads(default: Int): Int = {
val maxThreads: Option[Int] = config("maxthreads")
val threads: Int = config("threads", default = default)
maxThreads match {
case Some(max) => if (max > threads) threads else max
......@@ -120,6 +121,7 @@ trait CommandLineResources extends CommandLineFunction with Configurable {
protected def combineResources(commands: List[CommandLineResources]): Unit = {
commands.foreach(_.setResources())
nCoresRequest = Some(commands.map(_.threads).sum + threadsCorrection)
nCoresRequest.map(x => if (x > maxThreads.getOrElse(x)) maxThreads.getOrElse(x) else x)
_coreMemory = commands.map(cmd => cmd.coreMemory * (cmd.threads.toDouble / threads.toDouble)).sum
memoryLimit = Some(_coreMemory * threads)
......
......@@ -135,6 +135,7 @@ trait SummaryQScript extends BiopetQScript { qscript: QScript =>
}
md5sum.input = file
md5sum.output = new File(file.getParentFile, file.getName + ".md5")
md5sum.jobOutputFile = new File(file.getParentFile, s".${file.getName}.md5.md5sum.out")
// Need to not write a md5 file outside the outputDir
if (!file.getAbsolutePath.startsWith(outputDir.getAbsolutePath))
......
......@@ -41,6 +41,8 @@ class Flexiprep(val parent: Configurable) extends QScript with SummaryQScript wi
/** Make a final fastq files, by default only when flexiprep is the main pipeline */
var keepQcFastqFiles: Boolean = config("keepQcFastqFiles", default = parent == null)
override def defaults = super.defaults ++ Map("max_threads" -> 4)
/** Returns files to store in summary */
def summaryFiles: Map[String, File] = {
Map("input_R1" -> inputR1, "output_R1" -> fastqR1Qc) ++
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment