| locusAttributes | R Documentation |
Retrieve or modify the attributes of attached markers
getLocusAttributes(
x,
markers = NULL,
attribs = c("alleles", "afreq", "name", "chrom", "posMb", "mutmod"),
checkComps = FALSE,
simplify = FALSE
)
setLocusAttributes(
x,
markers = NULL,
locusAttributes,
matchNames = NA,
erase = FALSE
)
x |
A |
markers |
A character vector (with marker names) or a numeric vector
(with marker indices). If NULL (default), the behaviour depends on
|
attribs |
A subset of the character vector |
checkComps |
A logical. If TRUE, and |
simplify |
A logical. If TRUE, and |
locusAttributes |
A list of lists, with attributes for each marker. |
matchNames |
A logical, only relevant if |
erase |
A logical. If TRUE, all previous attributes of the selected
markers are erased. If FALSE, attributes not affected by the submitted
|
The default setting markers = NULL selects markers automatically, depending
on the matchNames argument. If matchNames = FALSE, all markers are
chosen. If matchNames = TRUE, markers will be matched against the name
entries in locusAttributes (and an error issued if any are missing).
Note that the default value NA of matchNames is changed to TRUE if all
entries of locusAttributes have a name component which matches the name
of an attached marker.
Possible attributes given in locusAttributes are as follows (default values
in parentheses):
alleles: a character vector with allele labels
afreq: a numeric vector with allele frequencies (rep.int(1/L, L),
where L = length(alleles))
name: marker name (NA)
chrom: chromosome number (NA)
posMb: physical location in megabases (NA)
mutmod: mutation model, or model name (NULL)
rate: mutation model parameter (NULL)
getLocusAttributes: a list of lists. If the markers have names,
these are used to name the outer list. If simplify = TRUE and attribs is
a single element, the output is a simple list.
setLocusAttributes: a modified version of x.
x = singleton(1) |>
addMarker(name = "m1", alleles = 1:2) |>
addMarker(name = "m2", alleles = letters[1:2], chrom = "X")
# By default, the markers to be modified are identified by name
locs = list(list(name = "m1", alleles = 1:10),
list(name = "m2", alleles = letters[1:10]))
y = setLocusAttributes(x, locusAttributes = locs)
getMarkers(y, 1:2)
# If `erase = TRUE` attributes not explicitly given are erased
y2 = setLocusAttributes(x, locusAttributes = locs, erase = TRUE)
chrom(y2, 2) # not "X" anymore
# The getter and setter are inverses
newx = setLocusAttributes(x, locusAttributes = getLocusAttributes(x))
stopifnot(identical(x, newx))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.