Updated Practical 3 Processing 16S rRNA amplicon data (markdown) authored by Ben Francis's avatar Ben Francis
...@@ -130,7 +130,7 @@ For now though, we're just going to use a (relatively) simple plotting function ...@@ -130,7 +130,7 @@ For now though, we're just going to use a (relatively) simple plotting function
seqtab.m$Genus <- sapply(strsplit(seqtab.m$variable, "-"), "[[", 6) seqtab.m$Genus <- sapply(strsplit(seqtab.m$variable, "-"), "[[", 6)
seqtab.m <- cbind(seqtab.m, replicate(1,seqtab.m[colnames(seqtab.m) == taxonomicLevel])) seqtab.m <- cbind(seqtab.m, replicate(1,seqtab.m[colnames(seqtab.m) == taxonomicLevel]))
colnames(seqtab.m) <- c(colnames(seqtab.m)[1:length(colnames(seqtab.m)) -1], "displayLevel") colnames(seqtab.m) <- c(colnames(seqtab.m)[1:length(colnames(seqtab.m)) -1], "displayLevel")
nb.cols <- length(seqtab.copy) - 1 nb.cols <- length(seqtab) - 1
mycolours <- rep(brewer.pal(12, "Paired"), ceiling(nb.cols/12)) mycolours <- rep(brewer.pal(12, "Paired"), ceiling(nb.cols/12))
ggplot(seqtab.m) + ggplot(seqtab.m) +
geom_bar(aes(x=sample, y=value, fill=displayLevel), stat="identity", position="stack") + geom_bar(aes(x=sample, y=value, fill=displayLevel), stat="identity", position="stack") +
... ...
......