io.projectglow.transformers.normalizevariants
The following function is for backward compatibility with the previous API where the normalizer could act in different modes: The default mode was normalizing the variants without splitting multiallelic ones.
The following function is for backward compatibility with the previous API where the normalizer could act in different modes: The default mode was normalizing the variants without splitting multiallelic ones. The "mode" option could be used to change this behavior. Setting "mode" to "split" only splits multiallelic variants and skips normalization. Setting "mode" to split_and_normalize splits multiallelic variants and then normalizes the split variants, which is equivalent to using split_multiallelics transformer followed by normalize_variants transformer.
Implements DataFrameTransformer to transform the input DataFrame of variants to an output DataFrame of normalized variants (normalization is as defined in vt normalize or bcftools norm).
A path to the reference genome .fasta file must be provided through the reference_genome_path option. The .fasta file must be accompanied with a .fai index file in the same folder.
The transformer output columns can be controlled by the replace_columns option:
If the replace_columns option is false, the transformer does not touch the original start, end, referenceAllele and alternateAlleles columns. Instead, a StructType column called normalizationResult is added to the DataFrame which contains the normalized start, end, referenceAllele, and alternateAlleles columns as well as the normalizationStatus StructType as the fifth field, which contains the following subfields:
If replace_columns option is true (default), the transformer replaces the original start, end, referenceAllele, and alternateAlleles columns with the normalized value in case they have changed. Otherwise (in case of no change or an error), the original start, end, referenceAllele, and alternateAlleles are not touched. A StructType normalizationStatus column is added to the DataFrame with the same subfields as above.