amp_merge_ampvis2: Merge ampvis2 object(s)

View source: R/amp_merge_ampvis2.R

amp_merge_ampvis2R Documentation

Merge ampvis2 object(s)

Description

Merge any number of ampvis2 objects into a single object.

Usage

amp_merge_ampvis2(
  ...,
  by_refseq = TRUE,
  refseq_names = NULL,
  rename_unmatched = TRUE,
  unmatched_prefix = "unmatched"
)

Arguments

...

(required) Any number of ampvis2-class objects to merge

by_refseq

(recommended) Merge by exact matches between DNA reference sequences. The full DNA sequences will then be used as the new names in the output. (default: TRUE)

refseq_names

Path to a FASTA file or a DNAbin class object with sequences whose names will be used as OTU names by exact matches (i.e. same length, 100% sequence identity). (default: NULL)

rename_unmatched

Whether to rename any unmatched sequences or not when refseq_names is provided. (default: TRUE)

unmatched_prefix

Prefix used to name any unmatched sequences when refseq_names is provided. An integer counting from 1 will be appended to this prefix, so for example the 123th unmatched sequence will be named unmatched123, and so on. (default: "unmatched")

Details

It's important to ensure that the taxonomy for all OTU's across data sets is generated in the exact same way with the same database. When by_refseq = FALSE it's likewise important to ensure that OTU ID's are not arbitrary between data sets and that they are corresponding to the same sequences across data sets (objects). When by_refseq = TRUE the full DNA sequences will be used as the new OTU ID's unless refseq_names is provided.

Currently, phylogenetic trees are not merged. Feel free to contribute.

Value

An ampvis2-class object

Examples

data("MiDAS")

# summary of samples from 2010-2012
amp_filter_samples(
  MiDAS,
  Year %in% c("2010", "2011", "2012")
)

# now merge individual objects and verify summary is the same
d_2010 <- amp_filter_samples(
  MiDAS,
  Year %in% "2010"
)
d_2011 <- amp_filter_samples(
  MiDAS,
  Year %in% "2011"
)
d_2012 <- amp_filter_samples(
  MiDAS,
  Year %in% "2012"
)

amp_merge_ampvis2(
  d_2010,
  d_2011,
  d_2012
)

MadsAlbertsen/ampvis2 documentation built on Jan. 28, 2024, 7:12 a.m.