Commit c56d1178 authored by bow's avatar bow
Browse files

Update report template

parent 8c734d16
......@@ -422,9 +422,9 @@ class GentrapLib(object):
# insert size metrics files
self.inserts_metrics_files = summary.get("bammetrics", {}).get("files", {}).get("insert_size_metrics", {})
# rna metrics files and stats
self.rna_metrics_files = summary.get("gentrap", {}).get("files", {}).get("rna_metrics", {})
_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))
......@@ -461,10 +461,15 @@ class GentrapSample(object):
self.libs = \
{l: GentrapLib(self.run, self, l, summary["libraries"][l]) \
for l in self.lib_names}
self.is_paired_end = summary.get("gentrap", {}).get("stats", {}).get("pipeline", {})["all_paired"]
# 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
self.rna_metrics_files = summary.get("gentrap", {}).get("files", {}).get("rna_metrics", {})
_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))
......
......@@ -77,7 +77,6 @@
=))
((* endif *))
((* if lib.sample.libs|length > 1 *))
\subsubsection{RNA-specific metrics}
\IfFileExists{((( lib.rna_metrics_files.output_chart.path )))}
......@@ -111,5 +110,3 @@
\hline
\end{tabular}
\end{center}
((* endif *))
\part{Sample "((( sample.name )))" Results}
\label{sample:(((sample.name)))}
((* if sample.libs|length > 1 *))
((* include "sample_mapping.tex" *))
((* endif *))
((* for lib in sample.libs.values() *))
((* include "lib.tex" *))
......
......@@ -5,6 +5,78 @@
\indent
% number + percentage of reads mapped to genome
% number + percentage of properly paired reads
\begin{center}
\captionof{table}{Mapping Overview}
\label{tab:bamstat-((( sample.name )))}
\setlength{\tabcolsep}{11pt}
((* if sample.is_paired_end *))
\begin{tabular}{ l r r r }
\hline
\multirow{2}{*}{Parameter} & \multicolumn{1}{c}{All Pairs} & \multicolumn{1}{c}{First in Pairs} & \multicolumn{1}{c}{Second in Pairs} \\
& Value & Value & Value \\
\hline \hline
Total reads & ((( sample.aln_metrics.PAIR.total_reads|nice_int ))) & ((( sample.aln_metrics.FIRST_OF_PAIR.total_reads|nice_int ))) & ((( sample.aln_metrics.SECOND_OF_PAIR.total_reads|nice_int ))) \\
Mean read length & ((( sample.aln_metrics.PAIR.mean_read_length|nice_flt ))) & ((( sample.aln_metrics.FIRST_OF_PAIR.mean_read_length|nice_flt ))) & ((( sample.aln_metrics.SECOND_OF_PAIR.mean_read_length|nice_flt ))) \\
Strand balance & ((( sample.aln_metrics.PAIR.strand_balance|nice_flt ))) & ((( sample.aln_metrics.FIRST_OF_PAIR.strand_balance|nice_flt ))) & ((( sample.aln_metrics.SECOND_OF_PAIR.strand_balance|nice_flt ))) \\
\% Mapped to reference & ((( sample.aln_metrics.PAIR.pct_pf_reads_aligned|float2nice_pct )))\% & ((( sample.aln_metrics.FIRST_OF_PAIR.pct_pf_reads_aligned|float2nice_pct )))\% & ((( sample.aln_metrics.SECOND_OF_PAIR.pct_pf_reads_aligned|float2nice_pct )))\% \\
\% Mapped to reference (MAPQ >= 20) & ((( sample.aln_metrics.PAIR.pct_pf_reads_aligned|float2nice_pct )))\% & ((( sample.aln_metrics.FIRST_OF_PAIR.pct_pf_reads_aligned|float2nice_pct )))\% & ((( sample.aln_metrics.SECOND_OF_PAIR.pct_pf_reads_aligned|float2nice_pct )))\% \\
Mismatch rate & ((( sample.aln_metrics.PAIR.pf_mismatch_rate|float2nice_pct )))\% & ((( sample.aln_metrics.FIRST_OF_PAIR.pf_mismatch_rate|float2nice_pct )))\% & ((( sample.aln_metrics.SECOND_OF_PAIR.pf_mismatch_rate|float2nice_pct )))\% \\
Indel rate & ((( sample.aln_metrics.PAIR.pf_indel_rate|float2nice_pct )))\% & ((( sample.aln_metrics.FIRST_OF_PAIR.pf_indel_rate|float2nice_pct )))\% & ((( sample.aln_metrics.SECOND_OF_PAIR.pf_indel_rate|float2nice_pct )))\% \\
Chimeras & ((( sample.aln_metrics.PAIR.pct_chimeras|float2nice_pct )))\% & ((( sample.aln_metrics.FIRST_OF_PAIR.pct_chimeras|float2nice_pct )))\% & ((( sample.aln_metrics.SECOND_OF_PAIR.pct_chimeras|float2nice_pct )))\% \\
\hline
((* else *))
\begin{tabular}{ l r }
\hline
\multirow{1}{*}{Parameter} & \multicolumn{1}{c}{Value} \\
\hline \hline
Total reads & ((( sample.aln_metrics.UNPAIRED.total_reads|nice_int ))) \\
Mean read length & ((( sample.aln_metrics.UNPAIRED.mean_read_length|nice_flt ))) \\
Strand balance & ((( sample.aln_metrics.UNPAIRED.strand_balance|nice_flt ))) \\
\% Mapped to reference & ((( sample.aln_metrics.UNPAIRED.pct_pf_reads_aligned|float2nice_pct )))\% \\
\% Mapped to reference (MAPQ >= 20) & ((( sample.aln_metrics.UNPAIRED.pct_pf_reads_aligned|float2nice_pct )))\% \\
Mismatch rate & ((( sample.aln_metrics.UNPAIRED.pf_mismatch_rate|float2nice_pct )))\% \\
Indel rate & ((( sample.aln_metrics.UNPAIRED.pf_indel_rate|float2nice_pct )))\% \\
\hline
((* endif *))
\end{tabular}
\end{center}
((* if sample.is_paired_end *))
% inferred insert size distribution
\subsubsection{Insert size distribution}
\IfFileExists{((( sample.inserts_metrics_files.output_histogram.path )))}
{
\begin{figure}[h!]
\centering
\includegraphics[width=0.7\textwidth]{((( sample.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}
% {
% \begin{figure}[h!]
% \centering
% \includegraphics[width=0.7\textwidth]{((( vars['OUT_DIR'] )))/((( vars['SAMPLE'] ))).f.insertsizes.png}
% \caption{Distribution of insert size length of paired-end reads whose first read maps to the minus strand.}
% \end{figure}
% }{}
% \IfFileExists{((( vars['OUT_DIR'] )))/((( vars['SAMPLE'] ))).r.insertsizes.png}
% {
% \begin{figure}[h!]
% \centering
% \includegraphics[width=0.7\textwidth]{((( vars['OUT_DIR'] )))/((( vars['SAMPLE'] ))).r.insertsizes.png}
% \caption{Distribution of insert size length of paired-end reads whose first read maps to the plus strand.}
% \end{figure}
% }{}
%}
=))
((* endif *))
\subsection{RNA-specific metrics}
......
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