merenlab/anvio

[BUG] KeyError: 'pop from an empty set'

Closed this issue · 1 comments

Short description of the problem

Bug happends when trying to compute functionnal enrichment. I found this discord question about it https://discord.com/channels/1002537821212512296/1198933214098624522/1198933214098624522 but no related issue. I narrowed down the problem to a set of contigs.db, using the debug flag did not provide more information.

anvi'o version

anvio-dev commit db8b5ab..6ba46c7

System info

anvio-dev on linux 6.

Detailed description of the issue

Using the command :

anvi-script-gen-function-matrix-across-genomes -e test_external_genomes.txt -G test_groups.txt --annotation-source Uniref90  --output-file-prefix functional_enrichment_all  --skip-checking-genome-hashes --debug

Yields:

    main(args)
  File "/home/guelou01/github/anvio/sandbox/anvi-script-gen-function-matrix-across-genomes", line 40, in main
    facc = AggregateFunctions(args, r=run, p=progress)
  File "/home/guelou01/github/anvio/anvio/genomedescriptions.py", line 1034, in __init__
    self.init()
  File "/home/guelou01/github/anvio/anvio/genomedescriptions.py", line 1051, in init
    self._populate_group_dicts() # <-- this has to be called after all genomes are initialized
  File "/home/guelou01/github/anvio/anvio/genomedescriptions.py", line 1301, in _populate_group_dicts
    f"Here is an example genome name from your anvi'o databases: '{self.layer_names_considered.pop()}'.")
KeyError: 'pop from an empty set'

Files / commands to reproduce the issue

Sent by email wih the issue number as subject.

meren commented

Hey @Louis-MG, thank you very much for sending this test case. I identified the problem -- some of your genomes were missing function annotation source of interest -- and fixed the problem so anvi'o will give you a meaningful error message for you to go after it. Please git pull from the master repository and re-run your command.

Thank you!