Commit 1571f046 authored by bow's avatar bow
Browse files

Merge branch 'patch-mutisample_summary' into 'develop'

Patch mutisample summary

See merge request !112
parents 4aa6f273 ca8089a0
......@@ -31,10 +31,30 @@ class Basty(val root: Configurable) extends QScript with MultiSampleQScript {
var gatkPipeline: GatkPipeline = new GatkPipeline(qscript)
def summaryFile: File = new File(outputDir, "Sage.summary.json")
//TODO: Add summary
def summaryFiles: Map[String, File] = Map()
//TODO: Add summary
def summarySettings: Map[String, Any] = Map()
def makeSample(id: String) = new Sample(id)
class Sample(sampleId: String) extends AbstractSample(sampleId) {
//TODO: Add summary
def summaryFiles: Map[String, File] = Map()
//TODO: Add summary
def summaryStats: Map[String, Any] = Map()
def makeLibrary(id: String) = new Library(id)
class Library(libId: String) extends AbstractLibrary(libId) {
//TODO: Add summary
def summaryFiles: Map[String, File] = Map()
//TODO: Add summary
def summaryStats: Map[String, Any] = Map()
protected def addJobs(): Unit = {}
}
......@@ -56,6 +76,7 @@ class Basty(val root: Configurable) extends QScript with MultiSampleQScript {
def biopetScript() {
gatkPipeline.biopetScript
addAll(gatkPipeline.functions)
addSummaryQScript(gatkPipeline)
addSamplesJobs()
}
......
......@@ -43,14 +43,28 @@ class GatkPipeline(val root: Configurable) extends QScript with MultiSampleQScri
def summaryFile = new File(outputDir, "GatkPipeline.summary.json")
//TODO: Add summary
def summaryFiles = Map()
//TODO: Add summary
def summarySettings = Map()
def makeSample(id: String) = new Sample(id)
class Sample(sampleId: String) extends AbstractSample(sampleId) {
//TODO: Add summary
def summaryFiles: Map[String, File] = Map()
//TODO: Add summary
def summaryStats: Map[String, Any] = Map()
def makeLibrary(id: String) = new Library(id)
class Library(libId: String) extends AbstractLibrary(libId) {
//TODO: Add summary
def summaryFiles: Map[String, File] = Map()
//TODO: Add summary
def summaryStats: Map[String, Any] = Map()
val mapping = new Mapping(qscript)
mapping.sampleId = Some(sampleId)
mapping.libId = Some(libId)
......
......@@ -18,39 +18,40 @@ 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 {
/** This trait creates a structured way of use multisample pipelines */
trait MultiSampleQScript extends SummaryQScript {
qscript =>
@Argument(doc = "Only Sample", shortName = "sample", required = false)
private val onlySamples: List[String] = Nil
require(globalConfig.map.contains("samples"), "No Samples found in config")
/**
* Sample class with basic functions build in
* @param sampleId
*/
abstract class AbstractSample(val sampleId: String) {
/** Sample class with basic functions build in */
abstract class AbstractSample(val sampleId: String) extends Summarizable {
/** Overrules config of qscript with default sample */
val config = new ConfigFunctions(defaultSample = sampleId)
/**
* Library class with basic functions build in
* @param libId
*/
abstract class AbstractLibrary(val libId: String) {
/** Library class with basic functions build in */
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)
/** Name overules the one from qscript */
def addSummarizable(summarizable: Summarizable, name: String): Unit = {
qscript.addSummarizable(summarizable, name, Some(sampleId), Some(libId))
}
/** Adds the library jobs */
final def addAndTrackJobs(): Unit = {
currentSample = Some(sampleId)
currentLib = Some(libId)
addJobs()
qscript.addSummarizable(this, "pipeline", Some(sampleId), Some(libId))
currentLib = None
currentSample = None
}
......@@ -83,10 +84,16 @@ trait MultiSampleQScript extends BiopetQScript {
ConfigUtils.getMapFromPath(globalConfig.map, List("samples", sampleId, "libraries")).getOrElse(Map()).keySet
}
/** Name overules the one from qscript */
def addSummarizable(summarizable: Summarizable, name: String): Unit = {
qscript.addSummarizable(summarizable, name, Some(sampleId))
}
/** Adds sample jobs */
final def addAndTrackJobs(): Unit = {
currentSample = Some(sampleId)
addJobs()
qscript.addSummarizable(this, "pipeline", Some(sampleId))
currentSample = None
}
......@@ -139,7 +146,7 @@ trait MultiSampleQScript extends BiopetQScript {
}
/**
* Method where the multisample jobs should be added, this will be executed only when running the -sample argument is not given
* Method where the multisample jobs should be added, this will be executed only when running the -sample argument is not given.
*/
def addMultiSampleJobs()
......
......@@ -9,18 +9,12 @@ import nl.lumc.sasc.biopet.core.config.Configurable
*
* Created by pjvan_thof on 2/14/15.
*/
trait Summarizable extends Configurable {
trait Summarizable {
/**
* Must return files to store into summary
* @return
*/
/** Must return files to store into summary */
def summaryFiles: Map[String, File]
/**
* Must returns stats to store into summary
* @return
*/
/** Must returns stats to store into summary */
def summaryStats: Map[String, Any]
/**
......
......@@ -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
}
......
......@@ -45,14 +45,28 @@ class Carp(val root: Configurable) extends QScript with MultiSampleQScript with
def summaryFile = new File(outputDir, "Carp.summary.json")
//TODO: Add summary
def summaryFiles = Map()
//TODO: Add summary
def summarySettings = Map()
def makeSample(id: String) = new Sample(id)
class Sample(sampleId: String) extends AbstractSample(sampleId) {
//TODO: Add summary
def summaryFiles: Map[String, File] = Map()
//TODO: Add summary
def summaryStats: Map[String, Any] = Map()
def makeLibrary(id: String) = new Library(id)
class Library(libId: String) extends AbstractLibrary(libId) {
//TODO: Add summary
def summaryFiles: Map[String, File] = Map()
//TODO: Add summary
def summaryStats: Map[String, Any] = Map()
val mapping = new Mapping(qscript)
mapping.libId = Some(libId)
mapping.sampleId = Some(sampleId)
......
......@@ -33,10 +33,30 @@ class Kopisu(val root: Configurable) extends QScript with MultiSampleQScript {
addSamplesJobs()
}
def summaryFile: File = new File(outputDir, "Kopisu.summary.json")
//TODO: Add summary
def summaryFiles: Map[String, File] = Map()
//TODO: Add summary
def summarySettings: Map[String, Any] = Map()
def makeSample(id: String) = new Sample(id)
class Sample(sampleId: String) extends AbstractSample(sampleId) {
//TODO: Add summary
def summaryFiles: Map[String, File] = Map()
//TODO: Add summary
def summaryStats: Map[String, Any] = Map()
def makeLibrary(id: String) = new Library(id)
class Library(libId: String) extends AbstractLibrary(libId) {
//TODO: Add summary
def summaryFiles: Map[String, File] = Map()
//TODO: Add summary
def summaryStats: Map[String, Any] = Map()
def addJobs(): Unit = {
}
......
......@@ -58,10 +58,30 @@ class Sage(val root: Configurable) extends QScript with MultiSampleQScript {
)
), super.defaults)
def summaryFile: File = new File(outputDir, "Sage.summary.json")
//TODO: Add summary
def summaryFiles: Map[String, File] = Map()
//TODO: Add summary
def summarySettings: Map[String, Any] = Map()
def makeSample(id: String) = new Sample(id)
class Sample(sampleId: String) extends AbstractSample(sampleId) {
//TODO: Add summary
def summaryFiles: Map[String, File] = Map()
//TODO: Add summary
def summaryStats: Map[String, Any] = Map()
def makeLibrary(id: String) = new Library(id)
class Library(libId: String) extends AbstractLibrary(libId) {
//TODO: Add summary
def summaryFiles: Map[String, File] = Map()
//TODO: Add summary
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