https://github.com/meglab2017/The-microbial-biosphere-of-the-coral-Acropora-cervicornis-in-Northeastern-Puerto-Rico
Revision acf5851080b5159b1e19b3afd81d9782f203f9b4 authored by meglab2017 on 15 August 2017, 02:21:33 UTC, committed by GitHub on 15 August 2017, 02:21:33 UTC
1 parent 6ecc1f9
Tip revision: acf5851080b5159b1e19b3afd81d9782f203f9b4 authored by meglab2017 on 15 August 2017, 02:21:33 UTC
Update README.md
Update README.md
Tip revision: acf5851
heatmap-script-fig4.R
library(vegan)
library(devtools)
meta <- read.csv("Coral_Mapping.csv",header=TRUE,row.names=1, sep=",")
dat1 <- read.csv("DESeq2_g_test44_tax", header=TRUE,row.names=1, sep=",")
dat3<-t(dat1)
data.prop_relA<- data.matrix(dat3)
data.prop_relA<- data.matrix(dat3)
mydist=function(c) {vegdist(c,method="euclidean")}
myclust=function(c) {hclust(c,method="average")}
mergedata.prop_rel <-merge(meta, as.matrix(data.prop_relA), by="row.names",all.x=FALSE)
dim(meta)
dim(data.prop_relA)
dim(mergedata.prop_rel)
(OTUcol1<-ncol(meta)+2)
(OTUcol2<-ncol(mergedata.prop_rel))
justOTU<-mergedata.prop_rel[,OTUcol1:OTUcol2]
justOTU[1:5,1:5]
rownames(justOTU[1:6,])
rownames(justOTU)<-mergedata.prop_rel$Row.names
rownames(justOTU[1:6,])
rownames(justOTU)<-mergedata.prop_rel$Row.names
justOTU2<-as.matrix(t(justOTU))
justOTU2[1:6,1:6]
library()
HEATMAP_COl <- colorRampPalette(c('#0571b0','#92c5de','#f4a582','#ca0020'))
color.map2 <- function(depth) {
if (depth =="shallow") "red"
else if(depth =="deep") "darkslateblue"
}
sidebarcolors <- unlist(lapply(mergedata.prop_rel$depth, color.map2))
clab=cbind(sidebarcolors)
colnames(clab)=c("depth")
pdf(file= "heatmap-sig-dif-ricketsialles.pdf",width = 25, height = 15)
par(mar=c(0, 2, 2, 3))
heatmap.3(justOTU2, hclustfun=myclust, distfun=mydist, dendrogram="row", Rowv = TRUE, Colv = FALSE, scale="none", col = HEATMAP_COl, lhei = c(1.05, 7), margins = c(20, 40), trace="none", density.info = "none", ColSideColors= clab, keysize=1, cexRow=2.1, cexCol=2.5, cex=5.5, sepwidth=c(0.00009,0.00009), sepcolor="midnightblue", colsep=1:ncol(justOTU2), rowsep=1:nrow(justOTU2), ColSideColorsSize=4, notecex=2.5, KeyValueName="Abundance")
panel.last= legend("topright", legend=c("shallow", "deep"), fill=c("red","darkslateblue"), border=FALSE, bty="n", x.intersp = 0.4, cex=2.5, title= "depth")
dev.off()
Computing file changes ...