Skip to content

Commit 068c2ad

Browse files
author
Tobias Andermann
committed
fixed plotting ValueError: Image too large
1 parent db7a28c commit 068c2ad

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

secapr/plot_sequence_yield.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,19 @@ def plot_contig_yield(contig_input_file,outdir,alignment_folder=False,read_cov_f
157157

158158
if not read_cov_file:
159159
if not alignment_folder:
160-
fig.savefig(os.path.join(outdir,'contig_yield_overview.png'),bbox_inches='tight', dpi = 500)
160+
filename = 'contig_yield_overview.png'
161161
else:
162-
fig.savefig(os.path.join(outdir,'contig_alignment_yield_overview.png'),bbox_inches='tight', dpi = 500)
162+
filename = 'contig_alignment_yield_overview.png'
163163
else:
164-
fig.savefig(os.path.join(outdir,'contig_alignment_read_cov_yield_overview.png'),bbox_inches='tight', dpi = 500)
164+
filename = 'contig_alignment_read_cov_yield_overview.png'
165+
166+
# try to print in high res, if too large, don't set quality requirement dpi
167+
try:
168+
fig.savefig(os.path.join(outdir,filename),bbox_inches='tight', dpi = 500)
169+
except ValueError:
170+
fig.savefig(os.path.join(outdir,filename),bbox_inches='tight')
171+
172+
165173

166174
def main(args):
167175
target_contig_folder = args.extracted_contigs

0 commit comments

Comments
 (0)