
Convert VCF-Style Genotype Strings to Integer Allele Dosage
convertGenotypeString.RdConverts genotype strings from the OMOP Genomic Extension's VARIANT_OCCURRENCE table to integer allele dosage values (0, 1, 2). Handles VCF-style genotypes ("0/0", "0/1", "1/1", and phased equivalents "0|0", "0|1", "1|1") as well as plain integer strings ("0", "1", "2"). Unrecognized values are converted to NA with a warning.
References
OHDSI Genomic CDM: https://github.com/OHDSI/Genomic-CDM
Examples
convertGenotypeString(c("0/0", "0/1", "1/1", "0|1", "2"))
#> [1] 0 1 2 1 2