Skip to content
Snippets Groups Projects
Commit a3af8046 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Fix code style warnings

parent fd956f72
No related branches found
No related tags found
No related merge requests found
Showing
with 53 additions and 52 deletions
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment