Commit ea210687 authored by Sander van der Zeeuw's avatar Sander van der Zeeuw
Browse files

fixed output_dir name bug

parent 1d0235fe
......@@ -17,7 +17,7 @@ package nl.lumc.sasc.biopet.core
import java.io.File
import java.io.PrintWriter
import nl.lumc.sasc.biopet.core.config.{ Config, Configurable }
import nl.lumc.sasc.biopet.core.config.{ ConfigValueIndex, Config, Configurable }
import org.broadinstitute.gatk.utils.commandline.Argument
import org.broadinstitute.gatk.queue.QSettings
import org.broadinstitute.gatk.queue.function.QFunction
......@@ -29,7 +29,14 @@ trait BiopetQScript extends Configurable with GatkLogging {
@Argument(doc = "JSON config file(s)", fullName = "config_file", shortName = "config", required = false)
val configfiles: List[File] = Nil
var outputDir: String = _
var outputDir: String = {
val temp = Config.getValueFromMap(Config.global.map, ConfigValueIndex(this.configName, configPath, "output_dir"))
if (temp.isEmpty) throw new IllegalArgumentException("No output_dir defined in config")
else {
val t = temp.get.value.toString
if (!t.endsWith("/")) t + "/" else t
}
}
@Argument(doc = "Disable all scatters", shortName = "DSC", required = false)
var disableScatter: Boolean = false
......
......@@ -108,7 +108,7 @@ trait MultiSampleQScript extends BiopetQScript {
def createFile(suffix: String) = new File(sampleDir, sampleId + suffix)
/** Returns sample directory */
def sampleDir = outputDir + "samples" + File.pathSeparator + sampleId + File.pathSeparator
def sampleDir = outputDir + "samples" + File.separator + sampleId + File.separator
}
/** Sample type, need implementation in pipeline */
......@@ -130,7 +130,8 @@ trait MultiSampleQScript extends BiopetQScript {
}
/**
* Runs addAndTrackJobs method for each sample */
* Runs addAndTrackJobs method for each sample
*/
final def addSamplesJobs() {
for ((sampleId, sample) <- samples) {
sample.addAndTrackJobs()
......
......@@ -80,6 +80,8 @@ class Carp(val root: Configurable) extends QScript with MultiSampleQScript {
merge.sortOrder = "coordinate"
merge.output = bamFile
add(merge)
//TODO: Add BigWIg track
}
val macs2 = new Macs2CallPeak(qscript)
......@@ -103,13 +105,13 @@ class Carp(val root: Configurable) extends QScript with MultiSampleQScript {
addSamplesJobs
for ((sampleId, sample) <- samples) {
for (control <- sample.controls) {
if (!samples.contains(control))
throw new IllegalStateException("For sample: " + sampleId + " this control: " + control + " does not exist")
for (controlId <- sample.controls) {
if (!samples.contains(controlId))
throw new IllegalStateException("For sample: " + sampleId + " this control: " + controlId + " does not exist")
val macs2 = new Macs2CallPeak(this)
macs2.treatment = sample.bamFile
macs2.control = samples(control).bamFile
macs2.name = sample + "_VS_" + control
macs2.control = samples(controlId).bamFile
macs2.name = sampleId + "_VS_" + controlId
macs2.outputdir = sample.sampleDir + "/" + "macs2/" + macs2.name + "/"
add(macs2)
}
......
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