Error when trying to group samples together then create heat map

When I run the qiime feature-table group command using

qiime feature-table group \
    --i-table "$BIOM.qza" \
    --p-axis "sample" \
    --m-metadata-file "merge.tsv" \
    --m-metadata-column "age" \
    --p-mode "mean-ceiling" \
    --output-dir "$BIOM-mean.qza"

it works and I get a file from it. However when I try to create a heat map from that using

qiime feature-table heatmap \
    --i-table "$BIOM-mean.qza/grouped_table.qza" \
    --m-metadata-file "merge.tsv" \
    --m-metadata-column "age" \
    --output-dir "$BIOM-heatmap"

I get an error saying β€œThe following ID(s) are not present in the MetadataColumn: β€˜1’, β€˜2’, β€˜3’, β€˜4’, β€˜5’, β€˜6’, β€˜7’” These numbers are the only ages I have in my metadata. I’m not sure what the issue is.

My goal is to create a heat map that looks at the average of samples at each age rather than at every sample individually. Thank you!

1 Like

Hi @Stephanieorch!

Ah - I think I know what is going on here! It looks like the feature table's IDs are being converted to strings ('1', '2', '3'..., this is because they are being "promoted" to sample identifiers in the new table), but in your metadata column (age) they are being coerced to numbers (1, 2, 3..., note there aren't quotes around each number). The easiest fix I can think of is to explicitly set the type of the age column in your metadata file to categorical - this will force QIIME 2 to interpret those values as strings, instead of numbers, which should get things moving along for you.

Let us know how that goes for you! :t_rex:

Is there a way to do this post-Qiita analysis? Or do I need to redo everything? Thank you!

Yep - the recommendation I provided above just requires you to add one new line to your metadata file - this can be done without changing anything in your analysis.

No, just fix your metadata, then run the heatmap visualization - those should be the only things you would need to do to get moving again!

1 Like

Thanks! I added the additional line to my metadata and made sure age was listed as categorical but am still receiving this error:

Plugin error from feature-table:

  The following IDs are not present in the metadata: '1', '2', '3', '4', '5', '6', '7'

Debug info has been saved to /var/folders/n8/0xt_lgk564l03t70txcj45xc0000gn/T/qiime2-q2cli-err-sha_hw_u.log

Oh wait, I just re-read your post - you don’t need to provide metadata to your heatmap command, since you have already grouped your samples by age. You have two options:

a) group table:

qiime feature-table group \
    --i-table "$BIOM.qza" \
    --p-axis "sample" \
    --m-metadata-file "merge.tsv" \
    --m-metadata-column "age" \
    --p-mode "mean-ceiling" \
    --output-dir "$BIOM-mean.qza"
# no metadata provided to heatmap since your sample
# ids in your grouped table are your ages
qiime feature-table heatmap \
    --i-table "$BIOM-mean.qza/grouped_table.qza" \
    --output-dir "$BIOM-heatmap"

b) don’t group table:

# no grouping step - go straight from your original table to a heatmap
qiime feature-table heatmap \
    --i-table "$BIOM.qza" \
    --m-metadata-file "merge.tsv" \
    --m-metadata-column "age" \
    --output-dir "$BIOM-heatmap"
1 Like

This worked! Thank you so much for your help.

1 Like

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