ancestry-array-ingest
Parse an AncestryDNA raw export, record chip metadata and hashes, and convert it to a sorted, bgzipped GRCh37 VCF (tabix-indexed with bcftools) with correct ploidy, PAR handling and REF orientation. U
Files1
View on GitHubSKILL.md.agents/skills/ancestry-array-ingest/SKILL.md
GitHubAncestryDNA array ingest
Trigger
A new or re-downloaded AncestryDNA ancestryDNA.txt, or a request to regenerate the
GRCh37 VCF used by imputation.
Inputs and outputs
- Input: the raw export (owner copy at
vault/genome/ancestry_dna/ancestryDNA.txt) and, for imputation-ready output, a local uncompressed GRCh37 FASTA (GENOME_REFERENCE_ROOT). - Output (gitignored scratch):
people/robert_clark_jr/vcf_output/*.vcf.gz,.tbi,*.conversion_summary.json,*.unconverted_rows.tsv. Archive reviewed outputs undervault/genome/converted/onprivateonly.
Privacy classification
Raw rows and VCFs are direct identifiers: R4 / do_not_share. Never copy them into tests,
examples, logs, prompts or public branches.
Preconditions
- Record the export's sha256 before reading it; keep the original bytes unchanged.
bcftools(BCFTOOLS_PATH) sorts, compresses and indexes; with--no-bcftoolsthe converter writes a sorted BGZF file without a tabix index.
Procedure
- Convert with an explicit
--sample-sex;malewrites non-PAR X and Y as haploid. - Use
--reference-fastato orient REF/ALT; unresolved rows go tounconverted_rows.tsv. - Keep the legacy header fields (
##aave_sample_sex,AAVE_REF_UNKNOWN) so outputs stay diffable with earlier VCFs.
Stop conditions
Stop when the hash differs from the manifest, the build is not GRCh37, or the reference FASTA naming does not match (1..22, X, Y, MT).
Failure handling
Malformed rows are counted and listed, never guessed. A missing FASTA yields an inspection-only VCF that is clearly labeled as not imputation-ready.
Validation
tests/test_convert_ancestry_vcf.py, test_genome_header.py, test_genome_orientation.py.
Example (synthetic)
.\.venv\Scripts\python.exe scripts\convert_ancestry_vcf.py `
--input tests\fixtures\synthetic\ancestry_raw_synthetic.txt `
--output-dir out\synthetic-vcf --sample-id synthetic --sample-sex male --no-bcftools
Cannot support
Strand and orientation are inferred from the reference, not from the array; a converted call is still an array call, not sequencing.