| merge-methods {polysat} | R Documentation |
Merge Two Genotype Objects into One
Description
The generic function merge has methods defined in polysat to
merge two genotype objects of the same class. Each method has optional
samples and loci arguments for specifying subsets of
samples and loci to be included in the merged object. Each method also
has an optional overwrite argument to specify which of the two
objects should not be used in the case of conflicting data.
Usage
merge(x, y, ...)
Arguments
x |
One of the objects to be merged. For the methods defined for
polysat this should be of class |
y |
The other object to be merged. Should be of the same class as
|
... |
Additional arguments specific to the method. |
Methods
The methods for merge in polysat have four additional
arguments: objectm, samples, loci, overwrite.
The samples and loci arguments can specify, using
character vectors, a subset of the samples and loci found in
x and y to write to the object that is returned.
If overwrite = "x", data from the second object will be used
wherever there is contradicting data. Likewise if overwrite =
"y", data from the first object will be used wherever there is
contradicting data. If no overwrite argument is given, then
any contradicting data between the two objects will produce an error
indicating where the contradicting data were found.
The objectm argument is primarily for internal use (most
users will not need it). If this argument is not
provided, a new genotype object is created and data from x
and y are written to it. If objectm is
provided, this is the object to which data will be written, and the
object that will be returned.
signature(x = "genambig", y = "genambig")-
This method merges the genotype data from
xandy. If the missing data symbols differ between the objects,overwriteis used to determine which missing data symbol to use, and all missing data symbols in the overwritten object are converted. Ifoverwriteis not provided and the missing data symbols differ between the objects, an error will be given. The genotypes are then filled in. If certain sample*locus combinations do not exist in either object (xandyhave different samples as well as different loci), missing data symbols are left in these positions. Again, for genotypes,overwritedetermines which object to preferentially use for data and whether to give an error if there is a disagreement.The
mergemethod forgendatais then called. signature(x = "genbinary", y = "genbinary")-
This method also merges genotype data for
xandy, then calls the method forgendata.Missing,Present, andAbsentare checked for consistency between objects similarly to what happens withMissingin thegenambigmethod. Genotypes are then written to the merged object, and consistency between genotypes is checked. signature(x = "gendata", y = "gendata")-
This method merges data about ploidy, repeat length, and population identity, as well as writing one or both dataset descriptions to the merged object.
The same population numbers can have different meanings in
PopInfo(x)andPopInfo(y). The uniquePopNamesare used instead to determine population identity, and thePopInfonumbers are changed if necessary. Therefore, it is important for identical populations to be named the same way in both objects, but not important for identical populations to have the same number in both objects.