# Setup: Pedigree with two markers
x = nuclearPed(1)
x = addMarker(x, `2` = "1/2", alleles = 1:2, name = "m1")
x = addMarker(x, `3` = "2/2", alleles = 1:2, name = "m2")
# Extract allele matrix
mat1 = getAlleles(x)
mat2 = getAlleles(x, ids = 2:3, markers = "m2")
stopifnot(identical(mat1[2:3, 3:4], mat2))
# Remove all genotypes
y = setAlleles(x, alleles = 0)
y
# Setting a single genotype
z = setAlleles(y, ids = "1", marker = "m2", alleles = 1:2)
# Alternative: In-place modification with `genotype()`
genotype(y, id = "1", marker = "m2") = "1/2"
stopifnot(identical(y,z))
### Manipulation of pedlist objects
s = transferMarkers(x, singleton("s"))
peds = list(x, s)
getAlleles(peds)
setAlleles(peds, ids = "s", marker = "m1", alleles = 1:2)
Run the code above in your browser using DataLab