KeyError: 'PRJNA14242' when using -t rel_ab_w_read_stats and --add_viruses

The issue seems to happen when the bowtie2 alignmenrt file was generated with “-t rel_ab_w_read_stats”, since I get the same error if I use that alignment file and “-t rel_ab”; while if I directly use the source fastq with “-t rel_ab” and “–ad_viruses” I don’t get any error (but then I don’t get the estimated read counts…)

Here’s a bowtie2 alignment file that triggers the issue: Actinia

Here’s the full trace with metaphlan 3.0.6:

> metaphlan metaphlan_bowtie2.txt ktest_relab_ws --input_type bowtie2out -t rel_ab_w_read_stats --mdelim ";" --add_viruses                                                                                           
> Traceback (most recent call last):
>   File "/zpool_1TB/lib/miniconda3/bin/metaphlan", line 10, in <module>
>     sys.exit(main())
>   File "/zpool_1TB/lib/miniconda3/lib/python3.7/site-packages/metaphlan/metaphlan.py", line 1127, in main
>     pars['tax_lev']+"__" if pars['tax_lev'] != 'a' else None )
>   File "/zpool_1TB/lib/miniconda3/lib/python3.7/site-packages/metaphlan/metaphlan.py", line 739, in relative_abundances
>     tot_ab += clade.compute_abundance()
>   File "/zpool_1TB/lib/miniconda3/lib/python3.7/site-packages/metaphlan/metaphlan.py", line 523, in compute_abundance
>     sum_ab = sum([c.compute_abundance() for c in self.children.values()])
>   File "/zpool_1TB/lib/miniconda3/lib/python3.7/site-packages/metaphlan/metaphlan.py", line 523, in <listcomp>
>     sum_ab = sum([c.compute_abundance() for c in self.children.values()])
>   File "/zpool_1TB/lib/miniconda3/lib/python3.7/site-packages/metaphlan/metaphlan.py", line 523, in compute_abundance
>     sum_ab = sum([c.compute_abundance() for c in self.children.values()])
>   File "/zpool_1TB/lib/miniconda3/lib/python3.7/site-packages/metaphlan/metaphlan.py", line 523, in <listcomp>
>     sum_ab = sum([c.compute_abundance() for c in self.children.values()])
>   File "/zpool_1TB/lib/miniconda3/lib/python3.7/site-packages/metaphlan/metaphlan.py", line 523, in compute_abundance
>     sum_ab = sum([c.compute_abundance() for c in self.children.values()])
>   File "/zpool_1TB/lib/miniconda3/lib/python3.7/site-packages/metaphlan/metaphlan.py", line 523, in <listcomp>
>     sum_ab = sum([c.compute_abundance() for c in self.children.values()])
>   File "/zpool_1TB/lib/miniconda3/lib/python3.7/site-packages/metaphlan/metaphlan.py", line 523, in compute_abundance
>     sum_ab = sum([c.compute_abundance() for c in self.children.values()])
>   File "/zpool_1TB/lib/miniconda3/lib/python3.7/site-packages/metaphlan/metaphlan.py", line 523, in <listcomp>
>     sum_ab = sum([c.compute_abundance() for c in self.children.values()])
>   File "/zpool_1TB/lib/miniconda3/lib/python3.7/site-packages/metaphlan/metaphlan.py", line 523, in compute_abundance
>     sum_ab = sum([c.compute_abundance() for c in self.children.values()])
>   File "/zpool_1TB/lib/miniconda3/lib/python3.7/site-packages/metaphlan/metaphlan.py", line 523, in <listcomp>
>     sum_ab = sum([c.compute_abundance() for c in self.children.values()])
>   File "/zpool_1TB/lib/miniconda3/lib/python3.7/site-packages/metaphlan/metaphlan.py", line 523, in compute_abundance
>     sum_ab = sum([c.compute_abundance() for c in self.children.values()])
>   File "/zpool_1TB/lib/miniconda3/lib/python3.7/site-packages/metaphlan/metaphlan.py", line 523, in <listcomp>
>     sum_ab = sum([c.compute_abundance() for c in self.children.values()])
>   File "/zpool_1TB/lib/miniconda3/lib/python3.7/site-packages/metaphlan/metaphlan.py", line 535, in compute_abundance
>     ext_clade = self.taxa2clades[ext]
> KeyError: 'PRJNA14242'