Created
March 25, 2016 23:50
-
-
Save zdk123/8922fa104f7717aee1f3 to your computer and use it in GitHub Desktop.
Example pipeline for running SpiecEasi on biom files
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
library('devtools') | |
install_github('zdk123/SpiecEasi') | |
library(SpiecEasi) | |
library(phyloseq) | |
url <- "https://github.com/zdk123/SpiecEasi/blob/master/inst/extdata/study_1925_closed_reference_otu_table.biom" | |
download.file(url, desfile='AG1.biom' method='wget') ## download method is system dependent | |
amgut1 <- import_biom('AG1.biom') | |
## filter taxa that appear in fewer than 30% of the samples | |
amgut1.filt <- prune_taxa(rowSums(sign(amgut1@otu_table@.Data)) > nsamples(amgut1)*.3, amgut1) | |
ig.mb <- graph.adjacency(se.mb.amgut$refit, mode='undirected') | |
vsize <- exp(colMeans(se.mb.amgut$data)/2)+2 | |
## filter edges that we are less confidence of (i.e. by StARS 'merge' estimate) | |
highconfnet <- se.mb.amgut$refit * (se.mb.amgut$merge[[se.mb.amgut$opt.index]] > .9) | |
ig.hc <- graph.adjacency(highconfnet, mode='undirected') | |
am.coord <- layout.fruchterman.reingold(ig.mb) | |
## plot | |
par(mfrow=c(1,2)) | |
plot(ig.mb, layout=am.coord, vertex.size=vsize, vertex.label=NA, main="MB") | |
plot(ig.hc, layout=am.coord, vertex.size=vsize, vertex.label=NA, main="High Confidence edges") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment