Skip to content

Axes object is not subscriptable #56

@zeeev

Description

@zeeev

Hello,

It appears that specifying a small number of contigs, in this case --contigs chr22, the code crashes with an indexing error. I'm trying to build a reproducible test for a single chromosome, otherwise I'd just run genome wide.

When len(chroms) ≤ 2, plt.subplots(1, 2) returns a 1D array of Axes, so subplots[i // 2] is already an Axes object and cannot be indexed again.

[2026-03-06 15:44:41] INFO: CPD bin size: 50000
[2026-03-06 15:44:41] INFO: Segmenting input coverage
Traceback (most recent call last):
  File "/opt/conda/envs/wakhan/bin/wakhan", line 6, in <module>
    sys.exit(main())
  File "/opt/wakhan/src/main.py", line 457, in main
    wakhan_all(args) #hapcorrect + cna
  File "/opt/wakhan/src/main.py", line 473, in wakhan_all
    cna_process(args) #cna
  File "/opt/wakhan/src/main.py", line 631, in cna_process
    opt_seg_cov, opt_seg_weights = parse_coverage_bed_cpd(coverage_bed, is_phased_cov, plot_path=cn_coverage_plot)
  File "/opt/wakhan/src/cna/optimization.py", line 331, in parse_coverage_bed_cpd
    sp = subplots[i // 2][i % 2]
TypeError: 'Axes' object is not subscriptable
(END)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions