wdecoster / NanoPlot

Plotting scripts for long read sequencing data
http://nanoplot.bioinf.be
MIT License
407 stars 48 forks source link

No static plots are saved due to some kaleido problem #281

Open raysteven opened 2 years ago

raysteven commented 2 years ago

Hello, I tried using NanoPlot this morning and it works perfectly. But when I try to reproduce my work this evening, it shows this error.

2021-11-18 15:49:13,858 NanoPlot 1.38.1 started with arguments Namespace(N50=False, alength=False, bam=None, barcoded=False, color='#4CB391', colormap='Greens', cram=None, downsample=None, dpi=100, drop_outliers=False, fasta=None, fastq=['all_reads_test.fastq'], fastq_minimal=None, fastq_rich=None, feather=None, font_scale=1, format='png', hide_stats=False, huge=False, info_in_report=False, legacy=None, listcolormaps=False, listcolors=False, loglength=False, maxlength=None, minlength=None, minqual=None, no_N50=False, no_supplementary=False, outdir='all_reads_test_preQC', path='all_reads_test_preQC/', percentqual=False, pickle=None, plots=['kde', 'dot'], prefix='', raw=False, readtype='1D', runtime_until=None, store=False, summary=None, threads=4, title=None, tsv_stats=False, ubam=None, verbose=False)
2021-11-18 15:49:13,859 Python version is: 3.8.10 (default, Sep 28 2021, 16:10:42)  [GCC 9.3.0]
2021-11-18 15:49:13,908 Nanoget: Starting to collect statistics from plain fastq file.
2021-11-18 15:50:41,785 Reduced DataFrame memory usage from 5.318733215332031Mb to 3.5458221435546875Mb
2021-11-18 15:50:41,868 Nanoget: Gathered all metrics of 232379 reads
2021-11-18 15:50:41,964 Calculated statistics
2021-11-18 15:50:41,964 Using sequenced read lengths for plotting.
2021-11-18 15:50:41,972 NanoPlot:  Valid color #4CB391.
2021-11-18 15:50:41,973 NanoPlot:  Valid colormap Greens.
2021-11-18 15:50:41,980 NanoPlot:  Creating length plots for Read length.
2021-11-18 15:50:41,981 NanoPlot:  Using 232379 reads maximum of 107539bp.
2021-11-18 15:50:49,652 No static plots are saved due to some kaleido problem:
2021-11-18 15:50:49,652 Transform failed with error code 1: Failed to serialize document: Uncaught
2021-11-18 15:50:56,014 No static plots are saved due to some kaleido problem:
2021-11-18 15:50:56,015 Transform failed with error code 1: Failed to serialize document: Uncaught

I'm running NanoPlot on a WSL with Ubuntu 20

wdecoster commented 2 years ago

Hi,

Is there a difference in internet connection/firewall between the morning and evening test? Regardless of the error, the HTML output should be created, but the (identical) PNGs would be missing.

Wouter

raysteven commented 2 years ago

I think what's different with the internet connection is the latency. Just now I try it once again and it shows a different error.

If you read this then NanoPlot 1.38.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 "/home/ray/.local/lib/python3.8/site-packages/nanoplotter/plot.py", line 45, in save
    self.save_static(figformat)
  File "/home/ray/.local/lib/python3.8/site-packages/nanoplotter/plot.py", line 71, in save_static
    f.write(scope.transform(self.fig, format=figformat))
  File "/home/ray/.local/lib/python3.8/site-packages/kaleido/scopes/plotly.py", line 161, in transform
    raise ValueError(
ValueError: Transform failed with error code 1: Failed to serialize document: Uncaught

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ray/.local/bin/NanoPlot", line 8, in <module>
    sys.exit(main())
  File "/home/ray/.local/lib/python3.8/site-packages/nanoplot/NanoPlot.py", line 104, in main
    plots = make_plots(datadf, settings)
  File "/home/ray/.local/lib/python3.8/site-packages/nanoplot/NanoPlot.py", line 161, in make_plots
    nanoplotter.length_plots(
  File "/home/ray/.local/lib/python3.8/site-packages/nanoplotter/nanoplotter_main.py", line 414, in length_plots
    histogram.save(figformat)
  File "/home/ray/.local/lib/python3.8/site-packages/nanoplotter/plot.py", line 49, in save
    os.remove(p)
FileNotFoundError: [Errno 2] No such file or directory: 'all_reads_test_preQC/WeightedHistogramReadlength.png'

When this error comes up the HTML output is not created, it's just the log file in the output folder.

wdecoster commented 2 years ago

NanoPlot v1.39.0 has a --no_static option and should be available through pip now and through conda soon, in case you don't want the png images or have trouble generating them.

awgymer commented 2 years ago

I am having this issue too and I think it may be due to a firewall on the cluster where it runs (which I am unlikely to be able to change). Is there any recommended workaround or solution besides the --no-static option?

drchriscole commented 2 years ago

I'm having the same issue. I agree with @awgymer is another solution possible? Previous versions of NanoPlot don't seem to have this problem.

callumparr commented 2 years ago

OK it seems my issue with NanoComp is stemming from the NanoPlotter / NanoPlot. It be great to export static plots for presentations. It's a bit of a faff to open the HTML plotly and export each time. https://github.com/wdecoster/nanocomp/issues/53#issue-1199060875