SunPengChuan / wgdi

WGDI: A user-friendly toolkit for evolutionary analyses of whole-genome duplications and ancestral karyotypes
https://wgdi.readthedocs.io/en/latest/
BSD 2-Clause "Simplified" License
114 stars 22 forks source link

Retain (-r) - TypeError: 'Axes' object is not subscriptable #51

Open erika-r-moore opened 3 months ago

erika-r-moore commented 3 months ago

Hello!

I am trying to run the "retain" function (-r), but keep getting this error:

Traceback (most recent call last):
  File "/home/ermoore3/miniconda2/envs/mamba/envs/wgdi/bin/wgdi", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/ermoore3/miniconda2/envs/mamba/envs/wgdi/lib/python3.12/site-packages/wgdi/run.py", line 163, in main
    module_to_run(arg, value)
  File "/home/ermoore3/miniconda2/envs/mamba/envs/wgdi/lib/python3.12/site-packages/wgdi/run.py", line 122, in module_to_run
    run_subprogram(program, conf, name)
  File "/home/ermoore3/miniconda2/envs/mamba/envs/wgdi/lib/python3.12/site-packages/wgdi/run.py", line 87, in run_subprogram
    r.run()
  File "/home/ermoore3/miniconda2/envs/mamba/envs/wgdi/lib/python3.12/site-packages/wgdi/retain.py", line 46, in run
    axs[i].plot(group['order'].values, group[j].values,
    ~~~^^^
TypeError: 'Axes' object is not subscriptable

The csv file is made (attached) but the image is not. I have looked at the WGDI read-the-docs website and wgdi-example GitHub, but have not found a solution. My -r code is:

alignment  =  align_polyclass_vvi161s-Acicarpha_chr11.csv
gff  =  ./0_gff/vvi161s.gff
lens  =  ./0_lens/vvi161s-EDIT.lens
colors  =  red,blue,green,orange,black,pink,purple
refgenome  =  shorthand
figsize  =  10,10
step  =  50
ylabel  =  Genes
savefile  =  retain_vvi161s-Acicarpha_chr11.csv
savefig  =  retain_vvi161s-Acicarpha_chr11.svg

Do you know what the issue may be? Also, am I doing the right gff and lens files? The gff designated is the full gff file (contains all chromosomes of the reference), while the -EDIT.lens file only includes one chromosome of interest (chr11). I can provide the code if needed.

Let me know and thanks for your help!

Best, Erika

retain_vvi161s-Acicarpha_chr11.csv

SunPengChuan commented 3 months ago

I just tested it, and a single chromosome indeed causes an error, which appears to be a bug. I'll be traveling for the next couple of days and won't be able to modify the code. You can analyze two chromosomes instead. Even if you list the same chromosome twice in the lens file, it will still run correctly.