In many applications it is useful to attach markers to their associated
ped
object. In particular for bigger projects with many markers, this makes
it easier to manipulate the dataset as a unit. The function setMarkers()
replaces all existing markers with the supplied ones, while addMarkers()
appends the supplied markers to any existing ones.
setMarkers(x, m = NULL, alleleMatrix = NULL, locusAttributes = NULL,
missing = 0, sep = NULL, ...)addMarkers(x, m = NULL, alleleMatrix = NULL, locusAttributes = NULL,
missing = 0, sep = NULL, ...)
A ped
object
Either a single marker
object or a list of marker
objects
A matrix with pedsize(x)
rows, containing the observed
alleles for one or several markers. The matrix must have either 1 or 2
columns per marker. If the former, then a sep
string must be a given, and
will be used to split all entries.
A list of lists, with attributes for each marker. See Details for possible attributes.
A single character (or coercible to one) indicating the symbol for missing alleles.
If this is a single string, each entry of alleleMatrix
is
interpreted as a genotype, and will be split by calling strsplit(..., split = sep, fixed = T)
. For example, if the entries are formatted as
"A/B", put sep = "/"
. Default: NULL.
Further arguments
A ped
object.
The most general format of locusAttributes
a list of lists, one for each
marker, where possible entries in the inner lists are as follows (default
values in parenthesis):
alleles
: a character vector with allele labels
afreq
: a numeric vector with allele frequencies (rep.int(1/L, L)
,
where L = length(alleles)
)
chrom
: chromosome number (NA)
posMb
: physical location in megabases (NA)
posCm
: position in centiMorgan (NA)
name
: marker name (NA)
mutmod
: mutation model, or model name (NULL)
rate
: mutation model parameter (NULL)
If locusAttributes
is just a single list of attributes (not a list of
lists), then it is repeated to match the number of markers.
Two alternative format of locusAttributes
are allowed: If a data.frame or
matrix is given, an attempt is made to interpret it as a frequency database
in allelic ladder
format. Such an interpretation is also attempted if
locusAttributes
is a list of named frequency vectors (where the names are
the allele labels).
# NOT RUN {
x = singleton(1)
m1 = marker(x, '1' = 1:2)
m2 = marker(x, '1' = 'a')
x = setMarkers(x, m1)
x = addMarkers(x, m2)
x
# Reversing the order of the markers
x = setMarkers(x, list(m2, m1))
x
# }
Run the code above in your browser using DataLab