Skip to content

Bulk Export (dump)

afquery dump exports allele frequency data to CSV. It supports filtering by region and disaggregating output by sex, technology, or phenotype group.


Basic Usage

Export all variants to stdout:

afquery dump --db ./db/

Write to a file:

afquery dump --db ./db/ --output all_variants.csv

AC > 0 filter

By default dump exports only variants with AC > 0. Variants at covered positions with no carriers are omitted. Use --all-variants to include AC=0 rows, or afquery query --locus to verify coverage at a specific position.

afquery dump --db ./db/ --all-variants --output all_covered.csv

Filter by Region

Export a single chromosome:

afquery dump --db ./db/ --chrom chr1 --output chr1.csv

Export a specific region:

afquery dump --db ./db/ --chrom chr1 --start 900000 --end 1000000 --output region.csv

Positions are 1-based, inclusive on both ends.


Sample Filtering

Apply the same sample filters as query:

afquery dump --db ./db/ \
  --phenotype E11.9 \
  --sex female \
  --tech wgs \
  --output diabetic_female_wgs.csv

Disaggregate Output

All three disaggregation modes work on the same principle: add stratified columns alongside the totals. They can be combined in a single command.

Base columns (always present):

chrom,pos,ref,alt,AC,AN,AF,N_HET,N_HOM_ALT,N_HOM_REF,N_FAIL

Add separate columns for male and female:

afquery dump --db ./db/ --by-sex --output by_sex.csv

Output columns:

chrom,pos,ref,alt,AC,AN,AF,N_HET,N_HOM_ALT,N_HOM_REF,N_FAIL,AC_male,AN_male,AF_male,N_HET_male,N_HOM_ALT_male,N_HOM_REF_male,N_FAIL_male,AC_female,AN_female,AF_female,N_HET_female,N_HOM_ALT_female,N_HOM_REF_female,N_FAIL_female

Add separate columns per sequencing technology:

afquery dump --db ./db/ --by-tech --output by_tech.csv

Output columns include AC_wgs, AN_wgs, AF_wgs, N_HET_wgs, N_HOM_ALT_wgs, N_HOM_REF_wgs, N_FAIL_wgs, AC_wes_v1, AN_wes_v1, etc. (one group of seven columns per registered technology).

Add separate columns for specific phenotype groups:

afquery dump --db ./db/ \
  --by-phenotype E11.9 \
  --by-phenotype I10 \
  --output by_phenotype.csv

Output includes AC_E11.9, AN_E11.9, AF_E11.9, N_HET_E11.9, N_HOM_ALT_E11.9, N_HOM_REF_E11.9, N_FAIL_E11.9, AC_I10, etc.

Disaggregate by all combinations of sex × technology × phenotype simultaneously:

afquery dump --db ./db/ --all-groups --output all_groups.csv

Warning

The number of columns grows as a Cartesian product. Disaggregating by all combinations may produce a very wide CSV file.


Parallelism

Use multiple threads for faster export:

afquery dump --db ./db/ --threads 16 --output all_variants.csv

Full Option Reference

See CLI Reference → dump.


Next Steps