Commit 7772e165 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Changed multisample trait

parent 348a42c4
......@@ -4,17 +4,17 @@ import nl.lumc.sasc.biopet.core.config.Configurable
trait MultiSampleQScript extends BiopetQScript {
type LibraryOutput <: AbstractLibraryOutput
type SampleOutput[LibraryOutput] <: AbstractSampleOutput[LibraryOutput]
type SampleOutput <: AbstractSampleOutput
abstract class AbstractLibraryOutput
abstract class AbstractSampleOutput[LibraryOutput] {
protected[MultiSampleQScript] var libraries: Map[String, LibraryOutput] = Map()
abstract class AbstractSampleOutput {
var libraries: Map[String, LibraryOutput] = Map()
def getAllLibraries = libraries
def getLibrary(key:String) = libraries(key)
}
var samplesConfig: Map[String, Any] = Map()
var samplesOutput: Map[String, SampleOutput[LibraryOutput]] = Map()
var samplesOutput: Map[String, SampleOutput] = Map()
def globalSampleDir: String = outputDir + "samples/"
final def runSamplesJobs() {
......@@ -24,23 +24,21 @@ trait MultiSampleQScript extends BiopetQScript {
var sample = Configurable.any2map(value)
if (!sample.contains("ID")) sample += ("ID" -> key)
if (sample("ID") == key) {
val output = runSingleSampleJobs(sample)
if (samplesOutput.contains(key)) output.libraries = samplesOutput(key).libraries
samplesOutput += key -> output
samplesOutput += key -> runSingleSampleJobs(sample)
}
else logger.warn("Key is not the same as ID on value for sample")
}
else logger.warn("No Samples found in config")
}
def runSingleSampleJobs(sampleConfig: Map[String, Any]): SampleOutput[LibraryOutput]
def runSingleSampleJobs(sample: String): SampleOutput[LibraryOutput] = {
def runSingleSampleJobs(sampleConfig: Map[String, Any]): SampleOutput
def runSingleSampleJobs(sample: String): SampleOutput = {
return runSingleSampleJobs(Configurable.any2map(samplesConfig(sample)))
}
final def runLibraryJobs(sampleConfig: Map[String, Any]): Map[String, LibraryOutput] = {
var output: Map[String, LibraryOutput] = Map()
val sampleID = sampleConfig("ID")
val sampleID = sampleConfig("ID").toString
if (sampleConfig.contains("libraries")) {
val runs = Configurable.any2map(sampleConfig("libraries"))
for ((key, value) <- runs) {
......
......@@ -40,7 +40,7 @@ class Sage(val root: Configurable) extends QScript with MultiSampleQScript {
var prefixFastq: File = _
}
class SampleOutput[LibraryOutput] extends AbstractSampleOutput[LibraryOutput] {
class SampleOutput extends AbstractSampleOutput {
}
......@@ -78,8 +78,8 @@ class Sage(val root: Configurable) extends QScript with MultiSampleQScript {
}
// Called for each sample
def runSingleSampleJobs(sampleConfig: Map[String, Any]): SampleOutput[LibraryOutput] = {
val sampleOutput = new SampleOutput[LibraryOutput]
def runSingleSampleJobs(sampleConfig: Map[String, Any]): SampleOutput = {
val sampleOutput = new SampleOutput
var libraryBamfiles: List[File] = List()
var libraryFastqFiles: List[File] = List()
val sampleID: String = sampleConfig("ID").toString
......
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