Humann2_renorm_table

Hi All,

I am unable to renormalize the stratified output using the humann2_renorm_table. Error below

Treating MSA-1003_kneaddata_genefamilies_stratified.tsv as stratified output, e.g. [‘UniRef90_unknown’, ‘g__Escherichia.s__Escherichia_coli’]
Traceback (most recent call last):
File “/rbxdata3/users/kpgv576/miniconda3/bin/humann2_renorm_table”, line 11, in
sys.exit(main())
File “/rbxdata3/users/kpgv576/miniconda3/lib/python2.7/site-packages/humann2/tools/renorm_table.py”, line 118, in main
special = args.special==“y”,
File “/rbxdata3/users/kpgv576/miniconda3/lib/python2.7/site-packages/humann2/tools/renorm_table.py”, line 104, in normalize
totals = totals_by_level[level] if levelwise else totals_by_level[1]
KeyError: 1

Has anyone seen this before?

Thanks.
-Deepak

From the file name (_stratified) I’m wondering if you’re removed the community totals from this file? I believe the renorm script expects both totals and stratifications to be present (some forms of normalization require the totals to function).

I also tried to perform the humann_renorm_table command on the input file that is already stratified, and got the same error. The issue appears to be that the upstream “humann_split_stratified_table” command that generated my input for the renorm command removes the community total value, which is required by the renorm command as described above.

If one would like to have renormalized data in the stratified format, one simple go around may be to first perform humann_renorm_table command on the initial joined table, then perform the humann_split_stratified_table command. This way the renorm step will still have the community totals going into renormalization.

Hopefully that helps

Marcus

Thanks for suggesting this workaround. We’ve noted this incompatibility and can fix it in an upcoming release.