Commit 7892b57c authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Changed run to library

parent eac4ec9e
......@@ -26,20 +26,20 @@ trait MultiSampleQScript extends BiopetQScript {
return runSingleSampleJobs(Configurable.any2map(samples(sample)))
}
final def runRunsJobs(sampleConfig: Map[String, Any]): Map[String, Map[String, File]] = {
final def runLibraryJobs(sampleConfig: Map[String, Any]): Map[String, Map[String, File]] = {
var output: Map[String, Map[String, File]] = Map()
val sampleID = sampleConfig("ID")
if (sampleConfig.contains("runs")) {
val runs = Configurable.any2map(sampleConfig("runs"))
if (sampleConfig.contains("librarys")) {
val runs = Configurable.any2map(sampleConfig("librarys"))
for ((key, value) <- runs) {
var run = Configurable.any2map(value)
if (!run.contains("ID")) run += ("ID" -> key)
if (run("ID") == key) {
output += key -> runSingleRunJobs(run, sampleConfig)
var library = Configurable.any2map(value)
if (!library.contains("ID")) library += ("ID" -> key)
if (library("ID") == key) {
output += key -> runSingleLibraryJobs(library, sampleConfig)
} else logger.warn("Key is not the same as ID on value for run of sample: " + sampleID)
}
} else logger.warn("No runs found in config for sample: " + sampleID)
return output
}
def runSingleRunJobs(runConfig: Map[String, Any], sampleConfig: Map[String, Any]): Map[String, File]
def runSingleLibraryJobs(runConfig: Map[String, Any], sampleConfig: Map[String, Any]): Map[String, File]
}
......@@ -70,17 +70,17 @@ class GatkPipeline(val root: Configurable) extends QScript with MultiSampleQScri
// Called for each sample
def runSingleSampleJobs(sampleConfig: Map[String, Any]): Map[String, List[File]] = {
var outputFiles: Map[String, List[File]] = Map()
var runBamfiles: List[File] = List()
var libraryBamfiles: List[File] = List()
var sampleID: String = sampleConfig("ID").toString
for ((run, runFiles) <- runRunsJobs(sampleConfig)) {
runBamfiles +:= runFiles("FinalBam")
for ((library, libraryFiles) <- runLibraryJobs(sampleConfig)) {
libraryBamfiles +:= libraryFiles("FinalBam")
}
outputFiles += ("FinalBams" -> runBamfiles)
outputFiles += ("FinalBams" -> libraryBamfiles)
if (runBamfiles.size > 0) {
finalBamFiles ++= runBamfiles
if (libraryBamfiles.size > 0) {
finalBamFiles ++= libraryBamfiles
val gatkVariantcalling = new GatkVariantcalling(this)
gatkVariantcalling.inputBams = runBamfiles
gatkVariantcalling.inputBams = libraryBamfiles
gatkVariantcalling.outputDir = outputDir + sampleID + "/variantcalling/"
gatkVariantcalling.init
gatkVariantcalling.biopetScript
......@@ -91,7 +91,7 @@ class GatkPipeline(val root: Configurable) extends QScript with MultiSampleQScri
}
// Called for each run from a sample
def runSingleRunJobs(runConfig: Map[String, Any], sampleConfig: Map[String, Any]): Map[String, File] = {
def runSingleLibraryJobs(runConfig: Map[String, Any], sampleConfig: Map[String, Any]): Map[String, File] = {
var outputFiles: Map[String, File] = Map()
val runID: String = runConfig("ID").toString
val sampleID: String = sampleConfig("ID").toString
......@@ -100,7 +100,7 @@ class GatkPipeline(val root: Configurable) extends QScript with MultiSampleQScri
if (runConfig.contains("inputtype")) inputType = runConfig("inputtype").toString
else inputType = config("inputtype", default = "dna").toString
if (runConfig.contains("R1")) {
val mapping = Mapping.loadFromRunConfig(this, runConfig, sampleConfig, runDir)
val mapping = Mapping.loadFromLibraryConfig(this, runConfig, sampleConfig, runDir)
addAll(mapping.functions) // Add functions of mapping to curent function pool
outputFiles += ("FinalBam" -> mapping.outputFiles("finalBamFile"))
......
......@@ -288,7 +288,7 @@ class Mapping(val root: Configurable) extends QScript with BiopetQScript {
object Mapping extends PipelineCommand {
override val pipeline = "/nl/lumc/sasc/biopet/pipelines/mapping/Mapping.class"
def loadFromRunConfig(root: Configurable, runConfig: Map[String, Any], sampleConfig: Map[String, Any], runDir: String): Mapping = {
def loadFromLibraryConfig(root: Configurable, runConfig: Map[String, Any], sampleConfig: Map[String, Any], runDir: String): Mapping = {
val mapping = new Mapping(root)
logger.debug("Mapping runconfig: " + runConfig)
......
Supports Markdown
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