mecfs_bio.build_system.task.genome_reference_harmonization.palindromes
Strand resolution of palindromic SNVs in untrusted tables: gwaslab's rule plus a distance check.
Rows arrive oriented so that NEA is the reference base, so a panel record with REF = NEA and ALT = EA describes the same variant. A variant is resolvable only when:
- its EAF is at most palindrome_maf_threshold, or at least 1 - palindrome_maf_threshold;
- the panel record exists;
- the panel MAF is at most panel_maf_threshold;
- after the decision, its EAF is within palindrome_max_af_distance of the panel AF.
It is kept when EAF and panel AF lie on the same side of 0.5, and strand-flipped (statistics flipped, alleles unchanged) otherwise. The distance check is not part of gwaslab's rule. On DecodeME, panels contradict each other's strand call for about one in ten palindromes beyond a distance of 0.1, against about one in five thousand within 0.02; see experiments/claude/gnomad_af_reference/palindrome_distance_vs_panel_disagreement.md.
Functions:
-
decide_palindrome_strands–One PalindromeDecision per row of rows (POS, EA, NEA, EAF), in row order.
Attributes:
decide_palindrome_strands
decide_palindrome_strands(
rows: DataFrame,
panel: DataFrame,
options: GenomeReferenceHarmonizationOptions,
) -> pl.Series
One PalindromeDecision per row of rows (POS, EA, NEA, EAF), in row order.