I'm doing a microbial ecology experiment setup as follows: Six barrels have been filled with different substrates. Water from the environment flows through the barrels. The barrels are sampled at different ports, located at the top, middle, and bottom of each barrel. Then the samples are sequenced and assigned taxonomic labels. The microbial community tends to vary both by substrate and by port.

Based on my understanding, ANOSIM compares the variability within a group to variability between groups (e.g. are all of the samples from the same barrels more similar than samples from different barrels). But my samples from each barrel are also from different ports, so I don't expect them to be that similar. Does ANOSIM account for this, or do I need some other test? I have run ANOSIM first using barrel, then using port, but I'm not really sure my R values are meaningful.

Thanks for any insight.