% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/amp_merge_ampvis2.R
\name{amp_merge_ampvis2}
\alias{amp_merge_ampvis2}
\title{Merge ampvis2 object(s)}
\usage{
amp_merge_ampvis2(
  ...,
  by_refseq = TRUE,
  refseq_names = NULL,
  rename_unmatched = TRUE,
  unmatched_prefix = "unmatched"
)
}
\arguments{
\item{...}{(required) Any number of ampvis2-class objects to merge}

\item{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. (\emph{default:} \code{TRUE})}

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

\item{rename_unmatched}{Whether to rename any unmatched sequences or not when \code{refseq_names} is provided. (\emph{default:} \code{TRUE})}

\item{unmatched_prefix}{Prefix used to name any unmatched sequences when \code{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 \code{unmatched123}, and so on. (\emph{default:} \code{"unmatched"})}
}
\value{
An ampvis2-class object
}
\description{
Merge any number of ampvis2 objects into a single object.
}
\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 \code{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 \code{by_refseq = TRUE} the full DNA sequences will be used as the new OTU ID's unless \code{refseq_names} is provided.

Currently, phylogenetic trees are not merged. Feel free to contribute.
}
\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
)
}
