\documentclass[a4paper]{article}
\usepackage[document]{ragged2e}
\usepackage{python}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage[T1]{fontenc}
\renewcommand*\familydefault{\ttdefault} %% Only if the base font of the document is to be typewriter style
\usepackage{subfigure}
\usepackage{geometry}
\usepackage{tcolorbox}
\usepackage{adjustbox}
\usepackage{setspace}
\usepackage{float}
\usepackage{url}
\usepackage{grffile}

\geometry{a4paper,left=25mm,right=20mm,
		top=12mm,
		bottom=20mm}

\setlength\parindent{0pt}

\tolerance=1
\emergencystretch=\maxdimen
\hyphenpenalty=1000
\hbadness=1000

\begin{document}

{\bf {\LARGE{ {{pipeline.name}} } Version {{pipeline.version}}   } }\\
\line(1,0){\textwidth} 

\begin{tabular}{p{0.25\textwidth} p{0.75\textwidth}}

Executor: & {{pipeline.user}} \\
Dataset: & {\bfseries{\verb|{{sample.name}}|} }\\
Started: &  {{sample.start}}\\
Finished: & {{sample.stop}}\\
 & \\
Operating System & \\
Server: & {{pipeline.server}}\\
System: & {{pipeline.system}}\\
Release: & {{pipeline.release}}\\
Version: & {{pipeline.operating_version}}\\
Machine: & {{pipeline.machine}}\\
 & \\
 Tool versions & \\
Python: & {{pipeline.python_version}}\\
FastQC: & {{pipeline.fastqc_version}}\\
Trimmomatic: & {{pipeline.trimmo_version}}\\
{%if sample.mappingRes !=None%}Bowtie2: & {{pipeline.bowtie_version}}\\{%endif%}
{%if sample.krakenRes != None%}Kraken: & {{pipeline.kraken_version}}\\{%endif%}
\end{tabular}\\

%----------------- Workflow -------------------%
\line(1,0){\textwidth} \\
Processed reads: \\
{%for read in sample.readSets %}
{{read.r1.get_filename()}}
{% if read.r2 %}
{{read.r2.get_filename()}}
{%endif%}
{%endfor%}

%-------------------- Summary -------------------%
\begin{tcolorbox}
{\large{Summary} } \\
{% if sample.nTrimmed() != 0 %} {{sample.nTrimmed()}} of {{sample.total_reads()}} ({{sample.pTrimmed()}}\%) reads remained after trimming \\
{{sample.get_mean_trimRes()}} \% of fragments were shorter than read length\\
{% else %}
No trimming was performed \\
{% endif %}
{%if sample.mappingRes !=None%}{{sample.mappingRes.numberOfAlignedReads}} ({{sample.mappingRes.percentAlignedReads}}\%) of reads aligned to \path{ {{sample.reference}} }\\ {%endif%}
{%if sample.krakenRes !=None%}{{sample.krakenRes.nClassified}} sequences classified ({{sample.krakenRes.pClassified}}\%) {%endif%}

\end{tcolorbox}

\line(1,0){\textwidth}  \\
\vspace{5mm}

%-------------------- FASTQC Results -------------------%

{\Large{FastQC (Pre | Post Trimming) } } \\
\vspace{5mm}

{%for read in sample.readSets %}

{\underline{Readname: {{read.r1.get_filename()}} } }\\
{%if read.r1.concat_files%}
\vspace{5mm}
Concatenated files:\\
\begin{itemize}
{%for file in read.r1.concat_files%}
\item {{file}}
{%endfor%}
\end{itemize}
{%endif%}

Trimming Log: \\
\textcolor{gray}{Using parameter:  {{trim_param}} }\\
{{read.trimRes.logs}} \\

{% for i in range(read.r1.qcRes.results|length) %}
    \begin{figure}[H]
        \centering
        \begin{adjustbox}{minipage=0.4\textwidth-2\fboxrule, cframe = {{read.r1.qcRes.results[i].color}} 2}%
        \begin{subfigure}%
           {\includegraphics[width=\textwidth]{/{{read.r1.qcRes.results[i].file}}} }
        \end{subfigure}
        \end{adjustbox}\qquad
        {% if sample.nTrimmed() != 0 %} \begin{adjustbox}{minipage=0.4\textwidth-2\fboxrule, cframe = {{read.trimRes.readset.r1.qcRes.results[i].color}} 2}%
            \begin{subfigure}%
           {\includegraphics[width=\textwidth]{/{{read.trimRes.readset.r1.qcRes.results[i].file}}} }
        \end{subfigure}
        \end{adjustbox}
        \caption{ {{read.trimRes.readset.r1.qcRes.results[i].name}}}
        {% endif %}
    \end{figure}
{% endfor %}

{% if read.r2 %}
{\underline{Readname:  {{read.r2.get_filename()}} } } \\
{%if read.r2.concat_files%}
Concatenated files: \\
\begin{itemize}
{%for file in read.r2.concat_files%}
\item {{file}}
{%endfor%}
\end{itemize}
{%endif%}

{% for i in range(read.r2.qcRes.results|length) %}
    \begin{figure}[H]
        \centering
        \begin{adjustbox}{minipage=0.4\textwidth -2\fboxrule, cframe = {{read.r2.qcRes.results[i].color}} 2}%
        \begin{subfigure}
           {\includegraphics[width=\textwidth]{/{{read.r2.qcRes.results[i].file}}} }
        \end{subfigure}
        \end{adjustbox}\qquad
        {% if sample.nTrimmed() != 0 %} \begin{adjustbox}{minipage=0.4\textwidth -2\fboxrule, cframe = {{read.trimRes.readset.r2.qcRes.results[i].color}} 2}%
        \begin{subfigure}%
            {\includegraphics[width=\textwidth]{/{{read.trimRes.readset.r2.qcRes.results[i].file}}} }
        \end{subfigure}
        \end{adjustbox}
        \caption{ {{read.trimRes.readset.r2.qcRes.results[i].name}}}
        {% endif %}
    \end{figure}
{% endfor %}
{% endif %}

{% endfor %}\\

%-------------------- Bowtie Results -------------------%
{%if sample.mappingRes != None%}
\line(1,0){\textwidth} 
\vspace{5mm}

{\Large{Bowtie2} } - Map against \path{ {{sample.reference}} } \\
{{sample.mappingRes.log}}
{%endif%}
%-------------------- Kraken Results -------------------%
{%if sample.krakenRes != None%}
\line(1,0){\textwidth} 
\vspace{5mm}

{\Large{Kraken} } \\

{{sample.krakenRes.log}}


\begin{singlespace}
\begin{verbatim}
{{sample.krakenRes.report}}
\end{verbatim}
\end{singlespace}
{%endif%}
\end{document}