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

Fixed intermediate files

parent ee8f8474
......@@ -75,6 +75,8 @@ class Shiva(val root: Configurable) extends QScript with ShivaTrait {
}
}
override def keepMergedFiles: Boolean = config("keep_merged_files", default = false)
override def summarySettings = super.summarySettings + ("use_indel_realigner" -> useIndelRealigner)
lazy val useIndelRealigner: Boolean = config("use_indel_realigner", default = true)
......@@ -87,7 +89,7 @@ class Shiva(val root: Configurable) extends QScript with ShivaTrait {
super.addJobs()
if (useIndelRealigner && libraries.values.flatMap(_.preProcessBam).size > 1) {
addIndelRealign(bamFile.get, sampleDir, libraries.size > 1)
addIndelRealign(bamFile.get, sampleDir, false)
}
}
}
......
......@@ -105,11 +105,12 @@ class MarkDuplicates(val root: Configurable) extends Picard with Summarizable {
}
object MarkDuplicates {
/** Returns default MarkDuplicates */
def apply(root: Configurable, input: List[File], output: File): MarkDuplicates = {
def apply(root: Configurable, input: List[File], output: File, isIntermediate: Boolean = false): MarkDuplicates = {
val markDuplicates = new MarkDuplicates(root)
markDuplicates.input = input
markDuplicates.output = output
markDuplicates.outputMetrics = new File(output.getParent, output.getName.stripSuffix(".bam") + ".metrics")
markDuplicates.isIntermediate = isIntermediate
markDuplicates
}
}
\ No newline at end of file
......@@ -65,12 +65,14 @@ class MergeSamFiles(val root: Configurable) extends Picard {
object MergeSamFiles {
/** Returns default MergeSamFiles */
def apply(root: Configurable, input: List[File], outputFile: File, sortOrder: String = null): MergeSamFiles = {
def apply(root: Configurable, input: List[File], outputFile: File,
sortOrder: String = null, isIntermediate: Boolean = false): MergeSamFiles = {
val mergeSamFiles = new MergeSamFiles(root)
mergeSamFiles.input = input
mergeSamFiles.output = outputFile
if (sortOrder == null) mergeSamFiles.sortOrder = "coordinate"
else mergeSamFiles.sortOrder = sortOrder
mergeSamFiles.isIntermediate = isIntermediate
mergeSamFiles
}
}
\ No newline at end of file
......@@ -160,6 +160,8 @@ trait MultisampleMappingTrait extends MultiSampleQScript
def preProcessBam = bamFile
def keepMergedFiles: Boolean = config("keep_merged_files", default = true)
def addJobs(): Unit = {
addPerLibJobs() // This add jobs for each library
......@@ -170,13 +172,13 @@ trait MultisampleMappingTrait extends MultiSampleQScript
case (MergeStrategy.PreProcessMergeSam | MergeStrategy.PreProcessMarkDuplicates) if libraries.flatMap(_._2.preProcessBam).size == 1 =>
add(Ln.linkBamFile(qscript, libraries.flatMap(_._2.preProcessBam).head, bamFile.get): _*)
case MergeStrategy.MergeSam =>
add(MergeSamFiles(qscript, libraries.flatMap(_._2.bamFile).toList, bamFile.get))
add(MergeSamFiles(qscript, libraries.flatMap(_._2.bamFile).toList, bamFile.get, isIntermediate = keepMergedFiles))
case MergeStrategy.PreProcessMergeSam =>
add(MergeSamFiles(qscript, libraries.flatMap(_._2.preProcessBam).toList, bamFile.get))
add(MergeSamFiles(qscript, libraries.flatMap(_._2.preProcessBam).toList, bamFile.get, isIntermediate = keepMergedFiles))
case MergeStrategy.MarkDuplicates =>
add(MarkDuplicates(qscript, libraries.flatMap(_._2.bamFile).toList, bamFile.get))
add(MarkDuplicates(qscript, libraries.flatMap(_._2.bamFile).toList, bamFile.get, isIntermediate = keepMergedFiles))
case MergeStrategy.PreProcessMarkDuplicates =>
add(MarkDuplicates(qscript, libraries.flatMap(_._2.preProcessBam).toList, bamFile.get))
add(MarkDuplicates(qscript, libraries.flatMap(_._2.preProcessBam).toList, bamFile.get, isIntermediate = keepMergedFiles))
case _ => throw new IllegalStateException("This should not be possible, unimplemented MergeStrategy?")
}
......
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