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

Merge branch 'release-0.7.0' into 'master'

Release 0.7.0



See merge request !449
parents 23c1ccea bf548a42
......@@ -9,8 +9,7 @@
#
# Contact us at: sasc@lumc.nl
#
# A dual licensing mode is applied. The source code within this project that are
# not part of GATK Queue is freely available for non-commercial use under an AGPL
# A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
# license; For commercial users or users who do not want to follow the AGPL
# license, please contact us to obtain a separate license.
#
......
......@@ -8,8 +8,7 @@
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project that are
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license.
*/
......@@ -17,15 +16,16 @@ package nl.lumc.sasc.biopet.pipelines.bammetrics
import java.io.File
import nl.lumc.sasc.biopet.core.annotations.{ RibosomalRefFlat, AnnotationRefFlat }
import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.core.annotations.{ AnnotationRefFlat, RibosomalRefFlat }
import nl.lumc.sasc.biopet.core.summary.SummaryQScript
import nl.lumc.sasc.biopet.core.{ Reference, BiopetFifoPipe, PipelineCommand, SampleLibraryTag }
import nl.lumc.sasc.biopet.extensions.bedtools.{ BedtoolsCoverage, BedtoolsIntersect }
import nl.lumc.sasc.biopet.core.{ BiopetFifoPipe, PipelineCommand, Reference, SampleLibraryTag }
import nl.lumc.sasc.biopet.extensions.bedtools.{ BedtoolsCoverage, BedtoolsIntersect, BedtoolsSort }
import nl.lumc.sasc.biopet.extensions.picard._
import nl.lumc.sasc.biopet.extensions.samtools.SamtoolsFlagstat
import nl.lumc.sasc.biopet.pipelines.bammetrics.scripts.CoverageStats
import nl.lumc.sasc.biopet.extensions.tools.BiopetFlagstat
import nl.lumc.sasc.biopet.pipelines.bammetrics.scripts.CoverageStats
import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.utils.intervals.BedCheck
import org.broadinstitute.gatk.queue.QScript
class BamMetrics(val root: Configurable) extends QScript
......@@ -41,6 +41,8 @@ class BamMetrics(val root: Configurable) extends QScript
@Input(doc = "Bam File", shortName = "BAM", required = true)
var inputBam: File = _
override def defaults = Map("bedtoolscoverage" -> Map("sorted" -> true))
/** return location of summary file */
def summaryFile = (sampleId, libId) match {
case (Some(s), Some(l)) => new File(outputDir, s + "-" + l + ".BamMetrics.summary.json")
......@@ -72,6 +74,8 @@ class BamMetrics(val root: Configurable) extends QScript
/** executed before script */
def init(): Unit = {
inputFiles :+= new InputFile(inputBam)
ampliconBedFile.foreach(BedCheck.checkBedFileToReference(_, referenceFasta(), biopetError = true))
roiBedFiles.foreach(BedCheck.checkBedFileToReference(_, referenceFasta(), biopetError = true))
}
/** Script to add jobs */
......@@ -162,7 +166,11 @@ class BamMetrics(val root: Configurable) extends QScript
addSummarizable(biopetFlagstatLoose, targetName + "_biopet_flagstat_loose")
add(new BiopetFifoPipe(this, List(biLoose, biopetFlagstatLoose)))
val bedCov = BedtoolsCoverage(this, intervals.bed, inputBam, depth = true)
val sorter = new BedtoolsSort(this)
sorter.input = intervals.bed
sorter.output = swapExt(targetDir, intervals.bed, ".bed", ".sorted.bed")
add(sorter)
val bedCov = BedtoolsCoverage(this, sorter.output, inputBam, depth = true)
val covStats = CoverageStats(this, targetDir, inputBam.getName.stripSuffix(".bam") + ".coverage")
covStats.title = Some("Coverage Plot")
covStats.subTitle = Some(s"for file '$targetName.bed'")
......
......@@ -8,8 +8,7 @@
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project that are
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license.
*/
......@@ -98,6 +97,7 @@ object BammetricsReport extends ReportBuilder {
/**
* Generate a stackbar plot for alignment stats
*
* @param outputDir OutputDir for the tsv and png file
* @param prefix Prefix of the tsv and png file
* @param summary Summary class
......@@ -126,9 +126,9 @@ object BammetricsReport extends ReportBuilder {
summary, Some(sample), lib).value.getOrElse(0).toString.toLong
val sb = new StringBuffer()
if (lib.isDefined) sb.append(sample + "-" + lib.get + "\t") else sb.append(sample + "\t")
sb.append((mapped - duplicates) + "\t")
sb.append((mapped - duplicates - secondary) + "\t")
sb.append(duplicates + "\t")
sb.append((total - mapped - secondary) + "\t")
sb.append((total - mapped) + "\t")
sb.append(secondary)
sb.toString
}
......@@ -161,6 +161,7 @@ object BammetricsReport extends ReportBuilder {
/**
* Generate a line plot for insertsize
*
* @param outputDir OutputDir for the tsv and png file
* @param prefix Prefix of the tsv and png file
* @param summary Summary class
......@@ -249,6 +250,7 @@ object BammetricsReport extends ReportBuilder {
/**
* Generate a line plot for wgs coverage
*
* @param outputDir OutputDir for the tsv and png file
* @param prefix Prefix of the tsv and png file
* @param summary Summary class
......@@ -339,6 +341,7 @@ object BammetricsReport extends ReportBuilder {
/**
* Generate a line plot for rna coverage
*
* @param outputDir OutputDir for the tsv and png file
* @param prefix Prefix of the tsv and png file
* @param summary Summary class
......
......@@ -8,8 +8,7 @@
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project that are
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license.
*/
......
......@@ -8,8 +8,7 @@
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project that are
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license.
*/
......
......@@ -8,8 +8,7 @@
#
# Contact us at: sasc@lumc.nl
#
# A dual licensing mode is applied. The source code within this project that are
# not part of GATK Queue is freely available for non-commercial use under an AGPL
# A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
# license; For commercial users or users who do not want to follow the AGPL
# license, please contact us to obtain a separate license.
#
......
......@@ -8,8 +8,7 @@
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project that are
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license.
*/
......@@ -37,7 +36,7 @@ class BamMetricsTest extends TestNGSuite with Matchers {
def initPipeline(map: Map[String, Any]): BamMetrics = {
new BamMetrics() {
override def configName = "bammetrics"
override def configNamespace = "bammetrics"
override def globalConfig = new Config(map)
qSettings = new QSettings
qSettings.runName = "test"
......@@ -61,9 +60,9 @@ class BamMetricsTest extends TestNGSuite with Matchers {
def testBamMetrics(rois: Int, amplicon: Boolean, rna: Boolean, wgs: Boolean) = {
val map = ConfigUtils.mergeMaps(Map("output_dir" -> BamMetricsTest.outputDir, "rna_metrics" -> rna, "wgs_metrics" -> wgs),
Map(BamMetricsTest.executables.toSeq: _*)) ++
(if (amplicon) Map("amplicon_bed" -> "amplicon.bed") else Map()) ++
(if (amplicon) Map("amplicon_bed" -> BamMetricsTest.ampliconBed.getAbsolutePath) else Map()) ++
(if (rna) Map("annotation_refflat" -> "transcripts.refFlat") else Map()) ++
Map("regions_of_interest" -> (1 to rois).map("roi_" + _ + ".bed").toList)
Map("regions_of_interest" -> (1 to rois).map(BamMetricsTest.roi(_).getAbsolutePath).toList)
val bammetrics: BamMetrics = initPipeline(map)
bammetrics.inputBam = BamMetricsTest.bam
......@@ -94,6 +93,14 @@ object BamMetricsTest {
val bam = new File(outputDir, "input" + File.separator + "bla.bam")
Files.touch(bam)
val ampliconBed = new File(outputDir, "input" + File.separator + "amplicon_bed.bed")
Files.touch(ampliconBed)
def roi(i: Int): File = {
val roi = new File(outputDir, "input" + File.separator + s"roi${i}.bed")
Files.touch(roi)
roi
}
private def copyFile(name: String): Unit = {
val is = getClass.getResourceAsStream("/" + name)
......
......@@ -9,8 +9,7 @@
Contact us at: sasc@lumc.nl
A dual licensing mode is applied. The source code within this project that are
not part of GATK Queue is freely available for non-commercial use under an AGPL
A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
license; For commercial users or users who do not want to follow the AGPL
license, please contact us to obtain a separate license.
......@@ -32,7 +31,7 @@
<parent>
<groupId>nl.lumc.sasc</groupId>
<artifactId>Biopet</artifactId>
<version>0.6.0</version>
<version>0.7.0</version>
<relativePath>../</relativePath>
</parent>
......
......@@ -8,8 +8,7 @@
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project that are
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license.
*/
......@@ -22,26 +21,28 @@ package nl.lumc.sasc.biopet.pipelines.basty
import java.io.File
import nl.lumc.sasc.biopet.core.MultiSampleQScript
import nl.lumc.sasc.biopet.core.{ MultiSampleQScript, PipelineCommand }
import nl.lumc.sasc.biopet.extensions.{ Cat, Raxml, RunGubbins }
import nl.lumc.sasc.biopet.pipelines.shiva.{ Shiva, ShivaTrait }
import nl.lumc.sasc.biopet.pipelines.shiva.Shiva
import nl.lumc.sasc.biopet.extensions.tools.BastyGenerateFasta
import nl.lumc.sasc.biopet.utils.ConfigUtils
import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.queue.QScript
trait BastyTrait extends MultiSampleQScript {
qscript: QScript =>
class Basty(val root: Configurable) extends QScript with MultiSampleQScript {
qscript =>
def this() = this(null)
case class FastaOutput(variants: File, consensus: File, consensusVariants: File)
def variantcallers = List("freebayes")
def variantcallers = List("unifiedgenotyper")
override def defaults = Map(
"ploidy" -> 1,
"variantcallers" -> variantcallers
)
lazy val shiva: ShivaTrait = new Shiva(qscript)
lazy val shiva = new Shiva(qscript)
def summaryFile: File = new File(outputDir, "Basty.summary.json")
......@@ -131,11 +132,11 @@ trait BastyTrait extends MultiSampleQScript {
raxmlMl.p = Some(seed)
raxmlMl.n = outputName + "_ml"
raxmlMl.w = dirSufixRaxml
raxmlMl.N = config("ml_runs", default = 20, submodule = "raxml")
raxmlMl.N = config("ml_runs", default = 20, namespace = "raxml")
add(raxmlMl)
val r = new scala.util.Random(seed)
val numBoot = config("boot_runs", default = 100, submodule = "raxml").asInt
val numBoot = config("boot_runs", default = 100, namespace = "raxml").asInt
val bootList = for (t <- 0 until numBoot) yield {
val raxmlBoot = new Raxml(this)
raxmlBoot.input = variants
......@@ -194,3 +195,5 @@ trait BastyTrait extends MultiSampleQScript {
FastaOutput(bastyGenerateFasta.outputVariants, bastyGenerateFasta.outputConsensus, bastyGenerateFasta.outputConsensusVariants)
}
}
object Basty extends PipelineCommand
......@@ -8,8 +8,7 @@
#
# Contact us at: sasc@lumc.nl
#
# A dual licensing mode is applied. The source code within this project that are
# not part of GATK Queue is freely available for non-commercial use under an AGPL
# A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
# license; For commercial users or users who do not want to follow the AGPL
# license, please contact us to obtain a separate license.
#
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
Biopet is built on top of GATK Queue for building bioinformatic
pipelines. It is mainly intended to support LUMC SHARK cluster which is running
SGE. But other types of HPC that are supported by GATK Queue (such as PBS)
should also be able to execute Biopet tools and pipelines.
Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
Contact us at: sasc@lumc.nl
A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
license; For commercial users or users who do not want to follow the AGPL
license, please contact us to obtain a separate license.
-->
<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">
......@@ -11,34 +27,33 @@
<parent>
<groupId>nl.lumc.sasc</groupId>
<artifactId>Biopet</artifactId>
<version>0.6.0-SNAPSHOT</version>
<relativePath>../public</relativePath>
<version>0.7.0-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<modules>
<module>../public/biopet-core</module>
<module>../public/biopet-public-package</module>
<module>../public/bammetrics</module>
<module>../public/flexiprep</module>
<module>../public/gentrap</module>
<module>../public/mapping</module>
<module>../public/sage</module>
<module>../public/kopisu</module>
<module>../public/gears</module>
<module>../public/bam2wig</module>
<module>../public/carp</module>
<module>../public/toucan</module>
<module>../public/shiva</module>
<module>../public/basty</module>
<module>../public/tinycap</module>
<module>../public/biopet-utils</module>
<module>../public/biopet-tools</module>
<module>../public/biopet-tools-extensions</module>
<module>../public/biopet-extensions</module>
<module>../public/biopet-tools-package</module>
<module>../protected/biopet-gatk-extensions</module>
<module>../protected/biopet-gatk-pipelines</module>
<module>../protected/biopet-protected-package</module>
<module>../biopet-core</module>
<module>../generate-indexes</module>
<module>../biopet-package</module>
<module>../bammetrics</module>
<module>../flexiprep</module>
<module>../gentrap</module>
<module>../mapping</module>
<module>../sage</module>
<module>../kopisu</module>
<module>../gears</module>
<module>../bam2wig</module>
<module>../carp</module>
<module>../toucan</module>
<module>../gwas-test</module>
<module>../shiva</module>
<module>../basty</module>
<module>../tinycap</module>
<module>../biopet-utils</module>
<module>../biopet-tools</module>
<module>../biopet-tools-extensions</module>
<module>../biopet-extensions</module>
<module>../biopet-tools-package</module>
</modules>
</project>
\ No newline at end of file
......@@ -10,8 +10,7 @@
Contact us at: sasc@lumc.nl
A dual licensing mode is applied. The source code within this project that are
not part of GATK Queue is freely available for non-commercial use under an AGPL
A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
license; For commercial users or users who do not want to follow the AGPL
license, please contact us to obtain a separate license.
......@@ -22,7 +21,7 @@
<parent>
<artifactId>Biopet</artifactId>
<groupId>nl.lumc.sasc</groupId>
<version>0.6.0</version>
<version>0.7.0</version>
<relativePath>../</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
......@@ -57,7 +56,7 @@
<dependency>
<groupId>org.broadinstitute.gatk</groupId>
<artifactId>gatk-queue</artifactId>
<version>3.5</version>
<version>3.6</version>
<exclusions>
<exclusion>
<groupId>org.broadinstitute.gatk</groupId>
......@@ -68,7 +67,7 @@
<dependency>
<groupId>org.broadinstitute.gatk</groupId>
<artifactId>gatk-queue-extensions-public</artifactId>
<version>3.5</version>
<version>3.6</version>
</dependency>
<dependency>
<groupId>org.scalatra.scalate</groupId>
......
Markdown is supported
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