...
 
Commits (761)
#Files to be included
project.git = true #All scala files tracked by git.
project.excludeFilters = [
"gatk/*"
]
style = default
maxColumn = 100
...@@ -21,10 +21,6 @@ node('local') { ...@@ -21,10 +21,6 @@ node('local') {
} }
} }
stage('Report Tests') {
junit '*/target/surefire-reports/*.xml'
}
stage('Check git on changes') { stage('Check git on changes') {
sh 'if [ $(git diff | wc -l) -eq 0 ]; then true; else echo "[ERROR] Git is not clean anymore after build"; git diff; echo "[ERROR] This might be caused by reformated code, if so run maven locally"; false; fi' sh 'if [ $(git diff | wc -l) -eq 0 ]; then true; else echo "[ERROR] Git is not clean anymore after build"; git diff; echo "[ERROR] This might be caused by reformated code, if so run maven locally"; false; fi'
} }
...@@ -33,7 +29,7 @@ node('local') { ...@@ -33,7 +29,7 @@ node('local') {
sh 'mkdocs build --clean --strict' sh 'mkdocs build --clean --strict'
} }
if (currentBuild.result == null || "SUCCESS".equals(currentBuild.result)) { if (currentBuild.result == null || "SUCCESS" == currentBuild.result) {
currentBuild.result = "SUCCESS" currentBuild.result = "SUCCESS"
slackSend(color: '#00FF00', message: "${currentBuild.result}: Job '${env.JOB_NAME} #${env.BUILD_NUMBER}' (<${env.BUILD_URL}|Open>)", channel: '#biopet-bot', teamDomain: 'lumc', tokenCredentialId: 'lumc') slackSend(color: '#00FF00', message: "${currentBuild.result}: Job '${env.JOB_NAME} #${env.BUILD_NUMBER}' (<${env.BUILD_URL}|Open>)", channel: '#biopet-bot', teamDomain: 'lumc', tokenCredentialId: 'lumc')
} else { } else {
...@@ -41,7 +37,7 @@ node('local') { ...@@ -41,7 +37,7 @@ node('local') {
} }
} catch (e) { } catch (e) {
if (currentBuild.result == null || "FAILED".equals(currentBuild.result)) { if (currentBuild.result == null || "FAILED" == currentBuild.result) {
currentBuild.result = "FAILED" currentBuild.result = "FAILED"
} }
slackSend(color: '#FF0000', message: "${currentBuild.result}: Job '${env.JOB_NAME} #${env.BUILD_NUMBER}' (<${env.BUILD_URL}|Open>)", channel: '#biopet-bot', teamDomain: 'lumc', tokenCredentialId: 'lumc') slackSend(color: '#FF0000', message: "${currentBuild.result}: Job '${env.JOB_NAME} #${env.BUILD_NUMBER}' (<${env.BUILD_URL}|Open>)", channel: '#biopet-bot', teamDomain: 'lumc', tokenCredentialId: 'lumc')
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<parent> <parent>
<groupId>nl.lumc.sasc</groupId> <groupId>nl.lumc.sasc</groupId>
<artifactId>Biopet</artifactId> <artifactId>Biopet</artifactId>
<version>0.9.0</version> <version>0.10.0-SNAPSHOT</version>
<relativePath>../</relativePath> <relativePath>../</relativePath>
</parent> </parent>
......
/** /**
* Biopet is built on top of GATK Queue for building bioinformatic * Biopet is built on top of GATK Queue for building bioinformatic
* pipelines. It is mainly intended to support LUMC SHARK cluster which is running * 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) * 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. * should also be able to execute Biopet tools and pipelines.
* *
* Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center * Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
* *
* Contact us at: sasc@lumc.nl * 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 * 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; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license. * license, please contact us to obtain a separate license.
*/ */
package nl.lumc.sasc.biopet.pipelines.bamtobigwig package nl.lumc.sasc.biopet.pipelines.bamtobigwig
import java.io.File import java.io.File
import nl.lumc.sasc.biopet.utils.config.Configurable import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.core.{ BiopetQScript, PipelineCommand } import nl.lumc.sasc.biopet.core.{BiopetQScript, PipelineCommand}
import nl.lumc.sasc.biopet.extensions.WigToBigWig import nl.lumc.sasc.biopet.extensions.WigToBigWig
import nl.lumc.sasc.biopet.extensions.igvtools.IGVToolsCount import nl.lumc.sasc.biopet.extensions.igvtools.IGVToolsCount
import org.broadinstitute.gatk.queue.QScript import org.broadinstitute.gatk.queue.QScript
/** /**
* Pipeline to create BigWigle files from a bam file * Pipeline to create BigWigle files from a bam file
* *
* Created by pjvan_thof on 1/29/15. * Created by pjvan_thof on 1/29/15.
*/ */
class Bam2Wig(val parent: Configurable) extends QScript with BiopetQScript { class Bam2Wig(val parent: Configurable) extends QScript with BiopetQScript {
def this() = this(null) def this() = this(null)
@Input(doc = "Input bam file", required = true) @Input(doc = "Input bam file", required = true)
var bamFile: File = null var bamFile: File = _
def init(): Unit = { def init(): Unit = {
inputFiles :+= new InputFile(bamFile) inputFiles :+= new InputFile(bamFile)
...@@ -70,4 +70,4 @@ object Bam2Wig extends PipelineCommand { ...@@ -70,4 +70,4 @@ object Bam2Wig extends PipelineCommand {
bamToBigWig.bamFile = bamFile bamToBigWig.bamFile = bamFile
bamToBigWig bamToBigWig
} }
} }
\ No newline at end of file
/** /**
* Biopet is built on top of GATK Queue for building bioinformatic * Biopet is built on top of GATK Queue for building bioinformatic
* pipelines. It is mainly intended to support LUMC SHARK cluster which is running * 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) * 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. * should also be able to execute Biopet tools and pipelines.
* *
* Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center * Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
* *
* Contact us at: sasc@lumc.nl * 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 * 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; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license. * license, please contact us to obtain a separate license.
*/ */
package nl.lumc.sasc.biopet.pipelines.bamtobigwig package nl.lumc.sasc.biopet.pipelines.bamtobigwig
import java.io.{ File, PrintWriter } import java.io.{File, PrintWriter}
import htsjdk.samtools.SamReaderFactory import htsjdk.samtools.SamReaderFactory
import nl.lumc.sasc.biopet.utils.config.Configurable import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.queue.function.InProcessFunction import org.broadinstitute.gatk.queue.function.InProcessFunction
import org.broadinstitute.gatk.utils.commandline.{ Input, Output } import org.broadinstitute.gatk.utils.commandline.{Input, Output}
import scala.collection.JavaConversions._ import scala.collection.JavaConversions._
/** /**
* Class to extract chrom.sizes files from a bam file * Class to extract chrom.sizes files from a bam file
* *
* Created by pjvan_thof on 1/29/15. * Created by pjvan_thof on 1/29/15.
*/ */
class BamToChromSizes(val parent: Configurable) extends InProcessFunction with Configurable { class BamToChromSizes(val parent: Configurable) extends InProcessFunction with Configurable {
@Input @Input
var bamFile: File = _ var bamFile: File = _
......
/** /**
* Biopet is built on top of GATK Queue for building bioinformatic * Biopet is built on top of GATK Queue for building bioinformatic
* pipelines. It is mainly intended to support LUMC SHARK cluster which is running * 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) * 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. * should also be able to execute Biopet tools and pipelines.
* *
* Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center * Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
* *
* Contact us at: sasc@lumc.nl * 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 * 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; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license. * license, please contact us to obtain a separate license.
*/ */
package nl.lumc.sasc.biopet.pipelines.bamtobigwig package nl.lumc.sasc.biopet.pipelines.bamtobigwig
import java.io.File import java.io.File
...@@ -24,21 +24,22 @@ import org.testng.annotations.Test ...@@ -24,21 +24,22 @@ import org.testng.annotations.Test
import scala.io.Source import scala.io.Source
/** /**
* Created by pjvanthof on 09/05/16. * Created by pjvanthof on 09/05/16.
*/ */
class BamToChromSizesTest extends TestNGSuite with Matchers { class BamToChromSizesTest extends TestNGSuite with Matchers {
private def resourcePath(p: String): String = { private def resourcePath(p: String): String = {
Paths.get(getClass.getResource(p).toURI).toString Paths.get(getClass.getResource(p).toURI).toString
} }
@Test @Test
def testChromSizes: Unit = { def testChromSizes(): Unit = {
val bamFile = new File(resourcePath("/empty.bam")) val bamFile = new File(resourcePath("/empty.bam"))
val bamToChromSizes = new BamToChromSizes(null) val bamToChromSizes = new BamToChromSizes(null)
bamToChromSizes.bamFile = bamFile bamToChromSizes.bamFile = bamFile
bamToChromSizes.chromSizesFile = File.createTempFile("chrom.", ".sizes") bamToChromSizes.chromSizesFile = File.createTempFile("chrom.", ".sizes")
bamToChromSizes.chromSizesFile.deleteOnExit() bamToChromSizes.chromSizesFile.deleteOnExit()
bamToChromSizes.run() bamToChromSizes.run()
Source.fromFile(bamToChromSizes.chromSizesFile).getLines().toList shouldBe List("chrQ\t10000", "chrR\t10000") Source.fromFile(bamToChromSizes.chromSizesFile).getLines().toList shouldBe List("chrQ\t10000",
"chrR\t10000")
} }
} }
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<parent> <parent>
<groupId>nl.lumc.sasc</groupId> <groupId>nl.lumc.sasc</groupId>
<artifactId>Biopet</artifactId> <artifactId>Biopet</artifactId>
<version>0.9.0</version> <version>0.10.0-SNAPSHOT</version>
<relativePath>../</relativePath> <relativePath>../</relativePath>
</parent> </parent>
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>nl.lumc.sasc</groupId> <groupId>nl.lumc.sasc</groupId>
<artifactId>BiopetToolsExtensions</artifactId> <artifactId>BiopetExtensions</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
......
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema._) #import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Sample)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Library)
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb) #import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb)
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb._) #import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb._)
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb.Implicts._) #import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb.Implicts._)
...@@ -19,6 +20,8 @@ ...@@ -19,6 +20,8 @@
<%@ var runId: Int %> <%@ var runId: Int %>
<%@ var allSamples: Seq[Sample] %> <%@ var allSamples: Seq[Sample] %>
<%@ var allLibraries: Seq[Library] %> <%@ var allLibraries: Seq[Library] %>
<%@ var alignmentSummaryPlotLines: Option[Seq[String]] %>
<%@ var alignmentSummaryResults: Map[(Int, Int), Map[String, Option[Any]]] %>
#{ #{
val samples = sampleId match { val samples = sampleId match {
case Some(id) => allSamples.filter(_.id == id).toList case Some(id) => allSamples.filter(_.id == id).toList
...@@ -45,7 +48,7 @@ ...@@ -45,7 +48,7 @@
</div> </div>
#end #end
#if (showPlot) #if (showPlot)
#{ BammetricsReport.alignmentSummaryPlot(outputDir, "alignmentSummary", summary, !sampleLevel, sampleId = sampleId) }# #{ BammetricsReport.alignmentSummaryPlot(outputDir, "alignmentSummary", alignmentSummaryPlotLines.getOrElse(Seq("")), !sampleLevel) }#
<div class="panel-body"> <div class="panel-body">
<img src="alignmentSummary.png" class="img-responsive" /> <img src="alignmentSummary.png" class="img-responsive" />
...@@ -58,7 +61,7 @@ ...@@ -58,7 +61,7 @@
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#alignmentSummaryTable"> <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#alignmentSummaryTable">
<i class="glyphicon glyphicon-eye-open"></i> Show table</button> <i class="glyphicon glyphicon-eye-open"></i> Show table</button>
#end #end
<a href="alignmentSummary.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i> TSV file</button></a> <a href="alignmentSummary.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i> Data points</button></a>
</div> </div>
#end #end
<div class="panel-body collapse #if (showTable)in#end" id="alignmentSummaryTable"> <div class="panel-body collapse #if (showTable)in#end" id="alignmentSummaryTable">
...@@ -95,11 +98,10 @@ ...@@ -95,11 +98,10 @@
"Duplicates" -> List("flagstats", "Duplicates"), "Duplicates" -> List("flagstats", "Duplicates"),
"NotPrimaryAlignment" -> List("flagstats", "NotPrimaryAlignment") "NotPrimaryAlignment" -> List("flagstats", "NotPrimaryAlignment")
) )
val results = summary.getStatKeys(runId, "bammetrics", "bamstats", sample = sample.id, library = libId.map(LibraryId).getOrElse(NoLibrary), keyValues = statsPaths) val total = alignmentSummaryResults((sample.id,libId.get))("All").getOrElse(0L).asInstanceOf[Long]
val total = results("All").getOrElse(0L).asInstanceOf[Long] val mapped = alignmentSummaryResults((sample.id, libId.get))("Mapped").getOrElse(0L).asInstanceOf[Long]
val mapped = results("Mapped").getOrElse(0L).asInstanceOf[Long] val duplicates = alignmentSummaryResults((sample.id,libId.get))("Duplicates").getOrElse(0L).asInstanceOf[Long]
val duplicates = results("Duplicates").getOrElse(0L).asInstanceOf[Long] val secondary = alignmentSummaryResults((sample.id,libId.get))("NotPrimaryAlignment").getOrElse(0L).asInstanceOf[Long]
val secondary = results("NotPrimaryAlignment").getOrElse(0L).asInstanceOf[Long]
}# }#
<td>${total}</td> <td>${total}</td>
<td>${mapped}</td> <td>${mapped}</td>
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
<tr><th>Version</th><td>${run.version}</td></tr> <tr><th>Version</th><td>${run.version}</td></tr>
<tr><th>Last commit hash</th><td>${run.commitHash}</td></tr> <tr><th>Last commit hash</th><td>${run.commitHash}</td></tr>
<tr><th>Output directory</th><td>${run.outputDir}</td></tr> <tr><th>Output directory</th><td>${run.outputDir}</td></tr>
<tr><th>Sample</th><td>${allSamples.filter(_.id == sampleId.get).headOption.map(_.name)}</td></tr> <tr><th>Sample</th><td>${allSamples.find(_.id == sampleId.get).map(_.name)}</td></tr>
<tr><th>Library</th><td>${allLibraries.filter(_.id == libId.get).headOption.map(_.name)}</td></tr> <tr><th>Library</th><td>${allLibraries.find(_.id == libId.get).map(_.name)}</td></tr>
</tbody> </tbody>
</table> </table>
<br/> <br/>
......
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema._) #import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Sample)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Library)
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb) #import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb)
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb._) #import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb._)
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb.Implicts._) #import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb.Implicts._)
...@@ -18,6 +19,8 @@ ...@@ -18,6 +19,8 @@
<%@ var fields: List[String] = List("min", "max", "mean", "median", "modal")%> <%@ var fields: List[String] = List("min", "max", "mean", "median", "modal")%>
<%@ var allSamples: Seq[Sample] %> <%@ var allSamples: Seq[Sample] %>
<%@ var allLibraries: Seq[Library] %> <%@ var allLibraries: Seq[Library] %>
<%@ var clippingPlotTables: Option[Array[Map[String, Array[Any]]]] %>
<%@ var clippingTableResults: Map[(Int, Int), Map[String, Option[Any]]] %>
#{ #{
val samples = sampleId match { val samples = sampleId match {
case Some(id) => allSamples.filter(_.id == id).toList case Some(id) => allSamples.filter(_.id == id).toList
...@@ -43,8 +46,7 @@ ...@@ -43,8 +46,7 @@
#end #end
#if (showPlot) #if (showPlot)
#{ BammetricsReport.clippingPlot(outputDir, "clipping", summary, !sampleLevel, sampleId = sampleId, libraryId = libId) }# #{ BammetricsReport.clippingPlot(outputDir, "clipping", clippingPlotTables.getOrElse(Array(Map("x" -> Array(""))))) }#
<div class="panel-body"> <div class="panel-body">
<img src="clipping.png" class="img-responsive" /> <img src="clipping.png" class="img-responsive" />
</div> </div>
...@@ -56,7 +58,7 @@ ...@@ -56,7 +58,7 @@
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#clippingTable"> <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#clippingTable">
<i class="glyphicon glyphicon-eye-open"></i> Show table</button> <i class="glyphicon glyphicon-eye-open"></i> Show table</button>
#end #end
<a href="clipping.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i>TSV file</button></a> <a href="clipping.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i> Data points</button></a>
</div> </div>
#end #end
...@@ -86,8 +88,7 @@ ...@@ -86,8 +88,7 @@
#if (libs.head != libId) <tr> #end #if (libs.head != libId) <tr> #end
#if (!sampleLevel) <td><a href="${rootPath}Samples/${sample.name}/Libraries/${libName}/index.html">${libName}</a></td> #end #if (!sampleLevel) <td><a href="${rootPath}Samples/${sample.name}/Libraries/${libName}/index.html">${libName}</a></td> #end
#{ #{
val statsPaths = fields.map(x => x -> List("clipping", "general", x)).toMap val results: Map[String, Option[Any]] = clippingTableResults((sample.id,libId.get))
val results = summary.getStatKeys(runId, "bammetrics", "bamstats", sample = sample.id, library = libId.map(LibraryId).getOrElse(NoLibrary), keyValues = statsPaths)
}# }#
#for (field <- fields) #for (field <- fields)
<td>${results(field)}</td> <td>${results(field)}</td>
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#import(scala.concurrent.Await) #import(scala.concurrent.Await)
#import(scala.concurrent.duration.Duration) #import(scala.concurrent.duration.Duration)
#import(nl.lumc.sasc.biopet.pipelines.bammetrics.BammetricsReport) #import(nl.lumc.sasc.biopet.pipelines.bammetrics.BammetricsReport)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema)
#import(java.io.File) #import(java.io.File)
<%@ var summary: SummaryDb %> <%@ var summary: SummaryDb %>
<%@ var sampleId: Option[Int] %> <%@ var sampleId: Option[Int] %>
...@@ -16,17 +17,15 @@ ...@@ -16,17 +17,15 @@
<%@ var target: Option[String] %> <%@ var target: Option[String] %>
<%@ var runId: Int %> <%@ var runId: Int %>
<%@ var fields: List[String] = List("mean", "median", "max", "horizontal", "frac_min_10x", "frac_min_20x", "frac_min_30x", "frac_min_40x", "frac_min_50x") %> <%@ var fields: List[String] = List("mean", "median", "max", "horizontal", "frac_min_10x", "frac_min_20x", "frac_min_30x", "frac_min_40x", "frac_min_50x") %>
<%@ var plotFile: Option[Schema.File] %>
<%@ var values: Map[String, Option[Any]] %>
#{ #{
val moduleName = target.get + "_cov_stats" val moduleName = target.get + "_cov_stats"
val statsPaths = fields.map(x => x -> List("coverage", "_all", x)).toMap
val plotFile = Await.result(summary.getFile(runId, PipelineName(metricsTag), ModuleName(moduleName), sampleId.map(SampleId).get, libId.map(LibraryId).getOrElse(NoLibrary), "plot"), Duration.Inf)
val originalPlot = new File(plotFile.get.path) val originalPlot = new File(plotFile.get.path)
val plot = new File(outputDir, target.get + "_cov_stats.png") val plot = new File(outputDir, target.get + "_cov_stats.png")
val values = summary.getStatKeys(runId, PipelineName(metricsTag), ModuleName(moduleName), sampleId.map(SampleId).get, libId.map(LibraryId).getOrElse(NoLibrary), statsPaths) if (originalPlot.exists()) IoUtils.copyFile(originalPlot, plot)
if (originalPlot.exists()) IoUtils.copyFile(originalPlot, plot)
}# }#
<img src="${plot.getName}"> <img src="${plot.getName}">
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
<%@ var sampleId: Option[Int] = None %> <%@ var sampleId: Option[Int] = None %>
<%@ var libId: Option[Int] = None %> <%@ var libId: Option[Int] = None %>
<%@ var rootPath: String %> <%@ var rootPath: String %>
<%@ var metricsTag: String = "bammetrics" %>
<%@ var sampleLevel: Boolean = false %> <%@ var sampleLevel: Boolean = false %>
<%@ var outputDir: File %> <%@ var outputDir: File %>
<%@ var fields: List[String] = List("mean_insert_size", "standard_deviation", "median_insert_size")%> <%@ var fields: List[String] = List("mean_insert_size", "standard_deviation", "median_insert_size")%>
...@@ -19,6 +18,8 @@ ...@@ -19,6 +18,8 @@
<%@ var runId: Int %> <%@ var runId: Int %>
<%@ var allSamples: Seq[Sample] %> <%@ var allSamples: Seq[Sample] %>
<%@ var allLibraries: Seq[Library] %> <%@ var allLibraries: Seq[Library] %>
<%@ var insertSizePlotTables: Option[Array[Map[String, Array[Any]]]] %>
<%@ var insertSizeTableResults: Map[(Int, Int), Map[String, Option[Any]]] %>
#{ #{
val samples = sampleId match { val samples = sampleId match {
case Some(id) => allSamples.filter(_.id == id).toList case Some(id) => allSamples.filter(_.id == id).toList
...@@ -45,7 +46,7 @@ ...@@ -45,7 +46,7 @@
#end #end
#if (showPlot) #if (showPlot)
#{ BammetricsReport.insertSizePlot(outputDir, "insertsize", summary, !sampleLevel, sampleId = sampleId, libraryId = libId) }# #{ BammetricsReport.insertSizePlot(outputDir, "insertsize", insertSizePlotTables.getOrElse(Array(Map("x" -> Array(""))))) }#
<div class="panel-body"> <div class="panel-body">
<img src="insertsize.png" class="img-responsive" /> <img src="insertsize.png" class="img-responsive" />
...@@ -58,7 +59,7 @@ ...@@ -58,7 +59,7 @@
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#insertsizeTable"> <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#insertsizeTable">
<i class="glyphicon glyphicon-eye-open"></i>Show table</button> <i class="glyphicon glyphicon-eye-open"></i>Show table</button>
#end #end
<a href="insertsize.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i>TSV file</button></a> <a href="insertsize.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i> Data points</button></a>
</div> </div>
#end #end
...@@ -88,8 +89,7 @@ ...@@ -88,8 +89,7 @@
#if (libs.head != libId) <tr> #end #if (libs.head != libId) <tr> #end
#if (!sampleLevel) <td><a href="${rootPath}Samples/${sample.name}/Libraries/${libName}/index.html">${libName}</a></td> #end #if (!sampleLevel) <td><a href="${rootPath}Samples/${sample.name}/Libraries/${libName}/index.html">${libName}</a></td> #end
#{ #{
val statsPaths = fields.map(x => x -> List("metrics", x.toUpperCase)).toMap val results: Map[String, Option[Any]] = insertSizeTableResults((sample.id, libId.get))
val results = summary.getStatKeys(runId, "bammetrics", "CollectInsertSizeMetrics", sample = sample.id, library = libId.map(LibraryId).getOrElse(NoLibrary), keyValues = statsPaths)
}# }#
#for (field <- fields) #for (field <- fields)
<td>${results(field)}</td> <td>${results(field)}</td>
......
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb) #import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema._) #import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Sample)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Library)
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb._) #import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb._)
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb.Implicts._) #import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb.Implicts._)
#import(nl.lumc.sasc.biopet.core.report.ReportPage) #import(nl.lumc.sasc.biopet.core.report.ReportPage)
...@@ -18,6 +19,8 @@ ...@@ -18,6 +19,8 @@
<%@ var fields: List[String] = List("min", "max", "mean", "median", "modal")%> <%@ var fields: List[String] = List("min", "max", "mean", "median", "modal")%>
<%@ var allSamples: Seq[Sample] %> <%@ var allSamples: Seq[Sample] %>
<%@ var allLibraries: Seq[Library] %> <%@ var allLibraries: Seq[Library] %>
<%@ var mappingQualityPlotTables: Option[Array[Map[String, Array[Any]]]] %>
<%@ var mappingQualityTableResults: Map[(Int, Int), Map[String, Option[Any]]] %>
#{ #{
val samples = sampleId match { val samples = sampleId match {
case Some(id) => allSamples.filter(_.id == id).toList case Some(id) => allSamples.filter(_.id == id).toList
...@@ -43,7 +46,7 @@ ...@@ -43,7 +46,7 @@
#end #end
#if (showPlot) #if (showPlot)
#{ BammetricsReport.mappingQualityPlot(outputDir, "mapping_quality", summary, !sampleLevel, sampleId = sampleId, libraryId = libId) }# #{ BammetricsReport.mappingQualityPlot(outputDir, "mapping_quality", mappingQualityPlotTables.getOrElse(Array(Map("x" -> Array("")))))}#
<div class="panel-body"> <div class="panel-body">
<img src="mapping_quality.png" class="img-responsive" /> <img src="mapping_quality.png" class="img-responsive" />
...@@ -56,7 +59,7 @@ ...@@ -56,7 +59,7 @@
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#mapping_qualityTable"> <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#mapping_qualityTable">
<i class="glyphicon glyphicon-eye-open"></i> Show table</button> <i class="glyphicon glyphicon-eye-open"></i> Show table</button>
#end #end
<a href="mapping_quality.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i> TSV file</button></a> <a href="mapping_quality.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i> Data points</button></a>
</div> </div>
#end #end
...@@ -86,8 +89,7 @@ ...@@ -86,8 +89,7 @@
#if (libs.head != libId) <tr> #end #if (libs.head != libId) <tr> #end
#if (!sampleLevel) <td><a href="${rootPath}Samples/${sample.name}/Libraries/${libName}/index.html">${libName}</a></td> #end #if (!sampleLevel) <td><a href="${rootPath}Samples/${sample.name}/Libraries/${libName}/index.html">${libName}</a></td> #end
#{ #{
val statsPaths = fields.map(x => x -> List("mapping_quality", "general", x)).toMap val results: Map[String, Option[Any]] = mappingQualityTableResults((sample.id,libId.get))
val results = summary.getStatKeys(runId, "bammetrics", "bamstats", sample = sample.id, library = libId.map(LibraryId).getOrElse(NoLibrary), keyValues = statsPaths)
}# }#
#for (field <- fields) #for (field <- fields)
<td>${results(field)}</td> <td>${results(field)}</td>
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
<%@ var runId: Int %> <%@ var runId: Int %>
<%@ var allSamples: Seq[Sample] %> <%@ var allSamples: Seq[Sample] %>
<%@ var allLibraries: Seq[Library] %> <%@ var allLibraries: Seq[Library] %>
<%@ var rnaHistogramPlotTables: Option[Array[Map[String, Array[Any]]]] %>
<%@ var rnaHistogramTableResults: Map[(Int, Int), Map[String, Option[Any]]] %>
#{ #{
val samples = sampleId match { val samples = sampleId match {
case Some(id) => allSamples.filter(_.id == id).toList case Some(id) => allSamples.filter(_.id == id).toList
...@@ -39,7 +41,7 @@ ...@@ -39,7 +41,7 @@
#end #end
#if (showPlot) #if (showPlot)
#{ BammetricsReport.rnaHistogramPlot(outputDir, "rna", summary, !sampleLevel, sampleId = sampleId, libraryId = libId) }# #{ BammetricsReport.rnaHistogramPlot(outputDir, "rna", rnaHistogramPlotTables.getOrElse(Array(Map("x" -> Array(""))))) }#
<div class="panel-body"> <div class="panel-body">
<img src="rna.png" class="img-responsive" /> <img src="rna.png" class="img-responsive" />
...@@ -50,7 +52,7 @@ ...@@ -50,7 +52,7 @@
#else #else
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#rnaTable">Show table</button> <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#rnaTable">Show table</button>
#end #end
<a href="rna.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i>TSV file</button></a> <a href="rna.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i> Data points</button></a>
</div> </div>
#end #end
...@@ -79,8 +81,7 @@ ...@@ -79,8 +81,7 @@
#if (libs.head != libId) <tr> #end #if (libs.head != libId) <tr> #end
#if (!sampleLevel) <td><a href="${rootPath}Samples/${sample.name}/Libraries/${libName}/index.html">${libName}</a></td> #end #if (!sampleLevel) <td><a href="${rootPath}Samples/${sample.name}/Libraries/${libName}/index.html">${libName}</a></td> #end
#{ #{
val statsPaths = fields.map(x => x -> List("metrics", x.toUpperCase)).toMap val results = rnaHistogramTableResults((sample.id,libId.get))
val results = summary.getStatKeys(runId, "bammetrics", "rna", sample = sample.id, library = libId.map(LibraryId).getOrElse(NoLibrary), keyValues = statsPaths)
}# }#
#for (field <- fields) #for (field <- fields)
<td>${results(field)}</td> <td>${results(field)}</td>
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
<%@ var fields: List[String] = List("mean_coverage", "pct_5x", "pct_10x", "pct_15x", "pct_20x", "pct_25x", "pct_30x", "pct_40x", "pct_50x", "pct_60x", "pct_70x", "pct_80x", "pct_90x", "pct_100x")%> <%@ var fields: List[String] = List("mean_coverage", "pct_5x", "pct_10x", "pct_15x", "pct_20x", "pct_25x", "pct_30x", "pct_40x", "pct_50x", "pct_60x", "pct_70x", "pct_80x", "pct_90x", "pct_100x")%>
<%@ var allSamples: Seq[Sample] %> <%@ var allSamples: Seq[Sample] %>
<%@ var allLibraries: Seq[Library] %> <%@ var allLibraries: Seq[Library] %>
<%@ var wgsHistogramPlotTables: Option[Array[Map[String, Array[Any]]]] %>
<%@ var wgsHistogramTableResults: Map[(Int, Int), Map[String, Option[Any]]] %>
#{ #{
val samples = sampleId match { val samples = sampleId match {
case Some(id) => allSamples.filter(_.id == id).toList case Some(id) => allSamples.filter(_.id == id).toList
...@@ -38,7 +40,7 @@ ...@@ -38,7 +40,7 @@
#end #end
#if (showPlot) #if (showPlot)
#{ BammetricsReport.wgsHistogramPlot(outputDir, "wgs", summary, !sampleLevel, sampleId = sampleId, libraryId = libId) }# #{ BammetricsReport.wgsHistogramPlot(outputDir, "rna", wgsHistogramPlotTables.getOrElse(Array(Map("x" -> Array(""))))) }#
<div class="panel-body"> <div class="panel-body">
<img src="wgs.png" class="img-responsive" /> <img src="wgs.png" class="img-responsive" />
...@@ -49,7 +51,7 @@ ...@@ -49,7 +51,7 @@
#else #else
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#wgsTable">Show table</button> <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#wgsTable">Show table</button>
#end #end
<a href="wgs.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i> TSV file</button></a> <a href="wgs.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i> Data points</button></a>
</div> </div>
#end #end
...@@ -78,13 +80,12 @@ ...@@ -78,13 +80,12 @@
#if (libs.head != libId) <tr> #end #if (libs.head != libId) <tr> #end
#if (!sampleLevel) <td><a href="${rootPath}Samples/${sample.name}/Libraries/${libName}/index.html">${libName}</a></td> #end #if (!sampleLevel) <td><a href="${rootPath}Samples/${sample.name}/Libraries/${libName}/index.html">${libName}</a></td> #end
#{ #{
val statsPaths = fields.map(x => x -> List("metrics", x.toUpperCase)).toMap val results = wgsHistogramTableResults((sample.id,libId.get))
val results = summary.getStatKeys(runId, "bammetrics", "wgs", sample = sample.id, library = libId.map(LibraryId).getOrElse(NoLibrary), keyValues = statsPaths) }#
}#
#for (field <- fields) #for (field <- fields)
<td>${results(field)}</td> <td>${results(field)}</td>
#end #end
</tr> </tr>
#end #end
#end #end
</tbody> </tbody>
......
/** /**
* Biopet is built on top of GATK Queue for building bioinformatic * Biopet is built on top of GATK Queue for building bioinformatic
* pipelines. It is mainly intended to support LUMC SHARK cluster which is running * 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) * 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. * should also be able to execute Biopet tools and pipelines.
* *
* Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center * Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
* *
* Contact us at: sasc@lumc.nl * 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 * 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; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license. * license, please contact us to obtain a separate license.
*/ */
package nl.lumc.sasc.biopet.pipelines.bammetrics package nl.lumc.sasc.biopet.pipelines.bammetrics
import java.io.File import java.io.File
...@@ -19,9 +19,10 @@ import java.io.File ...@@ -19,9 +19,10 @@ import java.io.File
import nl.lumc.sasc.biopet.utils.config.Configurable import nl.lumc.sasc.biopet.utils.config.Configurable
/** /**
* Created by pjvan_thof on 11/20/15. * Created by pjvan_thof on 11/20/15.
*/ */
trait TargetRegions extends Configurable { trait TargetRegions extends Configurable {
/** Bed files for region of interests */ /** Bed files for region of interests */
var roiBedFiles: List[File] = config("regions_of_interest", Nil) var roiBedFiles: List[File] = config("regions_of_interest", Nil)
......
/** /**
* Biopet is built on top of GATK Queue for building bioinformatic * Biopet is built on top of GATK Queue for building bioinformatic
* pipelines. It is mainly intended to support LUMC SHARK cluster which is running * 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) * 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. * should also be able to execute Biopet tools and pipelines.
* *
* Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center * Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
* *
* Contact us at: sasc@lumc.nl * 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 * 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; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license. * license, please contact us to obtain a separate license.
*/ */
package nl.lumc.sasc.biopet.pipelines.bammetrics.scripts package nl.lumc.sasc.biopet.pipelines.bammetrics.scripts
import java.io.File import java.io.File
...@@ -20,7 +20,7 @@ import nl.lumc.sasc.biopet.core.extensions.PythonCommandLineFunction ...@@ -20,7 +20,7 @@ import nl.lumc.sasc.biopet.core.extensions.PythonCommandLineFunction
import nl.lumc.sasc.biopet.utils.config.Configurable import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.core.summary.Summarizable import nl.lumc.sasc.biopet.core.summary.Summarizable
import nl.lumc.sasc.biopet.utils.ConfigUtils import nl.lumc.sasc.biopet.utils.ConfigUtils
import org.broadinstitute.gatk.utils.commandline.{ Input, Output } import org.broadinstitute.gatk.utils.commandline.{Input, Output}
class CoverageStats(val parent: Configurable) extends PythonCommandLineFunction with Summarizable { class CoverageStats(val parent: Configurable) extends PythonCommandLineFunction with Summarizable {
setPythonScript("bedtools_cov_stats.py") setPythonScript("bedtools_cov_stats.py")
...@@ -39,12 +39,13 @@ class CoverageStats(val parent: Configurable) extends PythonCommandLineFunction ...@@ -39,12 +39,13 @@ class CoverageStats(val parent: Configurable) extends PythonCommandLineFunction
override def defaultCoreMemory = 9.0 override def defaultCoreMemory = 9.0
def cmdLine = getPythonCommand + def cmdLine: String =
(if (inputAsStdin) " - " else required(input)) + getPythonCommand +
required("--plot", plot) + (if (inputAsStdin) " - " else required(input)) +
optional("--title", title) + required("--plot", plot) +
optional("--subtitle", subTitle) + optional("--title", title) +
" > " + required(output) optional("--subtitle", subTitle) +
" > " + required(output)
def summaryFiles: Map[String, File] = Map("plot" -> plot) def summaryFiles: Map[String, File] = Map("plot" -> plot)
......
/** /**
* Biopet is built on top of GATK Queue for building bioinformatic * Biopet is built on top of GATK Queue for building bioinformatic
* pipelines. It is mainly intended to support LUMC SHARK cluster which is running * 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) * 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. * should also be able to execute Biopet tools and pipelines.
* *
* Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center * Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
* *
* Contact us at: sasc@lumc.nl * 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 * 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; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license. * license, please contact us to obtain a separate license.
*/ */
package nl.lumc.sasc.biopet.pipelines.bammetrics package nl.lumc.sasc.biopet.pipelines.bammetrics
import java.io.{ File, FileOutputStream } import java.io.{File, FileOutputStream}
import com.google.common.io.Files import com.google.common.io.Files
import nl.lumc.sasc.biopet.extensions.picard._ import nl.lumc.sasc.biopet.extensions.picard._
...@@ -25,13 +25,13 @@ import org.apache.commons.io.FileUtils ...@@ -25,13 +25,13 @@ import org.apache.commons.io.FileUtils