Commit a3af8046 authored by Peter van 't Hof's avatar Peter van 't Hof

Fix code style warnings

parent fd956f72
......@@ -5,7 +5,7 @@ import java.io.{ File, PrintWriter }
import nl.lumc.sasc.biopet.core.config.Configurable
import nl.lumc.sasc.biopet.core.report.{ ReportBuilderExtension, ReportBuilder, ReportPage, ReportSection }
import nl.lumc.sasc.biopet.core.summary.{ Summary, SummaryValue }
import nl.lumc.sasc.biopet.extensions.rscript.{ StackedBarPlot, XYPlot }
import nl.lumc.sasc.biopet.extensions.rscript.{ StackedBarPlot, LinePlot }
class BammetricsReport(val root: Configurable) extends ReportBuilderExtension {
val builder = BammetricsReport
......@@ -204,7 +204,7 @@ object BammetricsReport extends ReportBuilder {
tsvWriter.close()
val plot = new XYPlot(null)
val plot = new LinePlot(null)
plot.input = tsvFile
plot.output = pngFile
plot.ylabel = Some("Reads")
......@@ -292,7 +292,7 @@ object BammetricsReport extends ReportBuilder {
tsvWriter.close()
val plot = new XYPlot(null)
val plot = new LinePlot(null)
plot.input = tsvFile
plot.output = pngFile
plot.ylabel = Some("Bases")
......
......@@ -59,8 +59,8 @@ class Bowtie(val root: Configurable) extends BiopetCommandLineFunction with Refe
var maqerr: Option[Int] = config("maqerr")
var maxins: Option[Int] = config("maxins")
override def beforeGraph {
super.beforeGraph
override def beforeGraph() {
super.beforeGraph()
if (reference == null) reference = referenceFasta()
}
......@@ -81,10 +81,9 @@ class Bowtie(val root: Configurable) extends BiopetCommandLineFunction with Refe
optional("--maxins", maxins) +
required(reference) +
(R2 match {
case Some(r2) => {
case Some(r2) =>
required("-1", R1) +
optional("-2", r2)
}
case _ => required(R1)
}) +
" > " + required(output)
......
......@@ -52,6 +52,6 @@ object Cat {
val cat = new Cat(root)
cat.input = input
cat.output = output
return cat
cat
}
}
\ No newline at end of file
......@@ -76,7 +76,7 @@ class Cutadapt(val root: Configurable) extends BiopetCommandLineFunction with Su
val stats: mutable.Map[String, Int] = mutable.Map("trimmed" -> 0, "tooshort" -> 0, "toolong" -> 0)
val adapter_stats: mutable.Map[String, Int] = mutable.Map()
if (stats_output.exists) for (line <- Source.fromFile(stats_output).getLines) {
if (stats_output.exists) for (line <- Source.fromFile(stats_output).getLines()) {
line match {
case trimR(m) => stats += ("trimmed" -> m.toInt)
case tooShortR(m) => stats += ("tooshort" -> m.toInt)
......
......@@ -22,6 +22,8 @@ import nl.lumc.sasc.biopet.core.{ BiopetCommandLineFunction, Reference }
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
/**
* Extension for freebayes
*
* Created by pjvan_thof on 3/3/15.
*/
class Freebayes(val root: Configurable) extends BiopetCommandLineFunction with Reference {
......@@ -42,8 +44,8 @@ class Freebayes(val root: Configurable) extends BiopetCommandLineFunction with R
override val versionRegex = """version: (.*)""".r
override def versionCommand = executable + " --version"
override def beforeGraph: Unit = {
super.beforeGraph
override def beforeGraph(): Unit = {
super.beforeGraph()
reference = referenceFasta()
}
......
......@@ -41,6 +41,6 @@ object Gzip {
val gzip = new Gzip(root)
gzip.input = input
gzip.output = output
return gzip
gzip
}
}
\ No newline at end of file
......@@ -51,11 +51,11 @@ class Ln(val root: Configurable) extends InProcessFunction with Configurable {
lazy val cmd: String = {
lazy val inCanonical: String = {
// need to remove "/~" to correctly expand path with tilde
input.getCanonicalPath().replace("/~", "")
input.getCanonicalPath.replace("/~", "")
}
lazy val outCanonical: String = {
output.getCanonicalPath().replace("/~", "")
output.getCanonicalPath.replace("/~", "")
}
lazy val inToks: Array[String] = {
......@@ -68,8 +68,8 @@ class Ln(val root: Configurable) extends InProcessFunction with Configurable {
lazy val commonPrefixLength: Int = {
val maxLength = scala.math.min(inToks.length, outToks.length)
var i: Int = 0;
while (i < maxLength && inToks(i) == outToks(i)) i += 1;
var i: Int = 0
while (i < maxLength && inToks(i) == outToks(i)) i += 1
i
}
......@@ -108,11 +108,11 @@ class Ln(val root: Configurable) extends InProcessFunction with Configurable {
}
}
override def run {
override def run() {
val stdout = new StringBuffer()
val stderr = new StringBuffer()
val process = Process(cmd).run(ProcessLogger(stdout append _ + "\n", stderr append _ + "\n"))
val exitcode = process.exitValue
val exitcode = process.exitValue()
if (exitcode != 0) {
throw new Exception("Error creating symbolic link, this was the original message: \n" + stderr)
}
......@@ -136,6 +136,6 @@ object Ln {
ln.input = input
ln.output = output
ln.relative = relative
return ln
ln
}
}
......@@ -45,7 +45,7 @@ object Md5sum {
val md5sum = new Md5sum(root)
md5sum.input = fastqfile
md5sum.output = new File(outDir, fastqfile.getName + ".md5")
return md5sum
md5sum
}
/** Makes md5sum with md5 file in same dir as input file */
......@@ -53,6 +53,6 @@ object Md5sum {
val md5sum = new Md5sum(root)
md5sum.input = file
md5sum.output = new File(file.getParentFile, file.getName + ".md5")
return md5sum
md5sum
}
}
......@@ -37,8 +37,8 @@ class Pbzip2(val root: Configurable) extends BiopetCommandLineFunction {
override val defaultCoreMemory = memory.getOrElse(1000).toDouble / 1000
override val defaultThreads = 2
override def beforeCmd {
if (!memory.isEmpty) memory = Option(memory.get * threads)
override def beforeCmd() {
if (memory.isDefined) memory = Option(memory.get * threads)
}
/** return commandline to execute */
......@@ -58,6 +58,6 @@ object Pbzip2 {
val pbzip2 = new Pbzip2(root)
pbzip2.input = input
pbzip2.output = output
return pbzip2
pbzip2
}
}
\ No newline at end of file
......@@ -57,7 +57,7 @@ trait PythonCommandLineFunction extends BiopetCommandLineFunction {
}
/** return basic command to prefix the complete command with */
def getPythonCommand(): String = {
def getPythonCommand: String = {
required(executable) + required(python_script)
}
}
......@@ -72,11 +72,11 @@ class Raxml(val root: Configurable) extends BiopetCommandLineFunction {
var executableThreads: Option[String] = config("exe_pthreads")
/** Sets correct output files to job */
override def beforeGraph {
override def beforeGraph() {
require(w != null)
if (threads == 0) threads = getThreads(defaultThreads)
executable = if (threads > 1 && executableThreads.isDefined) executableThreads.get else executableNonThreads
super.beforeGraph
super.beforeGraph()
out :::= List(Some(getInfoFile), getBestTreeFile, getBootstrapFile, getBipartitionsFile).flatten
f match {
case "d" if b.isEmpty => for (t <- 0 until N.getOrElse(1)) {
......
......@@ -22,6 +22,8 @@ import nl.lumc.sasc.biopet.core.BiopetCommandLineFunction
import scala.sys.process._
/**
* General rscript extension
*
* Created by wyleung on 17-2-15.
*/
trait RscriptCommandLineFunction extends BiopetCommandLineFunction {
......@@ -30,7 +32,7 @@ trait RscriptCommandLineFunction extends BiopetCommandLineFunction {
executable = config("exe", default = "Rscript", submodule = "Rscript")
override def beforeGraph: Unit = {
override def beforeGraph(): Unit = {
checkScript()
}
......
......@@ -53,8 +53,8 @@ class RunGubbins(val root: Configurable) extends BiopetCommandLineFunction {
var noCleanup: Boolean = config("no_cleanup", default = false)
/** Set correct output files */
override def beforeGraph: Unit = {
super.beforeGraph
override def beforeGraph(): Unit = {
super.beforeGraph()
require(outputDirectory != null)
jobLocalDir = outputDirectory
if (prefix.isEmpty) prefix = Some(fastafile.getName)
......
......@@ -41,6 +41,6 @@ object Sha1sum {
val sha1sum = new Sha1sum(root)
sha1sum.input = input
sha1sum.output = new File(outDir, input.getName + ".sha1")
return sha1sum
sha1sum
}
}
......@@ -62,7 +62,7 @@ class Sickle(val root: Configurable) extends BiopetCommandLineFunction with Summ
override def versionCommand = executable + " --version"
/** Sets qualityType is still empty */
override def beforeGraph {
override def beforeGraph() {
if (qualityType.isEmpty) qualityType = Some(defaultQualityType)
}
......@@ -100,22 +100,20 @@ class Sickle(val root: Configurable) extends BiopetCommandLineFunction with Summ
var stats: mutable.Map[String, Int] = mutable.Map()
if (output_stats.exists) for (line <- Source.fromFile(output_stats).getLines) {
if (output_stats.exists) for (line <- Source.fromFile(output_stats).getLines()) {
line match {
// single run
case sKept(num) => stats += ("num_reads_kept" -> num.toInt)
case sDiscarded(num) => stats += ("num_reads_discarded_total" -> num.toInt)
// paired run
case pPairKept(reads, pairs) => stats += ("num_reads_kept" -> reads.toInt)
case pSingleKept(total, r1, r2) => {
case pSingleKept(total, r1, r2) =>
stats += ("num_reads_kept_R1" -> r1.toInt)
stats += ("num_reads_kept_R2" -> r2.toInt)
}
case pPairDiscarded(reads, pairs) => stats += ("num_reads_discarded_both" -> reads.toInt)
case pSingleDiscarded(total, r1, r2) => {
case pSingleDiscarded(total, r1, r2) =>
stats += ("num_reads_discarded_R1" -> r1.toInt)
stats += ("num_reads_discarded_R2" -> r2.toInt)
}
case _ =>
}
}
......
......@@ -70,8 +70,8 @@ class Stampy(val root: Configurable) extends BiopetCommandLineFunction with Refe
override def versionCommand = executable + " --help"
/** Sets readgroup when not set yet */
override def beforeGraph: Unit = {
super.beforeGraph
override def beforeGraph(): Unit = {
super.beforeGraph()
require(readgroup != null)
if (reference == null) reference = referenceFasta()
}
......
......@@ -68,7 +68,7 @@ class Star(val root: Configurable) extends BiopetCommandLineFunction with Refere
/** Sets output files for the graph */
override def beforeGraph() {
super.beforeGraph
super.beforeGraph()
if (reference == null) reference = referenceFasta()
genomeDir = config("genomeDir", new File(reference.getAbsoluteFile.getParent, "star"))
if (outFileNamePrefix != null && !outFileNamePrefix.endsWith(".")) outFileNamePrefix += "."
......@@ -111,7 +111,7 @@ object Star {
* @param R1 R1 fastq file
* @param R2 R2 fastq file
* @param outputDir Outputdir for Star
* @param isIntermediate
* @param isIntermediate When set true jobs are flaged as intermediate
* @param deps Deps to add to wait on run
* @return Return Star
*
......@@ -123,8 +123,8 @@ object Star {
star.outputDir = outputDir
star.isIntermediate = isIntermediate
star.deps = deps
star.beforeGraph
return star
star.beforeGraph()
star
}
/**
......@@ -133,7 +133,7 @@ object Star {
* @param R1 R1 fastq file
* @param R2 R2 fastq file
* @param outputDir Outputdir for Star
* @param isIntermediate
* @param isIntermediate When set true jobs are flaged as intermediate
* @param deps Deps to add to wait on run
* @return Return Star
*/
......@@ -146,21 +146,21 @@ object Star {
val starCommand_pass1 = Star(configurable, R1, R2, new File(outputDir, "aln-pass1"))
starCommand_pass1.isIntermediate = isIntermediate
starCommand_pass1.deps = deps
starCommand_pass1.beforeGraph
starCommand_pass1.beforeGraph()
val starCommand_reindex = new Star(configurable)
starCommand_reindex.sjdbFileChrStartEnd = starCommand_pass1.outputTab
starCommand_reindex.outputDir = new File(outputDir, "re-index")
starCommand_reindex.runmode = "genomeGenerate"
starCommand_reindex.isIntermediate = isIntermediate
starCommand_reindex.beforeGraph
starCommand_reindex.beforeGraph()
val starCommand_pass2 = Star(configurable, R1, R2, new File(outputDir, "aln-pass2"))
starCommand_pass2.genomeDir = starCommand_reindex.outputDir
starCommand_pass2.isIntermediate = isIntermediate
starCommand_pass2.deps = deps
starCommand_pass2.beforeGraph
starCommand_pass2.beforeGraph()
return (starCommand_pass2.outputSam, List(starCommand_pass1, starCommand_reindex, starCommand_pass2))
(starCommand_pass2.outputSam, List(starCommand_pass1, starCommand_reindex, starCommand_pass2))
}
}
\ No newline at end of file
......@@ -66,7 +66,7 @@ class Tabix(val root: Configurable) extends BiopetCommandLineFunction {
/** Formats that tabix can handle */
private val validFormats: Set[String] = Set("gff", "bed", "sam", "vcf", "psltbl")
override def beforeGraph: Unit = {
override def beforeGraph(): Unit = {
p match {
case Some(fmt) =>
require(validFormats.contains(fmt), "-p flag must be one of " + validFormats.mkString(", "))
......
......@@ -141,8 +141,8 @@ class VariantEffectPredictor(val root: Configurable) extends BiopetCommandLineFu
var db_version: Option[Int] = config("db_version")
var buffer_size: Option[Int] = config("buffer_size")
override def beforeGraph: Unit = {
super.beforeGraph
override def beforeGraph(): Unit = {
super.beforeGraph()
if (!cache && !database) {
throw new IllegalArgumentException("Must supply either cache or database")
} else if (cache && dir.isEmpty) {
......
......@@ -44,6 +44,6 @@ object Zcat {
val zcat = new Zcat(root)
zcat.input = input
zcat.output = output
return zcat
zcat
}
}
\ No newline at end of file
......@@ -20,10 +20,7 @@ import java.io.File
import nl.lumc.sasc.biopet.core.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
/**
* This extension is based on bcftools 1.1-134
* @param root
*/
/** This extension is based on bcftools 1.1-134 */
class BcftoolsCall(val root: Configurable) extends Bcftools {
@Input(doc = "Input File")
var input: File = _
......@@ -36,7 +33,7 @@ class BcftoolsCall(val root: Configurable) extends Bcftools {
var c: Boolean = config("c", default = false)
var m: Boolean = config("m", default = false)
override def beforeGraph: Unit = {
override def beforeGraph(): Unit = {
require(c != m)
}
......
......@@ -43,7 +43,7 @@ class BedtoolsCoverage(val root: Configurable) extends Bedtools {
var inputTag = "-a"
override def beforeCmd {
override def beforeCmd() {
if (input.getName.endsWith(".bam")) inputTag = "-abam"
}
......
......@@ -40,7 +40,7 @@ class BedtoolsIntersect(val root: Configurable) extends Bedtools {
var inputTag = "-a"
override def beforeCmd {
override def beforeCmd() {
if (input.getName.endsWith(".bam")) inputTag = "-abam"
}
......@@ -63,6 +63,6 @@ object BedtoolsIntersect {
bedtoolsIntersect.output = output
bedtoolsIntersect.minOverlap = minOverlap
bedtoolsIntersect.count = count
return bedtoolsIntersect
bedtoolsIntersect
}
}
\ No newline at end of file
......@@ -77,8 +77,8 @@ object Breakdancer extends PipelineCommand {
breakdancer.input = input
breakdancer.reference = reference
breakdancer.workdir = runDir
breakdancer.init
breakdancer.biopetScript
return breakdancer
breakdancer.init()
breakdancer.biopetScript()
breakdancer
}
}
\ No newline at end of file
......@@ -58,7 +58,7 @@ class BreakdancerCaller(val root: Configurable) extends BiopetCommandLineFunctio
var h: Boolean = config("h", default = false)
var y: Option[Int] = config("y", default = 30)
override def beforeCmd {
override def beforeCmd() {
}
def cmdLine = required(executable) +
......@@ -86,6 +86,6 @@ object BreakdancerCaller {
val bdcaller = new BreakdancerCaller(root)
bdcaller.input = input
bdcaller.output = output
return bdcaller
bdcaller
}
}
......@@ -43,17 +43,17 @@ object BreakdancerConfig {
val bdconf = new BreakdancerConfig(root)
bdconf.input = input
bdconf.output = output
return bdconf
bdconf
}
def apply(root: Configurable, input: File, outputDir: String): BreakdancerConfig = {
val dir = if (outputDir.endsWith("/")) outputDir else outputDir + "/"
val outputFile = new File(dir + swapExtension(input.getName))
return apply(root, input, outputFile)
apply(root, input, outputFile)
}
def apply(root: Configurable, input: File): BreakdancerConfig = {
return apply(root, input, new File(swapExtension(input.getAbsolutePath)))
apply(root, input, new File(swapExtension(input.getAbsolutePath)))
}
private def swapExtension(inputFile: String) = inputFile.substring(0, inputFile.lastIndexOf(".bam")) + ".breakdancer.cfg"
......
......@@ -42,6 +42,6 @@ object BreakdancerVCF {
val bd = new BreakdancerVCF(root)
bd.input = input
bd.output = output
return bd
bd
}
}
\ No newline at end of file
......@@ -64,8 +64,8 @@ class BwaAln(val root: Configurable) extends Bwa with Reference {
override val defaultCoreMemory = 4.0
override val defaultThreads = 8
override def beforeGraph {
super.beforeGraph
override def beforeGraph() {
super.beforeGraph()
if (reference == null) reference = referenceFasta()
}
......
......@@ -71,8 +71,8 @@ class BwaMem(val root: Configurable) extends Bwa with Reference {
override val defaultCoreMemory = 4.0
override val defaultThreads = 8
override def beforeGraph {
super.beforeGraph
override def beforeGraph() {
super.beforeGraph()
if (reference == null) reference = referenceFasta()
}
......
......@@ -57,8 +57,8 @@ class BwaSampe(val root: Configurable) extends Bwa with Reference {
var r: String = _
override def beforeGraph {
super.beforeGraph
override def beforeGraph() {
super.beforeGraph()
if (reference == null) reference = referenceFasta()
}
......
......@@ -43,8 +43,8 @@ class BwaSamse(val root: Configurable) extends Bwa with Reference {
var n: Option[Int] = config("n")
var r: String = _
override def beforeGraph {
super.beforeGraph
override def beforeGraph() {
super.beforeGraph()
if (reference == null) reference = referenceFasta()
}
......
......@@ -57,9 +57,9 @@ object Clever extends PipelineCommand {
val cleverpipeline = new Clever(root)
cleverpipeline.input = input
cleverpipeline.workdir = runDir
cleverpipeline.init
cleverpipeline.biopetScript
return cleverpipeline
cleverpipeline.init()
cleverpipeline.biopetScript()
cleverpipeline
}
}
\ No newline at end of file
......@@ -9,7 +9,7 @@ import org.broadinstitute.gatk.utils.commandline.{ Argument, Input, Output }
class CleverCaller(val root: Configurable) extends BiopetCommandLineFunction {
executable = config("exe", default = "clever")
private lazy val versionexecutable: File = config("version_exe", default = (new File(executable).getParent + "/ctk-version"))
private lazy val versionexecutable: File = config("version_exe", default = new File(executable).getParent + "/ctk-version")
override val defaultThreads = 8
......@@ -45,7 +45,7 @@ class CleverCaller(val root: Configurable) extends BiopetCommandLineFunction {
var k: Boolean = config("k", default = false) // keep working directory
var r: Boolean = config("r", default = false) // take read groups into account
override def beforeCmd {
override def beforeCmd() {
if (workdir == null) throw new Exception("Clever :: Workdirectory is not defined")
// if (input.getName.endsWith(".sort.bam")) sorted = true
}
......@@ -70,6 +70,6 @@ object CleverCaller {
clever.reference = reference
clever.cwd = svDir
clever.workdir = runDir
return clever
clever
}
}
\ No newline at end of file
......@@ -107,9 +107,9 @@ object Delly extends PipelineCommand {
val dellypipeline = new Delly(root)
dellypipeline.input = input
dellypipeline.workdir = runDir
dellypipeline.init
dellypipeline.biopetScript
return dellypipeline
dellypipeline.init()
dellypipeline.biopetScript()
dellypipeline
}
}
\ No newline at end of file
......@@ -21,6 +21,8 @@ import nl.lumc.sasc.biopet.core.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
/**
* Extension for CombineVariants from GATK
*
* Created by pjvan_thof on 2/26/15.
*/
class CombineVariants(val root: Configurable) extends Gatk {
......@@ -45,8 +47,8 @@ class CombineVariants(val root: Configurable) extends Gatk {
inputMap += file -> name
}
override def beforeGraph: Unit = {
super.beforeGraph
override def beforeGraph(): Unit = {
super.beforeGraph()
genotypeMergeOptions match {
case Some("UNIQUIFY") | Some("PRIORITIZE") | Some("UNSORTED") | Some("REQUIRE_UNIQUE") | None =>
case _ => throw new IllegalArgumentException("Wrong option for genotypeMergeOptions")
......
......@@ -21,6 +21,8 @@ import nl.lumc.sasc.biopet.core.{ BiopetJavaCommandLineFunction, Reference }
import org.broadinstitute.gatk.utils.commandline.Input
/**
* General extension for GATK module
*
* Created by pjvan_thof on 2/26/15.
*/
abstract class Gatk extends BiopetJavaCommandLineFunction with Reference {
......@@ -54,8 +56,8 @@ abstract class Gatk extends BiopetJavaCommandLineFunction with Reference {
override def getVersion = super.getVersion.collect { case version => "Gatk " + version }
override def dictRequired = true
override def beforeGraph: Unit = {
super.beforeGraph
override def beforeGraph(): Unit = {
super.beforeGraph()
if (reference == null) reference = referenceFasta()
}