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

Merge branch 'fix-278' into 'develop'

Added fix mpileup for bcftools

fixes #278 

See merge request !326
parents 0b8f1ada fdfcf218
......@@ -24,7 +24,7 @@ trait PythonCommandLineFunction extends BiopetCommandLineFunction {
@Input(doc = "Python script", required = false)
var python_script: File = _
executable = config("exe", default = "python", submodule = "python")
executable = config("exe", default = "python", submodule = "python", freeVar = false)
protected var python_script_name: String = _
......
#!/usr/bin/env python
#
# 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.
#
from __future__ import print_function
__author__="Peter van 't Hof"
import sys
import re
upacPatern = re.compile(r'[RYKMSWBDHV]')
if __name__ == "__main__":
for line in sys.stdin:
l = line.strip().split("\t")
if len(l) >= 3:
l[3] = upacPatern.sub("N", l[3])
print("\t".join(map(str, l)))
......@@ -33,7 +33,9 @@ if __name__ == "__main__":
"""
for line in sys.stdin:
l = line.strip().split("\t")
if l[3] == "0":
l[2] = upacPatern.sub("N", l[2])
if len(l) < 4 or l[3] == "0":
# no alignment to this position
print("\t".join(map(str, l)))
continue
......@@ -49,5 +51,4 @@ if __name__ == "__main__":
if new_size == 0:
l[5] = ""
l[2] = upacPatern.sub("N", l[2])
print("\t".join(map(str, l)))
package nl.lumc.sasc.biopet.extensions.samtools
import nl.lumc.sasc.biopet.core.extensions.PythonCommandLineFunction
import nl.lumc.sasc.biopet.utils.config.Configurable
/**
* Created by sajvanderzeeuw on 19-1-16.
*/
class FixMpileup(val root: Configurable) extends PythonCommandLineFunction {
setPythonScript("fix_iupac_mpileup.py", "/nl/lumc/sasc/biopet/extensions/samtools/")
def cmdLine = getPythonCommand
}
......@@ -37,6 +37,7 @@ class SamtoolsMpileup(val root: Configurable) extends Samtools with Reference {
var disableBaq: Boolean = config("disable_baq", default = false)
var u: Boolean = config("u", default = false)
var v: Boolean = config("u", default = false)
var minMapQuality: Option[Int] = config("min_map_quality")
var minBaseQuality: Option[Int] = config("min_base_quality")
var depth: Option[Int] = config("depth")
......@@ -57,6 +58,7 @@ class SamtoolsMpileup(val root: Configurable) extends Samtools with Reference {
conditional(outputMappingQuality, "-s") +
conditional(disableBaq, "-B") +
conditional(u, "-u") +
conditional(v, "-v") +
(if (outputAsStsout) "" else required("-o", output)) +
(if (inputAsStdin) "-" else repeat(input))
}
......
......@@ -2,7 +2,7 @@ package nl.lumc.sasc.biopet.pipelines.shiva.variantcallers
import nl.lumc.sasc.biopet.extensions.Tabix
import nl.lumc.sasc.biopet.extensions.bcftools.BcftoolsCall
import nl.lumc.sasc.biopet.extensions.samtools.SamtoolsMpileup
import nl.lumc.sasc.biopet.extensions.samtools.{ FixMpileup, SamtoolsMpileup }
import nl.lumc.sasc.biopet.utils.config.Configurable
/** default mode of bcftools */
......@@ -14,6 +14,7 @@ class Bcftools(val root: Configurable) extends Variantcaller {
val mp = new SamtoolsMpileup(this)
mp.input = inputBams.values.toList
mp.u = true
mp.v = true
mp.reference = referenceFasta()
val bt = new BcftoolsCall(this)
......@@ -21,7 +22,7 @@ class Bcftools(val root: Configurable) extends Variantcaller {
bt.v = true
bt.c = true
add(mp | bt > outputFile)
add(mp | new FixMpileup(this) | bt > outputFile)
add(Tabix(this, outputFile))
}
}
package nl.lumc.sasc.biopet.pipelines.shiva.variantcallers
import java.io.File
import nl.lumc.sasc.biopet.extensions.{ Ln, Tabix }
import nl.lumc.sasc.biopet.extensions.bcftools.{ BcftoolsMerge, BcftoolsCall }
import nl.lumc.sasc.biopet.extensions.samtools.SamtoolsMpileup
import nl.lumc.sasc.biopet.extensions.samtools.{ FixMpileup, SamtoolsMpileup }
import nl.lumc.sasc.biopet.utils.config.Configurable
/** default mode of bcftools */
......@@ -17,6 +15,7 @@ class BcftoolsSingleSample(val root: Configurable) extends Variantcaller {
val mp = new SamtoolsMpileup(this)
mp.input :+= inputBam
mp.u = true
mp.v = true
mp.reference = referenceFasta()
val bt = new BcftoolsCall(this)
......@@ -25,7 +24,7 @@ class BcftoolsSingleSample(val root: Configurable) extends Variantcaller {
bt.c = true
bt.output = new File(outputDir, sample + ".vcf.gz")
add(mp | bt)
add(mp | new FixMpileup(this) | bt)
add(Tabix(this, bt.output))
bt.output
}
......
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