wdecoster / NanoPlot

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

NanoPlot never finishes #282

Closed sulheim closed 2 years ago

sulheim commented 2 years ago

I run NanoPlot 1.28 on WSL on Windows 10. The problem is that NanoPlot never finishes, see output:

NanoPlot --summary sequencing_summary.txt -o NanoPlot_QC --verbose --runtime_until 48 --barcoded -t 2
2021-11-26 11:10:58,207 NanoPlot 1.38.0 started with arguments Namespace(N50=False, alength=False, bam=None, barcoded=True, 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, legacy=None, listcolormaps=False, listcolors=False, loglength=False, maxlength=None, minlength=None, minqual=None, no_N50=False, no_supplementary=False, outdir='NanoPlot_QC', path='NanoPlot_QC/', percentqual=False, pickle=None, plots=['kde', 'dot'], prefix='', raw=False, readtype='1D', runtime_until=48, store=False, summary=['sequencing_summary.txt'], threads=2, title=None, tsv_stats=False, ubam=None, verbose=True)
2021-11-26 11:10:58,220 Python version is: 3.7.4 (default, Aug 13 2019, 20:35:49)  [GCC 7.3.0]
2021-11-26 11:10:58,790 Nanoget: Collecting metrics from summary file sequencing_summary_FAP36333_3c439cf5.txt for 1D sequencing
2021-11-26 11:10:58,793 Nanoget: Extracting metrics per barcode.
2021-11-26 11:10:59,816 Nanoget: Finished collecting statistics from summary file sequencing_summary_FAP36333_3c439cf5.txt
2021-11-26 11:11:00,003 Reduced DataFrame memory usage from 21.37126922607422Mb to 17.278202056884766Mb
2021-11-26 11:11:00,655 Nanoget: Gathered all metrics of 195086 reads
2021-11-26 11:11:00,781 Calculated statistics
2021-11-26 11:11:01,158 Using sequenced read lengths for plotting.
2021-11-26 11:11:01,192 Removing 0 reads generated after 48 hours in the run.
2021-11-26 11:11:01,331 Calculated statistics
2021-11-26 11:11:01,709 Processing unclassified
2021-11-26 11:11:01,735 NanoPlot:  Valid color #4CB391.
2021-11-26 11:11:01,736 NanoPlot:  Valid colormap Greens.
2021-11-26 11:11:01,747 NanoPlot:  Creating length plots for Read length.
2021-11-26 11:11:01,748 NanoPlot:  Using 56532 reads maximum of 174540bp.

It stays here for several hours, until I loose faith and kill the process.

sulheim commented 2 years ago

When I kill the process, the code is stuck here:

^CTraceback (most recent call last):
  File "/home/snorre/miniconda3/bin/NanoPlot", line 10, in <module>
    sys.exit(main())
  File "/home/snorre/miniconda3/lib/python3.7/site-packages/nanoplot/NanoPlot.py", line 97, in main
    make_plots(dfbarc, settings)
  File "/home/snorre/miniconda3/lib/python3.7/site-packages/nanoplot/NanoPlot.py", line 168, in make_plots
    figformat=settings["format"])
  File "/home/snorre/miniconda3/lib/python3.7/site-packages/nanoplotter/nanoplotter_main.py", line 414, in length_plots
    histogram.save(figformat)
  File "/home/snorre/miniconda3/lib/python3.7/site-packages/nanoplotter/plot.py", line 45, in save
    self.save_static(figformat)
  File "/home/snorre/miniconda3/lib/python3.7/site-packages/nanoplotter/plot.py", line 71, in save_static
    f.write(scope.transform(self.fig, format=figformat))
  File "/home/snorre/miniconda3/lib/python3.7/site-packages/kaleido/scopes/plotly.py", line 154, in transform
    figure, format=format, width=width, height=height, scale=scale
  File "/home/snorre/miniconda3/lib/python3.7/site-packages/kaleido/scopes/base.py", line 293, in _perform_transform
    self._ensure_kaleido()
  File "/home/snorre/miniconda3/lib/python3.7/site-packages/kaleido/scopes/base.py", line 192, in _ensure_kaleido
    startup_response_string = self._proc.stdout.readline().decode('utf-8')
KeyboardInterrupt
wdecoster commented 2 years ago

Thanks for reporting this. So it seems to be stuck in a step from kaleido, hmmm, not the first time that this module leads to issues. Similar issues (related to WSL) have been raised at the kaleido issue tracker, e.g. https://github.com/plotly/Kaleido/issues/110, without a fix. I should look into creating the possibility to turn off the use of kaleido to work around this issue.

sulheim commented 2 years ago

Exactly, I was actually scrolling through the options to see if that was possible! Would have been great.

wdecoster commented 2 years ago

I will push a new version one of the next days with a --no_static option to work around this

wdecoster commented 2 years ago

NanoPlot v1.39.0 has the --no_static option and should be available through pip now and through conda soon. As I don't use WSL, please give me feedback if anything doesn't go as expected.

sulheim commented 2 years ago

Hey, sorry for the late reply @wdecoster , but didn't get around to test it before now. Works fine, thanks a lot!