If you have problems or questions, ideas for improvements, or even found a bug or two, feel free to post at https://github.com/MadsAlbertsen/ampvis2/issues or email one of the developers, anything and everything is welcome.
By default the raw read counts in the abundance matrix are normalised (transformed to percentages) by some plotting functions automatically (for example
amp_timeseries, and more). This means that the relative abundances shown will be calculated based on the remaining taxa after the subset, not including the removed taxa, if any. To circumvent this, set
normalise = TRUE when subsetting with the
amp_subset_samples functions, and then set
raw = TRUE in the plotting function. This will transform the OTU counts to relative abundances BEFORE the subset, and setting
raw = TRUE will skip the transformation in the plotting function, see the example below.
If you wan’t to calculate a distance matrix manually and use it for PCoA or nMDS in
amp_ordinate, it can be done quite easily by just setting
filter_species = 0,
transform = "none", and
distmeasure = "none", like below. The matrix should be a symmetrical matrix containing coefficients for all pairs of samples in the data.
#Override the abundance table in the ampvis2 object with a custom distance matrix ampvis2_object$abund <- custom_dist_matrix #set filter_species = 0, transform = "none", and distmeasure = "none" amp_ordinate(ampvis2_object, type = "pcoa", filter_species = 0, transform = "none", distmeasure = "none")
This is particularly useful if you want to import data in the QIIME, biom, mothur, and pyrotagger formats, see the phyloseq Data Import tutorial. You will first have to extract the OTU-table and the metadata from the phyloseq object, and then import as normal with
library(ampvis2) #Combine OTU abundance table and taxonomy table from the phyloseq object "my_phyloseq_object": obj <- my_phyloseq_object otutable <- data.frame(OTU = rownames(phyloseq::otu_table(obj)@.Data), phyloseq::otu_table(obj)@.Data, phyloseq::tax_table(obj)@.Data, check.names = FALSE ) #Extract metadata from the phyloseq object: metadata <- data.frame(phyloseq::sample_data(obj), check.names = FALSE ) #Load the data with amp_load: my_ampvis2_object <- amp_load(otutable, metadata)