This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Example for calculating diversity profiles of Part of the Eectronic Supplementary Material for Leinster, T. & Cobbold C.A. 2011 | |
#"Measuring diversity: the importance of species similarity" # | |
#URL: www.esajournals.org/doi/abs/10.1890/10-2402.1 # | |
require(picante) | |
#assumes you already have a phylogeny (called "phylo") and a community matrix (called "samp")# | |
#where rows = sites, columns = taxa (the way VEGAN and PICANTE like them).# | |
samp <- t(samp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This code uses a community matrix a'la VEGAN to make a bipartite network of how your taxa are organized into a particular habitat# | |
#Gets really messy with >100 species# | |
samp <- samp[c(4,10,1,11,12),] | |
require(bipartite) | |
visweb(samp, type="nested", prednames=TRUE, preynames=TRUE, labsize=1, | |
plotsize=12, square="black", text="no", frame=NULL, textsize=1, | |
textcol="red", pred.lablength=NULL, prey.lablength = NULL, clear=TRUE, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This is code for those plots I made using the MPD and MNTD metrics. You need to organize them into a table such as the one below# | |
require(ggplot2) | |
data = read.csv("data.csv", header = TRUE, sep = "") | |
s <- c("NM1","NM2","NM3", "NM4", "NM5", "Green", "Pink", "Brown", "S1", "S2", "G1", "G2") | |
data$OTU <- factor(data$OTU) | |
cyanos = subset(data, group == "cyano") | |
PSBs = subset(data, group == "PSB") | |
closts = subset(data, group == "clost") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################ | |
#CODE FOR ANALYZING NESTEDNESS OF A COMMUNITY MATRIX & PLOTTING THE RESULTS# | |
############################################################################ | |
require(vegan) | |
require(ade4) | |
#Here, samp_85 is simply a community matrix of my 85% OTU cyano bins. The [5:9] just chooses | |
#specific rows for analysis (here, a depth gradient). | |
samp <- samp_85[c(5:9),] |
NewerOlder