# Child of half siblings: f = 1/8
x = halfCousinPed(0, child = TRUE)
# Inbreeding vector
inbreeding(x)
# Simpler output using the `ids` argument:
inbreeding(x, ids = 6)
### X-chromosomal inbreeding ###
# Males have inbreeding coefficient 1
stopifnot(inbreeding(x, ids = 6, Xchrom = TRUE) == 1)
y1 = swapSex(x, ids = 6) # female child
stopifnot(inbreeding(y1, ids = 6, Xchrom = TRUE) == 0)
y2 = swapSex(y1, ids = 2) # female ancestor
stopifnot(inbreeding(y2, ids = 6, Xchrom = TRUE) == 0.25)
### Inbred founder ###
# Mother 100% inbred
founderInbreeding(x, ids = 2) = 1
inbreeding(x)
# Example with selfing and complete inbreeding
s = selfingPed(1)
founderInbreeding(s, 1) = 1
stopifnot(inbreeding(s, ids = 2) == 1)
Run the code above in your browser using DataLab