longitudinal pairwise distances error

I'm having a problem that was also asked here but the error message was never addressed:

I have two time states represented by 1 and 2, in a metadata column called "time_point". Time 1 is the baseline.

I did this:

qiime longitudinal first-distances
--i-distance-matrix id-filtered-braycurtis_Hunter_NEW_fixed_distance-matrix.qza
--m-metadata-file Hunter_metadata_corrected_foals_cats_no40.txt
--p-state-column time_point
--p-individual-id-column foal_id
--p-baseline 1
--o-first-distances from_first_braycurtis.qza

which worked without an error, and then I did this:

qiime longitudinal pairwise-differences
--m-metadata-file Hunter_metadata_corrected_foals_cats_no40.txt
--m-metadata-file from_first_braycurtis.qza
--p-metric Distance
--p-group-column Group
--p-state-column time_point
--p-state-1 1
--p-state-2 2
--p-individual-id-column foal_id
--p-replicate-handling random
--o-visualization braycurtis_no40_pairwise-differences.qzv

which gives the error basically identical to the question not answered in the link at the top of this posting:

Plugin error from longitudinal:

** state_column must contain at least two unique values. Values in time_point: [2.]**

See above for debug info.

Here is the verbose error message:

Traceback (most recent call last):
File "/sw/hprc/sw/Anaconda3/2021.11/envs/qiime2-2021.11/lib/python3.8/site-packages/q2cli/commands.py", line 339, in call
results = action(**arguments)
File "", line 2, in pairwise_differences
File "/sw/hprc/sw/Anaconda3/2021.11/envs/qiime2-2021.11/lib/python3.8/site-packages/qiime2/sdk/action.py", line 245, in bound_callable
outputs = self.callable_executor(scope, callable_args,
File "/sw/hprc/sw/Anaconda3/2021.11/envs/qiime2-2021.11/lib/python3.8/site-packages/qiime2/sdk/action.py", line 453, in callable_executor
ret_val = self._callable(output_dir=temp_dir, **view_args)
File "/sw/hprc/sw/Anaconda3/2021.11/envs/qiime2-2021.11/lib/python3.8/site-packages/q2_longitudinal/_longitudinal.py", line 49, in pairwise_differences
_validate_input_values(metadata, metric, individual_id_column,
File "/sw/hprc/sw/Anaconda3/2021.11/envs/qiime2-2021.11/lib/python3.8/site-packages/q2_longitudinal/_utilities.py", line 44, in _validate_input_values
_validate_input_columns(
File "/sw/hprc/sw/Anaconda3/2021.11/envs/qiime2-2021.11/lib/python3.8/site-packages/q2_longitudinal/_utilities.py", line 94, in _validate_input_columns
raise ValueError("state_column must contain at least two unique "
ValueError: state_column must contain at least two unique values. Values in time_point: [2.]

Plugin error from longitudinal:

state_column must contain at least two unique values. Values in time_point: [2.]

See above for debug info.

I am happy to upload the metadata file if that helps, but for each animal there is a sample at each time point, 1 and 2 in the metadata file--none of the other qiime2 analyses have complained about the metadata file.

Hi @John_Blazier ,
first-differences and first-distances look at the differences in measurements between time 1 and time 2, and output the distance/difference labeled by the SampleID of the second timepoint (e.g., paired differences between time 0 and time 1 would be labeled by the SampleIDs at time 1).

So this effectively drops the first timepoint in the output. In your case you start with 2 timepoints, so the output will only contain the labels of timepoint 2 (none from timepoint 1). Hence the error you are seeing when you attempt to pass this result to pairwise-differences.

So this is not an error with the action, nor an issue with the metadata file.

Running first-distances and then passing those first distances to pairwise-differences is not a logical sequence of actions. Instead, you only need one action, pairwise-distances, to achieve the comparison that you are trying to make.

Good luck!

1 Like

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