wdecoster / NanoPlot

Plotting scripts for long read sequencing data

Home Page:http://nanoplot.bioinf.be

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ValueError: Transform failed with error code in NanoPlot

hwlim opened this issue · comments

Hi

I see that this error has been reported before, but I am seeing this in my recent installation.
I get the same error in running for fastq files.
I also updated plotly to v4.14, and nanoplot is 1.34.1.
Any suggestion to correct it?

Also, as a walkaround, is there an option to skip plotly and generate static image directly?

Thank you.

  • Lim

2021-03-15 19:00:06,255 Python version is: 3.6.3 (default, Dec 18 2019, 14:21:37) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
2021-03-15 19:00:06,257 NanoPlot: valid output format png
2021-03-15 19:00:06,290 Nanoget: Starting to collect statistics from bam file ../Minimap/align.bam.
2021-03-15 19:00:06,328 Nanoget: Bam file ../Minimap/align.bam contains 1756525 mapped and 55450 unmapped reads.
2021-03-15 19:02:57,189 Nanoget: bam ../Minimap/align.bam contains 974280 primary alignments.
2021-03-15 19:02:58,510 Reduced DataFrame memory usage from 138.44309616088867Mb to 113.35615921020508Mb
2021-03-15 19:02:59,516 Nanoget: Gathered all metrics of 974280 reads
2021-03-15 19:03:00,392 Calculated statistics
2021-03-15 19:03:00,394 Using sequenced read lengths for plotting.
2021-03-15 19:03:00,430 Using log10 scaled read lengths.
2021-03-15 19:03:00,544 NanoPlot: Valid color #4CB391.
2021-03-15 19:03:00,545 NanoPlot: Valid colormap Greens.
2021-03-15 19:03:00,600 NanoPlot: Creating length plots for Read length.
2021-03-15 19:03:00,601 NanoPlot: Using 974280 reads maximum of 107656bp.
2021-03-15 19:03:15,725 Transform failed with error code 1: Failed to serialize document: Uncaught
Traceback (most recent call last):
File "/usr/local/python/3.6.3/lib/python3.6/site-packages/nanoplot/NanoPlot.py", line 105, in main
plots = make_plots(datadf, settings)
File "/usr/local/python/3.6.3/lib/python3.6/site-packages/nanoplot/NanoPlot.py", line 159, in make_plots
title=settings["title"])
File "/usr/local/python/3.6.3/lib/python3.6/site-packages/nanoplotter/nanoplotter_main.py", line 328, in length_plots
plots.append(dynamic_histogram(array=array, name=name, path=path, title=title, color=color))
File "/usr/local/python/3.6.3/lib/python3.6/site-packages/nanoplotter/nanoplotter_main.py", line 351, in dynamic_histogram
dynhist.save()
File "/usr/local/python/3.6.3/lib/python3.6/site-packages/nanoplotter/plot.py", line 42, in save
self.save_static()
File "/usr/local/python/3.6.3/lib/python3.6/site-packages/nanoplotter/plot.py", line 60, in save_static
f.write(scope.transform(self.fig, format="png"))
File "/usr/local/python/3.6.3/lib/python3.6/site-packages/kaleido/scopes/plotly.py", line 163, in transform
code=code, message=message
ValueError: Transform failed with error code 1: Failed to serialize document: Uncaught

Are you sure this is from a recent NanoPlot version? In the log file, the first line should mention the version identifier and arguments... or did you delete that?

Sorry for the confusion.
Here is the full log and python module version list.
Thank you.

2021-03-16 11:29:50,474 NanoPlot 1.34.1 started with arguments Namespace(N50=False, alength=False, bam=['../Minimap/align.bam'], barcoded=False, color='#4CB391', colormap='Greens', cram=None, downsample=None, dpi=100, drop_outliers=False, fasta=None, fastq=None, fastq_minimal=None, fastq_rich=None, feather=None, font_scale=1, format='png', hide_stats=False, huge=False, info_in_report=False, listcolormaps=False, listcolors=False, loglength=True, maxlength=None, minlength=None, minqual=None, no_N50=False, no_supplementary=False, outdir='.', path='./bam', percentqual=False, pickle=None, plots=['kde', 'dot'], prefix='bam', raw=False, readtype='1D', runtime_until=None, store=False, summary=None, threads=4, title='bam_nano_plot', tsv_stats=False, ubam=None, verbose=False)
2021-03-16 11:29:50,474 Python version is: 3.6.3 (default, Dec 18 2019, 14:21:37) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
2021-03-16 11:29:50,475 NanoPlot: valid output format png
2021-03-16 11:29:50,500 Nanoget: Starting to collect statistics from bam file ../Minimap/align.bam.
2021-03-16 11:29:50,582 Nanoget: Bam file ../Minimap/align.bam contains 1756525 mapped and 55450 unmapped reads.
2021-03-16 11:33:48,293 Nanoget: bam ../Minimap/align.bam contains 974280 primary alignments.
2021-03-16 11:33:50,236 Reduced DataFrame memory usage from 138.44309616088867Mb to 113.35615921020508Mb
2021-03-16 11:33:51,193 Nanoget: Gathered all metrics of 974280 reads
2021-03-16 11:33:51,918 Calculated statistics
2021-03-16 11:33:51,920 Using sequenced read lengths for plotting.
2021-03-16 11:33:51,964 Using log10 scaled read lengths.
2021-03-16 11:33:52,079 NanoPlot: Valid color #4CB391.
2021-03-16 11:33:52,079 NanoPlot: Valid colormap Greens.
2021-03-16 11:33:52,148 NanoPlot: Creating length plots for Read length.
2021-03-16 11:33:52,149 NanoPlot: Using 974280 reads maximum of 107656bp.
2021-03-16 11:34:39,581 Transform failed with error code 1: Failed to serialize document: Uncaught
Traceback (most recent call last):
File "/usr/local/python/3.6.3/lib/python3.6/site-packages/nanoplot/NanoPlot.py", line 105, in main
plots = make_plots(datadf, settings)
File "/usr/local/python/3.6.3/lib/python3.6/site-packages/nanoplot/NanoPlot.py", line 159, in make_plots
title=settings["title"])
File "/usr/local/python/3.6.3/lib/python3.6/site-packages/nanoplotter/nanoplotter_main.py", line 328, in length_plots
plots.append(dynamic_histogram(array=array, name=name, path=path, title=title, color=color))
File "/usr/local/python/3.6.3/lib/python3.6/site-packages/nanoplotter/nanoplotter_main.py", line 351, in dynamic_histogram
dynhist.save()
File "/usr/local/python/3.6.3/lib/python3.6/site-packages/nanoplotter/plot.py", line 42, in save
self.save_static()
File "/usr/local/python/3.6.3/lib/python3.6/site-packages/nanoplotter/plot.py", line 60, in save_static
f.write(scope.transform(self.fig, format="png"))
File "/usr/local/python/3.6.3/lib/python3.6/site-packages/kaleido/scopes/plotly.py", line 163, in transform
code=code, message=message
ValueError: Transform failed with error code 1: Failed to serialize document: Uncaught

Could you try again using NanoPlot v1.35.0? It's now available through pip. If you still get the same error we can fix it quite easily I think.
(@iliasbukraa maybe we need another except in the save_static() method...)

Thanks a lot. I'll try and keep you posted!

Hi

I think I get the same error:

=====================
/usr/local/python/3.6.3/lib/python3.6/site-packages/ipykernel/kernelbase.py:16: VisibleDeprecationWarning: zmq.eventloop.minitornado is deprecated in pyzmq 14.0 and will be removed.
Install tornado itself to use zmq with the tornado IOLoop.

from jupyter_client.session import utcnow as now

If you read this then NanoPlot 1.35.1 has crashed :-(
Please try updating NanoPlot and see if that helps...

If not, please report this issue at https://github.com/wdecoster/NanoPlot/issues
If you could include the log file that would be really helpful.
Thanks!

Traceback (most recent call last):
File "/usr/local/python/3.6.3/bin/NanoPlot", line 11, in
sys.exit(main())
File "/usr/local/python/3.6.3/lib/python3.6/site-packages/nanoplot/NanoPlot.py", line 106, in main
plots = make_plots(datadf, settings)
File "/usr/local/python/3.6.3/lib/python3.6/site-packages/nanoplot/NanoPlot.py", line 163, in make_plots
title=settings["title"])
File "/usr/local/python/3.6.3/lib/python3.6/site-packages/nanoplotter/nanoplotter_main.py", line 417, in length_plots
histogram.save()
File "/usr/local/python/3.6.3/lib/python3.6/site-packages/nanoplotter/plot.py", line 44, in save
self.save_static()
File "/usr/local/python/3.6.3/lib/python3.6/site-packages/nanoplotter/plot.py", line 65, in save_static
f.write(scope.transform(self.fig, format="png"))
File "/usr/local/python/3.6.3/lib/python3.6/site-packages/kaleido/scopes/plotly.py", line 163, in transform
code=code, message=message
ValueError: Transform failed with error code 1: Failed to serialize document: Uncaught

Thanks for letting us know, we will look into this matter and make sure to fix it in the following days.

Thanks for your patience, the error should be fixed in NanoPlot v1.35.3, which is now available through pip. I cannot reproduce your error, so I can't test if it actually helps. Please let us know if you have further issues.