Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Cleaning up OTU tables and Phylogenies
phy = read.tree("mytree.tre")
samp = read.table("OTUtable.txt", head = T, sep = "")
#lists taxa in OTU table that are not in the phylogeny, and removes them
samp = (samp[rowSums(samp) != 0, , drop=FALSE])
samp = t(samp)
phy = prune.sample(samp, phy)
labs <- phy$tip.label
length(labs)
ncol(samp)
sampnames <- colnames(samp)
sampnames[!(sampnames %in% labs)]
samp <- samp[,labs]
#code for removing OTUs who don't belong in the diversity profile (i.e., zero for all communities)
samp = samp[,colSums(samp) != 0]
phy = prune.sample(comm, phy)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.