...
The ampvis2 package requires a 3 components:
A table of read counts per sample per ASV (abundance table)
A table that matches ASVs to taxonomy information
A metadata table containing your sample IDs and any variables (e.g. experimental groups) associated with each sample.
...
nfcore/ampliseq generates the abundance and taxonomy tables, and we created the metadata table in the previous section, so we can import all 3 into R.
Import the metadata table
...
Code Block |
---|
subgroup <- "all" |
Convert the imported data to ampvis2 format
The following code cell manipulates the data in a variety of ways (see the in-code #comments for explanations) to prepare the data for conversion to an ampliseq2 database.
Import the taxonomy table
Read in the taxonomy data - i.e. the taxonomic assignments for each ASV
...
Code Block |
---|
asv_table$Kingdom <- gsub("D_0", "k", asv_table$Kingdom) asv_table$Phylum <- gsub("D_1", "p", asv_table$Phylum) asv_table$Class <- gsub("D_2", "c", asv_table$Class) asv_table$Order <- gsub("D_3", "o", asv_table$Order) asv_table$Family <- gsub("D_4", "f", asv_table$Family) asv_table$Genus <- gsub("D_5", "g", asv_table$Genus) asv_table$Species <- gsub("D_6", "s", asv_table$Species) |
Convert the imported data to ampvis2 format
Now combine the samples data with the ASV table using amp_load(). This creates an ampvis2 database that can be used by ampvis2
Code Block |
---|
ampvisdata <- amp_load(otutable = asv_table, metadata = samples_table) |
You can see information about the ampvis2 object you just created by typing its name
Code Block |
---|
ampvisdata |
4b. Choosing a categorical variable to analyse
...