Commit fb8373ab authored by bow's avatar bow
Browse files

Initial report

parent 66bf4e3f
......@@ -30,6 +30,7 @@ from os import path
from jinja2 import Environment, FileSystemLoader
# set locale for digit grouping
locale.setlocale(locale.LC_ALL, "")
......@@ -68,11 +69,15 @@ class LongTable(object):
# filter functions for the jinja environment
def nice_int(num):
def nice_int(num, default="None"):
if num is None:
return default
return locale.format("%i", int(num), grouping=True)
def nice_flt(num):
def nice_flt(num, default="None"):
if num is None:
return default
return locale.format("%.2f", float(num), grouping=True)
......@@ -84,7 +89,7 @@ def natural_sort(inlist):
return inlist
def write_template(summary_file, template_file, logo_file):
def write_template(run, template_file, logo_file):
template_file = path.abspath(path.realpath(template_file))
template_dir = path.dirname(template_file)
......@@ -109,17 +114,74 @@ def write_template(summary_file, template_file, logo_file):
# write tex template for pdflatex
jinja_template = env.get_template(path.basename(template_file))
run.logo = logo_file
render_vars = {
"gentrap": {
"version": "--testing--",
"logo": logo_file,
"run": run,
rendered = jinja_template.render(**render_vars)
print(rendered, file=sys.stdout)
class GentrapLib(object):
def __init__(self, run, sample, name, summary):
assert isinstance(run, GentrapRun)
assert isinstance(sample, GentrapSample) = run
self.sample = sample = name
self._raw = summary
self.flexiprep = summary.get("flexiprep", {})
self.clipping = not self.flexiprep["settings"]["skip_clip"]
self.trimming = not self.flexiprep["settings"]["skip_trim"]
self.is_paired_end = self.flexiprep["settings"]["paired"]
def __repr__(self):
return "{0}(sample=\"{1}\", lib=\"{2}\")".format(
class GentrapSample(object):
def __init__(self, run, name, summary):
assert isinstance(run, GentrapRun) = run = name
self._raw = summary
self.lib_names = sorted(summary["libraries"].keys())
self.libs = \
{l: GentrapLib(, self, l, summary["libraries"][l]) \
for l in self.lib_names}
def __repr__(self):
return "{0}(\"{1}\")".format(self.__class__.__name__,
class GentrapRun(object):
def __init__(self, summary_file):
with open(summary_file, "r") as src:
summary = json.load(src)
self._raw = summary
self.summary_file = summary_file
self.sample_names = sorted(summary["samples"].keys())
self.samples = \
{s: GentrapSample(self, s, summary["samples"][s]) \
for s in self.sample_names}
self.files = summary["gentrap"]["files"]
self.executables = summary["gentrap"]["executables"]
self.settings = summary["gentrap"]["settings"]
self.version = self.settings["version"]
def __repr__(self):
return "{0}(\"{1}\")".format(self.__class__.__name__,
if __name__ == "__main__":
parser = argparse.ArgumentParser()
......@@ -131,4 +193,5 @@ if __name__ == "__main__":
help="Path to main logo file")
args = parser.parse_args()
write_template(args.summary_file, args.template_file, args.logo_file)
run = GentrapRun(args.summary_file)
write_template(run, args.template_file, args.logo_file)
\section{Library "((( )))" Results}
((* include "lib_seqeval.tex" *))
......@@ -43,46 +43,57 @@
\title{\Huge Gentrap: Generic Transcriptome Analysis Pipeline}
%\title{\Huge Gentrap Run Report}
\title{\resizebox{0.7\linewidth}{!}{\itshape Gentrap Run Report}}
\author{LUMC Sequencing Analysis Support Core}
{\LARGE Run Report v((( gentrap.version )))}
{\LARGE version ((( run.version )))}
\includegraphics[width=0.8\textwidth]{((( gentrap.logo )))}
\includegraphics[width=0.8\textwidth]{((( run.logo )))}
This document outlines the results obtained from running Gentrap, a generic
pipeline for transcriptome analysis.
% TODO: contents ~ preferrably in modules!
((* include "test.tex" *))
((* for sample in run.samples.values() *))
((* include "sample.tex" *))
((* endfor *))
\section{About Gentrap}
\part{About Gentrap}
The Generic Transcript Analysis Pipeline (Gentrap) aims to to be a
generic pipeline for analyzing transcripts from RNA-seq experiments.
The Generic Transcriptome Analysis Pipeline (Gentrap) is a
generic pipeline for analyzing transcripts from RNA-seq experiments. \\
Gentrap was developed by Wibowo Arindrarto (\href{}{})
based on raw scripts written by Jeroen Laros
(\href{}{}) and
Peter-Bram 't Hoen
(\href{}{}) as part of the
\href{https://git.lumc/nl/biopet/biopet}{Biopet framework}. \\
The Biopet framework is developed by the
\href{}{Sequencing Analysis Support Core} of the
\href{}{Leiden University Medical Center}, by extending the
\href{http://}{Queue framework}.
Please see the respective web sites for licensing information.
\part{Sample "((( )))" Results}
Hello from module ((( sample ))) \\
((* for lib in sample.libs.values() *))
((* include "lib.tex" *))
((* endfor *))
Supports Markdown
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