Skip to content

Commit

Permalink
Percentages added
Browse files Browse the repository at this point in the history
Shouldn't have been removed, filter_species doesn't work then
  • Loading branch information
KasperSkytte authored Sep 27, 2017
1 parent 6867be1 commit 8ad5d9e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions R/amp_ordinate.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8ad5d9e

Please sign in to comment.