TheBrownLab / PhyloFisher

PhyloFisher is a software package written in Python3 that can be used for the creation, analysis, and visualization of phylogenomic datasets that consist of eukaryotic protein sequences.
MIT License
31 stars 15 forks source link

index out of range error with select_taxa.py --chimera #81

Closed cha-namoth closed 1 year ago

cha-namoth commented 1 year ago

Hey guys,

I have an issue running select_taxa.py. Right now I'm trying to combine several taxa into a new chimera, but select_taxa.py --chimeras chimeras_input.tsv gives me the following error:

Traceback (most recent call last):
  File "/opt/Anaconda3/envs/fisher_1.2.7/bin/select_taxa.py", line 182, in <module>
    make_subset_tsv()
  File "/opt/Anaconda3/envs/fisher_1.2.7/bin/select_taxa.py", line 42, in make_subset_tsv
    low_tax_list = [taxa[ind][2] for ind in df.index]
  File "/opt/Anaconda3/envs/fisher_1.2.7/bin/select_taxa.py", line 42, in <listcomp>
    low_tax_list = [taxa[ind][2] for ind in df.index]
IndexError: list index out of range

The chimeras_input.tsv file is formatted properly as far as I can tell: newChimeraNameHigherTaxonomyLowerTaxonomytaxon1taxon2taxon3

I've tried it with several version of Phylofisher and keep getting the same error message. select_taxa.py without the --chimera flag works like it should and always has. If I remember correctly this used to work without issues about 1.5 years ago.

Any idea what the issue might be?

Cheers, Gordon

cha-namoth commented 1 year ago

Got it to work with version 1.1.2, and I now have a select_taxa.tsv. But that version doesn't generate a plot and gives me this:

Traceback (most recent call last):
  File "/opt/Anaconda3/envs/fisher_1.1.2/bin/select_taxa.py", line 181, in <module>
    tools.make_plot(taxa_comp, f'taxa_comp', y_count=gene_count, genes=False)
  File "/opt/Anaconda3/envs/fisher_1.1.2/lib/python3.7/site-packages/phylofisher/tools.py", line 170, in make_plot
    ax2.set_xticklabels(range(0, gene_num, 5))
  File "/opt/Anaconda3/envs/fisher_1.1.2/lib/python3.7/site-packages/matplotlib/axes/_base.py", line 73, in wrapper
    return get_method(self)(*args, **kwargs)
  File "/opt/Anaconda3/envs/fisher_1.1.2/lib/python3.7/site-packages/matplotlib/_api/deprecation.py", line 471, in wrapper
    return func(*args, **kwargs)
  File "/opt/Anaconda3/envs/fisher_1.1.2/lib/python3.7/site-packages/matplotlib/axis.py", line 1779, in _set_ticklabels
    return self.set_ticklabels(labels, minor=minor, **kwargs)
  File "/opt/Anaconda3/envs/fisher_1.1.2/lib/python3.7/site-packages/matplotlib/axis.py", line 1701, in set_ticklabels
    "The number of FixedLocator locations"
ValueError: The number of FixedLocator locations (78), usually from a call to set_ticks, does not match the number of ticklabels (77).
robert-ervin-jones commented 1 year ago

Hi Gordon,

Do you mind providing your chimeras_input.tsv? Each column in the file should be tab separated. I'm not able to find anything obviously wrong. This code hasn't been changed in several iterations now.

As far as the error in v1.1.2., that has now been handled. It stems from a plotting bug. You should be fine to move forward; you just won't be able to see the plot.

Let me know if there is anything else I can do to help.

Best, Robert

cha-namoth commented 1 year ago

Hi Robert,

absolutely, please see attached! That one worked with version 1.1.2 and I ran matrix_constructor.py successfully and already have a final tree.

For all I know this might be an issue on my side, but I found a workaround with the 1.1.2.

Cheers, Gordon

chimeras_Jun7.tsv.zip

robert-ervin-jones commented 1 year ago

Hi Gordon,

This issue has now been resolved in v1.2.9. Which has been pushed and should be available from Bioconda in a few days.

Thank for pointing this out to us!

Best, Robert

cha-namoth commented 1 year ago

Thanks for fixing this Robert!

Cheers, Gordon