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
ngs2gel.b<-function(spc,tax,subs=0.005,band_multiplier=5,label_tax_1="Phylum", | |
label_tax_2="Order", band_col="grey",y_labs_remover=2,y_labs_size=1){ | |
#libs used | |
require(reshape2) | |
require(vegan) | |
require(ggh4x) | |
require(cowplot) | |
require(ggrepel) |
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
##source_gist("https://gist.github.com/robiwangriff/79633a738b128e64226bf58381232da7") | |
#' # 1. Merge and filter | |
#'A small function to merge and align, and output a list containing the aligned $spc, $env, and $tax | |
#' files. The main part of this is merge() and requires specifying two "common reference" vectors in both datasets. | |
aligner<-function(spc,env,tax=NULL, spc_id="row.names",env_id="row.names",tax_id="row.names",transpose_spc=FALSE){ | |
#transpose the spc file so sample IDs are rows (and row names) | |
spc.t<-spc |
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
################################################################################################################# | |
#install | |
#library(devtools) | |
#source_gist("https://gist.github.com/robiwangriff/62ee1fd1adfcb50cfd5520075ce9da86") | |
#spc= a species(cols) by samples (rows) data frame | |
#env= an environmental metadata data frame, aligned with spc. Used to order and label samples on x axis (#the order loaded on gel) | |
#tax= a taxonomy file with sequences/OTU ids as row names - normally would match colnames of spc df. Though shouldnt matter. | |
#subs= Unlike real gels, we cant plot the abundance of every species. This sets a relative abundance threshold for taxa to plot. |