How to add more than one feature in a single cell of metadata

I have a metadata file that contains the following "Disease" column.

But, some samples have more than one disease. That's why after performing alpha and beta diversity analysis, qiime2 considers each cell as a single category. Here, in the figure below you can see that some categories have more than one disease.

So, how I can prepare my metadata so that qiime2 will consider each disease as a single category, while some sample will have more than one disease(as like first figure)

Hello @Anisur_Rahman,

Welcome to the forums! :qiime2:

One option is to make a new metadata columns for each disease state.

Disease HTN Gastric Thyroid Allergy
HTN yes no no no
HTN, Gastric issues yes yes no no
HTN, Thyroid yes no yes no
X no no no no

Let me know if that is a good solution for your data set.

Hi @colinbrislawn,
Thank you very much for your idea. Yeah, I can use this approach also.
But, is there any direct option? Otherwise, I will follow your idea.

As far as I know, the diversity alpha-group-significance plugin makes graphs and performs tests on each metadata column, so building these new columns is the most direct option.

Are you asking is there an elegant way to build these new columns? :thinking:

If you use R, you could use case_when() like this <- metadata %>% mutate(
  HTN = case_when(grepl("HTN", Disease) ~ "yes", TRUE ~ "no"),
  Gastric = case_when(grepl("Gastric", Disease) ~ "yes", TRUE ~ "no"),
  Thyroid = case_when(grepl("Thyroid", Disease) ~ "yes", TRUE ~ "no"),

Or the Convert Text to Columns Wizard in Excel would get you halfway there. :mage:


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