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

Fix compatibility issue with pandas >=2 #906

Merged
merged 1 commit into from
Apr 26, 2023

Conversation

abretaud
Copy link
Contributor

While testing funannotate compare 1.8.15 in a freshly installed conda env, I got this error:

[Apr 25 03:14 PM]: Summarizing fungal transcription factors
[Apr 25 03:14 PM]: Running GO enrichment for each genome
Traceback (most recent call last):
  File "/_conda/envs/__funannotate@1.8.15/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 3652, in get_loc
    return self._engine.get_loc(casted_key)
  File "pandas/_libs/index.pyx", line 147, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 176, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 7080, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 7088, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'GO'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/_conda/envs/__funannotate@1.8.15/bin/funannotate", line 10, in <module>
    sys.exit(main())
  File "/_conda/envs/__funannotate@1.8.15/lib/python3.8/site-packages/funannotate/funannotate.py", line 716, in main
    mod.main(arguments)
  File "/_conda/envs/__funannotate@1.8.15/lib/python3.8/site-packages/funannotate/compare.py", line 986, in main
    + df2["GO"].astype(str)
  File "/_conda/envs/__funannotate@1.8.15/lib/python3.8/site-packages/pandas/core/frame.py", line 3760, in __getitem__
    indexer = self.columns.get_loc(key)
  File "/_conda/envs/__funannotate@1.8.15/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 3654, in get_loc
    raise KeyError(key) from err
KeyError: 'GO'

After some debugging, I found out that it comes from a breaking change in pandas2

Change the default argument of regex for Series.str.replace() from True to False. Additionally, a single character pat with regex=True is now treated as a regular expression instead of a string literal. (GH36695, GH24804)

Here's a PR that always set the regex param to True, so it should work whatever pandas version is installed

abretaud added a commit to bioconda/bioconda-recipes that referenced this pull request Apr 26, 2023
@nextgenusfs nextgenusfs merged commit f6063f3 into nextgenusfs:master Apr 26, 2023
nextgenusfs pushed a commit to bioconda/bioconda-recipes that referenced this pull request Apr 26, 2023
* Pin pandas

nextgenusfs/funannotate#906

* Add comment for future update
cokelaer pushed a commit to cokelaer/bioconda-recipes that referenced this pull request Apr 28, 2023
* Pin pandas

nextgenusfs/funannotate#906

* Add comment for future update
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

Successfully merging this pull request may close these issues.

2 participants