Help with Anosim

Hi everyone,

I have some 16s data from 20 patients with the following samples types:

  1. Swab sample before treatment
  2. Swab sample after treatment
  3. Dressing sample before treatment
  4. Dressing sample after treatment

I have these samples for all 20 patients. What I want to do is run anosim analysis to check if there are significant differences in the diversity between swab and dressing samples both pre and post treatment.

For example:
Swab pre treatment vs dressing pre treatment
Swab post treatment vs dressing post treatment

But, I want to do this for each patient individually rather than all swabs pre vs all dressings pre. Is that possible to do? If so, what is the best way to do it?

Hi @mradz!

For a test like anosim you'll need more than one sample per treatment group, otherwise you'll wind up with divide-by-zero errors. If you do have multiple samples per group, then I think this analysis would be possible by splitting you feature table into sub-tables based on the different patients (so one table per patient), computing individual distance matrices using the metric of your choice, and then finally running diversity beta-group-significance once for each distance matrix (specifying anosim for the --p-method).

@jwdebelius might have some additional thoughts on this, I am probably missing something (and I am not a stats person, so please take my advice and suggested workflow with a grain of salt).


1 Like

Hi @mradz,

I agree with @thermokarst that you cannot run the analysis you'd like to run with ANOSIM because of the error.

I also dont think bulk ANOSIM is the best way to test this. You have this structure that already exists in your data: 4 samples from 20 people. I would assume that people's skin and wounds have individual signatures. So, my skin microbiome is specialized to my location, genetics, diet, etc... and yours is too. I worry that if you use a test that doesn't account for that underlying structure in the data, you're going to re-discover that people's microbiomes look more similar and miss other potentially intreesting things.

So, then, the problem becomes how to deal with nesting. My suggestion would be to look at the paired samples: is the distance between the pre treatment swab and dressing smaller or larger than the post treatment pair. That way, you're controlling for the individual effect, at least on a broader scale. I think you might be able to do something with q2-longitudinal to get there. You might need to re-code your metadata, so person1-pre is both your pre treatment samples, and person1-post are your post treatment, and then making a numeric column that matches swab and dressing (like swab=0, dressing=1, or something.)

There might be better ways, but that would be a first guess for me.


1 Like

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