Merge variant info from two sources with allele-flip-aware matching
Source:R/allele_qc.R
merge_variant_info.RdMerges variant metadata (chromosome, position, ref, alt) from two sources, detecting and correcting allele flips (where alt/ref are swapped). Creates a canonical key from sorted alleles to match across datasets.
Arguments
- variants1
A data.frame with columns
chrom,pos,alt,ref, or aGRangeswith corresponding metadata columns.- variants2
A data.frame or
GRangeswith the same columns.- all
Logical. If TRUE (default), returns the union of both sets. If FALSE, returns only variants from
variants2(flipped to matchvariants1's allele orientation).