wdecoster / NanoPlot

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

AttributeError: PolyCollection.set() got an unexpected keyword argument 'stat_func' #347

Closed mjfos2r closed 8 months ago

mjfos2r commented 11 months ago

Hello, I am attempting to run some QC checks on a sequencing run in progress. I have cat'd all of my fastq files for two barcodes into two files containing all base called reads. I attempted to run NanoPlot but ended up with a crash. I will attach my log file below.

output of uname -a:

Darwin MGB031262 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct  9 21:28:31 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T8112 arm64

output of system_profiler SPHardwareDataType:

$system_profiler SPHardwareDataType 
Hardware:

    Hardware Overview:

      Model Name: MacBook Pro
      Model Identifier: Mac14,7
      Model Number: MNEH3LL/A
      Chip: Apple M2
      Total Number of Cores: 8 (4 performance and 4 efficiency)
      Memory: 8 GB
      System Firmware Version: 10151.41.12
      OS Loader Version: 10151.41.12

My input data is two files for each of my two barcodes. barcode01_raw_all.fastq is 2.3G and 3088000 lines barcode02_raw_all.fastq is 4.4G and 7632000 lines

The command I executed was:

NanoPlot -t 8 --verbose --fastq ../reads/raw/barcode01_raw_all.fastq ../reads/raw/barcode02_raw_all.fastq --plots dot --legacy hex

and received the following log file:

$cat NanoPlot_20231109_1322.log
2023-11-09 13:22:26,513 NanoPlot 1.42.0 started with arguments Namespace(threads=8, verbose=True, store=False, raw=False, huge=False, outdir='.', no_static=False, prefix='', tsv_stats=False, only_report=False, info_in_report=False, maxlength=None, minlength=None, drop_outliers=False, downsample=None, loglength=False, percentqual=False, alength=False, minqual=None, runtime_until=None, readtype='1D', barcoded=False, no_supplementary=False, color='#4CB391', colormap='Greens', format=['png'], plots=['dot'], legacy=['hex'], listcolors=False, listcolormaps=False, no_N50=False, N50=False, title=None, font_scale=1, dpi=100, hide_stats=False, fastq=['../reads/raw/barcode01_raw_all.fastq', '../reads/raw/barcode02_raw_all.fastq'], fasta=None, fastq_rich=None, fastq_minimal=None, summary=None, bam=None, ubam=None, cram=None, pickle=None, feather=None, path='./')
2023-11-09 13:22:26,513 Python version is: 3.11.6 (main, Oct  2 2023, 20:46:14) [Clang 14.0.3 (clang-1403.0.22.14.1)]
2023-11-09 13:23:38,619 Nanoget: Gathered all metrics of 2680000 reads
2023-11-09 13:23:39,418 Calculated statistics
2023-11-09 13:23:39,419 Using sequenced read lengths for plotting.
2023-11-09 13:23:39,458 NanoPlot:  Valid color #4CB391.
2023-11-09 13:23:39,458 NanoPlot:  Valid colormap Greens.
2023-11-09 13:23:39,493 NanoPlot:  Creating length plots for Read length.
2023-11-09 13:23:39,493 NanoPlot:  Using 2680000 reads maximum of 139773bp.
2023-11-09 13:23:40,396 Saved ./WeightedHistogramReadlength  as png (or png for --legacy)
2023-11-09 13:23:40,927 Saved ./WeightedLogTransformed_HistogramReadlength  as png (or png for --legacy)
2023-11-09 13:23:41,393 Saved ./Non_weightedHistogramReadlength  as png (or png for --legacy)
2023-11-09 13:23:41,916 Saved ./Non_weightedLogTransformed_HistogramReadlength  as png (or png for --legacy)
2023-11-09 13:23:43,037 Saved ./Yield_By_Length  as png (or png for --legacy)
2023-11-09 13:23:43,039 Created length plots
2023-11-09 13:23:43,052 NanoPlot: Creating Read lengths vs Average read quality plots using 2680000 reads.
2023-11-09 13:23:43,923 Saved ./LengthvsQualityScatterPlot_dot  as png (or png for --legacy)
2023-11-09 13:23:44,138 NanoPlot: Creating Read lengths vs Average read quality legacy plots using 10000 reads.
2023-11-09 13:23:44,210 PolyCollection.set() got an unexpected keyword argument 'stat_func'
Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.11/site-packages/nanoplot/NanoPlot.py", line 110, in main
    plots = make_plots(datadf, settings)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/nanoplot/NanoPlot.py", line 179, in make_plots
    nanoplotter.scatter(
  File "/opt/homebrew/lib/python3.11/site-packages/nanoplotter/nanoplotter_main.py", line 182, in scatter
    plots_made += scatter_legacy(
                  ^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/nanoplotter/nanoplotter_main.py", line 258, in scatter_legacy
    plot = sns.jointplot(
           ^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/seaborn/axisgrid.py", line 2311, in jointplot
    grid.plot_joint(plt.hexbin, **joint_kws)
  File "/opt/homebrew/lib/python3.11/site-packages/seaborn/axisgrid.py", line 1828, in plot_joint
    func(self.x, self.y, **kwargs)
  File "/opt/homebrew/lib/python3.11/site-packages/matplotlib/pyplot.py", line 3172, in hexbin
    __ret = gca().hexbin(
            ^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/matplotlib/__init__.py", line 1465, in inner
    return func(ax, *map(sanitize_sequence, args), **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/matplotlib/axes/_axes.py", line 5108, in hexbin
    collection._internal_update(kwargs)
  File "/opt/homebrew/lib/python3.11/site-packages/matplotlib/artist.py", line 1219, in _internal_update
    return self._update_props(
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/matplotlib/artist.py", line 1193, in _update_props
    raise AttributeError(
AttributeError: PolyCollection.set() got an unexpected keyword argument 'stat_func'

Thank you for your help! Let me know if you need any additional information.

mjfos2r commented 11 months ago

update: changing plot to KDE and omitting --legacy hex allows for successful execution.

wdecoster commented 11 months ago

This looks pretty similar to https://github.com/wdecoster/NanoPlot/issues/222. Please try downgrading your seaborn installation to 0.10.1.