diff --git a/biopet-framework/BiopetFramework.iml b/biopet-framework/BiopetFramework.iml index 576d75a0e85692d1617394c0fee61366299e856c..3dcb6528e61ce918ca8776e785bec31720f9b2aa 100644 --- a/biopet-framework/BiopetFramework.iml +++ b/biopet-framework/BiopetFramework.iml @@ -5,7 +5,8 @@ <configuration> <option name="compilerLibraryLevel" value="Project" /> <option name="compilerLibraryName" value="Maven: org.scala-lang:scala-compiler-bundle:2.11.2" /> - <option name="compilerOptions" value="-dependencyfile $MODULE_DIR$/target/.scala_dependencies" /> + <option name="compilerOptions" value="-dependencyfile $MODULE_DIR$/target/.scala_dependencies -feature" /> + <option name="deprecationWarnings" value="true" /> <option name="languageLevel" value="Scala 2.11" /> <option name="vmOptions" value="" /> </configuration> @@ -29,15 +30,15 @@ <orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="library" name="com.twitter:algebird-core_2.10:0.8.1" level="project" /> <orderEntry type="library" name="gatk-protected" level="project" /> - <orderEntry type="library" name="Maven: org.mockito:mockito-all:1.9.5" level="project" /> <orderEntry type="library" scope="TEST" name="Maven: org.testng:testng:6.8" level="project" /> <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.10" level="project" /> <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" /> <orderEntry type="library" scope="TEST" name="Maven: org.beanshell:bsh:2.0b4" level="project" /> <orderEntry type="library" scope="TEST" name="Maven: com.beust:jcommander:1.27" level="project" /> <orderEntry type="library" scope="TEST" name="Maven: org.yaml:snakeyaml:1.6" level="project" /> - <orderEntry type="library" name="Maven: org.scalatest:scalatest_2.11:2.2.1" level="project" /> - <orderEntry type="library" name="Maven: org.scala-lang:scala-reflect:2.11.2" level="project" /> + <orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-all:1.9.5" level="project" /> + <orderEntry type="library" scope="TEST" name="Maven: org.scalatest:scalatest_2.11:2.2.1" level="project" /> + <orderEntry type="library" scope="TEST" name="Maven: org.scala-lang:scala-reflect:2.11.2" level="project" /> <orderEntry type="library" name="Maven: org.scala-lang.modules:scala-xml_2.11:1.0.2" level="project" /> <orderEntry type="library" name="Maven: org.scala-lang:scala-library:2.11.2" level="project" /> <orderEntry type="library" name="Maven: org.broadinstitute.gatk:gatk-queue-package-distribution:3.3" level="project" /> @@ -49,6 +50,5 @@ <orderEntry type="library" name="Maven: org.biojava:biojava3-sequencing:3.1.0" level="project" /> <orderEntry type="library" name="Maven: com.google.guava:guava:18.0" level="project" /> <orderEntry type="library" name="Maven: com.github.scopt:scopt_2.10:3.2.0" level="project" /> - <orderEntry type="library" name="Maven: org.mockito:mockito-all:1.9.5" level="project" /> </component> -</module> +</module> \ No newline at end of file diff --git a/biopet-framework/nb-configuration.xml b/biopet-framework/nb-configuration.xml index c2f0518e2a30c8af3fb854bd8e16e70f23679e5f..d1da94c53d08d4b3d1ab9b48ebfd64d331cdf41c 100644 --- a/biopet-framework/nb-configuration.xml +++ b/biopet-framework/nb-configuration.xml @@ -25,6 +25,5 @@ Any value defined here will override the pom.xml file value but is only applicab <com-junichi11-netbeans-changelf.use-global>false</com-junichi11-netbeans-changelf.use-global> <com-junichi11-netbeans-changelf.show-dialog>true</com-junichi11-netbeans-changelf.show-dialog> <org-netbeans-modules-javascript2-requirejs.enabled>true</org-netbeans-modules-javascript2-requirejs.enabled> - <netbeans.hint.jdkPlatform>JDK_1.8</netbeans.hint.jdkPlatform> </properties> </project-shared-configuration> diff --git a/biopet-framework/pom.xml b/biopet-framework/pom.xml index ac2879e75dea217e25cc42adf3e9b0aae80cd277..d06905d40c8554edb08208518c9d6231d04767ba 100644 --- a/biopet-framework/pom.xml +++ b/biopet-framework/pom.xml @@ -31,10 +31,17 @@ <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.11</artifactId> <version>2.2.1</version> + <scope>test</scope> </dependency> <dependency> <groupId>org.scala-lang</groupId> @@ -71,11 +78,6 @@ <artifactId>scopt_2.10</artifactId> <version>3.2.0</version> </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <version>1.9.5</version> - </dependency> </dependencies> <build> <resources> diff --git a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/Raxml.scala b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/Raxml.scala new file mode 100644 index 0000000000000000000000000000000000000000..a92926381614fc998a7a7afe367f1cb9457b79fc --- /dev/null +++ b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/Raxml.scala @@ -0,0 +1,71 @@ +package nl.lumc.sasc.biopet.extensions + +import nl.lumc.sasc.biopet.core.BiopetCommandLineFunction +import nl.lumc.sasc.biopet.core.config.Configurable +import org.broadinstitute.gatk.utils.commandline.{ Input, Output, Argument } +import java.io.File + +class Raxml(val root: Configurable) extends BiopetCommandLineFunction { + + override val defaultThreads = 4 + override def versionCommand = executable + " -v" + override val versionRegex = """.*version \w* .*""".r + + @Input(doc = "Input phy/fasta file", required = true) + var input: File = _ + + @Argument(doc = "Model", required = true) + var m: String = _ + + @Argument(doc = "Parsimony seed", required = false) + var p: Option[Int] = config("p") + + @Argument(doc = "Bootstrapping seed", required = false) + var b: Option[Int] = config("b") + + @Argument(doc = "Number of runs", required = false) + var N: Option[Int] = config("N") + + @Argument(doc = "Name of output files", required = true) + var n: String = _ + + @Argument(doc = "Name of output files", required = true) + var f: String = "d" + + @Argument(doc = "Output directory", required = false) + var w: String = jobLocalDir.getAbsolutePath + + @Input(required = false) + var t: File = _ + + @Input(required = false) + var z: File = _ + + @Output(doc = "Output files", required = false) + private var out: List[File] = Nil + + executable = config("exe", default = "raxmlHPC") + + override def afterGraph { + super.afterGraph + f match { + case "d" if b.isEmpty => out +:= getBestTree + case "d" if b.isDefined => out +:= getBootstrap + } + } + + def getBestTree: File = new File(w + File.separator + "RAxML_bestTree." + n) + def getBootstrap: File = new File(w + File.separator + "RAxML_bootstrap." + n) + + def cmdLine = required(executable) + + required("-m", m) + + required("-s", input) + + optional("-p", p) + + optional("-b", b) + + optional("-N", N) + + optional("-w", w) + + optional("-f", f) + + optional("-t", t) + + optional("-z", z) + + (if (threads > 1) required("-T", threads) else "") +} \ No newline at end of file diff --git a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/gatk/VariantEval.scala b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/gatk/VariantEval.scala new file mode 100644 index 0000000000000000000000000000000000000000..79877180170b8cb4ec1b4d10ebb9b8f74bc9f253 --- /dev/null +++ b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/gatk/VariantEval.scala @@ -0,0 +1,37 @@ +package nl.lumc.sasc.biopet.extensions.gatk + +import java.io.File +import nl.lumc.sasc.biopet.core.config.Configurable + +class VariantEval(val root: Configurable) extends org.broadinstitute.gatk.queue.extensions.gatk.VariantEval with GatkGeneral { + override def afterGraph { + super.afterGraph + } +} + +object VariantEval { + def apply(root: Configurable, sample: File, compareWith: File, + output: File): VariantEval = { + val vareval = new VariantEval(root) + vareval.eval = Seq(sample) + vareval.comp = Seq(compareWith) + vareval.out = output + vareval.afterGraph + return vareval + } + + def apply(root: Configurable, sample: File, compareWith: File, + output: File, ST: Seq[String], EV: Seq[String]): VariantEval = { + val vareval = new VariantEval(root) + vareval.eval = Seq(sample) + vareval.comp = Seq(compareWith) + vareval.out = output + vareval.noST = true + vareval.ST = ST + vareval.noEV = true + vareval.EV = EV + vareval.afterGraph + return vareval + } + +} \ No newline at end of file diff --git a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/pipelines/gatk/GatkVcfSampleCompare.scala b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/pipelines/gatk/GatkVcfSampleCompare.scala index 2ed691bb0d52b94a07b8ccef7c84909cbf3ff372..067012e443ee81958910e07fa0eb8c8361293bd8 100644 --- a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/pipelines/gatk/GatkVcfSampleCompare.scala +++ b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/pipelines/gatk/GatkVcfSampleCompare.scala @@ -5,8 +5,8 @@ import java.io.File import nl.lumc.sasc.biopet.core.config.Configurable import nl.lumc.sasc.biopet.extensions.gatk.CombineVariants import nl.lumc.sasc.biopet.extensions.gatk.SelectVariants +import nl.lumc.sasc.biopet.extensions.gatk.VariantEval import org.broadinstitute.gatk.queue.QScript -import org.broadinstitute.gatk.queue.extensions.gatk.{ CommandLineGATK, VariantEval } import org.broadinstitute.gatk.utils.commandline.{ Input, Argument } class GatkVcfSampleCompare(val root: Configurable) extends QScript with BiopetQScript { @@ -28,12 +28,6 @@ class GatkVcfSampleCompare(val root: Configurable) extends QScript with BiopetQS var sampleVcfs: Map[String, File] = Map() def generalSampleDir = outputDir + "samples/" - trait gatkArguments extends CommandLineGATK { - this.reference_sequence = reference - this.memoryLimit = 2 - this.jobResourceRequests :+= "h_vmem=4G" - } - def init() { if (reference == null) reference = config("reference") if (config.contains("target_bed")) @@ -70,14 +64,13 @@ class GatkVcfSampleCompare(val root: Configurable) extends QScript with BiopetQS for ((sample, sampleVcf) <- sampleVcfs) { val sampleDir = generalSampleDir + sample + File.separator for ((compareSample, compareSampleVcf) <- sampleVcfs) { - val variantEval = new VariantEval with gatkArguments - variantEval.eval = Seq(sampleVcf) - variantEval.comp = Seq(compareSampleVcf) - variantEval.out = new File(sampleDir + sample + "-" + compareSample + ".eval.txt") - variantEval.noST = true - variantEval.ST = Seq("VariantType", "CompRod") - variantEval.noEV = true - variantEval.EV = Seq("CompOverlap") + val variantEval = VariantEval(this, + sampleVcf, + compareSampleVcf, + new File(sampleDir + sample + "-" + compareSample + ".eval.txt"), + Seq("VariantType", "CompRod"), + Seq("CompOverlap") + ) if (targetBed != null) variantEval.L = targetBed add(variantEval) sampleCompareMetrics.deps ::= variantEval.out