I used the below code to do CAP analysis to link microbial data with elements, but not sure how to do statistical analysis to show which element variation is responsible most for the difference in microbial composition. I can only able to see two axis in figure so how I can get complete information about the variation based on these mineral element and individually like which mineral responsible most for microbial diversity?
# CAP ordinate
cap_ord <- ordinate(
physeq = phyloseq_prop,
method = "CAP",
distance = bray_not_na,
formula = ~ ~ P + Mn + Cu +Zn + Rb + Mg )
# CAP plot
cap_plot <- plot_ordination(
physeq =phyloseq_prop ,
ordination = cap_ord,
color = "SampleType",
axes = c(1,2)
) +
aes(shape = Region) +
geom_point(aes(colour = SampleType), alpha = 0.4, size = 4) +
geom_point(colour = "grey90", size = 1.5) +
scale_color_manual(values = c("#CBD588", "#5F7FC7", "orange","#DA5724", "#508578", "#CD9BCD",
"#AD6F3B", "#673770","#D14285","#652926", "#C84248",
"#8569D5")
)
# Now add the environmental variables as arrows
arrowmat <- vegan::scores(cap_ord, display = "bp")
# Add labels, make a data.frame
arrowdf <- data.frame(labels = rownames(arrowmat), arrowmat)
# Define the arrow aesthetic mapping
arrow_map <- aes(xend = CAP1,
yend = CAP2,
x = 0,
y = 0,
shape = NULL,
color = NULL,
label = labels)
label_map <- aes(x = 1.3 * CAP1,
y = 1.3 * CAP2,
shape = NULL,
color = NULL,
label = labels)
arrowhead = arrow(length = unit(0.02, "npc"))
pdf("cap2.pdf", height=8, width=8)
# Make a new graphic
cap_plot +
geom_segment(
mapping = arrow_map,
size = .5,
data = arrowdf,
color = "gray",
arrow = arrowhead
) +
geom_text(
mapping = label_map,
size = 4,
data = arrowdf,
show.legend = FALSE
)
dev.off();
cap_ord
Call: capscale(formula = distance ~ P + Mn + Cu +Zn + Rb + Mg, data = data)
Inertia Proportion Rank
Total 2.069e+01 1.000e+00
Constrained 5.240e+00 2.533e-01 10
Unconstrained 1.545e+01 7.468e-01 97
Imaginary -1.090e-03 -5.268e-05 1
Inertia is squared Bray distance
Eigenvalues for constrained axes:
CAP1 CAP2 CAP3 CAP4 CAP5 CAP6 CAP7 CAP8 CAP9 CAP10
2.5733 0.8789 0.5647 0.3797 0.3037 0.1873 0.1243 0.1030 0.0800 0.0453
Eigenvalues for unconstrained axes:
MDS1 MDS2 MDS3 MDS4 MDS5 MDS6 MDS7 MDS8
4.790 1.343 1.138 0.916 0.784 0.649 0.518 0.501
(Showing 8 of 97 unconstrained eigenvalues)
Many thanks
ordinate()
you are actually using a different techniquemethod="CAP"
. It might help to actually see the plotted output, to understand whether the issue is in data or a difficulty of the tool. It looks like you are using phyloseq, have you looked at the documentation? rdocumentation.org/packages/phyloseq/versions/1.16.2/topics/… $\endgroup$