...
 
Commits (112)
......@@ -33,6 +33,9 @@ class Bam2Wig(val parent: Configurable) extends QScript with BiopetQScript {
@Input(doc = "Input bam file", required = true)
var bamFile: File = _
@Input(required = false)
var deps: List[File] = Nil
def init(): Unit = {
inputFiles :+= new InputFile(bamFile)
}
......@@ -46,6 +49,7 @@ class Bam2Wig(val parent: Configurable) extends QScript with BiopetQScript {
bs.bamFile = bamFile
bs.chromSizesFile = bamFile.getAbsoluteFile + ".chrom.sizes"
bs.isIntermediate = true
deps.foreach(bs.deps :+= _)
add(bs)
val igvCount = new IGVToolsCount(this)
......@@ -53,6 +57,7 @@ class Bam2Wig(val parent: Configurable) extends QScript with BiopetQScript {
igvCount.genomeChromSizes = bs.chromSizesFile
igvCount.wig = Some(outputWigleFile)
igvCount.tdf = Some(outputTdfFile)
deps.foreach(igvCount.deps :+= _)
add(igvCount)
val wigToBigWig = new WigToBigWig(this)
......
......@@ -35,6 +35,9 @@ class BamToChromSizes(val parent: Configurable) extends InProcessFunction with C
@Output
var chromSizesFile: File = _
@Input(required = false)
var deps: List[File] = Nil
def run(): Unit = {
val bamReader = SamReaderFactory.makeDefault().open(bamFile)
val writer = new PrintWriter(chromSizesFile)
......
......@@ -18,7 +18,7 @@ import java.io.File
import nl.lumc.sasc.biopet.core.annotations.{AnnotationRefFlat, RibosomalRefFlat}
import nl.lumc.sasc.biopet.core.summary.SummaryQScript
import nl.lumc.sasc.biopet.core.{BiopetFifoPipe, PipelineCommand, Reference, SampleLibraryTag}
import nl.lumc.sasc.biopet.core._
import nl.lumc.sasc.biopet.extensions.bedtools.{BedtoolsCoverage, BedtoolsIntersect, BedtoolsSort}
import nl.lumc.sasc.biopet.extensions.picard._
import nl.lumc.sasc.biopet.extensions.samtools.SamtoolsFlagstat
......@@ -45,6 +45,9 @@ class BamMetrics(val parent: Configurable)
@Argument(required = false)
var paired: Boolean = true
@Input(required = false)
var deps: List[File] = Nil
override def defaults = Map("bedtoolscoverage" -> Map("sorted" -> true))
/** returns files to store in summary */
......@@ -209,6 +212,11 @@ class BamMetrics(val parent: Configurable)
}
addSummaryJobs()
functions.foreach {
case f: BiopetCommandLineFunction =>
f.deps ++= deps
case f =>
}
}
}
......
......@@ -48,6 +48,7 @@ class Basty(val parent: Configurable) extends QScript with MultiSampleQScript {
val executeGubbins: Boolean = config("execute_gubbins", default = true)
override def defaults = Map(
"sample_ploidy" -> 1,
"ploidy" -> 1,
"variantcallers" -> variantcallers
)
......
......@@ -36,6 +36,7 @@ trait BiopetJavaCommandLineFunction
optional("-Dscala.concurrent.context.maxThreads=", threads, spaceSeparated = false)
override def beforeGraph(): Unit = {
super.beforeGraph()
setResources()
if (javaMemoryLimit.isEmpty && memoryLimit.isDefined)
javaMemoryLimit = memoryLimit
......@@ -58,7 +59,7 @@ trait BiopetJavaCommandLineFunction
if (!BiopetCommandLineFunction.executableCache.contains(executable))
preProcessExecutable()
if (!Version.versionCache.contains(javaVersionCommand))
Version.getVersionInternal(javaVersionCommand, """java version "(.*)"""".r) match {
Version.getVersionInternal(javaVersionCommand, """java version "(.*)"""".r :: Nil) match {
case Some(version) => Version.versionCache += javaVersionCommand -> version
case _ =>
}
......
......@@ -97,6 +97,24 @@ trait BiopetQScript extends Configurable with GatkLogging { qscript: QScript =>
}
}
if (writeHtmlReport) {
logger.info("Adding report")
this match {
case q: MultiSampleQScript
if q.onlySamples.nonEmpty && !q.samples.forall(x => q.onlySamples.contains(x._1)) =>
logger.info("Write report is skipped because sample flag is used")
case _ =>
reportClass.foreach { report =>
for (f <- functions) f match {
case w: WriteSummary => report.deps :+= w.jobOutputFile
case _ =>
}
report.jobOutputFile = new File(report.outputDir, ".report.out")
add(report)
}
}
}
logger.info("Running pre commands")
var count = 0
val totalCount = functions.size
......@@ -146,24 +164,6 @@ trait BiopetQScript extends Configurable with GatkLogging { qscript: QScript =>
}
})
if (writeHtmlReport) {
logger.info("Adding report")
this match {
case q: MultiSampleQScript
if q.onlySamples.nonEmpty && !q.samples.forall(x => q.onlySamples.contains(x._1)) =>
logger.info("Write report is skipped because sample flag is used")
case _ =>
reportClass.foreach { report =>
for (f <- functions) f match {
case w: WriteSummary => report.deps :+= w.jobOutputFile
case _ =>
}
report.jobOutputFile = new File(report.outputDir, ".report.out")
add(report)
}
}
}
if (!skipWriteDependencies)
WriteDependencies.writeDependencies(functions, new File(logDir, "graph"))
else logger.debug("Write dependencies is skipped")
......
......@@ -25,7 +25,7 @@ trait ToolCommandFunction extends BiopetJavaCommandLineFunction with Version {
def toolObject: Object
def versionCommand = ""
def versionRegex: Regex = "".r
def versionRegex: List[Regex] = Nil
override def getVersion = Some("Biopet " + FullVersion)
......
......@@ -32,7 +32,7 @@ trait Version extends QFunction {
def versionCommand: String
/** Regex to get version from version command output */
def versionRegex: Regex
def versionRegex: List[Regex]
/** Allowed exit codes for the version command */
protected[core] def versionExitcode = List(0)
......@@ -64,7 +64,7 @@ object Version extends Logging {
/** Executes the version command */
private[core] def getVersionInternal(versionCommand: String,
versionRegex: Regex,
versionRegex: List[Regex],
versionExitcode: List[Int] = List(0)): Option[String] = {
if (versionCache.contains(versionCommand)) versionCache.get(versionCommand)
else if (versionCommand == null || versionRegex == null) None
......@@ -83,10 +83,14 @@ object Version extends Logging {
return None
}
for (line <- stdout.toString.split("\n") ++ stderr.toString.split("\n")) {
line match {
case versionRegex(m) => return Some(m)
case _ =>
}
val versons = versionRegex
.flatMap(r =>
line match {
case r(v) => Some(v)
case _ => None
})
.headOption
.foreach(x => return Some(x))
}
logger.warn(
"getVersion give a exit code " + process.exitValue + " but no version was found, executable correct? \n" + outputLog)
......
......@@ -113,6 +113,10 @@ object WriteDependencies extends Logging with Configurable {
val jobs = functionNames.par
.map {
case (f, name) =>
val configPath = f match {
case c: Configurable => c.configPath
case _ => Nil
}
name.toString -> Map(
"command" -> (f match {
case cmd: CommandLineFunction => cmd.commandLine
......@@ -146,7 +150,8 @@ object WriteDependencies extends Logging with Configurable {
"fail_files" -> BiopetQScript.safeFailFiles(f).getOrElse(Seq()).toList,
"stdout_file" -> f.jobOutputFile,
"done_at_start" -> BiopetQScript.safeIsDone(f),
"fail_at_start" -> BiopetQScript.safeIsFail(f)
"fail_at_start" -> BiopetQScript.safeIsFail(f),
"config_path" -> configPath
)
}
.toIterator
......
......@@ -17,6 +17,7 @@ package nl.lumc.sasc.biopet.core.extensions
import java.io.File
import nl.lumc.sasc.biopet.core.summary.WriteSummary
import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.queue.function.InProcessFunction
import org.broadinstitute.gatk.utils.commandline.{Argument, Input}
......@@ -25,7 +26,7 @@ import org.broadinstitute.gatk.utils.commandline.{Argument, Input}
*
* Created by pjvanthof on 16/08/15.
*/
class CheckChecksum extends InProcessFunction {
class CheckChecksum(val parent: Configurable) extends InProcessFunction with Configurable {
@Input(required = true)
var inputFile: File = _
......
......@@ -34,7 +34,7 @@ class Md5sum(val parent: Configurable) extends BiopetCommandLineFunction with Ve
executable = config("exe", default = "md5sum")
def versionRegex: Regex = """md5sum \(GNU coreutils\) (.*)""".r
def versionRegex: List[Regex] = """md5sum \(GNU coreutils\) (.*)""".r :: Nil
def versionCommand: String = executable + " --version"
/** return commandline to execute */
......
......@@ -142,7 +142,7 @@ trait SummaryQScript extends BiopetQScript { qscript: QScript =>
val writeSummary = new WriteSummary(this)
def addChecksum(file: File): Unit = {
if (writeSummary.md5sum) {
if (writeSummary.md5sum || inputFiles.find(_.file == file).flatMap(_.md5).isDefined) {
if (!SummaryQScript.md5sumCache.contains(file)) {
val md5sum = new Md5sum(this) {
override def configNamespace = "md5sum"
......@@ -208,7 +208,7 @@ trait SummaryQScript extends BiopetQScript { qscript: QScript =>
inputFile.md5 match {
case Some(checksum) =>
if (!SummaryQScript.checkChecksumCache.contains(inputFile.file)) {
val checkMd5 = new CheckChecksum
val checkMd5 = new CheckChecksum(this)
checkMd5.inputFile = inputFile.file
if (!SummaryQScript.md5sumCache.contains(inputFile.file))
addChecksum(inputFile.file)
......
......@@ -45,8 +45,7 @@ class WriteSummary(val parent: SummaryQScript) extends InProcessFunction with Co
@Input(doc = "deps", required = false)
var deps: List[File] = Nil
var md5sum: Boolean = config("summary_md5", default = true)
//TODO: add more checksums types
var md5sum: Boolean = config("summary_md5", default = false)
override def freezeFieldValues(): Unit = {
init()
......
......@@ -31,7 +31,7 @@ class ToolCommandTest extends TestNGSuite with Matchers {
}
tool.versionCommand shouldBe empty
tool.versionRegex.toString() shouldBe empty
tool.versionRegex shouldBe empty
tool.getVersion shouldBe Some("Biopet " + FullVersion)
tool.beforeGraph()
......
......@@ -123,10 +123,11 @@ class SummaryQScriptTest extends TestNGSuite with Matchers {
object SummaryQScriptTest {
def makeQscript(settings: Map[String, Any] = Map(),
files: Map[String, File] = Map(),
c: Map[String, Any] = Map()) =
c: Map[String, Any] = Map(),
md5: Boolean = true) =
new SummaryQScript with QScript {
outputDir = new File(".")
override def globalConfig = new Config(c)
override def globalConfig = new Config(c + ("summary_md5" -> md5))
def summarySettings: Map[String, Any] = settings
def summaryFiles: Map[String, File] = files
val tempFile: File = File.createTempFile("summary", ".json")
......
......@@ -358,13 +358,14 @@ object WriteSummaryTest {
def makeMultisampleQscript(name: String,
c: Map[String, Any],
md5: Boolean = true,
settings: Map[String, Any] = Map(),
files: Map[String, File] = Map(),
dir: File) =
new MultiSampleQScript with QScript {
summaryName = "test"
outputDir = dir
override def globalConfig = new Config(c + ("exe" -> "test"))
override def globalConfig = new Config(c + ("exe" -> "test") + ("summary_md5" -> md5))
def summarySettings: Map[String, Any] = settings
def summaryFiles: Map[String, File] = files
val tempFile: File = File.createTempFile("summary", ".json")
......@@ -412,7 +413,7 @@ object WriteSummaryTest {
def summaryFiles: Map[String, File] = files
def versionCommand: String = "echo test version"
def versionRegex: Regex = """(.*)""".r
def versionRegex: List[Regex] = """(.*)""".r :: Nil
override def getVersion = Some("test version")
override def outputs = Seq()
......@@ -438,7 +439,7 @@ object WriteSummaryTest {
def summaryStats: Any = stats
def versionCommand: String = "echo test version"
def versionRegex: Regex = """(.*)""".r
def versionRegex: List[Regex] = """(.*)""".r :: Nil
override def getVersion = Some("test version")
def commandLine: String = ""
......
......@@ -30,7 +30,7 @@ class Awk(val parent: Configurable) extends BiopetCommandLineFunction with Versi
def versionCommand: String = executable + " --version"
def versionRegex: Regex = """(GNU Awk \d+\.\d+\.\d+)""".r
def versionRegex: List[Regex] = """(GNU Awk \d+\.\d+\.\d+)""".r :: Nil
@Input(required = false)
var input: File = _
......
......@@ -40,7 +40,7 @@ class Cnmops(val parent: Configurable) extends RscriptCommandLineFunction with V
val v = super.cmdLine + "--version"
v.trim.replace("'", "")
}
def versionRegex: Regex = "(\\d+\\.\\d+\\.\\d+)".r
def versionRegex: List[Regex] = "(\\d+\\.\\d+\\.\\d+)".r :: Nil
/**
* Check whether version of cn mops is at least 1.18.0
......
......@@ -189,7 +189,7 @@ class Cufflinks(val parent: Configurable) extends BiopetCommandLineFunction with
/** do not contact server to check for update availability [FALSE] */
var noUpdateCheck: Boolean = config("no_update_check", default = false)
def versionRegex: Regex = """cufflinks v(.*)""".r
def versionRegex: List[Regex] = """cufflinks v(.*)""".r :: Nil
def versionCommand: String = executable
override def versionExitcode = List(0, 1)
......
......@@ -120,7 +120,7 @@ class Cuffquant(val parent: Configurable) extends BiopetCommandLineFunction with
/** Disable SCV correction */
var noScvCorrection: Boolean = config("no_scv_correction", default = false)
def versionRegex: Regex = """cuffquant v(.*)""".r
def versionRegex: List[Regex] = """cuffquant v(.*)""".r :: Nil
def versionCommand: String = executable
override def versionExitcode = List(0, 1)
......
......@@ -33,7 +33,7 @@ class Curl(val parent: Configurable) extends BiopetCommandLineFunction with Vers
executable = config("exe", default = "curl")
def versionCommand: String = executable + " --version"
def versionRegex: Regex = """curl (\w+\.\w+\.\w+) .*""".r
def versionRegex: List[Regex] = """curl (\w+\.\w+\.\w+) .*""".r :: Nil
def cmdLine: String =
required(executable) + required(url) + (if (outputAsStdout) "" else " > " + required(output))
......
......@@ -45,7 +45,7 @@ class Cutadapt(val parent: Configurable)
executable = config("exe", default = "cutadapt")
def versionCommand: String = executable + " --version"
def versionRegex: Regex = """(.*)""".r
def versionRegex: List[Regex] = """(.*)""".r :: Nil
/** Name of the key containing clipped adapters information in the summary stats. */
def adaptersStatsName = "adapters"
......
......@@ -49,7 +49,7 @@ class Fastqc(val parent: Configurable) extends BiopetCommandLineFunction with Ve
var nogroup: Boolean = config("nogroup", default = false)
var extract: Boolean = config("extract", default = true)
def versionRegex: Regex = """FastQC (.*)""".r
def versionRegex: List[Regex] = """FastQC (.*)""".r :: Nil
def versionCommand: String = executable + " --version"
override def defaultThreads = 4
......
......@@ -32,7 +32,7 @@ class Flash(val parent: Configurable) extends BiopetCommandLineFunction with Ver
def versionCommand: String = executable + " --version"
/** Regex to get version from version command output */
def versionRegex: Regex = """FLASH (v.*)""".r
def versionRegex: List[Regex] = """FLASH (v.*)""".r :: Nil
@Input(required = true)
var fastqR1: File = _
......
......@@ -131,7 +131,7 @@ class Freebayes(val parent: Configurable)
var haplotypeLength: Option[Int] = config("haplotype_length")
executable = config("exe", default = "freebayes")
def versionRegex: Regex = """version: (.*)""".r
def versionRegex: List[Regex] = """version: (.*)""".r :: Nil
def versionCommand: String = executable + " --version"
override def beforeGraph(): Unit = {
......
......@@ -31,7 +31,7 @@ class Gzip(val parent: Configurable) extends BiopetCommandLineFunction with Vers
executable = config("exe", default = "gzip", freeVar = false)
def versionRegex: Regex = """gzip (.*)""".r
def versionRegex: List[Regex] = """gzip (.*)""".r :: Nil
def versionCommand: String = executable + " --version"
def cmdLine: String =
......
......@@ -71,7 +71,7 @@ class HtseqCount(val parent: Configurable) extends BiopetCommandLineFunction wit
/** suppress progress report */
var quiet: Boolean = config("quiet", default = false)
def versionRegex: Regex = """.*, version (.*)\.""".r
def versionRegex: List[Regex] = """.*, version (.*)\.""".r :: Nil
def versionCommand: String = executable + " --help"
def cmdLine: String = {
......
......@@ -41,6 +41,10 @@ class Ln(val parent: Configurable) extends InProcessFunction with Configurable {
/** Generate out file for job */
override def freezeFieldValues(): Unit = {
if (output.getAbsolutePath == "/home/pjvan_thof/test/output/samples/sample2/lib_lib1/sample2-lib1.dedup.bam") {
""
}
val outLog: String = ".%s.%s.out".format(output.getName, analysisName)
jobOutputFile = new File(output.getAbsoluteFile.getParentFile, outLog)
super.freezeFieldValues()
......@@ -106,6 +110,10 @@ object Ln {
* @return
*/
def apply(root: Configurable, input: File, output: File, relative: Boolean = true): Ln = {
if (output.getAbsolutePath == "/home/pjvan_thof/test/output/samples/sample2/lib_lib1/sample2-lib1.dedup.bam") {
""
}
val ln = new Ln(root)
ln.input = input
ln.output = output
......
......@@ -31,7 +31,7 @@ class Raxml(val parent: Configurable) extends BiopetCommandLineFunction with Ver
override def defaultThreads = 1
def versionCommand: String = executable + " -v"
def versionRegex: Regex = """.*version ([\w\.]*) .*""".r
def versionRegex: List[Regex] = """.*version ([\w\.]*) .*""".r :: Nil
@Input(doc = "Input phy/fasta file", required = true)
var input: File = _
......
......@@ -32,7 +32,7 @@ class Sed(val parent: Configurable) extends BiopetCommandLineFunction with Versi
override def versionCommand: String = executable + " --version"
/** Regex to get version from version command output */
override def versionRegex: Regex = """sed (GNU sed) \d+.\d+.\d+""".r
override def versionRegex: List[Regex] = """sed (GNU sed) \d+.\d+.\d+""".r :: Nil
@Input(required = false)
var inputFile: File = _
......
......@@ -59,7 +59,7 @@ class Sickle(val parent: Configurable)
var discardN: Boolean = config("discardN", default = false)
var quiet: Boolean = config("quiet", default = false)
var defaultQualityType: String = config("defaultqualitytype", default = "sanger")
def versionRegex: Regex = """sickle version (.*)""".r
def versionRegex: List[Regex] = """sickle version (.*)""".r :: Nil
def versionCommand: String = executable + " --version"
/** Sets qualityType is still empty */
......
......@@ -115,7 +115,7 @@ class Snptest(val parent: Configurable)
executable = config("exe", default = "snptest")
def versionCommand: String = executable + " -help"
def versionRegex: Regex = "Welcome to SNPTEST (.*)".r
def versionRegex: List[Regex] = "Welcome to SNPTEST (.*)".r :: Nil
override def beforeGraph(): Unit = {
super.beforeGraph()
......
......@@ -64,7 +64,7 @@ class Stampy(val parent: Configurable)
var logfile: Option[String] = config("logfile")
executable = config("exe", default = "stampy.py", freeVar = false)
def versionRegex: Regex = """stampy v(.*) \(.*\), .*""".r
def versionRegex: List[Regex] = """stampy v(.*) \(.*\), .*""".r :: Nil
override def versionExitcode = List(0, 1)
/// Stampy uses approx factor 1.1 times the size of the genome in memory.
......
......@@ -59,7 +59,7 @@ class Star(val parent: Configurable)
executable = config("exe", "STAR")
def versionCommand: String = executable + " --version"
def versionRegex: Regex = """(.*)""".r
def versionRegex: List[Regex] = """(.*)""".r :: Nil
@Argument(doc = "Output Directory")
var outputDir: File = _
......
......@@ -60,7 +60,7 @@ class Tabix(val parent: Configurable) extends BiopetCommandLineFunction with Ver
executable = config("exe", default = "tabix", freeVar = false)
def versionCommand: String = executable
def versionRegex: Regex = """Version: (.*)""".r
def versionRegex: List[Regex] = """Version: (.*)""".r :: Nil
override def versionExitcode = List(0, 1)
/** Formats that tabix can handle */
......
......@@ -34,7 +34,7 @@ class TarExtract(val parent: Configurable) extends BiopetCommandLineFunction wit
executable = config("exe", default = "tar", freeVar = false)
def versionCommand: String = executable + " --version"
def versionRegex: Regex = """tar \(GNU tar\) (.*)""".r
def versionRegex: List[Regex] = """tar \(GNU tar\) (.*)""".r :: Nil
override def beforeGraph(): Unit = {
super.beforeGraph()
......
......@@ -32,7 +32,7 @@ class Tophat(val parent: Configurable)
executable = config("exe", default = "tophat", freeVar = false)
def versionRegex: Regex = """TopHat v(.*)""".r
def versionRegex: List[Regex] = """TopHat v(.*)""".r :: Nil
override def versionExitcode = List(0, 1)
def versionCommand: String = executable + " --version"
......
......@@ -55,7 +55,8 @@ class VariantEffectPredictor(val parent: Configurable)
else super.subPath
}
def versionRegex: Regex = """version (\d*)""".r
def versionRegex: List[Regex] =
"""version (\d*)""".r :: """ *ensembl-vep *\: (.*)""".r :: Nil
def versionCommand: String = executable + " " + vepScript + " --help"
//Boolean vars
......
......@@ -34,7 +34,7 @@ class Zcat(val parent: Configurable) extends BiopetCommandLineFunction with Vers
executable = config("exe", default = "zcat")
def versionRegex: Regex = """zcat \(gzip\) (.*)""".r
def versionRegex: List[Regex] = """zcat \(gzip\) (.*)""".r :: Nil
def versionCommand: String = executable + " --version"
/** Returns command to execute */
......
......@@ -22,6 +22,6 @@ abstract class Bcftools extends BiopetCommandLineFunction with Version {
override def subPath: List[String] = "bcftools" :: super.subPath
executable = config("exe", default = "bcftools", namespace = "bcftools", freeVar = false)
def versionCommand: String = executable
def versionRegex: Regex = """Version: (.*)""".r
def versionRegex: List[Regex] = """Version: (.*)""".r :: Nil
override def versionExitcode = List(0, 1)
}
......@@ -136,7 +136,7 @@ class BcftoolsView(val parent: Configurable) extends Bcftools {
)
}
def baseCmd: String = {
def cmdLine: String = {
executable +
required("view") +
conditional(dropGenotype, "-G") +
......@@ -170,19 +170,9 @@ class BcftoolsView(val parent: Configurable) extends Bcftools {
optional("-v", types) +
optional("-V", excludeTypes) +
conditional(onlyPrivate, "-x") +
conditional(excludePrivate, "-X")
}
def cmdPipeInput: String = {
baseCmd + "-"
}
def cmdPipe: String = {
baseCmd + required(input)
}
def cmdLine: String = {
baseCmd + required("-o", output) + required(input)
conditional(excludePrivate, "-X") +
(if (outputAsStdout) "" else required("-o", output)) +
(if (inputAsStdin) "-" else required(input))
}
/**
......
......@@ -23,5 +23,5 @@ abstract class Bedtools extends BiopetCommandLineFunction with Version {
override def subPath: List[String] = "bedtools" :: super.subPath
executable = config("exe", default = "bedtools", namespace = "bedtools")
def versionCommand: String = executable + " --version"
def versionRegex: Regex = """bedtools (.*)""".r
def versionRegex: List[Regex] = """bedtools (.*)""".r :: Nil
}
......@@ -42,7 +42,7 @@ class Bowtie(val parent: Configurable)
var output: File = _
executable = config("exe", default = "bowtie", freeVar = false)
def versionRegex: Regex = """.*[Vv]ersion:? (.*)""".r
def versionRegex: List[Regex] = """.*[Vv]ersion:? (.*)""".r :: Nil
override def versionExitcode = List(0, 1)
def versionCommand: String = executable + " --version"
......@@ -68,13 +68,15 @@ class Bowtie(val parent: Configurable)
val indexDir = new File(bowtieIndex).getParentFile
val basename = bowtieIndex.stripPrefix(indexDir.getPath + File.separator)
if (indexDir.exists()) {
if (indexDir.list().toList.filter(_.startsWith(basename)).exists(_.endsWith(".ebwtl")))
largeIndex = config("large-index", default = true)
else {
if (!indexDir.list().toList.filter(_.startsWith(basename)).exists(_.endsWith(".ebwt")))
Logging.addError(
s"No index files found for bowtie in: $indexDir with basename: $basename")
}
if (indexDir.canRead && indexDir.canExecute) {
if (indexDir.list().toList.filter(_.startsWith(basename)).exists(_.endsWith(".ebwtl")))
largeIndex = config("large-index", default = true)
else {
if (!indexDir.list().toList.filter(_.startsWith(basename)).exists(_.endsWith(".ebwt")))
Logging.addError(
s"No index files found for bowtie in: $indexDir with basename: $basename")
}
} else Logging.addError(s"Index dir of bowtie is not readable: $indexDir")
}
if (R2.nonEmpty && maxins.isEmpty) {
logger.warn(
......
......@@ -42,7 +42,7 @@ class Bowtie2(val parent: Configurable)
var output: File = _
executable = config("exe", default = "bowtie2", freeVar = false)
def versionRegex: Regex = """.*[Vv]ersion:? (.*)""".r
def versionRegex: List[Regex] = """.*[Vv]ersion:? (.*)""".r :: Nil
override def versionExitcode = List(0, 1)
def versionCommand: String = executable + " --version"
......@@ -154,15 +154,17 @@ class Bowtie2(val parent: Configurable)
val indexDir = new File(bowtieIndex).getParentFile
val basename = bowtieIndex.stripPrefix(indexDir.getPath + File.separator)
if (indexDir.exists()) {
if (!indexDir
.list()
.toList
.filter(_.startsWith(basename))
.exists({ p =>
p.endsWith(".bt2") || p.endsWith(".bt2l")
}))
Logging.addError(
s"No index files found for bowtie2 in: $indexDir with basename: $basename")
if (indexDir.canRead && indexDir.canExecute) {
if (!indexDir
.list()
.toList
.filter(_.startsWith(basename))
.exists({ p =>
p.endsWith(".bt2") || p.endsWith(".bt2l")
}))
Logging.addError(
s"No index files found for bowtie2 in: $indexDir with basename: $basename")
} else Logging.addError(s"Index dir of bowtie2 is not readable: $indexDir")
}
}
......
......@@ -33,7 +33,7 @@ class Bowtie2Build(val parent: Configurable) extends BiopetCommandLineFunction w
var baseName: String = _
executable = config("exe", default = "bowtie2-build", freeVar = false)
def versionRegex: Regex = """.*[Vv]ersion:? (\d*\.\d*\.\d*)""".r
def versionRegex: List[Regex] = """.*[Vv]ersion:? (\d*\.\d*\.\d*)""".r :: Nil
def versionCommand: String = executable + " --version"
override def defaultCoreMemory = 15.0
......
......@@ -33,7 +33,7 @@ class BowtieBuild(val parent: Configurable) extends BiopetCommandLineFunction wi
var baseName: String = _
executable = config("exe", default = "bowtie-build", freeVar = false)
def versionRegex: Regex = """.*[Vv]ersion:? (\d*\.\d*\.\d*)""".r
def versionRegex: List[Regex] = """.*[Vv]ersion:? (\d*\.\d*\.\d*)""".r :: Nil
def versionCommand: String = executable + " --version"
override def defaultCoreMemory = 15.0
......
......@@ -27,7 +27,7 @@ class BreakdancerCaller(val parent: Configurable) extends BiopetCommandLineFunct
override def defaultThreads = 1 // breakdancer can only work on 1 single thread
def versionRegex: Regex = """.*[Vv]ersion:? (.*)""".r
def versionRegex: List[Regex] = """.*[Vv]ersion:? (.*)""".r :: Nil
override def versionExitcode = List(1)
def versionCommand: String = executable
......
......@@ -26,7 +26,7 @@ import scala.util.matching.Regex
abstract class Bwa extends BiopetCommandLineFunction with Version {
override def subPath: List[String] = "bwa" :: super.subPath
executable = config("exe", default = "bwa")
def versionRegex: Regex = """Version: (.*)""".r
def versionRegex: List[Regex] = """Version: (.*)""".r :: Nil
override def versionExitcode = List(0, 1)
def versionCommand: String = executable
}
......@@ -79,6 +79,7 @@ class Centrifuge(val parent: Configurable)
var norc: Boolean = config("norc", default = false)
// Classification args
var k: Option[Int] = config("k")
var minHitlen: Option[Int] = config("min_hitlen")
var minTotallen: Option[Int] = config("min_totallen")
var hostTaxids: List[Int] = config("host_taxids", default = Nil)
......@@ -98,7 +99,7 @@ class Centrifuge(val parent: Configurable)
def versionCommand: String = s"$executable --version"
/** Regex to get version from version command output */
def versionRegex: Regex = ".* version (.*)".r
def versionRegex: List[Regex] = ".* version (.*)".r :: Nil
override def beforeGraph(): Unit = {
super.beforeGraph()
......@@ -129,6 +130,7 @@ class Centrifuge(val parent: Configurable)
conditional(ignoreQuals, "--ignore-quals") +
conditional(nofw, "--nofw") +
conditional(norc, "--norc") +
optional("-k", k) +
optional("--min-hitlen", minHitlen) +
optional("--min-totallen", minTotallen) +
optional("--host-taxids", if (hostTaxids.nonEmpty) Some(hostTaxids.mkString(",")) else None) +
......
......@@ -35,7 +35,7 @@ class CleverCaller(val parent: Configurable)
override def defaultCoreMemory = 3.0
def versionCommand: String = versionExecutable.getAbsolutePath
def versionRegex: Regex = """(.*)""".r
def versionRegex: List[Regex] = """(.*)""".r :: Nil
override def versionExitcode = List(0, 1)
@Input(doc = "Input file (bam)")
......
......@@ -23,7 +23,7 @@ abstract class Conifer extends PythonCommandLineFunction with Version {
override def subPath: List[String] = "conifer" :: super.subPath
// executable = config("exe", default = "conifer")
setPythonScript(config("script", default = "conifer.py", namespace = "conifer"))
def versionRegex: Regex = """(.*)""".r
def versionRegex: List[Regex] = """(.*)""".r :: Nil
override def versionExitcode = List(0)
def versionCommand: String = executable + " " + pythonScript + " --version"
......
......@@ -37,7 +37,7 @@ class DellyCallerCall(val parent: Configurable)
override def defaultCoreMemory = 4.0
def versionCommand: String = versionexecutable.getAbsolutePath
def versionRegex: Regex = """D[eE][lL][lL][yY] \(Version: (.*)\)""".r
def versionRegex: List[Regex] = """D[eE][lL][lL][yY] \(Version: (.*)\)""".r :: Nil
override def versionExitcode = List(0, 1)
@Input(doc = "Input file (bam)")
var input: File = _
......
......@@ -127,7 +127,7 @@ class FreeC(val parent: Configurable)
// Control-FREEC v8.7 : calling copy number alterations and LOH regions using deep-sequencing data
override def versionCommand: String = executable
override def versionRegex: Regex = """Control-FREEC v([0-9\.]+) : .*""".r
override def versionRegex: List[Regex] = """Control-FREEC v([0-9\.]+) : .*""".r :: Nil
override def defaultThreads = 4
override def defaultCoreMemory = 50
......
......@@ -324,7 +324,7 @@ trait CommandLineGATK extends BiopetJavaCommandLineFunction with Reference with
@Gather(classOf[org.broadinstitute.gatk.queue.function.scattergather.SimpleTextGatherFunction])
var log_to_file: File = _
def versionRegex: Regex = """(.*)""".r
def versionRegex: List[Regex] = """(.*)""".r :: Nil
override def versionExitcode = List(0, 1)
def versionCommand: String = executable + " -jar " + jarFile + " -version"
......
......@@ -46,7 +46,7 @@ class GmapBuild(val parent: Configurable)
override def defaultCoreMemory = 25.0
def versionRegex: Regex = """.* version (.*)""".r
def versionRegex: List[Regex] = """.* version (.*)""".r :: Nil
def versionCommand: String = executable
override def versionExitcode = List(0, 1, 255)
......
......@@ -332,7 +332,7 @@ class Gsnap(val parent: Configurable)
/** value to put into read-group library (rg-pl) field */
var readGroupPlatform: Option[String] = config("read_group_platform")
def versionRegex: Regex = """.* version (.*)""".r
def versionRegex: List[Regex] = """.* version (.*)""".r :: Nil
def versionCommand: String = executable + " --version"
override def beforeGraph(): Unit = {
......
......@@ -45,7 +45,7 @@ class Hisat2(val parent: Configurable)
var output: File = _
executable = config("exe", default = "hisat2", freeVar = false)
def versionRegex: Regex = """.*hisat2-align-s version (.*)""".r
def versionRegex: List[Regex] = """.*hisat2-align-s version (.*)""".r :: Nil
override def versionExitcode = List(0, 1)
def versionCommand: String = executable + " --version"
......
......@@ -45,7 +45,7 @@ class Hisat2Build(val parent: Configurable) extends BiopetCommandLineFunction wi
var exon: Option[File] = config("exon")
executable = config("exe", default = "hisat2-build", freeVar = false)
def versionRegex: Regex = """.*hisat.*version (.*)""".r
def versionRegex: List[Regex] = """.*hisat.*version (.*)""".r :: Nil
def versionCommand: String = executable + " --version"
var bmax: Option[Int] = config("bmax")
......
......@@ -27,6 +27,6 @@ abstract class IGVTools extends BiopetJavaCommandLineFunction with Version {
jarFile = config("igvtools_jar", namespace = "igvtools")
def versionCommand: String = executable + s" -jar ${jarFile.getAbsolutePath} version"
def versionRegex: Regex = """IGV Version:? ([\w\.]*) .*""".r
def versionRegex: List[Regex] = """IGV Version:? ([\w\.]*) .*""".r :: Nil
override def versionExitcode = List(0)
}
......@@ -47,7 +47,7 @@ class Kraken(val parent: Configurable) extends BiopetCommandLineFunction with Ve
executable = config("exe", default = "kraken")
def versionRegex: Regex = """^Kraken version ([\d\w\-\.]+)""".r
def versionRegex: List[Regex] = """^Kraken version ([\d\w\-\.]+)""".r :: Nil
override def versionExitcode = List(0, 1)
......
......@@ -26,7 +26,7 @@ import scala.util.matching.Regex
class KrakenReport(val parent: Configurable) extends BiopetCommandLineFunction with Version {
executable = config("exe", default = "kraken-report")
def versionRegex: Regex = """Kraken version (.*)""".r
def versionRegex: List[Regex] = """Kraken version (.*)""".r :: Nil
override def versionExitcode = List(0, 1)
override def defaultCoreMemory = 4.0
......
......@@ -26,6 +26,6 @@ import scala.util.matching.Regex
abstract class Macs2 extends BiopetCommandLineFunction with Version {
executable = config("exe", default = "macs2", namespace = "macs2", freeVar = false)
def versionCommand: String = executable + " --version"
def versionRegex: Regex = """macs2 (.*)""".r
def versionRegex: List[Regex] = """macs2 (.*)""".r :: Nil
override def versionExitcode = List(0, 1)
}
/**
* 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 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.picard
import java.io.File
import nl.lumc.sasc.biopet.core.Reference
import nl.lumc.sasc.biopet.utils.VcfUtils
import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{Input, Output}
class MergeVcfs(val parent: Configurable) extends Picard with Reference {
@Input(doc = "The input SAM or BAM files to analyze.", required = true)
var input: Seq[File] = Nil
@Input(doc = "Dict file.", required = false)
var dict: File = _
@Output(doc = "The output file to bam file to", required = true)
var output: File = _
@Output(required = false)
private var index: File = _
override def dictRequired = true
override def beforeGraph(): Unit = {
super.beforeGraph()
if (createIndex) index = VcfUtils.getVcfIndexFile(output)
if (dict == null) dict = referenceDictFile
}
override def cmdLine: String =
super.cmdLine +
repeat("INPUT=", input, spaceSeparated = false) +
required("OUTPUT=", output, spaceSeparated = false) +
optional("SEQUENCE_DICTIONARY=", dict, spaceSeparated = false)
}
......@@ -63,7 +63,7 @@ abstract class Picard extends BiopetJavaCommandLineFunction with Version {
executable + " -cp " + jarFile + " " + javaMainClass + s" $picardToolName -h"
else null
}
def versionRegex: Regex = """Version: (.*)""".r
def versionRegex: List[Regex] = """Version: (.*)""".r :: Nil
override def versionExitcode = List(0, 1)
override def defaultCoreMemory = 4.0
......
......@@ -37,7 +37,7 @@ class PindelCaller(val parent: Configurable)
override def defaultCoreMemory = 4.0
override def defaultThreads = 4
def versionRegex: Regex = """Pindel version:? (.*)""".r
def versionRegex: List[Regex] = """Pindel version:? (.*)""".r :: Nil
override def versionExitcode = List(1)
def versionCommand: String = executable
......
......@@ -34,7 +34,7 @@ class PindelVCF(val parent: Configurable)
override def defaultCoreMemory = 2.0
override def defaultThreads = 1
def versionRegex: Regex = """Version:?[ ]+(.*)""".r
def versionRegex: List[Regex] = """Version:?[ ]+(.*)""".r :: Nil
override def versionExitcode = List(0)
def versionCommand: String = executable + " -h"
......
......@@ -67,7 +67,7 @@ class AssignTaxonomy(val parent: Configurable) extends BiopetCommandLineFunction
var outputDir: File = _
def versionCommand: String = executable + " --version"
def versionRegex: Regex = """Version: (.*)""".r
def versionRegex: List[Regex] = """Version: (.*)""".r :: Nil
override def defaultCoreMemory = 4.0
override def beforeGraph(): Unit = {
......
......@@ -29,7 +29,7 @@ class MergeOtuMaps(val parent: Configurable) extends BiopetCommandLineFunction w
executable = config("exe", default = "merge_otu_maps.py")
def versionCommand: String = executable + " --version"
def versionRegex: Regex = """Version: (.*)""".r
def versionRegex: List[Regex] = """Version: (.*)""".r :: Nil
@Input(required = true)
var input: List[File] = Nil
......
......@@ -29,7 +29,7 @@ class MergeOtuTables(val parent: Configurable) extends BiopetCommandLineFunction
executable = config("exe", default = "merge_otu_tables.py")
def versionCommand: String = executable + " --version"
def versionRegex: Regex = """Version: (.*)""".r
def versionRegex: List[Regex] = """Version: (.*)""".r :: Nil
@Input(required = true)
var input: List[File] = Nil
......
......@@ -38,7 +38,7 @@ class PickClosedReferenceOtus(val parent: Configurable)
override def defaultThreads = 1
override def defaultCoreMemory = 20.0
def versionCommand: String = executable + " --version"
def versionRegex: Regex = """Version: (.*)""".r
def versionRegex: List[Regex] = """Version: (.*)""".r :: Nil
@Input(required = false)
var parameterFp: Option[File] = config("parameter_fp")
......
......@@ -38,7 +38,7 @@ class PickOpenReferenceOtus(val parent: Configurable)
override def defaultThreads = 1
override def defaultCoreMemory = 20.0
def versionCommand: String = executable + " --version"
def versionRegex: Regex = """Version: (.*)""".r
def versionRegex: List[Regex] = """Version: (.*)""".r :: Nil
@Input(required = false)
var parameterFp: Option[File] = config("parameter_fp")
......
......@@ -36,7 +36,7 @@ class PickOtus(val parent: Configurable) extends BiopetCommandLineFunction with
override def defaultThreads = 2
override def defaultCoreMemory = 5.0
def versionCommand: String = executable + " --version"
def versionRegex: Regex = """Version: (.*)""".r
def versionRegex: List[Regex] = """Version: (.*)""".r :: Nil
var otuPickingMethod: Option[String] = config("otu_picking_method")
var clusteringAlgorithm: Option[String] = config("clustering_algorithm")
......
......@@ -46,7 +46,7 @@ class PickRepSet(val parent: Configurable) extends BiopetCommandLineFunction wit
var sortBy: Option[String] = config("sort_by")
def versionCommand: String = executable + " --version"
def versionRegex: Regex = """Version: (.*)""".r
def versionRegex: List[Regex] = """Version: (.*)""".r :: Nil
var repSetPickingMethod: Option[String] = config("rep_set_picking_method")
......
......@@ -31,7 +31,7 @@ class SplitLibrariesFastq(val parent: Configurable)
executable = config("exe", default = "split_libraries_fastq.py")
def versionCommand: String = executable + " --version"
def versionRegex: Regex = """Version: (.*)""".r
def versionRegex: List[Regex] = """Version: (.*)""".r :: Nil
@Input
var input: List[File] = Nil
......
......@@ -27,6 +27,6 @@ abstract class Sambamba extends BiopetCommandLineFunction with Version {
executable = config("exe", default = "sambamba", namespace = "sambamba", freeVar = false)
def versionCommand: String = executable
def versionRegex: Regex = """sambamba v?(.*)""".r
def versionRegex: List[Regex] = """sambamba v?(.*)""".r :: Nil
override def versionExitcode = List(0, 1)
}
......@@ -23,6 +23,6 @@ abstract class Samtools extends BiopetCommandLineFunction with Version {
override def subPath: List[String] = "samtools" :: super.subPath
executable = config("exe", default = "samtools", namespace = "samtools", freeVar = false)
def versionCommand: String = executable
def versionRegex: Regex = """Version: (.*)""".r
def versionRegex: List[Regex] = """Version: (.*)""".r :: Nil
override def versionExitcode = List(0, 1)
}
......@@ -23,6 +23,6 @@ abstract class Seqtk extends BiopetCommandLineFunction with Version {
override def subPath: List[String] = "seqtk" :: super.subPath
executable = config("exe", default = "seqtk", freeVar = true)
def versionCommand: String = executable
def versionRegex: Regex = """Version: (.*)""".r
def versionRegex: List[Regex] = """Version: (.*)""".r :: Nil
override def versionExitcode = List(0, 1)
}
......@@ -17,6 +17,6 @@ abstract class Stouffbed extends BiopetCommandLineFunction with Version {