Commit a47f8a8a authored by wyleung's avatar wyleung
Browse files

Yamsvp pipeline changes, including the Clever as pipeline instead as...

Yamsvp pipeline changes, including the Clever as pipeline instead as CommandLine function. Allowing post processing of Clever results and such..
parent 83145a5c
......@@ -10,7 +10,7 @@
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath nl.lumc.sasc.biopet.pipelines.yamsvp.Yamsvp -outDir ../test -config ../test/samples.json -run</exec.args>
<exec.args>-classpath %classpath nl.lumc.sasc.biopet.pipelines.yamsvp.Yamsvp -outDir /usr/local/waiyi/ -config ../test/samples.json -run -l debug</exec.args>
<exec.executable>java</exec.executable>
<exec.workingdir>../test</exec.workingdir>
</properties>
......@@ -25,7 +25,7 @@
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath nl.lumc.sasc.biopet.pipelines.yamsvp.Yamsvp -outDir ../test -config ../test/samples.json -run</exec.args>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath nl.lumc.sasc.biopet.pipelines.yamsvp.Yamsvp -outDir /usr/local/waiyi/ -config ../test/samples.json -run -l debug</exec.args>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
<exec.workingdir>../test</exec.workingdir>
......@@ -41,7 +41,7 @@
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath nl.lumc.sasc.biopet.pipelines.yamsvp.Yamsvp -outDir ../test -config ../test/samples.json -run</exec.args>
<exec.args>-classpath %classpath nl.lumc.sasc.biopet.pipelines.yamsvp.Yamsvp -outDir /usr/local/waiyi/ -config ../test/samples.json -run -l debug</exec.args>
<exec.executable>java</exec.executable>
<exec.workingdir>../test</exec.workingdir>
</properties>
......
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package nl.lumc.sasc.biopet.extensions.svcallers
import nl.lumc.sasc.biopet.core.BiopetCommandLineFunction
import org.broadinstitute.gatk.queue.QScript
import nl.lumc.sasc.biopet.core.BiopetQScript
import nl.lumc.sasc.biopet.core.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{ Input, Output, Argument , MissingArgumentException}
import nl.lumc.sasc.biopet.core.PipelineCommand
import org.broadinstitute.gatk.utils.commandline.{ Input, Output, Argument }
import java.io.File
class Clever(val root: Configurable) extends BiopetCommandLineFunction {
......@@ -16,17 +14,17 @@ class Clever(val root: Configurable) extends BiopetCommandLineFunction {
private lazy val versionexecutable: File = config("version_exe", default = (new File(executable).getParent + "/ctk-version"))
override val defaultVmem = "4G"
override val defaultThreads = 8
override def versionCommand = versionexecutable.getAbsolutePath
override val versionRegex = """(.*)""".r
@Input(doc = "Input file (bam)")
var input: File = _
@Input(doc = "Reference Fasta file")
@Input(doc = "Reference")
var reference: File = _
@Argument(doc = "Work directory")
......@@ -42,10 +40,6 @@ class Clever(val root: Configurable) extends BiopetCommandLineFunction {
new File(workdir + "predictions.raw.txt")
}
// var vcf: File = output
if ( reference == null ) reference = config("reference")
// var T: Option[Int] = config("T", default = defaultThreads)
var f: Boolean = config("f", default = true) // delete work directory before running
// var w: String = config("w", default = workdir + "/work")
......@@ -59,6 +53,8 @@ class Clever(val root: Configurable) extends BiopetCommandLineFunction {
}
def cmdLine = required(executable) +
"--sorted " +
"--use_xa " +
optional("-T", nCoresRequest) +
conditional(f ,"-f") +
conditional(a ,"-a") +
......@@ -77,4 +73,44 @@ object Clever {
clever.workdir = runDir
return clever
}
}
class CleverPipeline(val root: Configurable) extends QScript with BiopetQScript {
def this() = this(null)
@Input(doc = "Input file (bam)")
var input: File = _
@Input(doc = "Reference")
var reference: File = _
@Argument(doc = "Work directory")
var workdir: String = _
override def init() {
}
def biopetScript() {
// write the pipeline here
logger.info("Starting Clever Pipeline")
/// start clever and then copy the vcf into the root directory "<sample>.clever/"
val clever = Clever(this, input, reference, workdir )
outputFiles += ("clever_vcf" -> clever.outputvcf )
add( clever )
}
}
object CleverPipeline extends PipelineCommand {
override val pipeline = "/nl/lumc/sasc/biopet/extensions/svcallers/Clever/Clever.class"
def apply(root: Configurable, input: File, runDir: String): CleverPipeline = {
val cleverpipeline = new CleverPipeline( root )
cleverpipeline.input = input
cleverpipeline.workdir = runDir
return cleverpipeline
}
}
\ No newline at end of file
......@@ -10,6 +10,7 @@ import nl.lumc.sasc.biopet.core.PipelineCommand
import nl.lumc.sasc.biopet.extensions.Cat
import nl.lumc.sasc.biopet.extensions.picard.MergeSamFiles
import nl.lumc.sasc.biopet.extensions.svcallers.Breakdancer
import nl.lumc.sasc.biopet.extensions.svcallers.Clever
import nl.lumc.sasc.biopet.pipelines.mapping.Mapping
......@@ -17,15 +18,13 @@ import nl.lumc.sasc.biopet.pipelines.mapping.Mapping
import org.broadinstitute.gatk.queue.QScript
import org.broadinstitute.gatk.queue.function._
class Yamsvp(val root: Configurable) extends QScript with MultiSampleQScript {
def this() = this(null)
var reference: File = _
var finalBamFiles: List[File] = Nil
def init() {
override def init() {
for (file <- configfiles) globalConfig.loadConfigFile(file)
reference = config("reference", required = true)
if (outputDir == null)
......@@ -44,52 +43,66 @@ class Yamsvp(val root: Configurable) extends QScript with MultiSampleQScript {
//
}
def runSingleSampleJobs(sampleConfig: Map[String, Any]): Map[String, List[File]] = {
var outputFiles: Map[String, List[File]] = Map()
var libraryBamfiles: List[File] = List()
var libraryFastqFiles: List[File] = List()
val sampleID: String = sampleConfig("ID").toString
val sampleDir: String = outputDir + sampleID + "/"
val sampleDir: String = outputDir + sampleID + "/"
val svcallingDir: String = sampleDir + "svcalls/"
for ((library, libraryFiles) <- runLibraryJobs(sampleConfig)) {
libraryBamfiles +:= libraryFiles("FinalBam")
}
val bamFile: File = if (libraryBamfiles.size == 1) libraryBamfiles.head
else if (libraryBamfiles.size > 1) {
val mergeSamFiles = MergeSamFiles(this, libraryBamfiles, sampleDir)
add(mergeSamFiles)
mergeSamFiles.output
} else null
else if (libraryBamfiles.size > 1) {
val mergeSamFiles = MergeSamFiles(this, libraryBamfiles, sampleDir)
add(mergeSamFiles)
mergeSamFiles.output
} else null
val fastqFile: File = if (libraryFastqFiles.size == 1) libraryFastqFiles.head
else if (libraryFastqFiles.size > 1) {
val cat = Cat.apply(this, libraryFastqFiles, sampleDir + sampleID + ".fastq")
add(cat)
cat.output
} else null
else if (libraryFastqFiles.size > 1) {
val cat = Cat.apply(this, libraryFastqFiles, sampleDir + sampleID + ".fastq")
add(cat)
cat.output
} else null
/// bamfile will be used as input for the SV callers. First run Clever
// val cleverVCF : File = sampleDir + "/" + sampleID + ".clever.vcf"
//
// val clever = Clever(this, bamFile, this.reference, sampleDir )
// outputFiles += ("CleverVCF" -> List(clever.outputvcf) )
// add(clever)
// val cleverVCF : File = sampleDir + "/" + sampleID + ".clever.vcf"
val cleverDir = svcallingDir + sampleID + ".clever/"
val clever = Clever(this, bamFile, this.reference, cleverDir)
outputFiles += ("clever_vcf" -> List(clever.outputvcf))
add(clever)
// val breakdancerDir = sampleDir + sampleID + ".breakdancer/"
// val breakdancer = Breakdancer(this, bamFile, this.reference, breakdancerDir )
// outputFiles += ("breakdancer_vcf" -> List(breakdancer.output) )
// addAll(breakdancer.functions)
return outputFiles
}
// Called for each run from a sample
def runSingleLibraryJobs(runConfig: Map[String, Any], sampleConfig: Map[String, Any]): Map[String, File] = {
var outputFiles: Map[String, File] = Map()
val runID: String = runConfig("ID").toString
val sampleID: String = sampleConfig("ID").toString
val runDir: String = outputDir + sampleID + "/run_" + runID + "/"
val alignmentDir: String = outputDir + sampleID + "/alignment/"
val runDir: String = alignmentDir + "run_" + runID + "/"
if (runConfig.contains("R1")) {
val mapping = Mapping.loadFromLibraryConfig(this, runConfig, sampleConfig, runDir)
mapping.skipFlexiprep = false
mapping.skipMarkduplicates = true
mapping.defaultAligner = "bwa"
mapping.chunking = true
mapping.numberChunks = 4
mapping.skipMarkduplicates = true // we do the dedup marking using Sambamba
mapping.defaultAligner = "stampy"
mapping.aligner = "stampy" // enfore stampy to be the aligner
// mapping.chunking = true // align in chunks
// mapping.numberChunks = 4 // could be a fixed value if taken from config
mapping.RGLB = runConfig("ID").toString
mapping.RGSM = sampleConfig("ID").toString
if (runConfig.contains("PL")) mapping.RGPL = runConfig("PL").toString
......@@ -102,7 +115,7 @@ class Yamsvp(val root: Configurable) extends QScript with MultiSampleQScript {
outputFiles += ("FinalBam" -> mapping.outputFiles("finalBamFile"))
} else this.logger.error("Sample: " + sampleID + ": No R1 found for run: " + runConfig)
logger.debug( outputFiles )
logger.debug(outputFiles)
return outputFiles
}
}
......
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