From 1177db98d60f3bb6932814b451810cf619f6e535 Mon Sep 17 00:00:00 2001 From: Simon Shen Date: Mon, 22 Apr 2024 21:46:57 -0400 Subject: [PATCH 1/2] change back to original matplotlib rcParams --- umi_tools/whitelist_methods.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/umi_tools/whitelist_methods.py b/umi_tools/whitelist_methods.py index 6c93b257..8d022bc4 100644 --- a/umi_tools/whitelist_methods.py +++ b/umi_tools/whitelist_methods.py @@ -8,11 +8,11 @@ import itertools import collections import matplotlib +# change back to original user params after plotting +_rcParams_orig = matplotlib.rcParams.copy() import copy import regex -# require to run on systems with no X11 -matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.lines as mlines @@ -100,6 +100,9 @@ def getKneeEstimateDensity(cell_barcode_counts, if plotfile_prefix: + # require to run on systems with no X11 + matplotlib.use('Agg') + # colour-blind friendly colours - https://gist.github.com/thriveth/8560036 CB_color_cycle = ['#377eb8', '#ff7f00', '#4daf4a', '#f781bf', '#a65628', '#984ea3', @@ -244,6 +247,8 @@ def getKneeEstimateDensity(cell_barcode_counts, outf.write("%s\t%s\n" % (local_mins_count, threshold_type)) + matplotlib.rcParams.update(_rcParams_orig) + return final_barcodes From ef41a57a59a649f35fe400ba9a6bde80388bfeab Mon Sep 17 00:00:00 2001 From: Simon Shen Date: Tue, 23 Apr 2024 22:22:23 -0400 Subject: [PATCH 2/2] capture recent params --- umi_tools/whitelist_methods.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/umi_tools/whitelist_methods.py b/umi_tools/whitelist_methods.py index 8d022bc4..4f075094 100644 --- a/umi_tools/whitelist_methods.py +++ b/umi_tools/whitelist_methods.py @@ -8,8 +8,6 @@ import itertools import collections import matplotlib -# change back to original user params after plotting -_rcParams_orig = matplotlib.rcParams.copy() import copy import regex @@ -100,6 +98,8 @@ def getKneeEstimateDensity(cell_barcode_counts, if plotfile_prefix: + # change back to original user params after plotting + _rcParams_orig = matplotlib.rcParams.copy() # require to run on systems with no X11 matplotlib.use('Agg')