From 519923a06c5866acae2afbe1012de138e3f33e10 Mon Sep 17 00:00:00 2001 From: Blaise Li <blaise.li__git@nsup.org> Date: Tue, 9 Jul 2019 15:21:03 +0200 Subject: [PATCH] Unset use of LaTeX, fix read type examination. --- libhts/libhts.py | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/libhts/libhts.py b/libhts/libhts.py index 07b5698..6631039 100644 --- a/libhts/libhts.py +++ b/libhts/libhts.py @@ -20,18 +20,19 @@ from scipy.stats.stats import pearsonr, linregress from scipy.stats.mstats import gmean import matplotlib as mpl import matplotlib.pyplot as plt +# TODO: set this at the "correct" place # https://stackoverflow.com/a/42768093/1878788 -from matplotlib.backends.backend_pgf import FigureCanvasPgf -mpl.backend_bases.register_backend('pdf', FigureCanvasPgf) -TEX_PARAMS = { - "text.usetex": True, # use LaTeX to write all text - "pgf.rcfonts": False, # Ignore Matplotlibrc - "pgf.texsystem": "lualatex", # hoping to avoid memory issues - "pgf.preamble": [ - r'\usepackage{color}' # xcolor for colours - ] -} -mpl.rcParams.update(TEX_PARAMS) +#from matplotlib.backends.backend_pgf import FigureCanvasPgf +#mpl.backend_bases.register_backend('pdf', FigureCanvasPgf) +#TEX_PARAMS = { +# "text.usetex": True, # use LaTeX to write all text +# "pgf.rcfonts": False, # Ignore Matplotlibrc +# "pgf.texsystem": "lualatex", # hoping to avoid memory issues +# "pgf.preamble": [ +# r'\usepackage{color}' # xcolor for colours +# ] +#} +#mpl.rcParams.update(TEX_PARAMS) import seaborn as sns # from rpy2.robjects import r, pandas2ri, Formula, StrVector # as_df = r("as.data.frame") @@ -275,11 +276,22 @@ def aligner2min_mapq(aligner, wildcards): What minimal MAPQ value should a read have to be considered uniquely mapped? See <https://sequencing.qcfail.com/articles/mapq-values-are-really-useful-but-their-implementation-is-a-mess/>. """ + mapping_type = None try: mapping_type = wildcards.mapping_type except AttributeError: - mapping_type = wildcards.mapped_type - if mapping_type.startswith("unique_"): + pass + if mapping_type is None: + try: + mapping_type = wildcards.mapped_type + except AttributeError: + pass + if mapping_type is None: + try: + mapping_type = wildcards.read_type + except AttributeError: + pass + if mapping_type is None or mapping_type.startswith("unique_"): if aligner == "hisat2": return "-Q 60" elif aligner == "bowtie2": -- GitLab