\documentclass[11pt, a4paper, landscape]{article}

\pdfobjcompresslevel=0

% Graphics, plotting, images:
\usepackage{graphicx}

% Tweaking text borders:
\usepackage[top=0.89cm, bottom=4cm, left=1.27cm, right=1.31cm]{geometry}
\setlength{\headsep}{0.6cm}

% Making hyperlinks:
\usepackage[colorlinks=true, urlcolor=hyperlinkblue, linkcolor=black]{hyperref}

% Making headers/footers:
\usepackage{fancyhdr}
\setlength{\headheight}{100pt}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}% Remove header rule
\fancyhead[LE,LO]{\includegraphics[width=35mm]{{#LOGO#}}\\\hrulefill\\~}
\fancyhead[CE,CO]{~\\\hrulefill\\~}
\fancyhead[RE,RO]{ \nouppercase{\leftmark\ | Page \thepage\ of \pageref{LastPage}}\\\hrulefill\\ {\lightfont \fontsize{10pt}{10pt}\selectfont {#SAMPLE_NAME#} | {#PANEL#} | \today}}

% tables spanning multiple pages
\usepackage{longtable}
\usepackage{array}
\newcolumntype{L}{>{\centering\arraybackslash}m{2.3cm}}
\newcolumntype{W}{>{\arraybackslash}m{18cm}}

\usepackage{booktabs}

%font setup
%\usepackage[sfdefault, medium]{roboto}
\usepackage{helvet}
\renewcommand\familydefault{\sfdefault}
\usepackage[T1]{fontenc}
\newcommand{\lightfont}{\fontseries{l}\selectfont}
\newcommand{\thinfont}{\fontseries{t}\selectfont}
\newcommand{\mediumfont}{\fontseries{m}\selectfont}
\newcommand{\boldfont}{\fontseries{b}\selectfont}

%multiple columns
\usepackage{multicol}
\setlength\columnsep{5mm}

%colors
\usepackage[table]{xcolor}
\definecolor{gray1}{HTML}{EDEDED}
\definecolor{gray2}{HTML}{EAEAEA}
\definecolor{lightblue1}{HTML}{E0F1F5}
\definecolor{darkblue1}{HTML}{2B8196}
\definecolor{hyperlinkblue}{HTML}{1F759B}

%tables
\usepackage{tabularx}
\usepackage{array}
\renewcommand{\arraystretch}{1.5}

\let\oldlongtable\longtable
\let\endoldlongtable\endlongtable
\renewenvironment{longtable}{\rowcolors{2}{lightblue1}{white}\oldlongtable} {
\endoldlongtable} %sets color scheme for long tables

%last page (for page count)
\usepackage{lastpage}

%change of caption styles
\usepackage[font=small]{caption}
\captionsetup{justification=raggedright,singlelinecheck=false}
\captionsetup[table]{ labelfont=it,textfont={it}}
\captionsetup[figure]{labelfont={it}}

%change of chapter styles
\usepackage{titlesec}
\titleformat{\section}
  {\normalfont \fontsize{16pt}{16pt}\selectfont}{\thesection}{1em}{}

\begin{document}

\noindent
{\fontsize{16pt}{16pt}\selectfont \color{darkblue1}{\textbf{{#SAMPLE_NAME#}}}}

\medskip
\noindent
{\lightfont {#PANEL#} | \today}

\medskip
\noindent Results have been filtered to exclude any putative variant detected below AF = {{#AF_THRESHOLD#}}. Variants below this threshold may be inspected manually in the unfiltered VCF files.

\section{QC information}

\begin{multicols}{2}
\noindent
{\color{darkblue1} \fontsize{14pt}{14pt}\selectfont Amplicon performance}\\

\noindent
\lightfont
\rowcolors{2}{white}{gray1}
\begin{tabularx}{\columnwidth}{X l}

Total reads: & \textbf{{#TOTAL_READS#}} \\
Aligned reads: & \textbf{{#ALIGNED_READS#}} \textbf{({#PCT_ALIGNED_READS#})} \\
Aligned bases (on target):& \textbf{{#ALIGN_BASES_ONTARGET#}} \\
Mean coverage:& \textbf{{#COV_MEAN#}} \\
Threshold coverage (20\% of Mean): & \textbf{{#COV_20#}} \\
Coverage uniformity (\% bases covered above 20\% of Mean): & \textbf{{#COV_UNI#}}  \\
\end{tabularx}

\columnbreak

\noindent
\mediumfont
{\color{darkblue1} \fontsize{14pt}{14pt}\selectfont  Per amplicon coverage}\\

\noindent
\lightfont
\rowcolors{2}{gray1}{white}
\begin{tabularx}{\columnwidth}{X l}

No. of amplicons:& \textbf{{{#ALL_AMPLICONS#}}} \\
No. of amplicons with 100\% coverage:& \textbf{{#COVERED_AMPLICONS#} ({#PCT_COV#})} \\
\end{tabularx}
\end{multicols}


{#BAD_AMPLICON_TABLE#}

\newpage
\newgeometry{left=1.23cm, bottom=1.01cm, right=1.27cm, top=3.74cm}
\setlength{\headsep}{0.5cm}

\renewcommand{\arraystretch}{1.4}
\section{Annotated variants}
\footnotesize

{\captionof{table}{Legend}
\noindent
\rowcolors{2}{gray2}{white}
\begin{oldlongtable}[l]{l W}
\rowcolor{gray2}
CHROM & Chromosome\\
POS & Position\\
REF & Reference base\\
ALT & Alternative base (i.e., variant)\\
AF & Allele frequency, also called "variant frequency". For the GATK caller, empirical AF is computed as the ratio of allele depth (AD) to read depth (DP). LoFreq similarly computes AF as the frequency of variant reads. \\
DP & Filtered read depth\\
AD & Allele depth\\
FS & FisherStrand (Phred-scaled p-value using Fisher's Exact Test to detect strand bias (the variation being seen on only the forward or only the reverse strand) in the reads.  More bias is indicative of false positive calls. Be wary of SNP with FS > 60.0 and an indel with FS > 200.0.)\\
DP4 & Number of 1) forward ref alleles; 2) reverse ref; 3) forward non-ref; 4) reverse non-ref alleles, used in variant calling. Sum can be smaller than DP because low-quality bases are not counted.\\
SB & Strand bias\\
GENE & Affected gene\\
ID & Variant identity\\
AA & Amino acid change\\
\end{oldlongtable}
{
\addtocounter{table}{-1}}}
\newpage

{#VCF_TABLES#}

\end{document}
