rrazaghi / modbamtools

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

Clustering failure produces error message #27

Open rowanhowellGE opened 1 year ago

rowanhowellGE commented 1 year ago

Hi,

Sometimes when using the modbamtools plot --cluster feature (modbamtools v0.4.8), I will get an error message and no output:

  File "/opt/conda/bin/modbamtools", line 8, in <module>
    sys.exit(cli())
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/modbamtools/cli.py", line 334, in plot
    fig = Plotter(
  File "/opt/conda/lib/python3.9/site-packages/modbamtools/modbamviz.py", line 100, in __init__
    assert self.num_tracks == len(self.titles)
AssertionError

This can be resolved by choosing a different region to attempt to cluster, so my guess would be that this occurs when multiple clusters can't be identified. I think it would be easier to interpret if this raised an informative warning, rather than this error message.