callRelatedness {BREADR} | R Documentation |
callRelatedness
Description
A function that takes PMR observations, and (given a prior distribution for degrees of relatedness) returns the posterior probabilities of all pairs of individuals being (a) the same individual/twins, (b) first-degree related, (c) second-degree related or (d) "unrelated" (third-degree or higher). The highest posterior probability degree of relatedness is also returned as a hard classification. Options include setting the background relatedness (or using the sample median), a minimum number of overlapping SNPs if one uses the sample median for background relatedness, and a minimum number of overlapping SNPs for including pairs in the analysis.
Usage
callRelatedness(
pmr_tibble,
class_prior = rep(0.25, 4),
average_relatedness = NULL,
median_co = 500,
filter_n = 1
)
Arguments
pmr_tibble |
a tibble that is the output of the processEigenstrat function. |
class_prior |
the prior probabilities for same/twin, 1st-degree, 2nd-degree, unrelated, respectively. |
average_relatedness |
a single numeric value, or a vector of numeric values, to use as the average background relatedness. If NULL, the sample median is used. |
median_co |
if average_relatedness is left NULL, then the minimum cutoff for the number of overlapping snps to be included in the median calculation is 500. |
filter_n |
the minimum number of overlapping SNPs for which pairs are removed from the entire analysis. If NULL, default is 1. |
Value
results_tibble: A tibble containing 13 columns:
row: The row number
pair: the pair of individuals that are compared.
relationship: the highest posterior probability estimate of the degree of relatedness.
pmr: the pairwise mismatch rate (mismatch/nsnps).
sd: the estimated standard deviation of the pmr.
mismatch: the number of sites which did not match for each pair.
nsnps: the number of overlapping snps that were compared for each pair.
ave_re;: the value for the background relatedness used for normalisation.
Same_Twins: the posterior probability associated with a same individual/twins classification.
First_Degree: the posterior probability associated with a first-degree classification.
Second_Degree: the posterior probability associated with a second-degree classification.
Unrelated: the posterior probability associated with an unrelated classification.
BF: A strength of confidence in the Bayes Factor associated with the highest posterior probability classification compared to the 2nd highest. (No longer included)
Examples
callRelatedness(counts_example,
class_prior=rep(0.25,4),
average_relatedness=NULL,
median_co=5e2,filter_n=1
)