############################################
### A standard case paternity case:
### Compute the power of exclusion when the claimed father is in fact
### unrelated to the child.
############################################
# Claim: 'AF' is the father of 'CH'
claim = nuclearPed(father = "AF", children = "CH")
# Attach two (empty) markers
claim = claim |>
addMarker(alleles = 1:2) |>
addMarker(alleles = 1:3)
# Truth: 'AF' and 'CH' are unrelated
true = singletons(c("AF", "CH"))
# EP when both are available for genotyping
exclusionPower(claim, true, ids = c("AF", "CH"))
# EP when the child is typed; homozygous 1/1 at both markers
claim2 = claim |>
setGenotype(marker = 1:2, id = "CH", geno = "1/1")
exclusionPower(claim2, true, ids = "AF")
############################################
### Two females claim to be mother and daughter, but are in reality sisters.
### We compute the power of various markers to reject the claim.
############################################
ids = c("A", "B")
claim = nuclearPed(father = "NN", mother = "A", children = "B", sex = 2)
true = nuclearPed(children = ids, sex = 2)
# SNP with MAF = 0.1:
PE1 = exclusionPower(claimPed = claim, truePed = true, ids = ids,
alleles = 1:2, afreq = c(0.9, 0.1))
stopifnot(round(PE1$EPtotal, 5) == 0.00405)
# Tetra-allelic marker with one major allele:
PE2 = exclusionPower(claimPed = claim, truePed = true, ids = ids,
alleles = 1:4, afreq = c(0.7, 0.1, 0.1, 0.1))
stopifnot(round(PE2$EPtotal, 5) == 0.03090)
### How does the power change if the true pedigree is inbred?
trueLOOP = halfSibPed(sex2 = 2) |> addChildren(4, 5, ids = ids)
# SNP with MAF = 0.1:
PE3 = exclusionPower(claimPed = claim, truePed = trueLOOP, ids = ids,
alleles = 1:2, afreq = c(0.9, 0.1))
# Power almost doubled compared with PE1
stopifnot(round(PE3$EPtotal, 5) == 0.00765)
Run the code above in your browser using DataLab