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

Fixed delly output file names

parent 4550f9b0
...@@ -19,7 +19,7 @@ class Delly(val root: Configurable) extends QScript with BiopetQScript with Refe ...@@ -19,7 +19,7 @@ class Delly(val root: Configurable) extends QScript with BiopetQScript with Refe
@Output(doc = "Delly result VCF") @Output(doc = "Delly result VCF")
var outputVcf: File = _ var outputVcf: File = _
var outputBaseName: File = _ var outputName: String = _
// select the analysis types DEL,DUP,INV,TRA // select the analysis types DEL,DUP,INV,TRA
var del: Boolean = config("DEL", default = true) var del: Boolean = config("DEL", default = true)
...@@ -27,7 +27,9 @@ class Delly(val root: Configurable) extends QScript with BiopetQScript with Refe ...@@ -27,7 +27,9 @@ class Delly(val root: Configurable) extends QScript with BiopetQScript with Refe
var inv: Boolean = config("INV", default = true) var inv: Boolean = config("INV", default = true)
var tra: Boolean = config("TRA", default = true) var tra: Boolean = config("TRA", default = true)
override def init() { override def init(): Unit = {
if (outputName == null) outputName = input.getName.stripSuffix(".bam")
if (outputVcf == null) outputVcf = new File(workDir, outputName + ".delly.vcf")
} }
def biopetScript() { def biopetScript() {
...@@ -36,15 +38,12 @@ class Delly(val root: Configurable) extends QScript with BiopetQScript with Refe ...@@ -36,15 +38,12 @@ class Delly(val root: Configurable) extends QScript with BiopetQScript with Refe
var outputFiles: Map[String, File] = Map() var outputFiles: Map[String, File] = Map()
var vcfFiles: Map[String, File] = Map() var vcfFiles: Map[String, File] = Map()
this.outputBaseName = workDir + input.getName.substring(0, input.getName.lastIndexOf(".bam"))
this.outputVcf = outputBaseName + ".delly.vcf"
/// start delly and then copy the vcf into the root directory "<sample>.delly/" /// start delly and then copy the vcf into the root directory "<sample>.delly/"
if (del) { if (del) {
val delly = new DellyCaller(this) val delly = new DellyCaller(this)
delly.input = input delly.input = input
delly.analysistype = "DEL" delly.analysistype = "DEL"
delly.outputvcf = outputBaseName + ".delly.del.vcf" delly.outputvcf = new File(workDir, outputName + ".delly.del.vcf")
add(delly) add(delly)
vcfFiles += ("DEL" -> delly.outputvcf) vcfFiles += ("DEL" -> delly.outputvcf)
} }
...@@ -52,7 +51,7 @@ class Delly(val root: Configurable) extends QScript with BiopetQScript with Refe ...@@ -52,7 +51,7 @@ class Delly(val root: Configurable) extends QScript with BiopetQScript with Refe
val delly = new DellyCaller(this) val delly = new DellyCaller(this)
delly.input = input delly.input = input
delly.analysistype = "DUP" delly.analysistype = "DUP"
delly.outputvcf = outputBaseName + ".delly.dup.vcf" delly.outputvcf = new File(workDir, outputName + ".delly.dup.vcf")
add(delly) add(delly)
vcfFiles += ("DUP" -> delly.outputvcf) vcfFiles += ("DUP" -> delly.outputvcf)
} }
...@@ -60,7 +59,7 @@ class Delly(val root: Configurable) extends QScript with BiopetQScript with Refe ...@@ -60,7 +59,7 @@ class Delly(val root: Configurable) extends QScript with BiopetQScript with Refe
val delly = new DellyCaller(this) val delly = new DellyCaller(this)
delly.input = input delly.input = input
delly.analysistype = "INV" delly.analysistype = "INV"
delly.outputvcf = outputBaseName + ".delly.inv.vcf" delly.outputvcf = new File(workDir, outputName + ".delly.inv.vcf")
add(delly) add(delly)
vcfFiles += ("INV" -> delly.outputvcf) vcfFiles += ("INV" -> delly.outputvcf)
} }
...@@ -68,7 +67,7 @@ class Delly(val root: Configurable) extends QScript with BiopetQScript with Refe ...@@ -68,7 +67,7 @@ class Delly(val root: Configurable) extends QScript with BiopetQScript with Refe
val delly = new DellyCaller(this) val delly = new DellyCaller(this)
delly.input = input delly.input = input
delly.analysistype = "TRA" delly.analysistype = "TRA"
delly.outputvcf = outputBaseName + ".delly.tra.vcf" delly.outputvcf = new File(workDir, outputName + ".delly.tra.vcf")
// vcfFiles += ("TRA" -> delly.outputvcf) // vcfFiles += ("TRA" -> delly.outputvcf)
add(delly) add(delly)
} }
...@@ -98,10 +97,10 @@ class Delly(val root: Configurable) extends QScript with BiopetQScript with Refe ...@@ -98,10 +97,10 @@ class Delly(val root: Configurable) extends QScript with BiopetQScript with Refe
object Delly extends PipelineCommand { object Delly extends PipelineCommand {
override val pipeline = "/nl/lumc/sasc/biopet/extensions/svcallers/Delly/Delly.class" override val pipeline = "/nl/lumc/sasc/biopet/extensions/svcallers/Delly/Delly.class"
def apply(root: Configurable, input: File, runDir: File): Delly = { def apply(root: Configurable, input: File, workDir: File): Delly = {
val dellyPipeline = new Delly(root) val dellyPipeline = new Delly(root)
dellyPipeline.input = input dellyPipeline.input = input
dellyPipeline.workDir = runDir dellyPipeline.workDir = workDir
dellyPipeline.init() dellyPipeline.init()
dellyPipeline.biopetScript() dellyPipeline.biopetScript()
dellyPipeline dellyPipeline
......
...@@ -135,6 +135,7 @@ class ShivaSvCalling(val root: Configurable) extends QScript with SummaryQScript ...@@ -135,6 +135,7 @@ class ShivaSvCalling(val root: Configurable) extends QScript with SummaryQScript
for ((sample, bamFile) <- inputBams) { for ((sample, bamFile) <- inputBams) {
val dellyDir = new File(outputDir, sample) val dellyDir = new File(outputDir, sample)
val delly = Delly(qscript, bamFile, dellyDir) val delly = Delly(qscript, bamFile, dellyDir)
delly.outputName = sample
addAll(delly.functions) addAll(delly.functions)
} }
} }
......
...@@ -247,20 +247,25 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript with Reference { ...@@ -247,20 +247,25 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript with Reference {
def addJobs(): Unit = { def addJobs(): Unit = {
addPerLibJobs() addPerLibJobs()
if (preProcessBam.isDefined) { preProcessBam.foreach { bam =>
val bamMetrics = new BamMetrics(qscript) val bamMetrics = new BamMetrics(qscript)
bamMetrics.sampleId = Some(sampleId) bamMetrics.sampleId = Some(sampleId)
bamMetrics.inputBam = preProcessBam.get bamMetrics.inputBam = bam
bamMetrics.outputDir = new File(sampleDir, "metrics") bamMetrics.outputDir = new File(sampleDir, "metrics")
bamMetrics.init() bamMetrics.init()
bamMetrics.biopetScript() bamMetrics.biopetScript()
addAll(bamMetrics.functions) addAll(bamMetrics.functions)
addSummaryQScript(bamMetrics) addSummaryQScript(bamMetrics)
val oldIndex: File = new File(bam.getAbsolutePath.stripSuffix(".bam") + ".bai")
val newIndex: File = new File(bam + ".bai")
val baiLn = Ln(qscript, oldIndex, newIndex)
add(baiLn)
variantcalling.foreach(vc => { variantcalling.foreach(vc => {
vc.sampleId = Some(sampleId) vc.sampleId = Some(sampleId)
vc.outputDir = new File(sampleDir, "variantcalling") vc.outputDir = new File(sampleDir, "variantcalling")
vc.inputBams = preProcessBam.get :: Nil vc.inputBams = bam :: Nil
vc.init() vc.init()
vc.biopetScript() vc.biopetScript()
addAll(vc.functions) addAll(vc.functions)
......
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