Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mirrors
biopet.biopet
Commits
91336909
Commit
91336909
authored
Mar 14, 2017
by
Peter van 't Hof
Browse files
Fixing BIOPET-542 and BIOPET-615
parent
a085648e
Changes
3
Hide whitespace changes
Inline
Side-by-side
bammetrics/src/main/resources/nl/lumc/sasc/biopet/pipelines/bammetrics/covstatsMultiTable.ssp
View file @
91336909
#import(nl.lumc.sasc.biopet.utils.IoUtils)
#import(nl.lumc.sasc.biopet.utils.summary.Summary)
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
#import(org.apache.commons.io.FileUtils)
#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.core.report.ReportPage)
#import(scala.concurrent.Await)
#import(scala.concurrent.duration.Duration)
#import(nl.lumc.sasc.biopet.pipelines.bammetrics.BammetricsReport)
#import(java.io.File)
<%@ var summary: Summary %>
<%@ var sampleId: Option[String] = None %>
<%@ var libId: Option[String] = None %>
<%@ var summary: SummaryDb %>
<%@ var sampleId: Option[Int] = None %>
<%@ var sampleLevel: Boolean = true %>
<%@ var
rootPath: String
%>
<%@ var
libId: Option[Int] = None
%>
<%@ var outputDir: File %>
<%@ var rootPath: String %>
<%@ var metricsTag: String = "bammetrics" %>
<%@ var target: Option[String] %>
<%@ 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") %>
#{
val samples = sampleId match {
case Some(sample) => List(sample.toString)
case _ => summary.samples.toList
}
val samples = Await.result(summary.getSamples(runId = Some(runId)), Duration.Inf)
}#
<table class="table">
<thead><tr>
<th>sample</th>
<th>mean</th>
<th>median</th>
<th>max</th>
<th>horizontal</th>
<th>frac min 10x</th>
<th>frac min 20x</th>
<th>frac min 30x</th>
<th>frac min 40x</th>
<th>frac min 50x</th>
#for (field <- fields)
<th>${field}</th>
#end
</tr></thead>
<tbody>
#for (sample <- samples.
toList.sorted
)
#for (sample <- samples.
sortBy(_.name)
)
#{
val libs = (libId, sampleLevel) match {
case (_, true) => List(
""
)
case (Some(
libId
), _) => List(libId
.toString
)
case _ => summary.
l
ibraries(sample).toList
val libs
: List[Option[Int]]
= (libId, sampleLevel) match {
case (_, true) => List(
None
)
case (Some(
_
), _) => List(libId)
case _ =>
Await.result(
summary.
getL
ibraries(sample
Id = Some(sample.id), runId = Some(runId)), Duration.Inf).map(x => Some(x.id)
).toList
}
}#
<tr><td rowspan="${libs.size}"><a href="${rootPath}Samples/${sample}/index.html">${sample}</a></td>
<tr><td rowspan="${libs.size}"><a href="${rootPath}Samples/${sample
.name
}/index.html">${sample
.name
}</a></td>
#for (libId <- libs)
#if (libs.head != libId) <tr> #end
#if (!sampleLevel) <td><a href="${rootPath}Samples/${sample}/Libraries/${libId}/index.html">${libId}</a></td> #end
#{
val prefixPath = List("samples", sample) ::: (if (libId.isEmpty) Nil else List("libraries", libId)) ::: List(metricsTag, "stats", target.get + "_cov_stats", "coverage", "_all")
val total = summary.getValue((prefixPath ::: List("biopet_flagstat", "All")):_*).getOrElse(0L).asInstanceOf[Long]
val mapped = summary.getValue((prefixPath ::: List("biopet_flagstat", "Mapped")):_*).getOrElse(0L).asInstanceOf[Long]
val duplicates = summary.getValue((prefixPath ::: List("biopet_flagstat", "Duplicates")):_*).getOrElse(0L).asInstanceOf[Long]
val moduleName = target.get + "_cov_stats"
val statsPaths = fields.map(x => x -> List("coverage", "_all", x)).toMap
val values = summary.getStatKeys(runId, PipelineName(metricsTag), ModuleName(moduleName), SampleId(sample.id), libId.map(LibraryId).getOrElse(NoLibrary), statsPaths)
}#
<td>${summary.getValue((prefixPath ::: "mean" :: Nil):_*)}</td>
<td>${summary.getValue((prefixPath ::: "median" :: Nil):_*)}</td>
<td>${summary.getValue((prefixPath ::: "max" :: Nil):_*)}</td>
<td>${summary.getValue((prefixPath ::: "horizontal" :: Nil):_*)}</td>
<td>${summary.getValue((prefixPath ::: "frac_min_10x" :: Nil):_*)}</td>
<td>${summary.getValue((prefixPath ::: "frac_min_20x" :: Nil):_*)}</td>
<td>${summary.getValue((prefixPath ::: "frac_min_30x" :: Nil):_*)}</td>
<td>${summary.getValue((prefixPath ::: "frac_min_40x" :: Nil):_*)}</td>
<td>${summary.getValue((prefixPath ::: "frac_min_50x" :: Nil):_*)}</td>
#for (field <- fields)
<th>${values(field)}</th>
#end
</tr>
#end
#end
...
...
bammetrics/src/main/resources/nl/lumc/sasc/biopet/pipelines/bammetrics/covstatsPlot.ssp
View file @
91336909
#import(nl.lumc.sasc.biopet.utils.IoUtils)
#import(nl.lumc.sasc.biopet.utils.summary.Summary)
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
#import(org.apache.commons.io.FileUtils)
#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.core.report.ReportPage)
#import(scala.concurrent.Await)
#import(scala.concurrent.duration.Duration)
#import(nl.lumc.sasc.biopet.pipelines.bammetrics.BammetricsReport)
#import(java.io.File)
<%@ var summary: Summary %>
<%@ var sampleId: Option[
String
] %>
<%@ var libId: Option[
String
] = None %>
<%@ var summary: Summary
Db
%>
<%@ var sampleId: Option[
Int
] %>
<%@ var libId: Option[
Int
] = None %>
<%@ var outputDir: File %>
<%@ var metricsTag: String = "bammetrics" %>
<%@ var target: Option[String] %>
<%@ 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") %>
#{
val originalPlot = new File(summary.getValue(sampleId, libId, metricsTag, "files", target.get + "_cov_stats", "plot", "path")
.getOrElse(throw new IllegalArgumentException("No plot found in summary")).toString)
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 plot = new File(outputDir, target.get + "_cov_stats.png")
val values = summary.getValue(sampleId, libId, metricsTag, "stats", target.get + "_cov_stats", "coverage", "_all")
.getOrElse(throw new IllegalArgumentException("No plot found in summary")).asInstanceOf[Map[String, Any]]
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)
}#
<img src="${plot.getName}">
<table class="table">
<thead><tr>
<th>mean</th>
<th>median</th>
<th>max</th>
<th>horizontal</th>
<th>frac min 10x</th>
<th>frac min 20x</th>
<th>frac min 30x</th>
<th>frac min 40x</th>
<th>frac min 50x</th>
#for (field <- fields)
<th>${field}</th>
#end
</tr></thead>
<tbody>
<tr>
<td>${values.get("mean")}</td>
<td>${values.get("median")}</td>
<td>${values.get("max")}</td>
<td>${values.get("horizontal")}</td>
<td>${values.get("frac_min_10x")}</td>
<td>${values.get("frac_min_20x")}</td>
<td>${values.get("frac_min_30x")}</td>
<td>${values.get("frac_min_40x")}</td>
<td>${values.get("frac_min_50x")}</td>
#for (field <- fields)
<th>${values(field)}</th>
#end
</tr>
</tbody>
</table>
shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/ShivaReport.scala
View file @
91336909
...
...
@@ -66,8 +66,9 @@ trait ShivaReportTrait extends MultisampleMappingReportTrait {
/** Generate a page with all target coverage stats */
def
regionsPage
:
Option
[(
String
,
ReportPage
)]
=
{
val
roi
=
summary
.
getSetting
(
runId
,
"shiva"
).
get
(
"regions_of_interest"
)
val
amplicon
=
summary
.
getSetting
(
runId
,
"shiva"
).
get
(
"amplicon_bed"
)
val
shivaSettings
=
Await
.
result
(
summary
.
getSetting
(
runId
,
"shiva"
),
Duration
.
Inf
).
get
val
roi
=
shivaSettings
.
get
(
"regions_of_interest"
)
val
amplicon
=
shivaSettings
.
get
(
"amplicon_bed"
)
var
regionPages
:
Map
[
String
,
ReportPage
]
=
Map
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment