Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Pandas error in anvi-get-codon-frequencies #2314

Open
philipwoods opened this issue Jul 27, 2024 · 6 comments
Open

[BUG] Pandas error in anvi-get-codon-frequencies #2314

philipwoods opened this issue Jul 27, 2024 · 6 comments

Comments

@philipwoods
Copy link

Short description of the problem

When running anvi-get-codon-frequencies, there is a TypeError in how pandas is used in _make_gene_codon_frequency_table.

anvi'o version

Anvi'o .......................................: marie (v8)
Python .......................................: 3.10.13

Profile database .............................: 38
Contigs database .............................: 21
Pan database .................................: 16
Genome data storage ..........................: 7
Auxiliary data storage .......................: 2
Structure database ...........................: 2
Metabolic modules database ...................: 4
tRNA-seq database ............................: 2

System info

The operating system is Red Hat enterprise Linux. Anvi'o was installed in a conda environment.

Detailed description of the issue

When running anvi-get-codon-frequencies I get the following error:

Traceback (most recent call last):
  File "/export/data1/sw/anaconda3-2019.07/envs/anvio-8/bin/anvi-get-codon-frequencies", line 420, in <module>
    main(args)
  File "/export/data1/sw/anaconda3-2019.07/envs/anvio-8/bin/anvi-get-codon-frequencies", line 115, in main
    frequency_df = multigenome_codon_usage.get_frequencies(
  File "/export/data1/sw/anaconda3-2019.07/envs/anvio-8/lib/python3.10/site-packages/anvio/codonusage.py", line 2265, in get_frequencies
    frequency_df = next(frequency_table_generator)
  File "/export/data1/sw/anaconda3-2019.07/envs/anvio-8/lib/python3.10/site-packages/anvio/codonusage.py", line 2281, in _get_genome_frequency_table
    genome_codon_usage = SingleGenomeCodonUsage(
  File "/export/data1/sw/anaconda3-2019.07/envs/anvio-8/lib/python3.10/site-packages/anvio/codonusage.py", line 89, in __init__
    self._make_gene_codon_frequency_table()
  File "/export/data1/sw/anaconda3-2019.07/envs/anvio-8/lib/python3.10/site-packages/anvio/codonusage.py", line 231, in _make_gene_codon_frequency_table
    gene_codon_frequency_df = gene_codon_frequency_df[constants.codon_to_AA]
  File "/export/data1/sw/anaconda3-2019.07/envs/anvio-8/lib/python3.10/site-packages/pandas/core/frame.py", line 4051, in __getitem__
    check_dict_or_set_indexers(key)
  File "/export/data1/sw/anaconda3-2019.07/envs/anvio-8/lib/python3.10/site-packages/pandas/core/indexing.py", line 2783, in check_dict_or_set_indexers
    raise TypeError(
TypeError: Passing a dict as an indexer is not supported. Use a list instead.
@meren
Copy link
Member

meren commented Jul 28, 2024

I see a lot of pandas errors reported lately. I wonder if there was an update recently that causes all these incompatibility issues.

Note for self: we should always finalize requirements.txt with explicit version numbers prior to release :(

@xvazquezc
Copy link
Contributor

Fwiw, I'm running 2 recent installations of anvio-dev in Ubuntu and Rocky Linux, both with pandas=1.4.4 and I haven't had any issues. (I even ran anvi-get-codon-frequencies in case it was a program-specific issue; no errors either).

I see a pretty old anaconda install, from when the flexible solve for environment deps was the default - less painful, but more prone to environments not being properly set.

@philipwoods
Copy link
Author

For what it's worth, I can verify that pandas 1.4.4 is installed in the environment:

(anvio-8) [pwoods@ocean revision]$ conda list | grep pandas
pandas                    1.4.4                    pypi_0    pypi

@meren
Copy link
Member

meren commented Jul 29, 2024

This is very interesting. @philipwoods, would you consider sharing your contigs-db file and the exact command you're running on it to get this error? Maybe we can try to reproduce it on our end and see if we can solve it.

@philipwoods
Copy link
Author

I get the error while running anvi-get-codon-frequencies -c ANME-2a_sp._Agg-19359.db -o test.txt with the attached contigs database.
ANME-2a_sp._Agg-19359.zip

@philipwoods
Copy link
Author

I just finished installing an anvio-dev environment and the command above ran with no issue, which is confusing but possibly also useful debugging information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants