Commit 3babdbc3 authored by Wai Yi Leung's avatar Wai Yi Leung

Merging SV calls - changed post-calling step in several SV-callers

parent 6f59dc48
......@@ -8,20 +8,19 @@ import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.utils.commandline._
/**
* Created by wyleung on 8-1-16.
*/
* Created by wyleung on 8-1-16.
*/
class Pysvtools(val root: Configurable) extends BiopetCommandLineFunction {
@Input(doc = "Input file", required = true)
var input: List[File] = Nil
@Argument(doc="Set flanking amount")
@Argument(doc = "Set flanking amount")
var flanking: Option[Int] = config("flanking")
var exclusionRegions: List[File] = config("exclusion_regions")
var translocationsOnly: Boolean = config("translocations_only")
@Output(doc = "Unzipped file", required = true)
var output: File = _
......@@ -43,16 +42,15 @@ class Pysvtools(val root: Configurable) extends BiopetCommandLineFunction {
// redefine the tsv, bed and regions output
val outputNamePrefix = output.getAbsolutePath.stripSuffix(".vcf")
tsvoutput = new File(outputNamePrefix+".tsv")
bedoutput = new File(outputNamePrefix+".bed")
regionsoutput = new File(outputNamePrefix+".regions.bed")
tsvoutput = new File(outputNamePrefix + ".tsv")
bedoutput = new File(outputNamePrefix + ".bed")
regionsoutput = new File(outputNamePrefix + ".regions.bed")
}
/** return commandline to execute */
def cmdLine = required(executable) +
repeat("-c", input) +
optional( "-f", flanking ) +
optional("-f", flanking) +
"-i " + repeat(input) +
"-o " + required(tsvoutput) +
"-b " + required(bedoutput) +
......
......@@ -17,9 +17,10 @@ package nl.lumc.sasc.biopet.pipelines.shiva
import nl.lumc.sasc.biopet.core.summary.SummaryQScript
import nl.lumc.sasc.biopet.core.{ PipelineCommand, Reference, SampleLibraryTag }
import nl.lumc.sasc.biopet.pipelines.shiva.svcallers.{ Delly, Breakdancer, Clever, SvCaller }
import nl.lumc.sasc.biopet.utils.{ BamUtils, Logging }
import nl.lumc.sasc.biopet.extensions.Pysvtools
import nl.lumc.sasc.biopet.pipelines.shiva.svcallers.{ Breakdancer, Clever, Delly, SvCaller }
import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.utils.{ BamUtils, Logging }
import org.broadinstitute.gatk.queue.QScript
/**
......@@ -62,6 +63,19 @@ class ShivaSvCalling(val root: Configurable) extends QScript with SummaryQScript
add(caller)
}
// merge VCF by sample
for ((sample, bamFile) <- inputBams) {
var sampleVcfs: List[File] = List()
callers.foreach { caller =>
sampleVcfs :+= caller.outputFiles(sample)
}
val mergeSVcalls = new Pysvtools(this)
mergeSVcalls.input = sampleVcfs
mergeSVcalls.output = new File(outputDir, sample + ".merged.vcf")
add(mergeSVcalls)
outputFiles += (sample -> mergeSVcalls.output)
}
addSummaryJobs()
}
......
......@@ -18,6 +18,8 @@ class Breakdancer(val root: Configurable) extends SvCaller {
val breakdancer = BreakdancerCaller(this, bdcfg.output, new File(breakdancerSampleDir, sample + ".breakdancer.tsv"))
val bdvcf = BreakdancerVCF(this, breakdancer.output, new File(breakdancerSampleDir, sample + ".breakdancer.vcf"))
add(bdcfg, breakdancer, bdvcf)
outputFiles += (sample -> bdvcf.output)
}
}
}
......@@ -13,6 +13,8 @@ class Clever(val root: Configurable) extends SvCaller {
val cleverDir = new File(outputDir, sample)
val clever = CleverCaller(this, bamFile, cleverDir)
add(clever)
outputFiles += (sample -> clever.outputvcf)
}
}
}
......@@ -20,7 +20,6 @@ class Delly(val root: Configurable) extends SvCaller {
val catVariants = new CatVariants(this)
catVariants.outputFile = new File(dellyDir, sample + ".delly.vcf.gz")
/// start delly and then copy the vcf into the root directory "<sample>.delly/"
if (del) {
val delly = new DellyCaller(this)
delly.input = bamFile
......@@ -55,6 +54,8 @@ class Delly(val root: Configurable) extends SvCaller {
}
add(catVariants)
outputFiles += (sample -> catVariants.outputFile)
}
}
}
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