View source: R/validate_pedigree.R
| validate_pedigree | R Documentation |
Validates parent-offspring trios against SNP genotype data using Mendelian error rates. Identifies incorrect parentage assignments, suggests best-matching replacements, and outputs a corrected pedigree. Founder trios (both parents coded as 0) are preserved unchanged if a founders file is supplied. Trios absent from the genotype file are retained as no_genotype_data.
validate_pedigree(
pedigree_file,
genotypes_file,
founders_file = NULL,
trio_error_threshold = 5,
min_markers = 10,
single_parent_error_threshold = 2,
verbose = TRUE,
plot_results = TRUE
)
pedigree_file |
Path to the pedigree file (TSV/CSV/TXT), OR a data.frame / data.table with columns: id, male_parent, female_parent. |
genotypes_file |
Path to the genotypes file (TSV/CSV/TXT), OR a data.frame / data.table with an id column followed by marker columns coded as 0, 1, 2. |
founders_file |
Character, optional. Path to a one-column file listing founder IDs. Founders with both parents coded as 0 are left unchanged. Defaults to NULL. |
trio_error_threshold |
Numeric. Maximum Mendelian error percentage to classify a trio as pass (default: 5.0). Must be between 0 and 100. |
min_markers |
Integer. Minimum non-missing markers required to evaluate a trio (default: 10). |
single_parent_error_threshold |
Numeric. Maximum homozygous-marker mismatch percentage for a parent to be considered acceptable (default: 2.0). Must be between 0 and 100. |
verbose |
Logical. If TRUE, prints progress, summary, and results to the console (default: TRUE). |
plot_results |
Logical. If TRUE, prints a histogram of trio Mendelian error percentages with a threshold line (default: TRUE). |
An invisible named list with the following elements:
Trios that passed the Mendelian error threshold.
Trios that failed the Mendelian error threshold.
Trios with insufficient markers for evaluation.
Trios absent from the genotype file.
Trios identified as founders.
Trios with one or both parents coded as 0 (non-founders).
Complete data.table with all trios and all output columns.
Pedigree table after applying recommended corrections.
ggplot object if plot_results = TRUE, otherwise NULL.
Josue Chinchilla-Vargas
geno_df <- data.frame(
id = c("P1", "P2", "P3", "Off1", "Off2"),
S1 = c(0L, 2L, 0L, 1L, 0L),
S2 = c(2L, 0L, 2L, 1L, 2L),
S3 = c(0L, 2L, 0L, 1L, 0L),
S4 = c(2L, 0L, 2L, 1L, 2L),
S5 = c(0L, 2L, 0L, 1L, 0L),
S6 = c(2L, 0L, 2L, 1L, 2L),
S7 = c(0L, 2L, 0L, 1L, 0L),
S8 = c(2L, 0L, 2L, 1L, 2L),
S9 = c(0L, 2L, 0L, 1L, 0L),
S10 = c(2L, 0L, 2L, 1L, 2L)
)
ped_df <- data.frame(
id = c("Off1", "Off2"),
male_parent = c("P1", "P1"),
female_parent = c("P2", "P3"),
stringsAsFactors = FALSE
)
results <- validate_pedigree(
pedigree_file = ped_df,
genotypes_file = geno_df,
verbose = FALSE,
plot_results = FALSE
)
print(results$full_results)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.