Skip to content
Snippets Groups Projects
Commit 8c039f3d authored by Wai Yi Leung's avatar Wai Yi Leung
Browse files

Merge branch 'develop' of git.lumc.nl:biopet/biopet into feature-gears

parents caf77b81 dafecf89
No related branches found
No related tags found
No related merge requests found
Showing
with 86 additions and 40 deletions
#!/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
main
test
...@@ -17,5 +17,6 @@ ...@@ -17,5 +17,6 @@
<module>public</module> <module>public</module>
<module>protected</module> <module>protected</module>
<module>external-example</module> <module>external-example</module>
<!--<module>biopet-aggregate</module>-->
</modules> </modules>
</project> </project>
...@@ -153,11 +153,11 @@ class GatkVariantcalling(val root: Configurable) extends QScript with BiopetQScr ...@@ -153,11 +153,11 @@ class GatkVariantcalling(val root: Configurable) extends QScript with BiopetQScr
scriptOutput.rawVcfFile = m2v.output scriptOutput.rawVcfFile = m2v.output
val vcfFilter = new VcfFilter(this) { val vcfFilter = new VcfFilter(this) {
override def defaults = ConfigUtils.mergeMaps(Map("min_sample_depth" -> 8, override def defaults = Map("min_sample_depth" -> 8,
"min_alternate_depth" -> 2, "min_alternate_depth" -> 2,
"min_samples_pass" -> 1, "min_samples_pass" -> 1,
"filter_ref_calls" -> true "filter_ref_calls" -> true
), super.defaults) )
} }
vcfFilter.inputVcf = m2v.output vcfFilter.inputVcf = m2v.output
vcfFilter.outputVcf = swapExt(outputDir, m2v.output, ".vcf", ".filter.vcf.gz") vcfFilter.outputVcf = swapExt(outputDir, m2v.output, ".vcf", ".filter.vcf.gz")
......
...@@ -39,31 +39,27 @@ class ShivaTest extends TestNGSuite with Matchers { ...@@ -39,31 +39,27 @@ class ShivaTest extends TestNGSuite with Matchers {
val bool = Array(true, false) val bool = Array(true, false)
for ( for (
s1 <- bool; s2 <- bool; s3 <- bool; multi <- bool; single <- bool; s1 <- bool; s2 <- bool; multi <- bool;
library <- bool; dbsnp <- bool; covariates <- bool; realign <- bool; baseRecalibration <- bool dbsnp <- bool; realign <- bool; baseRecalibration <- bool
) yield Array("", s1, s2, s3, multi, single, library, dbsnp, covariates, realign, baseRecalibration) ) yield Array("", s1, s2, multi, dbsnp, realign, baseRecalibration)
} }
@Test(dataProvider = "shivaOptions") @Test(dataProvider = "shivaOptions")
def testShiva(f: String, sample1: Boolean, sample2: Boolean, sample3: Boolean, def testShiva(f: String, sample1: Boolean, sample2: Boolean,
multi: Boolean, single: Boolean, library: Boolean, dbsnp: Boolean, multi: Boolean, dbsnp: Boolean,
covariates: Boolean, realign: Boolean, baseRecalibration: Boolean): Unit = { realign: Boolean, baseRecalibration: Boolean): Unit = {
val map = { val map = {
var m: Map[String, Any] = ShivaTest.config var m: Map[String, Any] = ShivaTest.config
if (sample1) m = ConfigUtils.mergeMaps(ShivaTest.sample1, m) if (sample1) m = ConfigUtils.mergeMaps(ShivaTest.sample1, m)
if (sample2) m = ConfigUtils.mergeMaps(ShivaTest.sample2, 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) if (dbsnp) m = ConfigUtils.mergeMaps(Map("dbsnp" -> "test"), m)
ConfigUtils.mergeMaps(Map("multisample_variantcalling" -> multi, ConfigUtils.mergeMaps(Map("multisample_variantcalling" -> multi,
"single_sample_variantcalling" -> single,
"library_variantcalling" -> library,
"use_analyze_covariates" -> covariates,
"use_indel_realigner" -> realign, "use_indel_realigner" -> realign,
"use_base_recalibration" -> baseRecalibration), m) "use_base_recalibration" -> baseRecalibration), m)
} }
if (!sample1 && !sample2 && !sample3) { // When no samples if (!sample1 && !sample2) { // When no samples
intercept[IllegalArgumentException] { intercept[IllegalArgumentException] {
initPipeline(map).script() initPipeline(map).script()
} }
...@@ -71,20 +67,18 @@ class ShivaTest extends TestNGSuite with Matchers { ...@@ -71,20 +67,18 @@ class ShivaTest extends TestNGSuite with Matchers {
val pipeline = initPipeline(map) val pipeline = initPipeline(map)
pipeline.script() pipeline.script()
val numberLibs = (if (sample1) 1 else 0) + (if (sample2) 1 else 0) + (if (sample3) 2 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) + (if (sample3) 1 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 // Gatk preprocess
pipeline.functions.count(_.isInstanceOf[IndelRealigner]) shouldBe (numberLibs + (if (sample3) 1 else 0)) * (if (realign) 1 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 (sample3) 1 else 0)) * (if (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) * (if (covariates) 2 else 1) pipeline.functions.count(_.isInstanceOf[BaseRecalibrator]) shouldBe (if (dbsnp && baseRecalibration) numberLibs else 0)
pipeline.functions.count(_.isInstanceOf[AnalyzeCovariates]) shouldBe (if (dbsnp && covariates && baseRecalibration) numberLibs else 0)
pipeline.functions.count(_.isInstanceOf[PrintReads]) 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) + pipeline.functions.count(_.isInstanceOf[VcfStats]) shouldBe (if (multi) 2 else 0)
(if (single) numberSamples * 2 else 0) + (if (library) numberLibs * 2 else 0)
} }
} }
} }
...@@ -115,7 +109,6 @@ object ShivaTest { ...@@ -115,7 +109,6 @@ object ShivaTest {
"dir" -> "test", "dir" -> "test",
"vep_script" -> "test", "vep_script" -> "test",
"output_dir" -> outputDir, "output_dir" -> outputDir,
"reference" -> (outputDir + File.separator + "ref.fa"),
"reference_fasta" -> (outputDir + File.separator + "ref.fa"), "reference_fasta" -> (outputDir + File.separator + "ref.fa"),
"gatk_jar" -> "test", "gatk_jar" -> "test",
"samtools" -> Map("exe" -> "test"), "samtools" -> Map("exe" -> "test"),
...@@ -147,23 +140,14 @@ object ShivaTest { ...@@ -147,23 +140,14 @@ object ShivaTest {
))) )))
val sample2 = Map( val sample2 = Map(
"samples" -> Map("sample2" -> Map("libraries" -> Map( "samples" -> Map("sample3" -> Map("libraries" -> Map(
"lib1" -> Map( "lib1" -> Map(
"R1" -> inputTouch("2_1_R1.fq"), "R1" -> inputTouch("2_1_R1.fq"),
"R2" -> inputTouch("2_1_R2.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( "lib2" -> Map(
"R1" -> inputTouch("3_2_R1.fq"), "R1" -> inputTouch("2_2_R1.fq"),
"R2" -> inputTouch("3_2_R2.fq") "R2" -> inputTouch("2_2_R2.fq")
) )
) )
))) )))
......
...@@ -131,7 +131,6 @@ object ShivaVariantcallingTest { ...@@ -131,7 +131,6 @@ object ShivaVariantcallingTest {
"cache" -> true, "cache" -> true,
"dir" -> "test", "dir" -> "test",
"vep_script" -> "test", "vep_script" -> "test",
"reference" -> (outputDir + File.separator + "ref.fa"),
"reference_fasta" -> (outputDir + File.separator + "ref.fa"), "reference_fasta" -> (outputDir + File.separator + "ref.fa"),
"gatk_jar" -> "test", "gatk_jar" -> "test",
"samtools" -> Map("exe" -> "test"), "samtools" -> Map("exe" -> "test"),
......
...@@ -35,10 +35,10 @@ trait BastyTrait extends MultiSampleQScript { ...@@ -35,10 +35,10 @@ trait BastyTrait extends MultiSampleQScript {
def variantcallers = List("freebayes") def variantcallers = List("freebayes")
override def defaults = ConfigUtils.mergeMaps(Map( override def defaults = Map(
"ploidy" -> 1, "ploidy" -> 1,
"variantcallers" -> variantcallers "variantcallers" -> variantcallers
), super.defaults) )
lazy val shiva: ShivaTrait = new Shiva(qscript) lazy val shiva: ShivaTrait = new Shiva(qscript)
......
...@@ -85,9 +85,11 @@ trait CommandLineResources extends CommandLineFunction with Configurable { ...@@ -85,9 +85,11 @@ trait CommandLineResources extends CommandLineFunction with Configurable {
this.freeze() this.freeze()
} }
var threadsCorrection = 0
protected def combineResources(commands: List[CommandLineResources]): Unit = { protected def combineResources(commands: List[CommandLineResources]): Unit = {
commands.foreach(_.setResources()) commands.foreach(_.setResources())
nCoresRequest = Some(commands.map(_.threads).sum) nCoresRequest = Some(commands.map(_.threads).sum + threadsCorrection)
_coreMemory = commands.map(cmd => cmd.coreMemeory * (cmd.threads.toDouble / threads.toDouble)).sum _coreMemory = commands.map(cmd => cmd.coreMemeory * (cmd.threads.toDouble / threads.toDouble)).sum
memoryLimit = Some(_coreMemory * threads) memoryLimit = Some(_coreMemory * threads)
......
...@@ -47,7 +47,7 @@ class Bowtie(val root: Configurable) extends BiopetCommandLineFunction with Refe ...@@ -47,7 +47,7 @@ class Bowtie(val root: Configurable) extends BiopetCommandLineFunction with Refe
override def defaultCoreMemory = 4.0 override def defaultCoreMemory = 4.0
override def defaultThreads = 8 override def defaultThreads = 8
var sam: Boolean = config("sam", default = true) var sam: Boolean = config("sam", default = false)
var sam_RG: Option[String] = config("sam-RG") var sam_RG: Option[String] = config("sam-RG")
var seedlen: Option[Int] = config("seedlen") var seedlen: Option[Int] = config("seedlen")
var seedmms: Option[Int] = config("seedmms") var seedmms: Option[Int] = config("seedmms")
......
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