Commit a68e86c1 authored by Wai Yi Leung's avatar Wai Yi Leung
Browse files

Refactor usage of Delly pipeline a bit by adding CatVariants and moving Delly to Shiva

parent fe9f50f7
/**
* Biopet is built on top of GATK Queue for building bioinformatic
* pipelines. It is mainly intended to support LUMC SHARK cluster which is running
* SGE. But other types of HPC that are supported by GATK Queue (such as PBS)
* should also be able to execute Biopet tools and pipelines.
*
* Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project that are
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license.
*/
package nl.lumc.sasc.biopet.extensions.gatk
import java.io.File
import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{Input, Output}
class CatVariants(val root: Configurable) extends Gatk {
val analysisType = "CatVariants"
@Input(doc = "", required = true)
var inputFiles: List[File] = Nil
@Output(doc = "", required = true)
var outputFile: File = null
override def cmdLine = super.cmdLine +
(for (file <- inputFiles) yield {
required("-V", file)
}).mkString +
required("-o", outputFile)
}
object CatVariants {
def apply(root: Configurable, input: List[File], output: File): CatVariants = {
val cv = new CatVariants(root)
cv.inputFiles = input
cv.outputFile = output
cv
}
}
\ No newline at end of file
......@@ -13,17 +13,19 @@
* license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license.
*/
package nl.lumc.sasc.biopet.extensions.delly
package nl.lumc.sasc.biopet.pipelines.shiva
import java.io.File
import nl.lumc.sasc.biopet.core.{ Reference, BiopetQScript, PipelineCommand }
import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.core.summary.SummaryQScript
import nl.lumc.sasc.biopet.core.{PipelineCommand, Reference}
import nl.lumc.sasc.biopet.extensions.Ln
import nl.lumc.sasc.biopet.extensions.delly.DellyCaller
import nl.lumc.sasc.biopet.extensions.gatk.CatVariants
import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.queue.QScript
import org.broadinstitute.gatk.queue.extensions.gatk.CatVariants
class Delly(val root: Configurable) extends QScript with BiopetQScript with Reference {
class Delly(val root: Configurable) extends QScript with Reference with SummaryQScript {
def this() = this(null)
@Input(doc = "Input file (bam)")
......@@ -47,9 +49,30 @@ class Delly(val root: Configurable) extends QScript with BiopetQScript with Refe
if (outputVcf == null) outputVcf = new File(workDir, outputName + ".delly.vcf")
}
override def summaryFile: File = new File(outputDir, "Delly.summary.json")
override def summaryFiles: Map[String, File] = Map.empty ++
Map("input" -> input) ++
Map("outputVCF" -> outputVcf)
override def summarySettings = {
Map(
"input" -> input,
"workDir" -> workDir,
"outputVCF" -> outputVcf,
"outputName" -> outputName,
"del" -> del,
"dup" -> dup,
"inv" -> inv,
"tra" -> tra
)
}
def biopetScript() {
// write the pipeline here
logger.info("Configuring Delly pipeline")
var outputFiles: Map[String, File] = Map()
var vcfFiles: Map[String, File] = Map()
......@@ -89,15 +112,13 @@ class Delly(val root: Configurable) extends QScript with BiopetQScript with Refe
// we need to merge the vcf's
val finalVCF = if (vcfFiles.size > 1) {
// do merging
// CatVariants is a $org.broadinstitute.gatk.utils.commandline.CommandLineProgram$;
//TODO: convert to biopet extension
val variants = new CatVariants()
variants.variant = vcfFiles.values.toList
val variants = new CatVariants(this)
variants.inputFiles = vcfFiles.values.toList
variants.outputFile = this.outputVcf
variants.reference = referenceFasta()
// variants.reference = referenceFasta()
// add the job
//add(variants)
Some(outputVcf)
add(variants)
Some(variants.outputFile)
} else if (vcfFiles.size == 1) {
// TODO: pretify this
val ln = Ln(this, vcfFiles.head._2, this.outputVcf, relative = true)
......@@ -110,8 +131,6 @@ class Delly(val root: Configurable) extends QScript with BiopetQScript with Refe
}
object Delly extends PipelineCommand {
override val pipeline = "/nl/lumc/sasc/biopet/extensions/svcallers/Delly/Delly.class"
def apply(root: Configurable, input: File, workDir: File): Delly = {
val dellyPipeline = new Delly(root)
dellyPipeline.input = input
......
......@@ -17,10 +17,9 @@ package nl.lumc.sasc.biopet.pipelines.shiva
import htsjdk.samtools.SamReaderFactory
import nl.lumc.sasc.biopet.core.summary.SummaryQScript
import nl.lumc.sasc.biopet.core.{ PipelineCommand, Reference, SampleLibraryTag }
import nl.lumc.sasc.biopet.core.{PipelineCommand, Reference, SampleLibraryTag}
import nl.lumc.sasc.biopet.extensions.breakdancer.Breakdancer
import nl.lumc.sasc.biopet.extensions.clever.CleverCaller
import nl.lumc.sasc.biopet.extensions.delly.Delly
import nl.lumc.sasc.biopet.utils.Logging
import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.queue.QScript
......@@ -135,6 +134,7 @@ class ShivaSvCalling(val root: Configurable) extends QScript with SummaryQScript
val delly = Delly(qscript, bamFile, dellyDir)
delly.outputName = sample
addAll(delly.functions)
addSummaryQScript(delly)
}
}
}
......
......@@ -21,15 +21,15 @@ package nl.lumc.sasc.biopet.pipelines.yamsvp
import java.io.File
import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.core.{ MultiSampleQScript, PipelineCommand }
import nl.lumc.sasc.biopet.core.{MultiSampleQScript, PipelineCommand}
import nl.lumc.sasc.biopet.extensions.Ln
import nl.lumc.sasc.biopet.extensions.breakdancer.Breakdancer
import nl.lumc.sasc.biopet.extensions.clever.CleverCaller
import nl.lumc.sasc.biopet.extensions.igvtools.IGVToolsCount
import nl.lumc.sasc.biopet.extensions.sambamba.{ SambambaMarkdup, SambambaMerge }
import nl.lumc.sasc.biopet.extensions.sambamba.{SambambaMarkdup, SambambaMerge}
import nl.lumc.sasc.biopet.pipelines.shiva.Delly
import nl.lumc.sasc.biopet.utils.config.Configurable
//import nl.lumc.sasc.biopet.extensions.pindel.Pindel
import nl.lumc.sasc.biopet.extensions.delly.Delly
import nl.lumc.sasc.biopet.pipelines.bammetrics.BamMetrics
import nl.lumc.sasc.biopet.pipelines.mapping.Mapping
import org.broadinstitute.gatk.queue.QScript
......
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