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

Biopet core code inspection round

parent c181bccd
......@@ -43,7 +43,7 @@ class PrefixFastq(val parent: Configurable) extends ToolCommandFunction {
* Creates command to execute extension
* @return
*/
override def cmdLine =
override def cmdLine: String =
super.cmdLine +
required("-i", inputFastq) +
required("-o", outputFastq) +
......
......@@ -31,7 +31,7 @@ class SageCountFastq(val parent: Configurable) extends ToolCommandFunction {
override def defaultCoreMemory = 3.0
override def cmdLine =
override def cmdLine: String =
super.cmdLine +
required("-I", input) +
required("-o", output)
......
......@@ -38,12 +38,12 @@ class SageCreateLibrary(val parent: Configurable) extends ToolCommandFunction {
@Output(doc = "Output file all genes", shortName = "allGenes", required = false)
var allGenesOutput: File = _
var tag: String = config("tag", default = "CATG")
var length: Option[Int] = config("length", default = 17)
val tag: String = config("tag", default = "CATG")
val length: Option[Int] = config("length", default = 17)
override def defaultCoreMemory = 3.0
override def cmdLine =
override def cmdLine: String =
super.cmdLine +
required("-I", input) +
optional("--tag", tag) +
......
......@@ -43,7 +43,7 @@ class SageCreateTagCounts(val parent: Configurable) extends ToolCommandFunction
override def defaultCoreMemory = 3.0
override def cmdLine =
override def cmdLine: String =
super.cmdLine +
required("-I", input) +
required("--tagLib", tagLib) +
......
......@@ -33,14 +33,14 @@ class SeqStat(val parent: Configurable) extends ToolCommandFunction with Summari
mainFunction = false
@Input(doc = "Input FASTQ", shortName = "input", required = true)
var input: File = null
var input: File = _
@Output(doc = "Output JSON", shortName = "output", required = true)
var output: File = null
var output: File = _
override def defaultCoreMemory = 4.0
override def cmdLine = super.cmdLine + required("-i", input) + required("-o", output)
override def cmdLine: String = super.cmdLine + required("-i", input) + required("-o", output)
def summaryStats: Map[String, Any] = {
val map = ConfigUtils.fileToConfigMap(output)
......
......@@ -28,7 +28,7 @@ class SnptestToVcf(val parent: Configurable) extends ToolCommandFunction with Re
def toolObject = nl.lumc.sasc.biopet.tools.SnptestToVcf
@Input(doc = "input Info file", required = true)
var inputInfo: File = null
var inputInfo: File = _
@Input(required = true)
var reference: File = _
......@@ -45,7 +45,7 @@ class SnptestToVcf(val parent: Configurable) extends ToolCommandFunction with Re
//if (outputVcf.getName.endsWith(".vcf.gz")) outputFiles :+= new File(outputVcf.getAbsolutePath + ".tbi")
}
override def cmdLine =
override def cmdLine: String =
super.cmdLine +
required("--inputInfo", inputInfo) +
required("--outputVcf", outputVcf) +
......
......@@ -32,9 +32,9 @@ class SquishBed(val parent: Configurable) extends ToolCommandFunction {
@Output(doc = "Output interval list", required = true)
var output: File = _
var strandSensitive: Boolean = config("strandSensitive", default = false)
val strandSensitive: Boolean = config("strandSensitive", default = false)
override def cmdLine =
override def cmdLine: String =
super.cmdLine +
required("-I", input) +
required("-o", output) +
......
......@@ -41,7 +41,7 @@ class ValidateAnnotation(val parent: Configurable) extends ToolCommandFunction w
if (reference == null) reference = referenceFasta()
}
override def cmdLine =
override def cmdLine: String =
super.cmdLine +
optional("-r", refflatFile) +
repeat("-g", gtfFile) +
......
......@@ -31,7 +31,7 @@ class ValidateFastq(val parent: Configurable) extends ToolCommandFunction {
override def defaultCoreMemory = 4.0
override def cmdLine =
override def cmdLine: String =
super.cmdLine +
required("-i", r1Fastq) +
optional("-j", r2Fastq)
......
......@@ -38,7 +38,7 @@ class ValidateVcf(val parent: Configurable) extends ToolCommandFunction with Ref
if (reference == null) reference = referenceFasta()
}
override def cmdLine =
override def cmdLine: String =
super.cmdLine +
required("-i", inputVcf) +
required("-R", reference) +
......
......@@ -61,7 +61,7 @@ class VcfFilter(val parent: Configurable) extends ToolCommandFunction {
outputVcfIndex = new File(outputVcf.getAbsolutePath + ".tbi")
}
override def cmdLine =
override def cmdLine: String =
super.cmdLine +
required("-I", inputVcf) +
required("-o", outputVcf) +
......
......@@ -50,9 +50,9 @@ class VcfStats(val parent: Configurable)
protected var outputDir: File = _
var infoTags: List[String] = Nil
var genotypeTags: List[String] = Nil
var allInfoTags = false
var allGenotypeTags = false
val genotypeTags: List[String] = Nil
val allInfoTags = false
val allGenotypeTags = false
var reference: File = _
var intervals: Option[File] = None
......
......@@ -39,7 +39,7 @@ class VcfStatsForSv(val parent: Configurable) extends ToolCommandFunction with S
override def defaultResidentFactor = 2.0
override def defaultVmemFactor = 3.0
override def cmdLine =
override def cmdLine: String =
super.cmdLine +
required("-i", inputFile) +
required("-o", outputFile) +
......
......@@ -53,7 +53,7 @@ class VcfWithVcf(val parent: Configurable) extends ToolCommandFunction with Refe
if (fields.isEmpty) throw new IllegalArgumentException("No fields found for VcfWithVcf")
}
override def cmdLine =
override def cmdLine: String =
super.cmdLine +
required("-I", input) +
required("-o", output) +
......
......@@ -33,17 +33,17 @@ class VepNormalizer(val parent: Configurable) extends ToolCommandFunction {
def toolObject = nl.lumc.sasc.biopet.tools.VepNormalizer
@Input(doc = "Input VCF, may be indexed", shortName = "InputFile", required = true)
var inputVCF: File = null
var inputVCF: File = _
@Output(doc = "Output VCF", shortName = "OutputFile", required = true)
var outputVcf: File = null
var outputVcf: File = _
var mode: String = config("mode", default = "standard")
var doNotRemove: Boolean = config("do_not_remove", default = false)
val mode: String = config("mode", default = "standard")
val doNotRemove: Boolean = config("do_not_remove", default = false)
override def defaultCoreMemory = 4.0
override def cmdLine =
override def cmdLine: String =
super.cmdLine +
required("-I", inputVCF) +
required("-O", outputVcf) +
......
......@@ -30,35 +30,35 @@ class WipeReads(val parent: Configurable) extends ToolCommandFunction {
def toolObject = nl.lumc.sasc.biopet.tools.WipeReads
@Input(doc = "Input BAM file (must be indexed)", shortName = "I", required = true)
var inputBam: File = null
var inputBam: File = _
@Input(doc = "Interval file", shortName = "r", required = true)
var intervalFile: File = null
var intervalFile: File = _
@Argument(doc = "Minimum MAPQ of reads in target region to remove (default: 0)")
var minMapQ: Option[Int] = config("min_mapq")
val minMapQ: Option[Int] = config("min_mapq")
@Argument(doc = "Read group IDs to be removed (default: remove reads from all read groups)")
var readgroup: Set[String] = config("read_group", default = Nil)
val readgroup: Set[String] = config("read_group", default = Nil)
@Argument(
doc = "Whether to remove multiple-mapped reads outside the target regions (default: yes)")
var limitRemoval: Boolean = config("limit_removal", default = false)
val limitRemoval: Boolean = config("limit_removal", default = false)
@Argument(doc = "Whether to index output BAM file or not")
var noMakeIndex: Boolean = config("no_make_index", default = false)
val noMakeIndex: Boolean = config("no_make_index", default = false)
@Argument(doc = "GTF feature containing intervals (default: exon)")
var featureType: Option[String] = config("feature_type")
val featureType: Option[String] = config("feature_type")
@Argument(doc = "Expected maximum number of reads in target regions (default: 7e7)")
var bloomSize: Option[Long] = config("bloom_size")
val bloomSize: Option[Long] = config("bloom_size")
@Argument(doc = "False positive rate (default: 4e-7)")
var falsePositive: Option[Long] = config("false_positive")
val falsePositive: Option[Long] = config("false_positive")
@Output(doc = "Output BAM", shortName = "o", required = true)
var outputBam: File = null
var outputBam: File = _
@Output(required = false)
private var outputIndex: Option[File] = None
......@@ -71,7 +71,7 @@ class WipeReads(val parent: Configurable) extends ToolCommandFunction {
if (!noMakeIndex) outputIndex = Some(new File(outputBam.getPath.stripSuffix(".bam") + ".bai"))
}
override def cmdLine =
override def cmdLine: String =
super.cmdLine +
required("-I", inputBam) +
required("-r", intervalFile) +
......
......@@ -37,7 +37,7 @@ class XcnvToBed(val parent: Configurable) extends ToolCommandFunction {
override def defaultCoreMemory = 4
override def cmdLine = {
override def cmdLine: String = {
super.cmdLine + required("-I", inputXcnv) + required("-O", outpuBed) + required("-S", sample)
}
......
......@@ -24,7 +24,7 @@ import org.testng.annotations.Test
class BiopetPipeTest extends TestNGSuite with Matchers {
class Pipe1 extends BiopetCommandLineFunction {
val parent = null
def cmdLine =
def cmdLine: String =
"pipe1" +
(if (!inputAsStdin) " input1 " else "") +
(if (!outputAsStdout) " output1 " + "")
......@@ -32,13 +32,13 @@ class BiopetPipeTest extends TestNGSuite with Matchers {
class Pipe2 extends BiopetCommandLineFunction {
val parent = null
def cmdLine =
def cmdLine: String =
"pipe2" +
(if (!inputAsStdin) " input2 " else "") +
(if (!outputAsStdout) " output2 " + "")
}
@Test def testPipeCommands: Unit = {
@Test def testPipeCommands(): Unit = {
val pipe1 = new Pipe1
val pipe2 = new Pipe2
pipe1.commandLine.contains("pipe1") shouldBe true
......@@ -49,7 +49,7 @@ class BiopetPipeTest extends TestNGSuite with Matchers {
pipe2.commandLine.contains("output2") shouldBe true
}
@Test def testPipe: Unit = {
@Test def testPipe(): Unit = {
val pipe = new Pipe1 | new Pipe2
pipe.commandLine.contains("pipe1") shouldBe true
pipe.commandLine.contains("input1") shouldBe true
......
......@@ -77,7 +77,7 @@ class CommandLineResourcesTest extends TestNGSuite with Matchers {
val cmd1 = new CommandLineFunctionMock with CommandLineResources
val cmd2 = new CommandLineFunctionMock with CommandLineResources
val mainCmd = new CommandLineFunctionMock with CommandLineResources {
def combine(functions: List[CommandLineResources]) = combineResources(functions)
def combine(functions: List[CommandLineResources]): Unit = combineResources(functions)
}
mainCmd.combine(List(cmd1, cmd2))
......
......@@ -35,7 +35,7 @@ class MultiSampleQScriptTest extends TestNGSuite with Matchers {
import MultiSampleQScriptTest._
@Test
def testDefault: Unit = {
def testDefault(): Unit = {
val script = MultiSampleQScriptTest(sample1 :: sample2 :: sample3 :: Nil)
script.outputDir = new File("./").getAbsoluteFile
......@@ -68,7 +68,7 @@ class MultiSampleQScriptTest extends TestNGSuite with Matchers {
}
@Test
def testTrio: Unit = {
def testTrio(): Unit = {
val script = MultiSampleQScriptTest(child :: father :: mother :: Nil)
script.init()
script.biopetScript()
......@@ -83,7 +83,7 @@ class MultiSampleQScriptTest extends TestNGSuite with Matchers {
}
@Test
def testGroups: Unit = {
def testGroups(): Unit = {
val script = MultiSampleQScriptTest(sample1 :: sample2 :: sample3 :: Nil)
script.init()
script.biopetScript()
......@@ -99,7 +99,7 @@ class MultiSampleQScriptTest extends TestNGSuite with Matchers {
}
@Test
def testOnlySamples: Unit = {
def testOnlySamples(): Unit = {
val script = MultiSampleQScriptTest(sample1 :: sample2 :: sample3 :: Nil, List("sample1"))
script.init()
script.biopetScript()
......@@ -108,7 +108,7 @@ class MultiSampleQScriptTest extends TestNGSuite with Matchers {
}
@Test
def testInvalidSampleName: Unit = {
def testInvalidSampleName(): Unit = {
val script = MultiSampleQScriptTest(sample4 :: Nil)
script.init()
script.biopetScript()
......@@ -210,13 +210,20 @@ object MultiSampleQScriptTest {
)
)
def apply(configs: List[Map[String, Any]], only: List[String] = Nil) = {
def apply(configs: List[Map[String, Any]], only: List[String] = Nil): QScript with MultiSampleQScript {
def init(): Unit
def getLastLogMessage: String
def biopetScript(): Unit
} = {
new QScript with MultiSampleQScript { qscript =>
qSettings = new QSettings()
qSettings.runName = "test"
override val onlySamples = only
override val onlySamples: List[String] = only
var buffer = new ListBuffer[String]()
......
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