Commit ba0cf48a authored by Sander Bollen's avatar Sander Bollen
Browse files

Merge branch 'feature-scoverage' into 'develop'

Feature scoverage

In this merge I try to fix #123 and #37

See merge request !240
parents 755c54b0 f4fb8907
#!/bin/bash
DIR=`readlink -f \`dirname $0\``
cp -r $DIR/../*/*/src/* $DIR/src
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>BiopetRoot</artifactId>
<groupId>nl.lumc.sasc</groupId>
<version>0.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>BiopetAggregate</artifactId>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.10</artifactId>
<version>2.2.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>nl.lumc.sasc</groupId>
<artifactId>BiopetProtectedPackage</artifactId>
<version>0.5.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
#!/bin/bash
DIR=`readlink -f \`dirname $0\``
rm -r $DIR/src/main $DIR/src/test
......@@ -17,5 +17,6 @@
<module>public</module>
<module>protected</module>
<module>external-example</module>
<!--<module>biopet-aggregate</module>-->
</modules>
</project>
......@@ -39,31 +39,27 @@ class ShivaTest extends TestNGSuite with Matchers {
val bool = Array(true, false)
for (
s1 <- bool; s2 <- bool; s3 <- bool; multi <- bool; single <- bool;
library <- bool; dbsnp <- bool; covariates <- bool; realign <- bool; baseRecalibration <- bool
) yield Array("", s1, s2, s3, multi, single, library, dbsnp, covariates, realign, baseRecalibration)
s1 <- bool; s2 <- bool; multi <- bool;
dbsnp <- bool; realign <- bool; baseRecalibration <- bool
) yield Array("", s1, s2, multi, dbsnp, realign, baseRecalibration)
}
@Test(dataProvider = "shivaOptions")
def testShiva(f: String, sample1: Boolean, sample2: Boolean, sample3: Boolean,
multi: Boolean, single: Boolean, library: Boolean, dbsnp: Boolean,
covariates: Boolean, realign: Boolean, baseRecalibration: Boolean): Unit = {
def testShiva(f: String, sample1: Boolean, sample2: Boolean,
multi: Boolean, dbsnp: Boolean,
realign: Boolean, baseRecalibration: Boolean): Unit = {
val map = {
var m: Map[String, Any] = ShivaTest.config
if (sample1) m = ConfigUtils.mergeMaps(ShivaTest.sample1, m)
if (sample2) m = ConfigUtils.mergeMaps(ShivaTest.sample2, m)
if (sample3) m = ConfigUtils.mergeMaps(ShivaTest.sample3, m)
if (dbsnp) m = ConfigUtils.mergeMaps(Map("dbsnp" -> "test"), m)
ConfigUtils.mergeMaps(Map("multisample_variantcalling" -> multi,
"single_sample_variantcalling" -> single,
"library_variantcalling" -> library,
"use_analyze_covariates" -> covariates,
"use_indel_realigner" -> realign,
"use_base_recalibration" -> baseRecalibration), m)
}
if (!sample1 && !sample2 && !sample3) { // When no samples
if (!sample1 && !sample2) { // When no samples
intercept[IllegalArgumentException] {
initPipeline(map).script()
}
......@@ -71,20 +67,18 @@ class ShivaTest extends TestNGSuite with Matchers {
val pipeline = initPipeline(map)
pipeline.script()
val numberLibs = (if (sample1) 1 else 0) + (if (sample2) 1 else 0) + (if (sample3) 2 else 0)
val numberSamples = (if (sample1) 1 else 0) + (if (sample2) 1 else 0) + (if (sample3) 1 else 0)
val numberLibs = (if (sample1) 1 else 0) + (if (sample2) 2 else 0)
val numberSamples = (if (sample1) 1 else 0) + (if (sample2) 1 else 0)
pipeline.functions.count(_.isInstanceOf[MarkDuplicates]) shouldBe (numberLibs + (if (sample3) 1 else 0))
pipeline.functions.count(_.isInstanceOf[MarkDuplicates]) shouldBe (numberLibs + (if (sample2) 1 else 0))
// Gatk preprocess
pipeline.functions.count(_.isInstanceOf[IndelRealigner]) shouldBe (numberLibs + (if (sample3) 1 else 0)) * (if (realign) 1 else 0)
pipeline.functions.count(_.isInstanceOf[RealignerTargetCreator]) shouldBe (numberLibs + (if (sample3) 1 else 0)) * (if (realign) 1 else 0)
pipeline.functions.count(_.isInstanceOf[BaseRecalibrator]) shouldBe (if (dbsnp && baseRecalibration) numberLibs else 0) * (if (covariates) 2 else 1)
pipeline.functions.count(_.isInstanceOf[AnalyzeCovariates]) shouldBe (if (dbsnp && covariates && baseRecalibration) numberLibs else 0)
pipeline.functions.count(_.isInstanceOf[IndelRealigner]) shouldBe (numberLibs * (if (realign) 1 else 0) + (if (sample2 && realign) 1 else 0))
pipeline.functions.count(_.isInstanceOf[RealignerTargetCreator]) shouldBe (numberLibs * (if (realign) 1 else 0) + (if (sample2 && realign) 1 else 0))
pipeline.functions.count(_.isInstanceOf[BaseRecalibrator]) shouldBe (if (dbsnp && baseRecalibration) numberLibs else 0)
pipeline.functions.count(_.isInstanceOf[PrintReads]) shouldBe (if (dbsnp && baseRecalibration) numberLibs else 0)
pipeline.functions.count(_.isInstanceOf[VcfStats]) shouldBe (if (multi) 2 else 0) +
(if (single) numberSamples * 2 else 0) + (if (library) numberLibs * 2 else 0)
pipeline.functions.count(_.isInstanceOf[VcfStats]) shouldBe (if (multi) 2 else 0)
}
}
}
......@@ -115,7 +109,6 @@ object ShivaTest {
"dir" -> "test",
"vep_script" -> "test",
"output_dir" -> outputDir,
"reference" -> (outputDir + File.separator + "ref.fa"),
"reference_fasta" -> (outputDir + File.separator + "ref.fa"),
"gatk_jar" -> "test",
"samtools" -> Map("exe" -> "test"),
......@@ -147,23 +140,14 @@ object ShivaTest {
)))
val sample2 = Map(
"samples" -> Map("sample2" -> Map("libraries" -> Map(
"samples" -> Map("sample3" -> Map("libraries" -> Map(
"lib1" -> Map(
"R1" -> inputTouch("2_1_R1.fq"),
"R2" -> inputTouch("2_1_R2.fq")
)
)
)))
val sample3 = Map(
"samples" -> Map("sample3" -> Map("libraries" -> Map(
"lib1" -> Map(
"R1" -> inputTouch("3_1_R1.fq"),
"R2" -> inputTouch("3_1_R2.fq")
),
"lib2" -> Map(
"R1" -> inputTouch("3_2_R1.fq"),
"R2" -> inputTouch("3_2_R2.fq")
"R1" -> inputTouch("2_2_R1.fq"),
"R2" -> inputTouch("2_2_R2.fq")
)
)
)))
......
......@@ -131,7 +131,6 @@ object ShivaVariantcallingTest {
"cache" -> true,
"dir" -> "test",
"vep_script" -> "test",
"reference" -> (outputDir + File.separator + "ref.fa"),
"reference_fasta" -> (outputDir + File.separator + "ref.fa"),
"gatk_jar" -> "test",
"samtools" -> Map("exe" -> "test"),
......
......@@ -17,12 +17,13 @@ package nl.lumc.sasc.biopet.extensions.picard
import java.io.File
import nl.lumc.sasc.biopet.core.Reference
import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.core.summary.Summarizable
import org.broadinstitute.gatk.utils.commandline.{ Argument, Input, Output }
/** Extension for picard CollectAlignmentSummaryMetrics */
class CollectAlignmentSummaryMetrics(val root: Configurable) extends Picard with Summarizable {
class CollectAlignmentSummaryMetrics(val root: Configurable) extends Picard with Summarizable with Reference {
javaMainClass = new picard.analysis.CollectAlignmentSummaryMetrics().getClass.getName
@Input(doc = "The input SAM or BAM files to analyze. Must be coordinate sorted.", required = true)
......@@ -41,7 +42,7 @@ class CollectAlignmentSummaryMetrics(val root: Configurable) extends Picard with
var output: File = _
@Argument(doc = "Reference file", required = false)
var reference: File = config("reference")
var reference: File = _
@Argument(doc = "ASSUME_SORTED", required = false)
var assumeSorted: Boolean = config("assumeSorted", default = true)
......@@ -52,6 +53,11 @@ class CollectAlignmentSummaryMetrics(val root: Configurable) extends Picard with
@Argument(doc = "STOP_AFTER", required = false)
var stopAfter: Option[Long] = config("stopAfter")
override def beforeGraph(): Unit = {
super.beforeGraph()
if (reference == null) reference = referenceFasta()
}
/** Returns command to execute */
override def cmdLine = super.cmdLine +
required("INPUT=", input, spaceSeparated = false) +
......
......@@ -17,6 +17,7 @@ package nl.lumc.sasc.biopet.extensions.picard
import java.io.File
import nl.lumc.sasc.biopet.core.Reference
import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.core.summary.Summarizable
import org.broadinstitute.gatk.utils.commandline.{ Argument, Input, Output }
......@@ -24,7 +25,7 @@ import org.broadinstitute.gatk.utils.commandline.{ Argument, Input, Output }
import scala.collection.immutable.Nil
/** Extension for picard CollectInsertSizeMetrics */
class CollectInsertSizeMetrics(val root: Configurable) extends Picard with Summarizable {
class CollectInsertSizeMetrics(val root: Configurable) extends Picard with Summarizable with Reference {
javaMainClass = new picard.analysis.CollectInsertSizeMetrics().getClass.getName
@Input(doc = "The input SAM or BAM files to analyze. Must be coordinate sorted.", required = true)
......@@ -37,7 +38,7 @@ class CollectInsertSizeMetrics(val root: Configurable) extends Picard with Summa
protected var outputHistogram: File = null
@Argument(doc = "Reference file", required = false)
var reference: File = config("reference")
var reference: File = _
@Argument(doc = "DEVIATIONS", required = false)
var deviations: Option[Double] = config("deviations")
......@@ -59,6 +60,7 @@ class CollectInsertSizeMetrics(val root: Configurable) extends Picard with Summa
override def beforeGraph() {
outputHistogram = new File(output + ".pdf")
if (reference == null) reference = referenceFasta()
}
/** Returns command to execute */
......
......@@ -116,7 +116,6 @@ object CarpTest {
copyFile("ref.fa.fai")
val executables = Map(
"reference" -> (outputDir + File.separator + "ref.fa"),
"reference_fasta" -> (outputDir + File.separator + "ref.fa"),
"fastqc" -> Map("exe" -> "test"),
"seqtk" -> Map("exe" -> "test"),
......
......@@ -196,7 +196,6 @@ object GentrapTest {
copyFile("ref.fa.fai")
val executables = Map(
"reference" -> (outputDir + File.separator + "ref.fa"),
"reference_fasta" -> (outputDir + File.separator + "ref.fa"),
"refFlat" -> "test",
"annotation_gtf" -> "test",
......
......@@ -50,7 +50,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<scoverage.plugin.version>1.0.4</scoverage.plugin.version>
<scoverage.plugin.version>1.1.1</scoverage.plugin.version>
<scalaVersion>2.10.4</scalaVersion>
</properties>
<build>
......@@ -243,10 +244,12 @@
<artifactId>scoverage-maven-plugin</artifactId>
<version>${scoverage.plugin.version}</version>
<configuration>
<scalaVersion>2.10.2</scalaVersion>
<scalaVersion>${scalaVersion}</scalaVersion>
<aggregate>true</aggregate>
<highlighting>true</highlighting>
<!-- other parameters -->
</configuration>
</plugin>
</plugin>
</plugins>
</build>
<reporting>
......@@ -255,6 +258,17 @@
<groupId>org.scoverage</groupId>
<artifactId>scoverage-maven-plugin</artifactId>
<version>${scoverage.plugin.version}</version>
<configuration>
<aggregate>true</aggregate> <!-- for aggregated report -->
<highlighting>true</highlighting>
</configuration>
<reportSets>
<reportSet>
<reports>
<report>report</report> <!-- select only one report from: report, integration-report and report-only reporters -->
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
......
......@@ -109,7 +109,6 @@ object ShivaTest {
"cache" -> true,
"dir" -> "test",
"vep_script" -> "test",
"reference" -> (outputDir + File.separator + "ref.fa"),
"reference_fasta" -> (outputDir + File.separator + "ref.fa"),
"gatk_jar" -> "test",
"samtools" -> Map("exe" -> "test"),
......
......@@ -112,7 +112,6 @@ object ShivaVariantcallingTest {
"cache" -> true,
"dir" -> "test",
"vep_script" -> "test",
"reference" -> (outputDir + File.separator + "ref.fa"),
"reference_fasta" -> (outputDir + File.separator + "ref.fa"),
"gatk_jar" -> "test",
"samtools" -> Map("exe" -> "test"),
......
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