From 8ad5d9e10a9c3c5199c383bd4fec11721bcec0cd Mon Sep 17 00:00:00 2001 From: KasperSkytte Date: Wed, 27 Sep 2017 15:41:51 +0200 Subject: [PATCH] Percentages added Shouldn't have been removed, filter_species doesn't work then --- R/amp_ordinate.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/R/amp_ordinate.R b/R/amp_ordinate.R index 3d37c235..ffd129d3 100644 --- a/R/amp_ordinate.R +++ b/R/amp_ordinate.R @@ -173,6 +173,11 @@ amp_ordinate<- function(data, #Check the data data <- amp_rename(data = data, tax_empty = tax_empty) + #First transform to percentages + abund_pct <- as.data.frame(sapply(data$abund, function(x) x/sum(x) * 100)) + rownames(abund_pct) <- rownames(data$abund) #keep rownames + data$abund <- abund_pct + #Then filter low abundant OTU's where ALL samples have below the threshold set with filter_species in percent data$abund <- data$abund[!apply(data$abund, 1, function(row) all(row <= filter_species)),] #remove low abundant OTU's rownames(data$tax) <- data$tax$OTU