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

Make samples and libraries Summarizable

parent 8cdbba34
......@@ -31,10 +31,24 @@ class Basty(val root: Configurable) extends QScript with MultiSampleQScript {
var gatkPipeline: GatkPipeline = new GatkPipeline(qscript)
def summaryFile: File = new File(outputDir, "Sage.summary.json")
def summaryFiles: Map[String, File] = Map()
def summarySettings: Map[String, Any] = Map()
def makeSample(id: String) = new Sample(id)
class Sample(sampleId: String) extends AbstractSample(sampleId) {
def summaryFiles: Map[String, File] = Map()
def summaryStats: Map[String, Any] = Map()
def makeLibrary(id: String) = new Library(id)
class Library(libId: String) extends AbstractLibrary(libId) {
def summaryFiles: Map[String, File] = Map()
def summaryStats: Map[String, Any] = Map()
protected def addJobs(): Unit = {}
}
......@@ -56,6 +70,7 @@ class Basty(val root: Configurable) extends QScript with MultiSampleQScript {
def biopetScript() {
gatkPipeline.biopetScript
addAll(gatkPipeline.functions)
addSummaryQScript(gatkPipeline)
addSamplesJobs()
}
......
......@@ -49,8 +49,16 @@ class GatkPipeline(val root: Configurable) extends QScript with MultiSampleQScri
def makeSample(id: String) = new Sample(id)
class Sample(sampleId: String) extends AbstractSample(sampleId) {
def summaryFiles: Map[String, File] = Map()
def summaryStats: Map[String, Any] = Map()
def makeLibrary(id: String) = new Library(id)
class Library(libId: String) extends AbstractLibrary(libId) {
def summaryFiles: Map[String, File] = Map()
def summaryStats: Map[String, Any] = Map()
val mapping = new Mapping(qscript)
mapping.sampleId = Some(sampleId)
mapping.libId = Some(libId)
......
......@@ -18,13 +18,16 @@ package nl.lumc.sasc.biopet.core
import java.io.File
import nl.lumc.sasc.biopet.core.config.{ Config }
import nl.lumc.sasc.biopet.core.summary.{ SummaryQScript, Summarizable }
import nl.lumc.sasc.biopet.utils.ConfigUtils
import org.broadinstitute.gatk.utils.commandline.{ Argument }
/**
* This trait creates a structured way of use multisample pipelines
*/
trait MultiSampleQScript extends BiopetQScript {
trait MultiSampleQScript extends SummaryQScript {
qscript =>
@Argument(doc = "Only Sample", shortName = "sample", required = false)
private val onlySamples: List[String] = Nil
......@@ -34,7 +37,7 @@ trait MultiSampleQScript extends BiopetQScript {
* Sample class with basic functions build in
* @param sampleId
*/
abstract class AbstractSample(val sampleId: String) {
abstract class AbstractSample(val sampleId: String) extends Summarizable {
/** Overrules config of qscript with default sample */
val config = new ConfigFunctions(defaultSample = sampleId)
......@@ -42,7 +45,7 @@ trait MultiSampleQScript extends BiopetQScript {
* Library class with basic functions build in
* @param libId
*/
abstract class AbstractLibrary(val libId: String) {
abstract class AbstractLibrary(val libId: String) extends Summarizable {
/** Overrules config of qscript with default sample and default library */
val config = new ConfigFunctions(defaultSample = sampleId, defaultLibrary = libId)
......@@ -51,6 +54,7 @@ trait MultiSampleQScript extends BiopetQScript {
currentSample = Some(sampleId)
currentLib = Some(libId)
addJobs()
addSummarizable(this, "pipeline", Some(sampleId), Some(libId))
currentLib = None
currentSample = None
}
......@@ -87,6 +91,7 @@ trait MultiSampleQScript extends BiopetQScript {
final def addAndTrackJobs(): Unit = {
currentSample = Some(sampleId)
addJobs()
addSummarizable(this, "pipeline", Some(sampleId))
currentSample = None
}
......
......@@ -22,11 +22,25 @@ import org.broadinstitute.gatk.queue.QScript
class MultisamplePipelineTemplate(val root: Configurable) extends QScript with MultiSampleQScript {
def this() = this(null)
def summaryFile: File = new File(outputDir, "MultisamplePipelineTemplate.summary.json")
def summaryFiles: Map[String, File] = Map()
def summarySettings: Map[String, Any] = Map()
def makeSample(id: String) = new Sample(id)
class Sample(sampleId: String) extends AbstractSample(sampleId) {
def summaryFiles: Map[String, File] = Map()
def summaryStats: Map[String, Any] = Map()
def makeLibrary(id: String) = new Library(id)
class Library(libId: String) extends AbstractLibrary(libId) {
def summaryFiles: Map[String, File] = Map()
def summaryStats: Map[String, Any] = Map()
protected def addJobs(): Unit = {
// Library jobs
}
......
......@@ -51,8 +51,16 @@ class Carp(val root: Configurable) extends QScript with MultiSampleQScript with
def makeSample(id: String) = new Sample(id)
class Sample(sampleId: String) extends AbstractSample(sampleId) {
def summaryFiles: Map[String, File] = Map()
def summaryStats: Map[String, Any] = Map()
def makeLibrary(id: String) = new Library(id)
class Library(libId: String) extends AbstractLibrary(libId) {
def summaryFiles: Map[String, File] = Map()
def summaryStats: Map[String, Any] = Map()
val mapping = new Mapping(qscript)
mapping.libId = Some(libId)
mapping.sampleId = Some(sampleId)
......
......@@ -33,10 +33,24 @@ class Kopisu(val root: Configurable) extends QScript with MultiSampleQScript {
addSamplesJobs()
}
def summaryFile: File = new File(outputDir, "Kopisu.summary.json")
def summaryFiles: Map[String, File] = Map()
def summarySettings: Map[String, Any] = Map()
def makeSample(id: String) = new Sample(id)
class Sample(sampleId: String) extends AbstractSample(sampleId) {
def summaryFiles: Map[String, File] = Map()
def summaryStats: Map[String, Any] = Map()
def makeLibrary(id: String) = new Library(id)
class Library(libId: String) extends AbstractLibrary(libId) {
def summaryFiles: Map[String, File] = Map()
def summaryStats: Map[String, Any] = Map()
def addJobs(): Unit = {
}
......
......@@ -58,10 +58,24 @@ class Sage(val root: Configurable) extends QScript with MultiSampleQScript {
)
), super.defaults)
def summaryFile: File = new File(outputDir, "Sage.summary.json")
def summaryFiles: Map[String, File] = Map()
def summarySettings: Map[String, Any] = Map()
def makeSample(id: String) = new Sample(id)
class Sample(sampleId: String) extends AbstractSample(sampleId) {
def summaryFiles: Map[String, File] = Map()
def summaryStats: Map[String, Any] = Map()
def makeLibrary(id: String) = new Library(id)
class Library(libId: String) extends AbstractLibrary(libId) {
def summaryFiles: Map[String, File] = Map()
def summaryStats: Map[String, Any] = Map()
val inputFastq: File = config("R1")
val prefixFastq: File = createFile(".prefix.fastq")
......
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