marker_attach {pedtools} | R Documentation |
Attach markers to pedigrees
Description
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. Note that there is also
the function addMarker()
, which creates and attaches a single marker in one
go.
Usage
setMarkers(
x,
m = NULL,
alleleMatrix = NULL,
locusAttributes = NULL,
missing = 0,
sep = NULL,
checkCons = TRUE
)
addMarkers(
x,
m = NULL,
alleleMatrix = NULL,
locusAttributes = NULL,
missing = 0,
sep = NULL,
checkCons = TRUE
)
Arguments
x |
A |
m |
Either a single |
alleleMatrix |
A matrix with |
locusAttributes |
A list of lists, with attributes for each marker. See Details for possible attributes. |
missing |
A single character (or coercible to one) indicating the symbol for missing alleles. |
sep |
If this is a single string, each entry of |
checkCons |
A logical. If TRUE (default), each marker is checked for
consistency with |
Details
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)
, whereL = length(alleles)
) -
chrom
: chromosome number (NA) -
posMb
: physical location in megabases (NA) -
name
: marker name (NA) -
mutmod
: mutation model, or model name (NULL) -
rate
: mutation model parameter (NULL)
If locusAttributes
is a single list of attributes (not a list of lists),
then it is repeated to match the number of markers.
Alternative formats of locusAttributes
:
data frame or matrix. In this case an attempt is made to interpret it as a frequency database in
allelic ladder
format.A list of frequency vectors. All vectors should sum to 1, and be named (with allele labels)
Shortcut for simple SNP data: The argument
locusAttributes = "snp-AB"
sets all markers to be equifrequent SNPs with alleles A and B. The letters A and B may be replaced by other single-character letters or numbers.
Value
A ped
object.
See Also
Examples
x = singleton(1)
m1 = marker(x, `1` = "1/2")
m2 = marker(x, `1` = "a/b")
# Attach to x
x1 = setMarkers(x, list(m1, m2))
# Reversing the order of the markers
setMarkers(x, list(m2, m1))
# Alternative syntax, adding one marker at a time
x2 = x |>
addMarker(`1` = "1/2") |>
addMarker(`1` = "a/b")
stopifnot(identical(x1, x2))