Skip to content
GitLab
Menu
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
1de28c56
Commit
1de28c56
authored
Mar 08, 2015
by
bow
Browse files
Add library-level and sample-level RNA metrics to report
parent
bbaa6236
Changes
4
Hide whitespace changes
Inline
Side-by-side
public/gentrap/src/main/resources/nl/lumc/sasc/biopet/pipelines/gentrap/scripts/pdf_report.py
View file @
1de28c56
...
...
@@ -419,6 +419,31 @@ class GentrapLib(object):
self
.
fastqc_r2_qc
=
FastQC
(
self
.
fastqc_r2_qc_files
[
"fastqc_data"
][
"path"
])
# mapping metrics settings
self
.
aln_metrics
=
summary
.
get
(
"bammetrics"
,
{}).
get
(
"stats"
,
{}).
get
(
"alignment_metrics"
,
{})
# insert size metrics files
self
.
inserts_metrics_files
=
summary
.
get
(
"bammetrics"
,
{}).
get
(
"files"
,
{}).
get
(
"insert_size_metrics"
,
{})
# rna metrics files and stats
_rmetrics
=
summary
.
get
(
"gentrap"
,
{}).
get
(
"stats"
,
{}).
get
(
"rna_metrics"
,
{})
if
_rmetrics
:
self
.
rna_metrics_files
=
summary
.
get
(
"gentrap"
,
{}).
get
(
"files"
,
{}).
get
(
"rna_metrics"
,
{})
self
.
rna_metrics
=
{
k
:
v
for
k
,
v
in
_rmetrics
.
items
()
}
pf_bases
=
float
(
_rmetrics
[
"pf_bases"
])
exonic_bases
=
int
(
_rmetrics
.
get
(
"coding_bases"
,
0
))
+
int
(
_rmetrics
.
get
(
"utr_bases"
,
0
))
# picard uses pct_ but it's actually ratio ~ we follow their convention
pct_exonic_bases_all
=
exonic_bases
/
float
(
_rmetrics
[
"pf_bases"
])
pct_exonic_bases
=
exonic_bases
/
float
(
_rmetrics
.
get
(
"pf_aligned_bases"
,
0
))
self
.
rna_metrics
.
update
({
"exonic_bases"
:
exonic_bases
,
"pct_exonic_bases_all"
:
pct_exonic_bases_all
,
"pct_exonic_bases"
:
pct_exonic_bases
,
"pct_aligned_bases"
:
1.0
,
"pct_aligned_bases_all"
:
float
(
_rmetrics
.
get
(
"pf_aligned_bases"
,
0.0
))
/
pf_bases
,
"pct_coding_bases_all"
:
float
(
_rmetrics
.
get
(
"coding_bases"
,
0.0
))
/
pf_bases
,
"pct_utr_bases_all"
:
float
(
_rmetrics
.
get
(
"utr_bases"
,
0.0
))
/
pf_bases
,
"pct_intronic_bases_all"
:
float
(
_rmetrics
.
get
(
"intronic_bases"
,
0.0
))
/
pf_bases
,
"pct_intergenic_bases_all"
:
float
(
_rmetrics
.
get
(
"intergenic_bases"
,
0.0
))
/
pf_bases
,
})
if
_rmetrics
.
get
(
"ribosomal_bases"
,
""
)
!=
""
:
self
.
rna_metrics
[
"pct_ribosomal_bases_all"
]
=
float
(
_rmetrics
.
get
(
"pf_ribosomal_bases"
,
0.0
))
/
pf_bases
def
__repr__
(
self
):
return
"{0}(sample=
\"
{1}
\"
, lib=
\"
{2}
\"
)"
.
format
(
...
...
@@ -436,6 +461,30 @@ class GentrapSample(object):
self
.
libs
=
\
{
l
:
GentrapLib
(
self
.
run
,
self
,
l
,
summary
[
"libraries"
][
l
])
\
for
l
in
self
.
lib_names
}
# rna metrics files and stats
_rmetrics
=
summary
.
get
(
"gentrap"
,
{}).
get
(
"stats"
,
{}).
get
(
"rna_metrics"
,
{})
if
_rmetrics
:
self
.
rna_metrics_files
=
summary
.
get
(
"gentrap"
,
{}).
get
(
"files"
,
{}).
get
(
"rna_metrics"
,
{})
self
.
rna_metrics
=
{
k
:
v
for
k
,
v
in
_rmetrics
.
items
()
}
pf_bases
=
float
(
_rmetrics
[
"pf_bases"
])
exonic_bases
=
int
(
_rmetrics
.
get
(
"coding_bases"
,
0
))
+
int
(
_rmetrics
.
get
(
"utr_bases"
,
0
))
# picard uses pct_ but it's actually ratio ~ we follow their convention
pct_exonic_bases_all
=
exonic_bases
/
float
(
_rmetrics
[
"pf_bases"
])
pct_exonic_bases
=
exonic_bases
/
float
(
_rmetrics
.
get
(
"pf_aligned_bases"
,
0
))
self
.
rna_metrics
.
update
({
"exonic_bases"
:
exonic_bases
,
"pct_exonic_bases_all"
:
pct_exonic_bases_all
,
"pct_exonic_bases"
:
pct_exonic_bases
,
"pct_aligned_bases"
:
1.0
,
"pct_aligned_bases_all"
:
float
(
_rmetrics
.
get
(
"pf_aligned_bases"
,
0.0
))
/
pf_bases
,
"pct_coding_bases_all"
:
float
(
_rmetrics
.
get
(
"coding_bases"
,
0.0
))
/
pf_bases
,
"pct_utr_bases_all"
:
float
(
_rmetrics
.
get
(
"utr_bases"
,
0.0
))
/
pf_bases
,
"pct_intronic_bases_all"
:
float
(
_rmetrics
.
get
(
"intronic_bases"
,
0.0
))
/
pf_bases
,
"pct_intergenic_bases_all"
:
float
(
_rmetrics
.
get
(
"intergenic_bases"
,
0.0
))
/
pf_bases
,
})
if
_rmetrics
.
get
(
"ribosomal_bases"
,
""
)
!=
""
:
self
.
rna_metrics
[
"pct_ribosomal_bases_all"
]
=
float
(
_rmetrics
.
get
(
"pf_ribosomal_bases"
,
0.0
))
/
pf_bases
def
__repr__
(
self
):
return
"{0}(
\"
{1}
\"
)"
.
format
(
self
.
__class__
.
__name__
,
self
.
name
)
...
...
public/gentrap/src/main/resources/nl/lumc/sasc/biopet/pipelines/gentrap/templates/pdf/lib_mapping.tex
View file @
1de28c56
\subsection
{
Mapping
}
\label
{
sec:map
}
\label
{
sec:map
-((( lib.sample.name )))-((( lib.name )))
}
\subsubsection
{
Mapping statistics
}
Table~
\ref
{
tab:bamstat-((( lib.sample.name )))-((( lib.name ))))
}
shows the overview statistics of the
generated alignment file.
\indent
% number + percentage of reads mapped to genome
% number + percentage of properly paired reads
\begin{center}
\captionof
{
table
}{
Mapping Overview
}
\label
{
tab:bamstat-((( lib.sample.name )))-((( lib.name )))
)
}
\label
{
tab:bamstat-((( lib.sample.name )))-((( lib.name )))
}
\setlength
{
\tabcolsep
}{
11pt
}
((* if lib.is
_
paired
_
end *))
\begin{tabular}
{
l r r r
}
...
...
@@ -46,34 +43,19 @@ generated alignment file.
\end{tabular}
\end{center}
((=
%((* if run.is_paired_end *))
%% inferred insert size distribution
%\subsection{Insert size distribution}
%
%This section contains a quick overview of the insert size distribution
%of the mapped reads.
%
%\indent
%
%There are three possible types of inserts the graph may denote:
%\begin{description}
% \item[\textit{inward}] \hfill \\
% Each read pair maps to opposite strands and point towards each other.
% \item[\textit{outward}] \hfill \\
% Each read pair maps to opposite strands and point away from each other.
% \item[\textit{same directions}] \hfill \\
% Both read pair map to the same strand.
%\end{description}
%
%\IfFileExists{((( vars['OUT_DIR'] )))/((( vars['SAMPLE'] ))).insertsizes.png}
%{
% \begin{figure}[h!]
% \centering
% \includegraphics[width=0.7\textwidth]{((( vars['OUT_DIR'] )))/((( vars['SAMPLE'] ))).insertsizes.png}
% \caption{Distribution of insert size length of paired-end reads mapped to opposite strands.}
% \end{figure}
%}
((* if lib.is
_
paired
_
end *))
% inferred insert size distribution
\subsubsection
{
Insert size distribution
}
\IfFileExists
{
((( lib.inserts
_
metrics
_
files.output
_
histogram.path )))
}
{
\begin{figure}
[h!]
\centering
\includegraphics
[width=0.7\textwidth]
{
((( lib.inserts
_
metrics
_
files.output
_
histogram.path )))
}
\caption
{
Distribution of insert size length of paired-end reads mapped to opposite strands.
}
\end{figure}
}
((= TODO: strand-specific stats
%{
% \IfFileExists{((( vars['OUT_DIR'] )))/((( vars['SAMPLE'] ))).f.insertsizes.png}
% {
...
...
@@ -92,5 +74,42 @@ generated alignment file.
% \end{figure}
% }{}
%}
%((* endif *))
=))
((* endif *))
((* if lib.sample.libs|length > 1 *))
\subsubsection
{
RNA-specific metrics
}
\IfFileExists
{
((( lib.rna
_
metrics
_
files.output
_
chart.path )))
}
{
\begin{figure}
[h!]
\centering
\includegraphics
[width=0.7\textwidth]
{
((( lib.rna
_
metrics
_
files.output
_
chart.path )))
}
\caption
{
Normalized coverage bias plot.
}
\end{figure}
}
\begin{center}
\captionof
{
table
}{
Functional annotation metrics
}
\label
{
tab:fannot-((( lib.sample.name )))-((( lib.name ))))
}
\setlength
{
\tabcolsep
}{
11pt
}
\begin{tabular}
{
l r r r
}
\hline
\multirow
{
2
}{
*
}{
Parameter
}
&
\multicolumn
{
3
}{
c
}{
Value
}
\\
&
Count
&
\%
of all
&
\%
of aligned
\\
\hline
\hline
Total bases
&
((( lib.rna
_
metrics.pf
_
bases|nice
_
int )))
&
100
\%
&
-
\\
Aligned bases
&
((( lib.rna
_
metrics.pf
_
aligned
_
bases|nice
_
int )))
&
((( lib.rna
_
metrics.pct
_
aligned
_
bases
_
all|float2nice
_
pct )))
\%
&
((( lib.rna
_
metrics.pct
_
aligned
_
bases|float2nice
_
pct )))
\%
\\
Exonic bases
&
((( lib.rna
_
metrics.exonic
_
bases|nice
_
int )))
&
((( lib.rna
_
metrics.pct
_
exonic
_
bases
_
all|float2nice
_
pct )))
\%
&
((( lib.rna
_
metrics.pct
_
exonic
_
bases|float2nice
_
pct )))
\%
\\
\hspace*
{
4mm
}
Coding bases
&
((( lib.rna
_
metrics.coding
_
bases|nice
_
int )))
&
((( lib.rna
_
metrics.pct
_
coding
_
bases
_
all|float2nice
_
pct )))
\%
&
((( lib.rna
_
metrics.pct
_
coding
_
bases|float2nice
_
pct )))
\%
\\
\hspace*
{
4mm
}
UTR bases
&
((( lib.rna
_
metrics.utr
_
bases|nice
_
int )))
&
((( lib.rna
_
metrics.pct
_
utr
_
bases
_
all|float2nice
_
pct )))
\%
&
((( lib.rna
_
metrics.pct
_
utr
_
bases|float2nice
_
pct )))
\%
\\
Intronic bases
&
((( lib.rna
_
metrics.intronic
_
bases|nice
_
int )))
&
((( lib.rna
_
metrics.pct
_
intronic
_
bases
_
all|float2nice
_
pct )))
\%
&
((( lib.rna
_
metrics.pct
_
intronic
_
bases|float2nice
_
pct )))
\%
\\
Intergenic bases
&
((( lib.rna
_
metrics.intergenic
_
bases|nice
_
int )))
&
((( lib.rna
_
metrics.pct
_
intergenic
_
bases
_
all|float2nice
_
pct )))
\%
&
((( lib.rna
_
metrics.pct
_
intergenic
_
bases|float2nice
_
pct )))
\%
\\
((* if lib.rna
_
metrics.ribosomal
_
bases != "" *))
Ribosomal bases
&
((( lib.rna
_
metrics.ribosomal
_
bases|nice
_
int )))
&
((( lib.rna
_
metrics.pct
_
ribosomal
_
bases
_
all|float2nice
_
pct )))
\%
&
((( lib.rna
_
metrics.pct
_
ribosomal
_
bases|float2nice
_
pct )))
\%
\\
((* endif *))
\hline
\end{tabular}
\end{center}
((* endif *))
public/gentrap/src/main/resources/nl/lumc/sasc/biopet/pipelines/gentrap/templates/pdf/sample.tex
View file @
1de28c56
\part
{
Sample "((( sample.name )))" Results
}
\label
{
sample:(((sample.name)))
}
Hello from module ((( sample )))
\\
((* include "sample
_
mapping.tex" *))
((* for lib in sample.libs.values() *))
((* include "lib.tex" *))
...
...
public/gentrap/src/main/resources/nl/lumc/sasc/biopet/pipelines/gentrap/templates/pdf/sample_mapping.tex
0 → 100644
View file @
1de28c56
\section
{
Mapping
}
\label
{
sec:map-((( sample.name )))
}
\subsection
{
Mapping statistics
}
\indent
\subsection
{
RNA-specific metrics
}
\IfFileExists
{
((( sample.rna
_
metrics
_
files.output
_
chart.path )))
}
{
\begin{figure}
[h!]
\centering
\includegraphics
[width=0.7\textwidth]
{
((( sample.rna
_
metrics
_
files.output
_
chart.path )))
}
\caption
{
Normalized coverage bias plot.
}
\end{figure}
}
\begin{center}
\captionof
{
table
}{
Functional annotation metrics
}
\label
{
tab:fannot-((( sample.name )))
}
\setlength
{
\tabcolsep
}{
11pt
}
\begin{tabular}
{
l r r r
}
\hline
\multirow
{
2
}{
*
}{
Parameter
}
&
\multicolumn
{
3
}{
c
}{
Value
}
\\
&
Count
&
\%
of all
&
\%
of aligned
\\
\hline
\hline
Total bases
&
((( sample.rna
_
metrics.pf
_
bases|nice
_
int )))
&
100
\%
&
-
\\
Aligned bases
&
((( sample.rna
_
metrics.pf
_
aligned
_
bases|nice
_
int )))
&
((( sample.rna
_
metrics.pct
_
aligned
_
bases
_
all|float2nice
_
pct )))
\%
&
((( sample.rna
_
metrics.pct
_
aligned
_
bases|float2nice
_
pct )))
\%
\\
Exonic bases
&
((( sample.rna
_
metrics.exonic
_
bases|nice
_
int )))
&
((( sample.rna
_
metrics.pct
_
exonic
_
bases
_
all|float2nice
_
pct )))
\%
&
((( sample.rna
_
metrics.pct
_
exonic
_
bases|float2nice
_
pct )))
\%
\\
\hspace*
{
4mm
}
Coding bases
&
((( sample.rna
_
metrics.coding
_
bases|nice
_
int )))
&
((( sample.rna
_
metrics.pct
_
coding
_
bases
_
all|float2nice
_
pct )))
\%
&
((( sample.rna
_
metrics.pct
_
coding
_
bases|float2nice
_
pct )))
\%
\\
\hspace*
{
4mm
}
UTR bases
&
((( sample.rna
_
metrics.utr
_
bases|nice
_
int )))
&
((( sample.rna
_
metrics.pct
_
utr
_
bases
_
all|float2nice
_
pct )))
\%
&
((( sample.rna
_
metrics.pct
_
utr
_
bases|float2nice
_
pct )))
\%
\\
Intronic bases
&
((( sample.rna
_
metrics.intronic
_
bases|nice
_
int )))
&
((( sample.rna
_
metrics.pct
_
intronic
_
bases
_
all|float2nice
_
pct )))
\%
&
((( sample.rna
_
metrics.pct
_
intronic
_
bases|float2nice
_
pct )))
\%
\\
Intergenic bases
&
((( sample.rna
_
metrics.intergenic
_
bases|nice
_
int )))
&
((( sample.rna
_
metrics.pct
_
intergenic
_
bases
_
all|float2nice
_
pct )))
\%
&
((( sample.rna
_
metrics.pct
_
intergenic
_
bases|float2nice
_
pct )))
\%
\\
((* if sample.rna
_
metrics.ribosomal
_
bases != "" *))
Ribosomal bases
&
((( sample.rna
_
metrics.ribosomal
_
bases|nice
_
int )))
&
((( sample.rna
_
metrics.pct
_
ribosomal
_
bases
_
all|float2nice
_
pct )))
\%
&
((( sample.rna
_
metrics.pct
_
ribosomal
_
bases|float2nice
_
pct )))
\%
\\
((* endif *))
\hline
\end{tabular}
\end{center}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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