Commit 559881ed authored by Sander van der Zeeuw's avatar Sander van der Zeeuw
Browse files

add varscan to shiva variantcallers

parent 9e62862f
...@@ -20,7 +20,7 @@ import java.io.File ...@@ -20,7 +20,7 @@ import java.io.File
import nl.lumc.sasc.biopet.utils.config.Configurable import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{ Input, Output } import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
class Mpileup2cns(val root: Configurable) extends Varscan { class VarscanMpileup2cns(val root: Configurable) extends Varscan {
@Input(doc = "Input mpileup file", required = false) // if not defined, input is stdin @Input(doc = "Input mpileup file", required = false) // if not defined, input is stdin
var input: Option[File] = None var input: Option[File] = None
...@@ -47,22 +47,17 @@ class Mpileup2cns(val root: Configurable) extends Varscan { ...@@ -47,22 +47,17 @@ class Mpileup2cns(val root: Configurable) extends Varscan {
variants.foreach { case v => require(validValues.contains(v), "variants value must be either 0 or 1") } variants.foreach { case v => require(validValues.contains(v), "variants value must be either 0 or 1") }
} }
override def cmdLine = { override def cmdLine = super.cmdLine + required("mpileup2cns") +
val baseCommand = super.cmdLine + required("mpileup2cns") + required(input) +
required("", input) + optional("--min-coverage", minCoverage) +
required("--min-coverage", minCoverage) + optional("--min-reads2", minReads2) +
required("--min-reads2", minReads2) + optional("--min-avg-qual", minAvgQual) +
required("--min-avg-qual", minAvgQual) + optional("--min-var-freq", minVarFreq) +
required("--min-var-freq", minVarFreq) + optional("--min-freq-for-hom", minFreqForHom) +
required("--min-freq-for-hom", minFreqForHom) + optional("--p-value", pValue) +
required("--p-value", pValue) + optional("--strand-filter", strandFilter) +
required("--strand-filter", strandFilter) + optional("--output-vcf", outputVcf) +
required("--output-vcf", outputVcf) + optional("--vcf-sample-list", vcfSampleList) +
required("--vcf-sample-list", vcfSampleList) + optional("--variants", variants) +
required("--variants", variants) (if (outputAsStsout) "" else " > " + required(output))
if (output.isDefined) baseCommand + " > " + required(output)
else baseCommand
}
} }
...@@ -21,7 +21,7 @@ import nl.lumc.sasc.biopet.core.{ Reference, BiopetCommandLineFunction } ...@@ -21,7 +21,7 @@ import nl.lumc.sasc.biopet.core.{ Reference, BiopetCommandLineFunction }
import nl.lumc.sasc.biopet.core.extensions.PythonCommandLineFunction import nl.lumc.sasc.biopet.core.extensions.PythonCommandLineFunction
import nl.lumc.sasc.biopet.utils.config.Configurable import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.extensions.samtools.SamtoolsMpileup import nl.lumc.sasc.biopet.extensions.samtools.SamtoolsMpileup
import nl.lumc.sasc.biopet.extensions.varscan.Mpileup2cns import nl.lumc.sasc.biopet.extensions.varscan.VarscanMpileup2cns
import nl.lumc.sasc.biopet.extensions.{ Bgzip, Tabix } import nl.lumc.sasc.biopet.extensions.{ Bgzip, Tabix }
import org.broadinstitute.gatk.utils.commandline.{ Input, Output } import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
...@@ -65,7 +65,7 @@ class CustomVarScan(val root: Configurable) extends BiopetCommandLineFunction wi ...@@ -65,7 +65,7 @@ class CustomVarScan(val root: Configurable) extends BiopetCommandLineFunction wi
override def cmdLine: String = required(executable) + required("-vP") + required("""\t\t""") override def cmdLine: String = required(executable) + required("-vP") + required("""\t\t""")
} }
private val varscan = new Mpileup2cns(wrapper.root) { private val varscan = new VarscanMpileup2cns(wrapper.root) {
override def configName = wrapper.configName override def configName = wrapper.configName
strandFilter = Option(0) strandFilter = Option(0)
outputVcf = Option(1) outputVcf = Option(1)
......
...@@ -156,7 +156,12 @@ trait ShivaVariantcallingTrait extends SummaryQScript ...@@ -156,7 +156,12 @@ trait ShivaVariantcallingTrait extends SummaryQScript
} }
/** Will generate all available variantcallers */ /** Will generate all available variantcallers */
protected def callersList: List[Variantcaller] = List(new Freebayes(this), new RawVcf(this), new Bcftools(this), new BcftoolsSingleSample(this)) protected def callersList: List[Variantcaller] = List(
new Freebayes(this),
new RawVcf(this),
new Bcftools(this),
new BcftoolsSingleSample(this),
new VarscanCnsSingleSample(this))
/** Location of summary file */ /** Location of summary file */
def summaryFile = new File(outputDir, "ShivaVariantcalling.summary.json") def summaryFile = new File(outputDir, "ShivaVariantcalling.summary.json")
......
package nl.lumc.sasc.biopet.pipelines.shiva.variantcallers
import java.io.PrintWriter
import nl.lumc.sasc.biopet.extensions.gatk.CombineVariants
import nl.lumc.sasc.biopet.extensions.{ Ln, Tabix, Bgzip }
import nl.lumc.sasc.biopet.extensions.samtools.SamtoolsMpileup
import nl.lumc.sasc.biopet.extensions.varscan.VarscanMpileup2cns
import nl.lumc.sasc.biopet.utils.config.Configurable
/**
* Created by sajvanderzeeuw on 15-1-16.
*/
class VarscanCnsSingleSample(val root: Configurable) extends Variantcaller {
val name = "varscan_cns_singlesample"
protected def defaultPrio = 25
override def defaults = Map(
"samtoolsmpileup" -> Map(
"disable_baq" -> true,
"depth" -> 1000000
),
"mpileup2cns" -> Map("strand_filter" -> 0)
)
override def fixedValues = Map(
"samtoolsmpileup" -> Map("output_mapping_quality" -> true),
"mpileup2cns" -> Map("output_vcf" -> 1)
)
def biopetScript: Unit = {
val sampleVcfs = for ((sample, inputBam) <- inputBams.toList) yield {
val mpileup = new SamtoolsMpileup(this)
mpileup.input = List(inputBam)
val sampleVcf = new File(outputDir, s"${name}_$sample.vcf.gz")
val sampleFile = new File(outputDir, s"$sample.name.txt")
sampleFile.deleteOnExit()
val writer = new PrintWriter(sampleFile)
writer.println(sample)
writer.close()
val varscan = new VarscanMpileup2cns(this)
varscan.vcfSampleList = Some(sampleVcf)
add(mpileup | varscan | new Bgzip(this) > sampleVcf)
add(Tabix(this, sampleVcf))
sampleVcf
}
if (sampleVcfs.size > 1) {
val cv = new CombineVariants(this)
cv.inputFiles = sampleVcfs
cv.outputFile = outputFile
cv.setKey = "null"
cv.excludeNonVariants = true
add(cv)
} else add(Ln.apply(this, sampleVcfs.head, outputFile))
add(Tabix(this, outputFile))
}
}
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