marker_setattr {pedtools} | R Documentation |
Set marker attributes
Description
These functions set or modify various attributes of markers attached to a pedigree. They are sometimes more convenient (and pipe-friendly) than the in-place modifiers described in marker_inplace.
Usage
setGenotype(x, marker = NULL, ids = NULL, geno = NULL, id = NULL)
setAfreq(x, marker, afreq, strict = TRUE)
setAlleleLabels(x, marker, alleles)
setMarkername(x, marker = NULL, name)
setChrom(x, marker = NULL, chrom)
setPosition(x, marker = NULL, posMb)
Arguments
x |
A |
marker |
A vector of indices or names of one or several markers attached
to |
geno |
A character vector of length |
id , ids |
A vector naming one or several pedigree members, or a function
(e.g., |
afreq |
A numeric of the same length as |
strict |
A logical. If TRUE (default) the new frequencies cannot remove or add any alleles. |
alleles |
A character containing allele names. If not given, and |
name |
A character of the same length as |
chrom |
A character of the same length as |
posMb |
A numeric of the same length as |
Value
A copy of x
with modified attributes.
Examples
x = nuclearPed() |>
addMarker(alleles = 1:2) |>
setMarkername(marker = 1, name = "M") |>
setGenotype(marker = "M", ids = 1, geno = "1/2") |>
setAfreq(marker = "M", afreq = c(`1` = 0.1, `2` = 0.9)) |>
setChrom(marker = "M", chrom = 1) |>
setPosition(marker = "M", posMb = 123.45)
# Alternatively, all of this could have been done on creation:
y = addMarker(nuclearPed(),
`1` = "1/2",
afreq = c(`1` = 0.1, `2` = 0.9),
name = "M",
chrom = 1,
posMb = 123.45)
stopifnot(identical(x, y))