rrazaghi / modbamtools

Set of tools to manipulate and visualize modified base bam files
Apache License 2.0
49 stars 4 forks source link

ValueError: If mode is 'interp', window_length must be less than or equal to the size of x. #28

Open rl4940 opened 1 year ago

rl4940 commented 1 year ago

My code is this: modbamtools plot -r NC_007793.1:607408-609562 95_0_0.bam -o modbamtools/

And my version is this: modbamtools --version : modbamtools, version 0.4.8

But I still have the issue with these followings: Traceback (most recent call last): File "/gpfs/data/pirontilab/Students/RenqiuguoLi/miniconda/envs/modbamtools/bin/modbamtools", line 8, in sys.exit(cli()) File "/gpfs/data/pirontilab/Students/RenqiuguoLi/miniconda/envs/modbamtools/lib/python3.8/site-packages/click/core.py", line 1130, in call return self.main(args, kwargs) File "/gpfs/data/pirontilab/Students/RenqiuguoLi/miniconda/envs/modbamtools/lib/python3.8/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/gpfs/data/pirontilab/Students/RenqiuguoLi/miniconda/envs/modbamtools/lib/python3.8/site-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/gpfs/data/pirontilab/Students/RenqiuguoLi/miniconda/envs/modbamtools/lib/python3.8/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) File "/gpfs/data/pirontilab/Students/RenqiuguoLi/miniconda/envs/modbamtools/lib/python3.8/site-packages/click/core.py", line 760, in invoke return __callback(args, **kwargs) File "/gpfs/data/pirontilab/Students/RenqiuguoLi/miniconda/envs/modbamtools/lib/python3.8/site-packages/modbamtools/cli.py", line 334, in plot fig = Plotter( File "/gpfs/data/pirontilab/Students/RenqiuguoLi/miniconda/envs/modbamtools/lib/python3.8/site-packages/modbamtools/modbamviz.py", line 47, in init self.tracks, self.num_tracks = get_tracks_gl( File "/gpfs/data/pirontilab/Students/RenqiuguoLi/miniconda/envs/modbamtools/lib/python3.8/site-packages/modbamtools/tracks_webgl.py", line 276, in get_tracks_gl freq_traces, single_read_traces, het_traces = make_modbam_trace_gl( File "/gpfs/data/pirontilab/Students/RenqiuguoLi/miniconda/envs/modbamtools/lib/python3.8/site-packages/modbamtools/tracks_webgl.py", line 178, in make_modbam_trace_gl freq = plot_frequencies_gl(sample_dict, start, end, color=colors[i]) File "/gpfs/data/pirontilab/Students/RenqiuguoLi/miniconda/envs/modbamtools/lib/python3.8/site-packages/modbamtools/tracks_webgl.py", line 71, in plot_frequencies_gl freq, freq_smooth = calc_freq(dict_per_read_mod, start, end) File "/gpfs/data/pirontilab/Students/RenqiuguoLi/miniconda/envs/modbamtools/lib/python3.8/site-packages/modbamtools/utils.py", line 78, in calc_freq freq_smooth["y"] = savgol_filter(freq["y"], window, poly) File "/gpfs/data/pirontilab/Students/RenqiuguoLi/miniconda/envs/modbamtools/lib/python3.8/site-packages/scipy/signal/_savitzky_golay.py", line 345, in savgol_filter raise ValueError("If mode is 'interp', window_length must be less " ValueError: If mode is 'interp', window_length must be less than or equal to the size of x.

Please! Thank you very much!

rainwala commented 1 year ago

Hello, I'm also getting this error now, having used the dorado basecaller from Oxford Nanopore. the modbamtools version I have is 0.4.8

Previously I had this error on data from the guppy basecaller, but with version 0.2.2 of modbamtools, and upgrading modbamtools to 0.4.8 fixed the error that time. Could this error be due to the dorado basecaller?

rainwala commented 1 year ago

my code and error are:

modbamtools plot -r chr8:127729510-127749672 control_dorado_0-3-0_dna_r10.4.1_e8.2_400bps_hac_v4.1.0_mod_bases_aligned.bam  -o modbamtools/
Traceback (most recent call last):
  File "/usr/local/bin/modbamtools", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/modbamtools/cli.py", line 334, in plot
    fig = Plotter(
  File "/usr/local/lib/python3.8/dist-packages/modbamtools/modbamviz.py", line 47, in __init__
    self.tracks, self.num_tracks = get_tracks_gl(
  File "/usr/local/lib/python3.8/dist-packages/modbamtools/tracks_webgl.py", line 276, in get_tracks_gl
    freq_traces, single_read_traces, het_traces = make_modbam_trace_gl(
  File "/usr/local/lib/python3.8/dist-packages/modbamtools/tracks_webgl.py", line 178, in make_modbam_trace_gl
    freq = plot_frequencies_gl(sample_dict, start, end, color=colors[i])
  File "/usr/local/lib/python3.8/dist-packages/modbamtools/tracks_webgl.py", line 71, in plot_frequencies_gl
    freq, freq_smooth = calc_freq(dict_per_read_mod, start, end)
  File "/usr/local/lib/python3.8/dist-packages/modbamtools/utils.py", line 78, in calc_freq
    freq_smooth["y"] = savgol_filter(freq["y"], window, poly)
  File "/usr/local/lib/python3.8/dist-packages/scipy/signal/_savitzky_golay.py", line 345, in savgol_filter
    raise ValueError("If mode is 'interp', window_length must be less "
ValueError: If mode is 'interp', window_length must be less than or equal to the size of x.