error in qiime longitudinal maturity-index: nan

Dear QIIME2 Team, thank you for your extraordinary contributions.

I'm working on qiime2-2020.2, and was trying to run the qiime longitudinal maturity-index function.
It did well with the sample data, while when it came to my own, it keeps yielding error "nan".
Here are my codes and the error log:

qiime longitudinal maturity-index
--i-table table-v13.qza
--m-metadata-file SMARTBB_metadata.txt
--p-state-column month
--p-group-by bodysite
--p-individual-id-column subject
--p-control NP
--p-stratify
--output-dir maturity
--verbose
Traceback (most recent call last):
File "/Users/norchen/miniconda3/envs/qiime2-2020.2/lib/python3.6/site-packages/q2cli/commands.py", line 328, in call
results = action(**arguments)
File "</Users/norchen/miniconda3/envs/qiime2-2020.2/lib/python3.6/site-packages/decorator.py:decorator-gen-278>", line 2, in maturity_index
File "/Users/norchen/miniconda3/envs/qiime2-2020.2/lib/python3.6/site-packages/qiime2/sdk/action.py", line 245, in bound_callable
output_types, provenance)
File "/Users/norchen/miniconda3/envs/qiime2-2020.2/lib/python3.6/site-packages/qiime2/sdk/action.py", line 484, in callable_executor
outputs = self._callable(scope.ctx, **view_args)
File "/Users/norchen/miniconda3/envs/qiime2-2020.2/lib/python3.6/site-packages/q2_longitudinal/_longitudinal.py", line 528, in maturity_index
pred_md, 'prediction', state_column, group_by, control)
File "/Users/norchen/miniconda3/envs/qiime2-2020.2/lib/python3.6/site-packages/q2_longitudinal/_utilities.py", line 823, in _maz_score
_median, _std = medians[metadata.loc[i][column]]
KeyError: nan

Plugin error from longitudinal:

nan

See above for debug info.

The same files were all good when applied to some other longitudinal functions, so I was wondering why it claims so. I also have re-checked my metadata file with Keemei and it passed.

Sincere thanks to your kind suggestions for your kind supports!

Hi @ypsung

I encountered lot of error messages from the console when running longitudinal analysis command. I can tell you how I managed to fix some of them:
Usually, an error message pops up if

  • the group-column is not grouped properly in the metadata file-check the metadata file in this tutorial, the mode of delivery is very carefully grouped
  • Your group column does not have alpha-diversity. This is rare, but it happened to me because I was incorrectly grouping the samples.
  • Sometimes, I was not supplying the state column correctly (maybe this is the error)

These were the errors I encountered-while I managed to solve them, I am still facing more errors, as I solve them, I will be happy to share with you what I did :slight_smile:

Hope this helps,
Best,
Anirban

1 Like

Welcome to the forum @ypsung!

This error has been described a couple times before, see the search results here: Search results for 'maturity-index keyerror' - QIIME 2 Forum

As mentioned in those topics, the q2-longitudinal tutorial at qiime2.org has some useful notes on this method. The metadata groups need to be represented at all time points.

1 Like

Thanks Nicholas for your timely reply.

Yes i did the search on forum before but still do not understand what "nan" means in my error report.

according to the notes, i amended the state column in our metadata file so the tree timepoints have even intervals, while the same error were reported.

also the sample size in our dataset is around x300 per bodysite, so i'm sure it was not the problem neither.

additionally, i tried with an subset of data, as follow:

qiime longitudinal maturity-index
--i-table table_NPBO.qza
--m-metadata-file NPBO_metadata.txt
--p-state-column maturity-month
--p-group-by bodysite
--p-individual-id-column subject
--p-control BO
--p-stratify
--output-dir maturity
--verbose

and the error reported:
Traceback (most recent call last):
File "/Users/norchen/miniconda3/envs/qiime2-2020.2/lib/python3.6/site-packages/q2cli/commands.py", line 328, in call
results = action(**arguments)
File "</Users/norchen/miniconda3/envs/qiime2-2020.2/lib/python3.6/site-packages/decorator.py:decorator-gen-278>", line 2, in maturity_index
File "/Users/norchen/miniconda3/envs/qiime2-2020.2/lib/python3.6/site-packages/qiime2/sdk/action.py", line 245, in bound_callable
output_types, provenance)
File "/Users/norchen/miniconda3/envs/qiime2-2020.2/lib/python3.6/site-packages/qiime2/sdk/action.py", line 484, in callable_executor
outputs = self._callable(scope.ctx, **view_args)
File "/Users/norchen/miniconda3/envs/qiime2-2020.2/lib/python3.6/site-packages/q2_longitudinal/_longitudinal.py", line 560, in maturity_index
sorted_table = cluster_table.view(biom.Table).sort_order(clust_md.index)
File "/Users/norchen/miniconda3/envs/qiime2-2020.2/lib/python3.6/site-packages/biom/table.py", line 2055, in sort_order
fancy = np.array([self.index(i, axis=axis) for i in order], dtype=int)
File "/Users/norchen/miniconda3/envs/qiime2-2020.2/lib/python3.6/site-packages/biom/table.py", line 2055, in
fancy = np.array([self.index(i, axis=axis) for i in order], dtype=int)
File "/Users/norchen/miniconda3/envs/qiime2-2020.2/lib/python3.6/site-packages/biom/table.py", line 1444, in index
raise UnknownIDError(id, axis)
biom.exception.UnknownIDError: The sample ID 'BO-nan' could not be found in the BIOM table.

Plugin error from longitudinal:

The sample ID 'BO-nan' could not be found in the BIOM table.

See above for debug info.

The problem is i checked for several times, we do not have sample ID "BO-non" in our metadata, so i was pretty confused what the qiime try to tell.

would you kindly suggest which part could be problematic?

sincere thanks.

Thanks Anirban for your generous sharing.

Yes I agree with you there should be something wrong with the metadata file, and am still find the right way to correct it.

Thank you again for the warm support, hope both of us can get an ideal output. :slight_smile:

Dear Nicholas, thanks again for your suggestions.

I generated a new metadata file with no blank cells then the function finally works out.

Thank you and the team again for the great works. :+1: :+1:

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.