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
e3400a8a
Commit
e3400a8a
authored
Jan 25, 2017
by
Peter van 't Hof
Browse files
Added unassigned reads to krona plot for centrifuge
parent
67a6842b
Changes
6
Hide whitespace changes
Inline
Side-by-side
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/BiopetQScript.scala
View file @
e3400a8a
...
...
@@ -120,7 +120,7 @@ trait BiopetQScript extends Configurable with GatkLogging { qscript: QScript =>
val
className
=
if
(
f
.
getClass
.
isAnonymousClass
)
f
.
getClass
.
getSuperclass
.
getSimpleName
else
f
.
getClass
.
getSimpleName
BiopetQScript
.
safeOutputs
(
f
)
match
{
case
Some
(
o
)
=>
f
.
jobOutputFile
=
new
File
(
o
.
head
.
getAbsoluteFile
.
getParent
,
"."
+
f
.
firstOutput
.
getName
+
"."
+
className
+
".out"
)
case
_
=>
f
.
jobOutputFile
=
new
File
(
"./stdout"
)
// Line is here for test backup
case
_
=>
f
.
jobOutputFile
=
new
File
(
"./stdout"
)
// Line is here for test backup
}
})
...
...
gears/src/main/resources/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp
View file @
e3400a8a
...
...
@@ -10,17 +10,23 @@
<%@ var libId: Option[String] = None %>
<%@ var args: Map[String, Any] %>
<%@ var outputDir: File %>
<%@ var centrifugeTag: Option[String] = None %>
<%@ var summaryStatsTag: String = "krakenreport" %>
<%@ var summaryModuleTag: String = "gearskraken" %>
<%
val summaries = if (sampleId.isEmpty
&& libId.isEmpty
) {
val summaries = if (sampleId.isEmpty) {
summary.getSampleValues(summaryModuleTag, "stats", summaryStatsTag).map(x => x._1 -> x._2.get.asInstanceOf[Map[String, Any]])
} else summary.getValue(sampleId, libId, summaryModuleTag, "stats", summaryStatsTag).map(sampleId.get -> _.asInstanceOf[Map[String, Any]]).toList.toMap
val totalReads = if (sampleId.isEmpty) {
centrifugeTag.map {tag => summary.getSampleValues(summaryModuleTag, "stats", tag, "metrics", "Read").map(x => x._1 -> x._2.getOrElse(0L).toString.toLong) }
} else centrifugeTag.flatMap(tag => summary.getValue(sampleId, libId, summaryModuleTag, "stats", tag, "metrics", "Read"))
.map(value => Map(sampleId.get -> value.toString.toLong))
val tempFile = File.createTempFile("krona.", ".xml")
tempFile.deleteOnExit()
GearsKraken.convertKrakenSummariesToKronaXml(summaries, tempFile)
GearsKraken.convertKrakenSummariesToKronaXml(summaries, tempFile
, totalReads
)
val output = ReportBuilder.renderTemplate("/nl/lumc/sasc/biopet/core/report/krona.ssp",
args ++ Map("kronaXml" -> tempFile))
...
...
gears/src/main/scala/nl/lumc/sasc/biopet/pipelines/gears/GearsKraken.scala
View file @
e3400a8a
...
...
@@ -120,7 +120,7 @@ object GearsKraken {
convertKrakenSummariesToKronaXml
(
summaries
,
outputFile
)
}
def
convertKrakenSummariesToKronaXml
(
summaries
:
Map
[
String
,
Map
[
String
,
Any
]],
outputFile
:
File
)
:
Unit
=
{
def
convertKrakenSummariesToKronaXml
(
summaries
:
Map
[
String
,
Map
[
String
,
Any
]],
outputFile
:
File
,
totalReads
:
Option
[
Map
[
String
,
Long
]]
=
None
)
:
Unit
=
{
val
samples
=
summaries
.
keys
.
toList
.
sorted
...
...
@@ -156,7 +156,7 @@ object GearsKraken {
if
(
k
==
"root"
)
{
val
unclassified
=
summaries
(
sample
)(
"unclassified"
).
asInstanceOf
[
Map
[
String
,
Any
]](
"size"
).
asInstanceOf
[
Long
]
<
val
>
{
getValue
(
sample
,
(
path
:::
k
::
Nil
).
tail
,
"size"
).
getOrElse
(
0
).
toString
.
toLong
+
unclassified
}
{
totalReads
.
flatMap
(
_
.
get
(
sample
)).
getOrElse
(
getValue
(
sample
,
(
path
:::
k
::
Nil
).
tail
,
"size"
).
getOrElse
(
0
).
toString
.
toLong
+
unclassified
)
}
</
val
>
}
else
{
<
val
>
...
...
gears/src/main/scala/nl/lumc/sasc/biopet/pipelines/gears/GearsReport.scala
View file @
e3400a8a
...
...
@@ -50,7 +50,7 @@ object GearsReport extends MultisampleReportBuilder {
)),
Map
())),
List
(
"Unique mappings"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
,
Map
(
"summaryStatsTag"
->
"centrifuge_unique_report"
)
)),
Map
(
"summaryModuleTag"
->
"gearscentrifuge"
)))
)),
Map
(
"summaryModuleTag"
->
"gearscentrifuge"
,
"centrifugeTag"
->
Some
(
"centrifuge"
)
)))
else
Nil
)
:::
(
if
(
krakenExecuted
)
List
(
"Kraken analysis"
->
ReportPage
(
List
(),
List
(
"Krona plot"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
)),
Map
()))
...
...
@@ -92,7 +92,7 @@ object GearsReport extends MultisampleReportBuilder {
)),
Map
())),
List
(
"Unique mappings"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
,
Map
(
"summaryStatsTag"
->
"centrifuge_unique_report"
)
)),
Map
(
"summaryModuleTag"
->
"gearscentrifuge"
)))
)),
Map
(
"summaryModuleTag"
->
"gearscentrifuge"
,
"centrifugeTag"
->
Some
(
"centrifuge"
)
)))
else
Nil
)
:::
(
if
(
krakenExecuted
)
List
(
"Kraken analysis"
->
ReportPage
(
List
(),
List
(
"Krona plot"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
)),
Map
()))
...
...
@@ -126,7 +126,7 @@ object GearsReport extends MultisampleReportBuilder {
)),
Map
())),
List
(
"Unique mappings"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
,
Map
(
"summaryStatsTag"
->
"centrifuge_unique_report"
)
)),
Map
(
"summaryModuleTag"
->
"gearscentrifuge"
)))
)),
Map
(
"summaryModuleTag"
->
"gearscentrifuge"
,
"centrifugeTag"
->
Some
(
"centrifuge"
)
)))
else
Nil
)
:::
(
if
(
krakenExecuted
)
List
(
"Kraken analysis"
->
ReportPage
(
List
(),
List
(
"Krona plot"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
)),
Map
()))
...
...
gears/src/main/scala/nl/lumc/sasc/biopet/pipelines/gears/GearsSingleReport.scala
View file @
e3400a8a
...
...
@@ -41,7 +41,7 @@ object GearsSingleReport extends ReportBuilder {
else
Nil
)
++
(
if
(
centrifugeExecuted
)
List
(
"Centrifuge analysis"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
,
Map
(
"summaryModuleTag"
->
"gearscentrifuge"
,
"summaryStatsTag"
->
"centrifuge_unique_report"
)))
Map
(
"summaryModuleTag"
->
"gearscentrifuge"
,
"summaryStatsTag"
->
"centrifuge_unique_report"
,
"centrifugeTag"
->
Some
(
"centrifuge"
)
)))
else
Nil
),
pageArgs
)
...
...
mapping/src/main/scala/nl/lumc/sasc/biopet/pipelines/mapping/MultisampleMappingReport.scala
View file @
e3400a8a
...
...
@@ -65,7 +65,7 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder {
)),
Map
())),
List
(
"Unique mappings"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
,
Map
(
"summaryStatsTag"
->
"centrifuge_unique_report"
)
)),
Map
(
"summaryModuleTag"
->
"gearscentrifuge"
)))
)),
Map
(
"summaryModuleTag"
->
"gearscentrifuge"
,
"centrifugeTag"
->
Some
(
"centrifuge"
)
)))
else
Nil
)
++
List
(
"Reference"
->
ReportPage
(
List
(),
List
(
"Reference"
->
ReportSection
(
"/nl/lumc/sasc/biopet/core/report/reference.ssp"
,
Map
(
"pipeline"
->
pipelineName
))
...
...
@@ -128,7 +128,7 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder {
"Libraries"
->
generateLibraryPage
(
args
),
"Alignment"
->
BammetricsReport
.
bamMetricsPage
(
summary
,
Some
(
sampleId
),
None
))
++
(
if
(
centrifugeExecuted
)
List
(
"Centriguge analysis"
->
ReportPage
(
List
(
"Non-unique"
->
ReportPage
(
List
(),
List
(
"All mappings"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
,
Map
(
"summaryStatsTag"
->
"centrifuge_report"
)
Map
(
"summaryStatsTag"
->
"centrifuge_report"
,
"centrifugeTag"
->
Some
(
"centrifuge"
)
)
)),
Map
())),
List
(
"Unique mappings"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
,
Map
(
"summaryStatsTag"
->
"centrifuge_unique_report"
)
...
...
@@ -162,7 +162,7 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder {
)),
Map
())),
List
(
"Unique mappings"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
,
Map
(
"summaryStatsTag"
->
"centrifuge_unique_report"
)
)),
Map
(
"summaryModuleTag"
->
"gearscentrifuge"
)))
)),
Map
(
"summaryModuleTag"
->
"gearscentrifuge"
,
"centrifugeTag"
->
Some
(
"centrifuge"
)
)))
else
Nil
)
:::
(
if
(
krakenExecuted
)
List
(
"Dustbin analysis"
->
ReportPage
(
List
(),
List
(
"Krona Plot"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
)),
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