Commit 3e44feaf authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Change output files handling

parent ccfed547
......@@ -133,7 +133,7 @@ class Basty(val root: Configurable) extends QScript with MultiSampleQScript {
raxmlBoot.N = 1
raxmlBoot.n = outputName + "_boot_" + t
add(raxmlBoot)
raxmlBoot.getBootstrapFile
raxmlBoot.getBootstrapFile.get
}
val cat = Cat(this, bootList.toList, new File(outputDir, "/boot_list"))
......@@ -142,7 +142,7 @@ class Basty(val root: Configurable) extends QScript with MultiSampleQScript {
val raxmlBi = new Raxml(this)
raxmlBi.input = concensusVariants
raxmlBi.t = raxmlMl.getBestTreeFile
raxmlBi.z = cat.output
raxmlBi.z = Some(cat.output)
raxmlBi.m = config("raxml_ml_model", default = "GTRGAMMAX")
raxmlBi.p = seed
raxmlBi.f = "b"
......@@ -152,7 +152,7 @@ class Basty(val root: Configurable) extends QScript with MultiSampleQScript {
val gubbins = new RunGubbins(this)
gubbins.fastafile = concensusVariants
gubbins.startingTree = Some(raxmlBi.getBipartitionsFile)
gubbins.startingTree = raxmlBi.getBipartitionsFile
gubbins.outputDirectory = dirSufixGubbins
add(gubbins)
}
......
......@@ -36,7 +36,6 @@ class Cat(val root: Configurable) extends BiopetCommandLineFunction {
def cmdLine = required(executable) + repeat(input) + " > " + required(output)
}
/**
* Object for constructors for cat
*/
......
......@@ -19,7 +19,12 @@ import nl.lumc.sasc.biopet.core.BiopetCommandLineFunction
import nl.lumc.sasc.biopet.core.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{ Input, Output, Argument }
import java.io.File
import scalaz.std.boolean.option
/**
* extension for raxml
* based on version 8.1.3
*/
class Raxml(val root: Configurable) extends BiopetCommandLineFunction {
override val defaultThreads = 1
......@@ -50,49 +55,51 @@ class Raxml(val root: Configurable) extends BiopetCommandLineFunction {
@Argument(doc = "Output directory", required = true)
var w: File = null
var noBfgs: Boolean = config("no_bfgs", default = false)
@Input(required = false)
var t: File = _
var t: Option[File] = _
@Input(required = false)
var z: File = _
var z: Option[File] = _
@Output(doc = "Output files", required = false)
private var out: List[File] = Nil
var noBfgs: Boolean = config("no_bfgs", default = false)
var executableNonThreads: String = config("exe", default = "raxmlHPC")
var executableThreads: Option[String] = config("exe_pthreads")
/** Sets correct output files to job */
override def beforeGraph {
require(w != null)
if (threads == 0) threads = getThreads(defaultThreads)
executable = if (threads > 1 && executableThreads.isDefined) executableThreads.get else executableNonThreads
super.beforeGraph
out +:= getInfoFile
out :::= List(Some(getInfoFile), getBestTreeFile, getBootstrapFile, getBipartitionsFile).flatten
f match {
case "d" if b.isEmpty => {
out +:= getBestTreeFile
for (t <- 0 until N.getOrElse(1)) {
out +:= new File(w, "RAxML_log." + n + ".RUN." + t)
out +:= new File(w, "RAxML_parsimonyTree." + n + ".RUN." + t)
out +:= new File(w, "RAxML_result." + n + ".RUN." + t)
}
}
case "d" if b.isDefined => out +:= getBootstrapFile
case "b" => {
out +:= new File(w, "RAxML_bipartitionsBranchLabels." + n)
out +:= new File(w, "RAxML_bipartitions." + n)
case "d" if b.isEmpty => for (t <- 0 until N.getOrElse(1)) {
out +:= new File(w, "RAxML_log." + n + ".RUN." + t)
out +:= new File(w, "RAxML_parsimonyTree." + n + ".RUN." + t)
out +:= new File(w, "RAxML_result." + n + ".RUN." + t)
}
case _ =>
case "b" => out +:= new File(w, "RAxML_bipartitionsBranchLabels." + n)
case _ =>
}
}
def getBestTreeFile: File = new File(w, "RAxML_bestTree." + n)
def getBootstrapFile: File = new File(w, "RAxML_bootstrap." + n)
def getBipartitionsFile: File = new File(w, "RAxML_bipartitions." + n)
def getInfoFile: File = new File(w, "RAxML_info." + n)
/** Returns bestTree file */
def getBestTreeFile = option(f == "d" && b.isEmpty, new File(w, "RAxML_bestTree." + n))
/** Returns bootstrap file */
def getBootstrapFile = option(f == "d" && b.isDefined, new File(w, "RAxML_bootstrap." + n))
/** Returns bipartitions file */
def getBipartitionsFile = option(f == "b", new File(w, "RAxML_bipartitions." + n))
/** Returns info file */
def getInfoFile = new File(w, "RAxML_info." + n)
/** return commandline to execute */
def cmdLine = required(executable) +
required("-m", m) +
required("-s", input) +
......
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