...
 
Commits (5)
......@@ -33,6 +33,9 @@ class Bam2Wig(val parent: Configurable) extends QScript with BiopetQScript {
@Input(doc = "Input bam file", required = true)
var bamFile: File = _
@Input(required = false)
var deps: List[File] = Nil
def init(): Unit = {
inputFiles :+= new InputFile(bamFile)
}
......@@ -46,6 +49,7 @@ class Bam2Wig(val parent: Configurable) extends QScript with BiopetQScript {
bs.bamFile = bamFile
bs.chromSizesFile = bamFile.getAbsoluteFile + ".chrom.sizes"
bs.isIntermediate = true
deps.foreach(bs.deps :+= _)
add(bs)
val igvCount = new IGVToolsCount(this)
......@@ -53,6 +57,7 @@ class Bam2Wig(val parent: Configurable) extends QScript with BiopetQScript {
igvCount.genomeChromSizes = bs.chromSizesFile
igvCount.wig = Some(outputWigleFile)
igvCount.tdf = Some(outputTdfFile)
deps.foreach(igvCount.deps :+= _)
add(igvCount)
val wigToBigWig = new WigToBigWig(this)
......
......@@ -35,6 +35,9 @@ class BamToChromSizes(val parent: Configurable) extends InProcessFunction with C
@Output
var chromSizesFile: File = _
@Input(required = false)
var deps: List[File] = Nil
def run(): Unit = {
val bamReader = SamReaderFactory.makeDefault().open(bamFile)
val writer = new PrintWriter(chromSizesFile)
......
......@@ -18,7 +18,7 @@ import java.io.File
import nl.lumc.sasc.biopet.core.annotations.{AnnotationRefFlat, RibosomalRefFlat}
import nl.lumc.sasc.biopet.core.summary.SummaryQScript
import nl.lumc.sasc.biopet.core.{BiopetFifoPipe, PipelineCommand, Reference, SampleLibraryTag}
import nl.lumc.sasc.biopet.core._
import nl.lumc.sasc.biopet.extensions.bedtools.{BedtoolsCoverage, BedtoolsIntersect, BedtoolsSort}
import nl.lumc.sasc.biopet.extensions.picard._
import nl.lumc.sasc.biopet.extensions.samtools.SamtoolsFlagstat
......@@ -45,6 +45,9 @@ class BamMetrics(val parent: Configurable)
@Argument(required = false)
var paired: Boolean = true
@Input(required = false)
var deps: List[File] = Nil
override def defaults = Map("bedtoolscoverage" -> Map("sorted" -> true))
/** returns files to store in summary */
......@@ -209,6 +212,11 @@ class BamMetrics(val parent: Configurable)
}
addSummaryJobs()
functions.foreach {
case f: BiopetCommandLineFunction =>
f.deps ++= deps
case f =>
}
}
}
......
......@@ -48,6 +48,7 @@ class Basty(val parent: Configurable) extends QScript with MultiSampleQScript {
val executeGubbins: Boolean = config("execute_gubbins", default = true)
override def defaults = Map(
"sample_ploidy" -> 1,
"ploidy" -> 1,
"variantcallers" -> variantcallers
)
......
......@@ -142,7 +142,7 @@ trait SummaryQScript extends BiopetQScript { qscript: QScript =>
val writeSummary = new WriteSummary(this)
def addChecksum(file: File): Unit = {
if (writeSummary.md5sum) {
if (writeSummary.md5sum || inputFiles.find(_.file == file).flatMap(_.md5).isDefined) {
if (!SummaryQScript.md5sumCache.contains(file)) {
val md5sum = new Md5sum(this) {
override def configNamespace = "md5sum"
......
......@@ -45,8 +45,7 @@ class WriteSummary(val parent: SummaryQScript) extends InProcessFunction with Co
@Input(doc = "deps", required = false)
var deps: List[File] = Nil
var md5sum: Boolean = config("summary_md5", default = true)
//TODO: add more checksums types
var md5sum: Boolean = config("summary_md5", default = false)
override def freezeFieldValues(): Unit = {
init()
......
......@@ -41,6 +41,10 @@ class Ln(val parent: Configurable) extends InProcessFunction with Configurable {
/** Generate out file for job */
override def freezeFieldValues(): Unit = {
if (output.getAbsolutePath == "/home/pjvan_thof/test/output/samples/sample2/lib_lib1/sample2-lib1.dedup.bam") {
""
}
val outLog: String = ".%s.%s.out".format(output.getName, analysisName)
jobOutputFile = new File(output.getAbsoluteFile.getParentFile, outLog)
super.freezeFieldValues()
......@@ -106,6 +110,10 @@ object Ln {
* @return
*/
def apply(root: Configurable, input: File, output: File, relative: Boolean = true): Ln = {
if (output.getAbsolutePath == "/home/pjvan_thof/test/output/samples/sample2/lib_lib1/sample2-lib1.dedup.bam") {
""
}
val ln = new Ln(root)
ln.input = input
ln.output = output
......
......@@ -54,9 +54,6 @@ class Carp(val parent: Configurable) extends QScript with MultisampleMappingTrai
override def makeSample(id: String) = new Sample(id)
class Sample(sampleId: String) extends super.Sample(sampleId) {
override def bamFile: Option[File] =
if (libraries.size == 1) libraries.head._2.mapping.map(_.finalBamFile) else super.bamFile
override def preProcessBam = Some(createFile("filter.bam"))
override def metricsPreprogressBam = false
......@@ -69,7 +66,12 @@ class Carp(val parent: Configurable) extends QScript with MultisampleMappingTrai
override def addJobs(): Unit = {
super.addJobs()
add(Bam2Wig(qscript, bamFile.get))
val bam2Wig = Bam2Wig(qscript, bamFile.get)
if (libraries.size == 1) {
bam2Wig.deps ++= libraries.head._2.bamFile ++
libraries.head._2.bamFile.map(_.getAbsolutePath.stripSuffix(".bam") + ".bai")
}
add(bam2Wig)
val samtoolsView = new SamtoolsView(qscript)
samtoolsView.input = bamFile.get
......
......@@ -344,6 +344,10 @@ trait MultisampleMappingTrait extends MultiSampleQScript with Reference { qscrip
bamMetrics.outputDir = new File(sampleDir, "metrics")
bamMetrics.paired =
libraries.exists(x => x._2.inputR1.isDefined || x._2.inputBam.isDefined)
if (libraries.size == 1) {
bamMetrics.deps ++= libraries.head._2.bamFile ++
libraries.head._2.bamFile.map(_.getAbsolutePath.stripSuffix(".bam") + ".bai")
}
add(bamMetrics)
if (config("execute_bam2wig", default = true)) add(Bam2Wig(qscript, preProcessBam.get))
......