Skip to contents

Converts 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.

Usage

convertGenotypeString(genotypeRaw)

Arguments

genotypeRaw

Character vector of raw genotype strings.

Value

Integer vector of allele dosage values (0, 1, or 2). Unrecognized values are set to NA.

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