From 63762a0be3bb571718f2798be2ef04640515aa07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Pic=C3=B3n=20Cossio?= Date: Fri, 27 Oct 2023 10:13:27 -0700 Subject: [PATCH] --only-report option added (#346) * --only-report option added * --only-report option added for barcoded too --- .DS_Store | Bin 0 -> 6148 bytes nanoplot/NanoPlot.py | 4 ++++ nanoplot/utils.py | 6 +++++ nanoplotter/plot.py | 53 +++++++++++++++++++++++-------------------- 4 files changed, 38 insertions(+), 25 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..8a8e854c4517ff2ddb9fc6aa823225aecf8af375 GIT binary patch literal 6148 zcmeHK!AiqG5Z!I7CKMqDg&qT53%0cs#7l_v12m!sm6(vC!I&*cY7V84v;L4@;`cbS zyAez6!HYSSqgoyWWn#6h0>wWM>v$eIoV;Dx;xbq%G=@mgS z%iSQm!QQ11Nm$!Kcok1d-`YDBX%WQfB$EkoG=Y%Y>o|=>>55qz}ssx4U9Fbd-1X~5$OX& z)Y)|wAu&J<5CfaefIjz(_NFhC)<+Bw1HWbf&j%Y6(a~5blt%|Nczwk279tAR_?AGl zH98tAg)jobRVtuL<@$-iRXX@>9p`AQ6smN_<;?IMJu}xY6fS26zb(TVcN9`f3=jj$ z3^Y~O!uo%<{{6q4L_K1F7}zKVcx&v9U09N?tt*SeT5E&egQ8$urSK~S3|WdH7E5sl bR0{ZQGyolql|t}<&_zJfKn*eQrwn`o'.format(urlquote(string)) def save(self, settings): - if self.html: - with open(self.path, "w") as html_out: - html_out.write(self.html) - if not settings["no_static"]: - try: - for fmt in settings["format"]: - self.save_static(fmt) - except (AttributeError, ValueError) as e: - p = os.path.splitext(self.path)[0] + ".png" - if os.path.exists(p): - os.remove(p) + if not(self.only_report): + if self.html: + with open(self.path, "w") as html_out: + html_out.write(self.html) + if not settings["no_static"]: + try: + for fmt in settings["format"]: + self.save_static(fmt) + except (AttributeError, ValueError) as e: + p = os.path.splitext(self.path)[0] + ".png" + if os.path.exists(p): + os.remove(p) - logging.warning("No static plots are saved due to some kaleido problem:") - logging.warning(e) + logging.warning("No static plots are saved due to some kaleido problem:") + logging.warning(e) - elif self.fig: - # if settings["format"] is a list, save the figure in all formats - if isinstance(settings["format"], list): - for fmt in settings["format"]: - self.fig.savefig( - fname=self.path + "." + fmt, - format=fmt, - bbox_inches="tight", - ) + elif self.fig: + # if settings["format"] is a list, save the figure in all formats + if isinstance(settings["format"], list): + for fmt in settings["format"]: + self.fig.savefig( + fname=self.path + "." + fmt, + format=fmt, + bbox_inches="tight", + ) + else: + self.fig.savefig(fname=self.path, format=settings["format"], bbox_inches="tight") else: - self.fig.savefig(fname=self.path, format=settings["format"], bbox_inches="tight") - else: - sys.exit("No method to save plot object: no html or fig defined.") + sys.exit("No method to save plot object: no html or fig defined.") def show(self): if self.fig: