merenlab / anvio

An analysis and visualization platform for 'omics data
http://merenlab.org/software/anvio
GNU General Public License v3.0
440 stars 145 forks source link

[BUG] anvi-summarize fails with flag '--init-gene-coverages' #2062

Closed FlorianTrigodet closed 1 year ago

FlorianTrigodet commented 1 year ago

Short description of the problem

I was running the anvio self test when I found an error with anvi-summarize.

anvi'o version

Main dev version.

Detailed description of the issue

I ran the mini self test:

anvi-self-test --suite mini

And I got this error:

:: Summarizing CONCOCT results ...

Contigs DB ...................................: Initialized: /Users/ftrigodet/toto/CONTIGS.db (v. 20)

WARNING
===============================================
ProfileSuperClass found a collection focus, which means it will be initialized
using only the splits in the profile database that are affiliated with the
collection CONCOCT and all bins it describes.

WARNING
===============================================
A subset of splits (35 of 35, to be precise) are requested to initiate gene-
level coverage stats for. No need to worry, this is just a warning in case you
are as obsessed as wanting to know everything there is to know.

[27 Mar 23 11:16:48 Computing gene-level coverage stats in STANDARD mode...] 10 of 35 splits ...                                                                                 Traceback (most recent call last):
  File "/Users/ftrigodet/github/anvio/bin/anvi-summarize", line 123, in <module>
    main(args)
  File "/Users/ftrigodet/github/anvio/bin/anvi-summarize", line 64, in main
    summary = summarizer.ProfileSummarizer(args)
  File "/Users/ftrigodet/github/anvio/anvio/summarizer.py", line 707, in __init__
    DatabasesMetaclass.__init__(self, self.args, self.run, self.progress)
  File "/Users/ftrigodet/github/anvio/anvio/dbops.py", line 3771, in __init__
    ProfileSuperclass.__init__(self, self.args, self.run, self.progress)
  File "/Users/ftrigodet/github/anvio/anvio/dbops.py", line 3009, in __init__
    init_split_coverage_values_per_nt=init_split_coverage_values_per_nt)
  File "/Users/ftrigodet/github/anvio/anvio/dbops.py", line 3199, in init_gene_level_coverage_stats_dicts
    gene_level_coverage_stats, failed_gene_caller_ids = self.get_gene_level_coverage_stats(split_name, contigs_db, **parameters)
ValueError: not enough values to unpack (expected 2, got 0)

Traceback for debugging
================================================================================
  File "/Users/ftrigodet/github/anvio/bin/anvi-self-test", line 118, in <module>
    main(args)
  File "/Users/ftrigodet/github/anvio/bin/anvi-self-test", line 83, in main
    raise ConfigError(f"According to the exit code ('{exitcode}'), anvi'o suspects that something may have gone wrong while "
================================================================================

Config Error: According to the exit code ('1'), anvi'o suspects that something may have gone
              wrong while running your tests :/ We hope that the reason is clear to you from
              the lines above. But if you don't see anything obvious, and especially if the
              test ended up running until the end with reasonable looking final results, you
              shouldn't worry too much about this error. Life is short and we all can worry
              just a bit less.

Files to reproduce

Here are a contigs.db and a merged profile.db to reproduce the error rapidly: test_summarize.tar.gz

anvi-summarize -c CONTIGS.db -p SAMPLES-MERGED/PROFILE.db -C CONCOCT -o summary --init-gene-coverage
meren commented 1 year ago

There is no AUXILIARY-DATA.db in the test directory, so it is not quite reproducible :) But I did find the bug and fixed it. Thank you very much, Florian!