#[Investigation whether gut bacteria at the genus level vary in relative abundance depending on the foraging proportion of the Eucalyptus species; R] Fig.4 (d) library(vegan) library(psych) library(corrplot) # Import the foraging data forage = read.csv("hirakawa_data.csv",header=TRUE,row.names=1) # Import the data on the average relative abundance of gut bacteria relabn = read.csv("av_relabn_l6.csv",header=TRUE,row.names=1) s_forage<-forage[,3:7] m_forage = as.matrix(s_forage) m_relabn = as.matrix(relabn) # Spearman’s rank correlation with Benjamini-Hochberg correction x<-corr.test(m_relabn[,1:97], m_forage[,1:5], method="spearman", adjust="fdr")$r write.csv(x,file="x.csv") p<-corr.test(m_relabn[,1:97], m_forage[,1:5], method="spearman", adjust="fdr")$p write.csv(p,file="p.csv") #Visualization r7 = read.csv("relabn_l6_0.7_2.csv",header=TRUE,row.names=1) r77 = as.matrix(r7) hoge <- matrix(as.matrix(r7), nrow(r7), ncol(r7)) corrplot(r77, method="shade", shade.col=NA, tl.col="black", tl.cex=0.9, cl.ratio = 0.6,tl.srt=100)