afquery 0.5.0__tar.gz → 0.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {afquery-0.5.0 → afquery-0.7.0}/.github/workflows/ci.yml +4 -4
- {afquery-0.5.0 → afquery-0.7.0}/.github/workflows/docs.yml +2 -2
- {afquery-0.5.0 → afquery-0.7.0}/.github/workflows/release.yml +15 -15
- {afquery-0.5.0 → afquery-0.7.0}/PKG-INFO +8 -7
- {afquery-0.5.0 → afquery-0.7.0}/README.md +7 -6
- {afquery-0.5.0 → afquery-0.7.0}/docs/advanced/coverage-evidence.md +11 -7
- {afquery-0.5.0 → afquery-0.7.0}/docs/advanced/debugging-results.md +4 -3
- afquery-0.7.0/docs/advanced/filter-pass-tracking.md +82 -0
- afquery-0.7.0/docs/advanced/ploidy-and-sex-chroms.md +204 -0
- {afquery-0.5.0 → afquery-0.7.0}/docs/faq.md +4 -2
- {afquery-0.5.0 → afquery-0.7.0}/docs/getting-started/concepts.md +13 -10
- {afquery-0.5.0 → afquery-0.7.0}/docs/getting-started/preprocessing.md +13 -6
- {afquery-0.5.0 → afquery-0.7.0}/docs/getting-started/quickstart.md +4 -3
- {afquery-0.5.0 → afquery-0.7.0}/docs/getting-started/tutorial.md +52 -40
- {afquery-0.5.0 → afquery-0.7.0}/docs/getting-started/understanding-output.md +31 -20
- {afquery-0.5.0 → afquery-0.7.0}/docs/guides/annotate-vcf.md +8 -7
- {afquery-0.5.0 → afquery-0.7.0}/docs/guides/create-database.md +1 -1
- {afquery-0.5.0 → afquery-0.7.0}/docs/guides/dump-export.md +18 -5
- {afquery-0.5.0 → afquery-0.7.0}/docs/guides/query.md +9 -8
- {afquery-0.5.0 → afquery-0.7.0}/docs/guides/variant-info.md +10 -9
- {afquery-0.5.0 → afquery-0.7.0}/docs/index.md +2 -2
- {afquery-0.5.0 → afquery-0.7.0}/docs/reference/cli.md +13 -7
- {afquery-0.5.0 → afquery-0.7.0}/docs/reference/data-model.md +7 -6
- afquery-0.7.0/docs/reference/glossary.md +85 -0
- {afquery-0.5.0 → afquery-0.7.0}/docs/reference/python-api.md +28 -9
- {afquery-0.5.0 → afquery-0.7.0}/docs/troubleshooting.md +1 -1
- {afquery-0.5.0 → afquery-0.7.0}/docs/use-cases/acmg-use-cases.md +5 -5
- {afquery-0.5.0 → afquery-0.7.0}/docs/use-cases/clinical-prioritization.md +1 -1
- {afquery-0.5.0 → afquery-0.7.0}/docs/use-cases/population-specific-af.md +1 -1
- {afquery-0.5.0 → afquery-0.7.0}/docs/use-cases/pseudo-controls.md +4 -4
- {afquery-0.5.0 → afquery-0.7.0}/docs/use-cases/sex-specific-af.md +6 -6
- {afquery-0.5.0 → afquery-0.7.0}/docs/use-cases/technology-integration.md +2 -2
- {afquery-0.5.0 → afquery-0.7.0}/examples/demo/README.md +1 -1
- {afquery-0.5.0 → afquery-0.7.0}/examples/demo/create_demo_data.py +15 -12
- {afquery-0.5.0 → afquery-0.7.0}/resources/normalize_vcf.sh +8 -27
- {afquery-0.5.0 → afquery-0.7.0}/src/afquery/_version.py +2 -2
- {afquery-0.5.0 → afquery-0.7.0}/src/afquery/annotate.py +73 -44
- {afquery-0.5.0 → afquery-0.7.0}/src/afquery/cli.py +36 -21
- {afquery-0.5.0 → afquery-0.7.0}/src/afquery/database.py +33 -9
- {afquery-0.5.0 → afquery-0.7.0}/src/afquery/dump.py +25 -13
- {afquery-0.5.0 → afquery-0.7.0}/src/afquery/models.py +9 -5
- afquery-0.7.0/src/afquery/ploidy.py +133 -0
- {afquery-0.5.0 → afquery-0.7.0}/src/afquery/preprocess/__init__.py +2 -2
- {afquery-0.5.0 → afquery-0.7.0}/src/afquery/preprocess/ingest.py +102 -10
- {afquery-0.5.0 → afquery-0.7.0}/src/afquery/preprocess/synth.py +4 -0
- {afquery-0.5.0 → afquery-0.7.0}/src/afquery/preprocess/update.py +2 -1
- {afquery-0.5.0 → afquery-0.7.0}/src/afquery/query.py +128 -67
- {afquery-0.5.0 → afquery-0.7.0}/tests/conftest.py +25 -5
- {afquery-0.5.0 → afquery-0.7.0}/tests/data/expected_results.json +18 -9
- {afquery-0.5.0 → afquery-0.7.0}/tests/data/vcfs/S00.vcf +4 -3
- {afquery-0.5.0 → afquery-0.7.0}/tests/data/vcfs/S01.vcf +3 -2
- {afquery-0.5.0 → afquery-0.7.0}/tests/data/vcfs/S03.vcf +2 -1
- {afquery-0.5.0 → afquery-0.7.0}/tests/data/vcfs/S04.vcf +1 -1
- {afquery-0.5.0 → afquery-0.7.0}/tests/data/vcfs/S05.vcf +2 -1
- {afquery-0.5.0 → afquery-0.7.0}/tests/oracle.py +86 -24
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_annotate.py +36 -10
- afquery-0.7.0/tests/test_chrY_par.py +79 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_cli.py +20 -8
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_cli_docs_consistency.py +61 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_dump.py +106 -5
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_haploid_stats.py +65 -35
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_invariants.py +7 -7
- afquery-0.7.0/tests/test_multiallelic.py +365 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_no_coverage.py +8 -8
- afquery-0.7.0/tests/test_normalize_script.py +28 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_oracle_consistency.py +99 -13
- afquery-0.7.0/tests/test_ploidy.py +193 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_preprocess.py +112 -10
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_query.py +3 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_sample_filter.py +7 -5
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_synthetic_stats.py +64 -11
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_update.py +6 -7
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_variant_info.py +76 -17
- afquery-0.5.0/docs/advanced/filter-pass-tracking.md +0 -111
- afquery-0.5.0/docs/advanced/ploidy-and-sex-chroms.md +0 -165
- afquery-0.5.0/docs/reference/glossary.md +0 -73
- afquery-0.5.0/src/afquery/cli.pyr +0 -369
- afquery-0.5.0/src/afquery/ploidy.py +0 -80
- afquery-0.5.0/tests/test_multiallelic.py +0 -153
- afquery-0.5.0/tests/test_ploidy.py +0 -117
- {afquery-0.5.0 → afquery-0.7.0}/.dockerignore +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/.gitignore +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/CONTRIBUTING.md +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/Dockerfile +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/LICENSE +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/.gitignore +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/INSTALL.md +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/README.md +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/Snakefile +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/capture_kit/.gitignore +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/capture_kit/01a_assign_samples.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/capture_kit/01b_write_manifests.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/capture_kit/02_build_databases.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/capture_kit/03_compute_metrics.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/capture_kit/04_classify_acmg.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/capture_kit/05_plot_figures.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/capture_kit/README.md +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/capture_kit/Snakefile +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/capture_kit/__init__.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/capture_kit/beds/SureSelect_v5.bed +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/capture_kit/beds/SureSelect_v6.bed +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/capture_kit/beds/SureSelect_v7.bed +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/capture_kit/config.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/config.yaml +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/envs/benchmark.yaml +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/performance/.gitignore +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/performance/01_prepare_data.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/performance/02_query_scaling.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/performance/03_build.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/performance/04_annotate.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/performance/05_vs_bcftools.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/performance/06_plot.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/performance/README.md +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/performance/Snakefile +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/performance/collect_annotate.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/performance/collect_bcftools.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/performance/collect_build_perf.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/performance/collect_prepare.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/performance/collect_query_scaling.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/performance/config.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/performance/config_smoke.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/shared/__init__.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/shared/config.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/shared/rules/download_1kg.smk +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/benchmarks/shared/utils.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/docs/advanced/benchmarking.md +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/docs/advanced/multi-cohort-strategies.md +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/docs/advanced/performance.md +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/docs/advanced/pipeline-integration.md +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/docs/assets/img/gap2_mixed_technologies.png +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/docs/getting-started/installation.md +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/docs/getting-started/motivation.md +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/docs/guides/manifest-format.md +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/docs/guides/sample-filtering.md +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/docs/guides/update-database.md +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/docs/scripts/gen_gap2_figure.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/docs/stylesheets/extra.css +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/docs/use-cases/cohort-stratification.md +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/mkdocs.yml +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/pyproject.toml +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/recipes/afquery/meta.yaml +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/src/afquery/__init__.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/src/afquery/benchmark.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/src/afquery/bitmaps.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/src/afquery/capture.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/src/afquery/constants.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/src/afquery/preprocess/build.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/src/afquery/preprocess/compact.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/src/afquery/preprocess/manifest.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/src/afquery/preprocess/regions.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/src/afquery/storage.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/src/afquery/variant_info.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/data/annotate_input.vcf +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/data/annotate_multi_bucket.vcf +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/data/annotate_multi_chrom.vcf +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/data/beds/wes_kit_a.bed +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/data/beds/wes_kit_b.bed +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/data/beds/wes_kit_nochr.bed +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/data/manifest.tsv +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/data/vcfs/S02.vcf +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/data/vcfs/S06.vcf +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/data/vcfs/S07.vcf +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/data/vcfs/S08.vcf +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/data/vcfs/S09.vcf +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_batch.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_benchmark.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_bitmaps.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_capture.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_compact.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_constants.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_info.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_pass_filter.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_storage.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_synth.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_update_metadata.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_update_partitioned.py +0 -0
- {afquery-0.5.0 → afquery-0.7.0}/tests/test_warnings.py +0 -0
|
@@ -13,11 +13,11 @@ jobs:
|
|
|
13
13
|
matrix:
|
|
14
14
|
python-version: ["3.10", "3.11", "3.12"]
|
|
15
15
|
steps:
|
|
16
|
-
- uses: actions/checkout@
|
|
16
|
+
- uses: actions/checkout@v5
|
|
17
17
|
with:
|
|
18
18
|
fetch-depth: 0 # hatch-vcs needs full history to resolve version
|
|
19
19
|
|
|
20
|
-
- uses: actions/setup-python@
|
|
20
|
+
- uses: actions/setup-python@v6
|
|
21
21
|
with:
|
|
22
22
|
python-version: ${{ matrix.python-version }}
|
|
23
23
|
|
|
@@ -29,9 +29,9 @@ jobs:
|
|
|
29
29
|
|
|
30
30
|
- name: Upload coverage to Codecov
|
|
31
31
|
if: matrix.python-version == '3.12'
|
|
32
|
-
uses: codecov/codecov-action@
|
|
32
|
+
uses: codecov/codecov-action@v7
|
|
33
33
|
with:
|
|
34
34
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
35
35
|
files: ./coverage.xml
|
|
36
36
|
fail_ci_if_error: true
|
|
37
|
-
|
|
37
|
+
disable_safe_directory: true
|
|
@@ -25,11 +25,11 @@ jobs:
|
|
|
25
25
|
deploy:
|
|
26
26
|
runs-on: ubuntu-latest
|
|
27
27
|
steps:
|
|
28
|
-
- uses: actions/checkout@
|
|
28
|
+
- uses: actions/checkout@v5
|
|
29
29
|
with:
|
|
30
30
|
fetch-depth: 0
|
|
31
31
|
|
|
32
|
-
- uses: actions/setup-python@
|
|
32
|
+
- uses: actions/setup-python@v6
|
|
33
33
|
with:
|
|
34
34
|
python-version: '3.11'
|
|
35
35
|
|
|
@@ -14,10 +14,10 @@ jobs:
|
|
|
14
14
|
matrix:
|
|
15
15
|
python-version: ["3.10", "3.11", "3.12"]
|
|
16
16
|
steps:
|
|
17
|
-
- uses: actions/checkout@
|
|
17
|
+
- uses: actions/checkout@v5
|
|
18
18
|
with:
|
|
19
19
|
fetch-depth: 0
|
|
20
|
-
- uses: actions/setup-python@
|
|
20
|
+
- uses: actions/setup-python@v6
|
|
21
21
|
with:
|
|
22
22
|
python-version: ${{ matrix.python-version }}
|
|
23
23
|
- run: pip install -e ".[dev]"
|
|
@@ -28,15 +28,15 @@ jobs:
|
|
|
28
28
|
needs: test
|
|
29
29
|
runs-on: ubuntu-latest
|
|
30
30
|
steps:
|
|
31
|
-
- uses: actions/checkout@
|
|
31
|
+
- uses: actions/checkout@v5
|
|
32
32
|
with:
|
|
33
33
|
fetch-depth: 0 # required: hatch-vcs reads git tags for version
|
|
34
|
-
- uses: actions/setup-python@
|
|
34
|
+
- uses: actions/setup-python@v6
|
|
35
35
|
with:
|
|
36
36
|
python-version: "3.11"
|
|
37
37
|
- run: pip install build
|
|
38
38
|
- run: python -m build
|
|
39
|
-
- uses: actions/upload-artifact@
|
|
39
|
+
- uses: actions/upload-artifact@v7
|
|
40
40
|
with:
|
|
41
41
|
name: dist
|
|
42
42
|
path: dist/
|
|
@@ -51,7 +51,7 @@ jobs:
|
|
|
51
51
|
permissions:
|
|
52
52
|
id-token: write # required for OIDC Trusted Publishing
|
|
53
53
|
steps:
|
|
54
|
-
- uses: actions/download-artifact@
|
|
54
|
+
- uses: actions/download-artifact@v8
|
|
55
55
|
with:
|
|
56
56
|
name: dist
|
|
57
57
|
path: dist/
|
|
@@ -64,11 +64,11 @@ jobs:
|
|
|
64
64
|
permissions:
|
|
65
65
|
contents: write
|
|
66
66
|
steps:
|
|
67
|
-
- uses: actions/download-artifact@
|
|
67
|
+
- uses: actions/download-artifact@v8
|
|
68
68
|
with:
|
|
69
69
|
name: dist
|
|
70
70
|
path: dist/
|
|
71
|
-
- uses: softprops/action-gh-release@
|
|
71
|
+
- uses: softprops/action-gh-release@v3
|
|
72
72
|
with:
|
|
73
73
|
files: dist/*
|
|
74
74
|
generate_release_notes: true
|
|
@@ -81,20 +81,20 @@ jobs:
|
|
|
81
81
|
permissions:
|
|
82
82
|
packages: write
|
|
83
83
|
steps:
|
|
84
|
-
- uses: actions/checkout@
|
|
84
|
+
- uses: actions/checkout@v5
|
|
85
85
|
|
|
86
86
|
- name: Extract version
|
|
87
87
|
id: version
|
|
88
88
|
run: echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
|
|
89
89
|
|
|
90
90
|
- name: Set up QEMU
|
|
91
|
-
uses: docker/setup-qemu-action@
|
|
91
|
+
uses: docker/setup-qemu-action@v4
|
|
92
92
|
|
|
93
93
|
- name: Set up Docker Buildx
|
|
94
|
-
uses: docker/setup-buildx-action@
|
|
94
|
+
uses: docker/setup-buildx-action@v4
|
|
95
95
|
|
|
96
96
|
- name: Login to GHCR
|
|
97
|
-
uses: docker/login-action@
|
|
97
|
+
uses: docker/login-action@v4
|
|
98
98
|
with:
|
|
99
99
|
registry: ghcr.io
|
|
100
100
|
username: ${{ github.actor }}
|
|
@@ -117,7 +117,7 @@ jobs:
|
|
|
117
117
|
echo "Not available after 6 min, proceeding anyway."
|
|
118
118
|
|
|
119
119
|
- name: Build and push
|
|
120
|
-
uses: docker/build-push-action@
|
|
120
|
+
uses: docker/build-push-action@v7
|
|
121
121
|
with:
|
|
122
122
|
context: .
|
|
123
123
|
push: true
|
|
@@ -135,11 +135,11 @@ jobs:
|
|
|
135
135
|
permissions:
|
|
136
136
|
contents: write
|
|
137
137
|
steps:
|
|
138
|
-
- uses: actions/checkout@
|
|
138
|
+
- uses: actions/checkout@v5
|
|
139
139
|
with:
|
|
140
140
|
fetch-depth: 0
|
|
141
141
|
|
|
142
|
-
- uses: actions/setup-python@
|
|
142
|
+
- uses: actions/setup-python@v6
|
|
143
143
|
with:
|
|
144
144
|
python-version: "3.11"
|
|
145
145
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: afquery
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: Genomic allele frequency query engine with bitmap-encoded genotypes
|
|
5
5
|
License: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -77,7 +77,7 @@ AFQuery solves this with per-position, per-technology capture-aware AN, ploidy-a
|
|
|
77
77
|
- **Coverage evidence model** — `N_NO_COVERAGE` separates trusted hom-ref from samples lacking sufficient evidence; query-time gates (`--min-pass`, `--min-observed`, `--min-quality-evidence`) keep AF conservative.
|
|
78
78
|
- **ACMG-compatible AC/AN/AF** — per-standard definitions, exposed as both query output and VCF INFO fields.
|
|
79
79
|
- **Flexible metadata filtering** — arbitrary phenotype labels (ICD-10, HPO, OMIM, custom tags), inclusion or exclusion (`^` prefix), combined with sex and technology.
|
|
80
|
-
- **Parallel VCF annotation** — multi-threaded; adds `AFQUERY_AC/AN/AF/N_HET/N_HOM_ALT/N_HOM_REF/N_FAIL/N_NO_COVERAGE` INFO fields.
|
|
80
|
+
- **Parallel VCF annotation** — multi-threaded; adds `AFQUERY_AC/AN/AF/N_HET/N_HOM_ALT/N_HEMI/N_HOM_REF/N_FAIL/N_NO_COVERAGE` INFO fields.
|
|
81
81
|
- **Bulk CSV export** — per-variant frequencies with optional disaggregation by sex, technology, or phenotype.
|
|
82
82
|
- **Incremental updates** — add or remove samples, edit phenotype/sex metadata, compact storage, without full rebuilds.
|
|
83
83
|
- **Audit changelog** — every database operation is logged with timestamps and operator notes.
|
|
@@ -185,13 +185,14 @@ Every query and annotated VCF reports:
|
|
|
185
185
|
| `AC` | Alt-allele count over eligible samples (FILTER=PASS) |
|
|
186
186
|
| `AN` | Total alleles considered, ploidy- and capture-aware |
|
|
187
187
|
| `AF` | `AC / AN` |
|
|
188
|
-
| `N_HET` | Heterozygous PASS carriers |
|
|
189
|
-
| `N_HOM_ALT` | Homozygous-alt PASS carriers |
|
|
190
|
-
| `
|
|
191
|
-
| `
|
|
188
|
+
| `N_HET` | Heterozygous PASS carriers (diploid) |
|
|
189
|
+
| `N_HOM_ALT` | Homozygous-alt PASS carriers (diploid); every carrier on chrM |
|
|
190
|
+
| `N_HEMI` | Hemizygous PASS carriers: males on chrX outside the PARs and on chrY |
|
|
191
|
+
| `N_HOM_REF` | Samples trusted as homozygous reference (hemizygous for REF where haploid) |
|
|
192
|
+
| `N_FAIL` | Samples with a failed call (FILTER ≠ PASS, or a genotype inconsistent with ploidy) at the position (excluded from AC/AN) |
|
|
192
193
|
| `N_NO_COVERAGE` | Non-carriers on a partially-covered tech without sufficient evidence to call hom-ref |
|
|
193
194
|
|
|
194
|
-
VCF INFO field names use the `AFQUERY_` prefix (e.g. `AFQUERY_AF`, `AFQUERY_N_NO_COVERAGE`).
|
|
195
|
+
VCF INFO field names use the `AFQUERY_` prefix (e.g. `AFQUERY_AF`, `AFQUERY_N_NO_COVERAGE`). `query` and `dump` also report `n_eligible`, the number of samples that can be genotyped at the position.
|
|
195
196
|
|
|
196
197
|
## CLI commands
|
|
197
198
|
|
|
@@ -47,7 +47,7 @@ AFQuery solves this with per-position, per-technology capture-aware AN, ploidy-a
|
|
|
47
47
|
- **Coverage evidence model** — `N_NO_COVERAGE` separates trusted hom-ref from samples lacking sufficient evidence; query-time gates (`--min-pass`, `--min-observed`, `--min-quality-evidence`) keep AF conservative.
|
|
48
48
|
- **ACMG-compatible AC/AN/AF** — per-standard definitions, exposed as both query output and VCF INFO fields.
|
|
49
49
|
- **Flexible metadata filtering** — arbitrary phenotype labels (ICD-10, HPO, OMIM, custom tags), inclusion or exclusion (`^` prefix), combined with sex and technology.
|
|
50
|
-
- **Parallel VCF annotation** — multi-threaded; adds `AFQUERY_AC/AN/AF/N_HET/N_HOM_ALT/N_HOM_REF/N_FAIL/N_NO_COVERAGE` INFO fields.
|
|
50
|
+
- **Parallel VCF annotation** — multi-threaded; adds `AFQUERY_AC/AN/AF/N_HET/N_HOM_ALT/N_HEMI/N_HOM_REF/N_FAIL/N_NO_COVERAGE` INFO fields.
|
|
51
51
|
- **Bulk CSV export** — per-variant frequencies with optional disaggregation by sex, technology, or phenotype.
|
|
52
52
|
- **Incremental updates** — add or remove samples, edit phenotype/sex metadata, compact storage, without full rebuilds.
|
|
53
53
|
- **Audit changelog** — every database operation is logged with timestamps and operator notes.
|
|
@@ -155,13 +155,14 @@ Every query and annotated VCF reports:
|
|
|
155
155
|
| `AC` | Alt-allele count over eligible samples (FILTER=PASS) |
|
|
156
156
|
| `AN` | Total alleles considered, ploidy- and capture-aware |
|
|
157
157
|
| `AF` | `AC / AN` |
|
|
158
|
-
| `N_HET` | Heterozygous PASS carriers |
|
|
159
|
-
| `N_HOM_ALT` | Homozygous-alt PASS carriers |
|
|
160
|
-
| `
|
|
161
|
-
| `
|
|
158
|
+
| `N_HET` | Heterozygous PASS carriers (diploid) |
|
|
159
|
+
| `N_HOM_ALT` | Homozygous-alt PASS carriers (diploid); every carrier on chrM |
|
|
160
|
+
| `N_HEMI` | Hemizygous PASS carriers: males on chrX outside the PARs and on chrY |
|
|
161
|
+
| `N_HOM_REF` | Samples trusted as homozygous reference (hemizygous for REF where haploid) |
|
|
162
|
+
| `N_FAIL` | Samples with a failed call (FILTER ≠ PASS, or a genotype inconsistent with ploidy) at the position (excluded from AC/AN) |
|
|
162
163
|
| `N_NO_COVERAGE` | Non-carriers on a partially-covered tech without sufficient evidence to call hom-ref |
|
|
163
164
|
|
|
164
|
-
VCF INFO field names use the `AFQUERY_` prefix (e.g. `AFQUERY_AF`, `AFQUERY_N_NO_COVERAGE`).
|
|
165
|
+
VCF INFO field names use the `AFQUERY_` prefix (e.g. `AFQUERY_AF`, `AFQUERY_N_NO_COVERAGE`). `query` and `dump` also report `n_eligible`, the number of samples that can be genotyped at the position.
|
|
165
166
|
|
|
166
167
|
## CLI commands
|
|
167
168
|
|
|
@@ -20,16 +20,15 @@ into `N_HOM_REF`. The flags below decide *which* samples land there.
|
|
|
20
20
|
under the active criteria. At a biallelic site the genotype invariant becomes:
|
|
21
21
|
|
|
22
22
|
```
|
|
23
|
-
N_HET + N_HOM_ALT + N_HOM_REF + N_FAIL + N_NO_COVERAGE = n_eligible
|
|
23
|
+
N_HET + N_HOM_ALT + N_HEMI + N_HOM_REF + N_FAIL + N_NO_COVERAGE = n_eligible
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
At a multi-allelic site, eligible samples that carry only another ALT allele at
|
|
27
27
|
the position fall in none of these categories for this allele, so the sum is
|
|
28
28
|
lower than `n_eligible` by exactly that number of samples.
|
|
29
29
|
|
|
30
|
-
Samples in `N_NO_COVERAGE` remain in `eligible` and contribute to `AN
|
|
31
|
-
|
|
32
|
-
allele frequencies. Two rules always hold:
|
|
30
|
+
Samples in `N_NO_COVERAGE` remain in `eligible` and contribute to `AN`, so
|
|
31
|
+
AC/AN/AF stay conservative — the field never inflates allele frequencies. Two rules always hold:
|
|
33
32
|
|
|
34
33
|
- **Carriers are never reclassified.** A sample with a `het`, `hom`, or
|
|
35
34
|
`fail` call at the position stays in its category. `N_NO_COVERAGE` only
|
|
@@ -55,6 +54,11 @@ position. They run at query time, so no database rebuild is needed.
|
|
|
55
54
|
When both flags are >0, both must hold (AND). The default `0` disables the
|
|
56
55
|
gate.
|
|
57
56
|
|
|
57
|
+
`afquery annotate` applies the same gates to input alleles that are not in the
|
|
58
|
+
database. At a position where no sample has any call, no tech has evidence, so
|
|
59
|
+
under any active gate the non-carriers of partially-covered techs are reported
|
|
60
|
+
as `N_NO_COVERAGE`.
|
|
61
|
+
|
|
58
62
|
!!! tip
|
|
59
63
|
If your VCFs do not carry `FORMAT/DP` or `FORMAT/GQ`, these are the
|
|
60
64
|
flags you want. They are the cheapest option and apply to any database.
|
|
@@ -70,7 +74,7 @@ afquery query --db ./db/ --locus chr1:925952
|
|
|
70
74
|
```
|
|
71
75
|
|
|
72
76
|
```
|
|
73
|
-
chr1:925952 G>A AC=142 AN=2742 AF=0.0518 n_eligible=1371 N_HET=138 N_HOM_ALT=2 N_HOM_REF=1231 N_FAIL=0 N_NO_COVERAGE=0
|
|
77
|
+
chr1:925952 G>A AC=142 AN=2742 AF=0.0518 n_eligible=1371 N_HET=138 N_HOM_ALT=2 N_HEMI=0 N_HOM_REF=1231 N_FAIL=0 N_NO_COVERAGE=0
|
|
74
78
|
```
|
|
75
79
|
|
|
76
80
|
Now require at least one PASS carrier per partially-covered tech:
|
|
@@ -80,7 +84,7 @@ afquery query --db ./db/ --locus chr1:925952 --min-pass 1
|
|
|
80
84
|
```
|
|
81
85
|
|
|
82
86
|
```
|
|
83
|
-
chr1:925952 G>A AC=142 AN=2742 AF=0.0518 n_eligible=1371 N_HET=138 N_HOM_ALT=2 N_HOM_REF=1108 N_FAIL=0 N_NO_COVERAGE=123
|
|
87
|
+
chr1:925952 G>A AC=142 AN=2742 AF=0.0518 n_eligible=1371 N_HET=138 N_HOM_ALT=2 N_HEMI=0 N_HOM_REF=1108 N_FAIL=0 N_NO_COVERAGE=123
|
|
84
88
|
```
|
|
85
89
|
|
|
86
90
|
Samples on partially-covered techs that did not contribute a single PASS
|
|
@@ -102,7 +106,7 @@ coverage decision is baked in.
|
|
|
102
106
|
| `--min-dp D` | Minimum `FORMAT/DP` per carrier. |
|
|
103
107
|
| `--min-gq G` | Minimum `FORMAT/GQ` per carrier. |
|
|
104
108
|
| `--min-qual Q` | Minimum VCF `QUAL` per carrier. |
|
|
105
|
-
| `--min-covered K`| Per partially-covered tech, the position is "trusted" only if at least K of its carriers pass the quality thresholds. Non-carriers of failing positions are recorded as `N_NO_COVERAGE`.
|
|
109
|
+
| `--min-covered K`| Per partially-covered tech, the position is "trusted" only if at least K of its carriers pass the quality thresholds. Non-carriers of failing positions are recorded as `N_NO_COVERAGE`. Carriers of any ALT allele at the position count, so every allele of a multi-allelic site gets the same verdict; samples carrying another allele there are never counted as `N_NO_COVERAGE`. |
|
|
106
110
|
|
|
107
111
|
A carrier counts as quality-passing only if **all** active thresholds hold
|
|
108
112
|
(unset thresholds are simply ignored). At least one of these flags must be
|
|
@@ -19,6 +19,7 @@ AN=0 means no eligible samples at the queried position. Work through these check
|
|
|
19
19
|
| WES samples missing from AN | `afquery query --db ./db/ --locus chr1:12345678 --tech WES_kit_A` | If this prints `No variants found for the given filters.` for a technology whose kit should cover the position, while the unfiltered query returns the variant, that technology's capture index is not matching the position. `afquery` warns on open when a capture BED is empty or matches no known chromosome, naming the offending contigs. |
|
|
20
20
|
| AN=0 only on chrM | `afquery query --db ./db/ --locus chrM:3243` | Mitochondrial coverage is easy to lose on its own: a BED naming it `chrMT` still matches on the autosomes, so nothing else looks wrong. Names are normalized (`MT`, `M`, `chrMT` → `chrM`) since v0.4.0 — databases built before that may need the capture BED re-checked. |
|
|
21
21
|
| Technology filter | Remove `--tech` filter | Check if any samples match the requested technology. |
|
|
22
|
+
| Position in a chrY PAR | `afquery query --db ./db/ --locus chrY:1500000` | A warning says the position lies in a pseudoautosomal region. PAR loci are counted at their chrX coordinates; query the chrX position instead. |
|
|
22
23
|
|
|
23
24
|
### 2. Unexpected AF Value
|
|
24
25
|
|
|
@@ -42,13 +43,13 @@ A variant you expect to find is not in the database:
|
|
|
42
43
|
|
|
43
44
|
### 4. Unexpected N_FAIL > 0
|
|
44
45
|
|
|
45
|
-
`N_FAIL > 0` means some eligible samples had a call with `FILTER≠PASS` at this position. These samples are
|
|
46
|
+
`N_FAIL > 0` means some eligible samples had a call with `FILTER≠PASS` at this position. These samples are left out of AC and AN. This is usually benign (1–2 samples), but a high N_FAIL warrants investigation:
|
|
46
47
|
|
|
47
48
|
| N_FAIL relative to n_eligible | Likely cause |
|
|
48
49
|
|---|---|
|
|
49
50
|
| 1–2 samples | Isolated low-quality calls — not concerning |
|
|
50
51
|
| > 5% of n_eligible | Systematic sequencing artifact at this site |
|
|
51
|
-
| All eligible samples | Site-wide QC failure —
|
|
52
|
+
| All eligible samples | Site-wide QC failure — AN=0 and AF is `NA`, although the variant is present in source VCFs |
|
|
52
53
|
|
|
53
54
|
To inspect a site with high N_FAIL, query with `--format json` to see all fields:
|
|
54
55
|
|
|
@@ -88,7 +89,7 @@ Validates: manifest consistency, Parquet file integrity, capture index presence.
|
|
|
88
89
|
afquery query --db ./db/ --locus chr1:12345678 --format json
|
|
89
90
|
```
|
|
90
91
|
|
|
91
|
-
JSON format shows all fields including N_HET, N_HOM_ALT, N_HOM_REF, and N_FAIL — useful for understanding the composition of the result.
|
|
92
|
+
JSON format shows all fields including N_HET, N_HOM_ALT, N_HEMI, N_HOM_REF, and N_FAIL — useful for understanding the composition of the result.
|
|
92
93
|
|
|
93
94
|
|
|
94
95
|
### Direct Metadata Inspection
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# FILTER=PASS Tracking
|
|
2
|
+
|
|
3
|
+
AFQuery keeps the calls that fail quality filters (`FILTER≠PASS`) instead of discarding them. A failed call tells you the position was looked at but the sample's genotype there is unknown, which is different both from "variant not present" and from "variant present".
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## What counts as a failed call
|
|
8
|
+
|
|
9
|
+
A sample has a failed call at a position when its VCF holds, for any ALT allele there:
|
|
10
|
+
|
|
11
|
+
- a call carrying the ALT allele with `FILTER` other than `PASS` or `.`;
|
|
12
|
+
- a missing genotype (`./.`) at a site that failed a filter; or
|
|
13
|
+
- calls that carry more alleles than the sample has at the position, such as a heterozygous call (`0/1`) or two ALT alleles (`1/2`) on chrX non-PAR or chrY in a male. These are detected when the VCF is ingested, which logs a warning (see [Genotypes inconsistent with ploidy](ploidy-and-sex-chroms.md#genotypes-inconsistent-with-ploidy)).
|
|
14
|
+
|
|
15
|
+
These samples are stored in the variant's `fail_bitmap` and reported as `N_FAIL`. A homozygous-reference call (`0/0`) is never stored, so at a failed site it would count as hom-ref; [`normalize_vcf.sh`](../getting-started/preprocessing.md) avoids this by masking every genotype at a failed site as missing.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## How failed calls are counted
|
|
20
|
+
|
|
21
|
+
A failed call is judged per **position**, not per allele: a sample with a failed call for any ALT allele at a position has no reliable genotype there. For every allele at that position, the sample:
|
|
22
|
+
|
|
23
|
+
- adds nothing to **AC**, even if another record at the position called it with `FILTER=PASS`;
|
|
24
|
+
- is left out of **AN**, which counts only the alleles of samples with a usable call;
|
|
25
|
+
- is counted in **N_FAIL**, which therefore has the same value on every line of a multi-allelic site;
|
|
26
|
+
- stays in **n_eligible**, so `N_HET + N_HOM_ALT + N_HEMI + N_HOM_REF + N_FAIL + N_NO_COVERAGE` still accounts for every eligible sample (see [Multi-allelic sites](../getting-started/understanding-output.md#multi-allelic-sites) for the one exception).
|
|
27
|
+
|
|
28
|
+
Leaving failed calls out of AN keeps AF an estimate over the genotypes that were actually observed. At every position, AN equals the reference alleles plus the AC of all its ALT alleles.
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
afquery query --db ./db/ --locus chr1:925952
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
chr1:925952 G>A AC=142 AN=2728 AF=0.0521 n_eligible=1371 N_HET=138 N_HOM_ALT=2 N_HEMI=0 N_HOM_REF=1224 N_FAIL=7 N_NO_COVERAGE=0
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The 7 samples with a failed call are part of `n_eligible` (138 + 2 + 1224 + 7 = 1371) but not of AN: 2 × (1371 − 7) = 2728.
|
|
39
|
+
|
|
40
|
+
### When every eligible sample failed
|
|
41
|
+
|
|
42
|
+
If all eligible samples have a failed call at a position, AN is 0 and AF is undefined: `NA` in text and TSV output, `null` in JSON and the Python API, an empty cell in `dump`, and `.` in `AFQUERY_AF`. `N_FAIL` still reports how many samples failed.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Counting failed calls as reference
|
|
47
|
+
|
|
48
|
+
`--fail-as-ref` (`fail_as_ref=True` in the Python API) keeps samples with a failed call in AN, counting them as homozygous reference. It is available on `query`, `annotate` and `dump`, and changes only AN and AF: the failed samples still add nothing to AC and are still reported in `N_FAIL`.
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
afquery query --db ./db/ --locus chr1:925952 --fail-as-ref
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
chr1:925952 G>A AC=142 AN=2742 AF=0.0518 n_eligible=1371 N_HET=138 N_HOM_ALT=2 N_HEMI=0 N_HOM_REF=1224 N_FAIL=7 N_NO_COVERAGE=0
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Because every failed sample is then treated as a non-carrier, the AF is never higher than the default one, which makes it a conservative lower estimate when a site has many failures. AN then no longer equals the reference alleles plus the AC of all ALT alleles.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Finding the failed samples
|
|
63
|
+
|
|
64
|
+
`afquery variant-info` lists each sample with a failed call at the position as genotype `alt` with filter `FAIL`, along with its technology and phenotypes. This shows whether failures cluster in one technology or sample group. See [Variant Info](../guides/variant-info.md).
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
afquery variant-info --db ./db/ --locus chr1:925952
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## VCF annotation
|
|
73
|
+
|
|
74
|
+
`afquery annotate` writes the same per-position values: `AFQUERY_AN` excludes failed calls and `AFQUERY_N_FAIL` counts each failed sample once per site. See [Understanding Output](../getting-started/understanding-output.md#vcf-annotation-fields) for the full set of `AFQUERY_*` fields.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Next Steps
|
|
79
|
+
|
|
80
|
+
- [Understanding Output](../getting-started/understanding-output.md) — interpreting N_FAIL in query and annotate results
|
|
81
|
+
- [ACMG Criteria](../use-cases/acmg-use-cases.md) — using N_FAIL to assess site quality before applying BA1/PM2
|
|
82
|
+
- [Debugging Results](debugging-results.md) — diagnosing unexpectedly high N_FAIL values
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# Ploidy & Special Chromosomes
|
|
2
|
+
|
|
3
|
+
AFQuery computes ploidy-aware AN for sex chromosomes (chrX, chrY) and the mitochondrial chromosome (chrM). This ensures that allele frequencies are correct when querying these chromosomes, where the number of alleles per sample differs from the diploid autosomes.
|
|
4
|
+
|
|
5
|
+
!!! note "Chromosome name normalization"
|
|
6
|
+
AFQuery accepts `MT`, `chrMT`, and `chrM` as input; output always uses `chrM`.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Ploidy Rules
|
|
11
|
+
|
|
12
|
+
| Chromosome | Female AN contribution | Male AN contribution |
|
|
13
|
+
|------------|----------------------|---------------------|
|
|
14
|
+
| Autosomes (chr1–22) | 2 | 2 |
|
|
15
|
+
| chrX (non-PAR) | 2 | 1 |
|
|
16
|
+
| chrX (PAR1, PAR2) | 2 | 2 |
|
|
17
|
+
| chrY (non-PAR) | 0 | 1 |
|
|
18
|
+
| chrY (PAR1, PAR2) | 0 | 0 — counted on chrX |
|
|
19
|
+
| chrM | 1 | 1 |
|
|
20
|
+
|
|
21
|
+
For each eligible sample at a given position, AFQuery adds the appropriate ploidy count to AN based on the sample's sex and the chromosome/position.
|
|
22
|
+
|
|
23
|
+
A sample contributing ploidy 0 is not eligible at that position at all: a female has no chrY to genotype, so she is neither a carrier nor homozygous reference there. On chrY, `n_eligible`, `N_HOM_REF` and `AN` therefore count males only. In the chrY PARs nobody is eligible (see below).
|
|
24
|
+
|
|
25
|
+
!!! note "Karyotypes"
|
|
26
|
+
The manifest records each sample as `male` or `female`, read as XY or XX. Other sex-chromosome karyotypes (45,X; 47,XXY; mosaics) are not modelled: a sample is given the ploidy of the sex it is registered with.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Pseudoautosomal Regions (PAR)
|
|
31
|
+
|
|
32
|
+
PAR1 and PAR2 are the same sequence at the two ends of chrX and chrY, and they recombine like an autosome: a male carries one copy on his X and one on his Y, so at a PAR locus every sample is diploid. The reference genome holds that sequence twice, once on each chromosome, so AFQuery counts every PAR locus once, at its chrX coordinates:
|
|
33
|
+
|
|
34
|
+
- **chrX PAR**: diploid for both sexes — males and females contribute AN=2.
|
|
35
|
+
- **chrY PAR**: not genotyped. Nobody is eligible there, so a query returns no results and AN is 0. This keeps a PAR variant from being counted twice, and keeps a male carrier from being taken for a hemizygote.
|
|
36
|
+
|
|
37
|
+
Most analysis references hard-mask the chrY PARs (the GRCh38 analysis sets do), so variant callers report PAR variants on chrX anyway. Calls at chrY PAR coordinates only appear when the reads were aligned to an unmasked reference; they are stored, but not counted. A point query (`query --locus`, `variant-info`) at such a position warns that it lies in a PAR; region and batch queries, `dump` and `annotate` skip it silently (`annotate` writes `AFQUERY_AN=0`).
|
|
38
|
+
|
|
39
|
+
PAR coordinates by genome build:
|
|
40
|
+
|
|
41
|
+
<!-- Source of truth: src/afquery/constants.py PAR dict -->
|
|
42
|
+
|
|
43
|
+
### GRCh38
|
|
44
|
+
|
|
45
|
+
**chrX:**
|
|
46
|
+
|
|
47
|
+
| Region | Start | End |
|
|
48
|
+
|--------|-------|-----|
|
|
49
|
+
| PAR1 | 10,001 | 2,781,479 |
|
|
50
|
+
| PAR2 | 155,701,383 | 156,030,895 |
|
|
51
|
+
|
|
52
|
+
**chrY:**
|
|
53
|
+
|
|
54
|
+
| Region | Start | End |
|
|
55
|
+
|--------|-------|-----|
|
|
56
|
+
| PAR1 | 10,001 | 2,781,479 |
|
|
57
|
+
| PAR2 | 56,887,903 | 57,217,415 |
|
|
58
|
+
|
|
59
|
+
### GRCh37 / hg19
|
|
60
|
+
|
|
61
|
+
**chrX:**
|
|
62
|
+
|
|
63
|
+
| Region | Start | End |
|
|
64
|
+
|--------|-------|-----|
|
|
65
|
+
| PAR1 | 60,001 | 2,699,520 |
|
|
66
|
+
| PAR2 | 154,931,044 | 155,260,560 |
|
|
67
|
+
|
|
68
|
+
**chrY:**
|
|
69
|
+
|
|
70
|
+
| Region | Start | End |
|
|
71
|
+
|--------|-------|-----|
|
|
72
|
+
| PAR1 | 10,001 | 2,649,520 |
|
|
73
|
+
| PAR2 | 59,034,050 | 59,363,566 |
|
|
74
|
+
|
|
75
|
+
Positions within PAR1 or PAR2 on chrX are treated as diploid for all samples; positions within PAR1 or PAR2 on chrY are not genotyped.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Effect on AF Queries
|
|
80
|
+
|
|
81
|
+
### chrY
|
|
82
|
+
|
|
83
|
+
Querying chrY with `--sex female` returns `AN=0` (females have no Y chromosome):
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
afquery query --db ./db/ --locus chrY:2787758 --sex female
|
|
87
|
+
# chrY:2787758 — no results (AN=0 for all variants)
|
|
88
|
+
|
|
89
|
+
afquery query --db ./db/ --locus chrY:2787758 --sex male
|
|
90
|
+
# chrY:2787758 C>T AC=3 AN=856 AF=0.0035 n_eligible=856 N_HET=0 N_HOM_ALT=0 N_HEMI=3 N_HOM_REF=853 N_FAIL=0 N_NO_COVERAGE=0
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Inside a chrY PAR (here GRCh38 PAR1), nothing is reported, whatever the filters:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
afquery query --db ./db/ --locus chrY:1500000
|
|
97
|
+
# AfqueryWarning: chrY:1500000 lies in a pseudoautosomal region (PAR); PAR variants
|
|
98
|
+
# are counted at their chrX coordinates, so nobody is genotyped here.
|
|
99
|
+
# No variants found for the given filters.
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Query the same locus at its chrX coordinates instead (`chrX:1500000`).
|
|
103
|
+
|
|
104
|
+
### chrX non-PAR
|
|
105
|
+
|
|
106
|
+
Male samples contribute AN=1, female samples contribute AN=2. This means a cohort of 500 females and 500 males has AN = 500×2 + 500×1 = 1500 at a non-PAR X position.
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
afquery query --db ./db/ --locus chrX:100000000
|
|
110
|
+
# N_total = 1000 samples, AN = 1500 (not 2000)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### chrM
|
|
114
|
+
|
|
115
|
+
All samples are haploid at mitochondrial loci:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
afquery query --db ./db/ --locus chrM:3243
|
|
119
|
+
# AN = n_samples (one allele per sample)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Genotype Counting
|
|
125
|
+
|
|
126
|
+
### Counting Identity
|
|
127
|
+
|
|
128
|
+
For every query result at a biallelic site, the following identity holds:
|
|
129
|
+
|
|
130
|
+
**N_HET + N_HOM_ALT + N_HEMI + N_HOM_REF + N_FAIL + N_NO_COVERAGE = n_eligible**
|
|
131
|
+
|
|
132
|
+
This can be used to validate results. At a multi-allelic site, eligible samples that carry only another ALT allele at the position fall in none of these categories, so the sum is lower by exactly that number of samples (see [Multi-allelic sites](../getting-started/understanding-output.md#multi-allelic-sites)). N_HOM_REF is the number of eligible samples that carry only the reference allele and have no failed call at the position: homozygous reference where they are diploid, and, where they are haploid, hemizygous for the reference (a male on chrX non-PAR or chrY) or a non-carrier on chrM. N_NO_COVERAGE is 0 unless a coverage-evidence filter is active — see [Coverage Evidence](coverage-evidence.md).
|
|
133
|
+
|
|
134
|
+
!!! note "Mutual exclusivity"
|
|
135
|
+
N_HET, N_HOM_ALT, N_HEMI, N_HOM_REF, N_FAIL, and N_NO_COVERAGE are mutually exclusive. A sample with a failed call for any allele at the position is counted in N_FAIL only — it does not appear in N_HET, N_HOM_ALT, N_HEMI or N_HOM_REF, and is left out of AC and AN.
|
|
136
|
+
|
|
137
|
+
The genotype counts are counted per sample, not per allele, and each follows the sample's ploidy at the position:
|
|
138
|
+
|
|
139
|
+
| Count | Who | Copies of the ALT allele (AC) |
|
|
140
|
+
|-------|-----|------------------------------|
|
|
141
|
+
| N_HET | diploid sample, GT `0/1` | 1 |
|
|
142
|
+
| N_HOM_ALT | diploid sample, GT `1/1`; every carrier on chrM | 2; 1 on chrM |
|
|
143
|
+
| N_HEMI | male carrier on chrX non-PAR or chrY (GT `1`, or `1/1` written diploid) | 1 |
|
|
144
|
+
|
|
145
|
+
So `AC = N_HET + 2 × N_HOM_ALT + N_HEMI` everywhere except chrM, where `AC = N_HOM_ALT`. N_HEMI is always 0 on the autosomes, the chrX PARs and chrM, and for females.
|
|
146
|
+
|
|
147
|
+
### chrX non-PAR
|
|
148
|
+
|
|
149
|
+
- A male with GT=`1` (or `1/1`) is **hemizygous**: he has a single copy of the locus. He contributes AC=1, AN=1 and is counted in **N_HEMI**.
|
|
150
|
+
- A male with GT=`0/1` is a failed call: REF and ALT cannot both be the genotype of a single copy (see [Genotypes inconsistent with ploidy](#genotypes-inconsistent-with-ploidy)).
|
|
151
|
+
- A female with GT=`0/1` contributes AC=1, AN=2 and is counted in N_HET; with GT=`1/1`, AC=2, AN=2 and N_HOM_ALT.
|
|
152
|
+
|
|
153
|
+
N_HET and N_HOM_ALT describe diploid genotypes only, so at a non-PAR chrX position the males are never in them: their carriers are in N_HEMI and the rest in N_HOM_REF (or N_FAIL).
|
|
154
|
+
|
|
155
|
+
### chrY
|
|
156
|
+
|
|
157
|
+
chrY outside the PARs is haploid in males and absent in females (who are not eligible there):
|
|
158
|
+
|
|
159
|
+
- Every carrier is hemizygous, counted in **N_HEMI**
|
|
160
|
+
- N_HET and N_HOM_ALT are always 0 on chrY
|
|
161
|
+
|
|
162
|
+
### chrM
|
|
163
|
+
|
|
164
|
+
chrM is haploid for all samples (both sexes contribute AN=1), but it is not hemizygous: a cell holds hundreds to thousands of mtDNA copies, and a variant may be present in all of them (homoplasmy) or in a fraction (heteroplasmy). AFQuery stores the discretized genotypes of the source VCF and records no heteroplasmy level (see the [FAQ](../faq.md#is-heteroplasmy-taken-into-account-when-calculating-allele-frequency-in-mitochondrial-variants)), so:
|
|
165
|
+
|
|
166
|
+
- Every carrier counts once, in **N_HOM_ALT**, whatever its GT (`1`, `0/1` or `1/1`); a `0/1` call is not an error there
|
|
167
|
+
- N_HET and N_HEMI are always 0 on chrM
|
|
168
|
+
|
|
169
|
+
### Genotypes inconsistent with ploidy
|
|
170
|
+
|
|
171
|
+
Ploidy comes from each sample's sex and the position, not from how the VCF writes the genotype. A male carrier on chrX non-PAR or chrY counts as one allele whether its GT is written haploid (`1`) or diploid (`1/1`): both name a single allele. A call that names more alleles than the sample has cannot be counted that way:
|
|
172
|
+
|
|
173
|
+
- on chrX non-PAR or chrY in a male, a call naming two different alleles: a heterozygous call (`0/1`) or two ALT alleles (`1/2`). A male has a single copy there, so REF and ALT cannot both be his genotype; such a call usually comes from mis-mapped reads or contamination, and a 47,XXY sample registered as male shows it genuinely;
|
|
174
|
+
- on chrM, two different ALT alleles (`1/2`). A `0/1` call on chrM is not inconsistent: it is heteroplasmy, a mix of mtDNA copies, and the sample is a carrier (see [chrM](#chrm_1));
|
|
175
|
+
- on a diploid position, more than two copies across the records at that position (e.g. `1/1` for one ALT and `0/1` for another).
|
|
176
|
+
|
|
177
|
+
`create-db` and `update-db --add-samples` record every call of the sample at such a position as a failed call, so it counts in `N_FAIL` and is left out of AC and AN (counted as hom-ref with `--fail-as-ref`), and log a warning naming the sample and the positions.
|
|
178
|
+
|
|
179
|
+
A cohort called in diploid mode on the sex chromosomes therefore shows male `N_FAIL` at chrX positions where the caller saw both alleles in a male. That is the intended reading, the one gnomAD applies too: those genotypes are unknown, not hom-ref and not carriers. Do not rewrite them with `bcftools +fixploidy` beforehand; it keeps the first allele of each call (`0/1` becomes `0`), which turns them into hom-ref without a trace (see [Preprocessing](../getting-started/preprocessing.md#ploidy-of-sex-chromosomes-and-chrm)).
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Sex Filter Interaction
|
|
184
|
+
|
|
185
|
+
When `--sex female` is used on chrX (non-PAR), AN is purely diploid:
|
|
186
|
+
|
|
187
|
+
- Each eligible female contributes AN=2
|
|
188
|
+
- AF is computed over a fully diploid denominator
|
|
189
|
+
|
|
190
|
+
When `--sex male` is used on chrX (non-PAR), AN is purely haploid:
|
|
191
|
+
|
|
192
|
+
- Each eligible male contributes AN=1
|
|
193
|
+
- AF reflects the observed allele frequency in haploid male calls
|
|
194
|
+
- Carriers are all hemizygous: N_HEMI = AC, and N_HET = N_HOM_ALT = 0
|
|
195
|
+
|
|
196
|
+
This makes it straightforward to compare X-linked variant frequencies between sexes without manual ploidy adjustment.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Next Steps
|
|
201
|
+
|
|
202
|
+
- [Sex-Specific AF](../use-cases/sex-specific-af.md) — X-linked variant analysis using sex-stratified queries
|
|
203
|
+
- [Key Concepts](../getting-started/concepts.md) — AC/AN/AF overview and the ploidy table
|
|
204
|
+
- [Sample Filtering](../guides/sample-filtering.md) — `--sex` filter syntax
|
|
@@ -153,7 +153,7 @@ On chrX non-PAR positions, males contribute AN=1 and females contribute AN=2. Wh
|
|
|
153
153
|
|
|
154
154
|
## What does N_FAIL mean in query output?
|
|
155
155
|
|
|
156
|
-
`N_FAIL` is the count of eligible samples whose call had `FILTER≠PASS` at the position. Shown as `N_FAIL=N` in text output. These samples are
|
|
156
|
+
`N_FAIL` is the count of eligible samples whose call had `FILTER≠PASS` at the position. Shown as `N_FAIL=N` in text output. These samples are left out of AC and AN, because their genotype there is unknown. See [FILTER=PASS Tracking](advanced/filter-pass-tracking.md).
|
|
157
157
|
|
|
158
158
|
---
|
|
159
159
|
|
|
@@ -191,6 +191,8 @@ As a result, intermediate heteroplasmy levels (such as 20%) are not explicitly r
|
|
|
191
191
|
|
|
192
192
|
Therefore, this limitation arises from the variant calling step. The application operates on already discretized genotypes according to ploidy and does not model heteroplasmy as a continuous variable.
|
|
193
193
|
|
|
194
|
+
In practice, every chrM call carrying the ALT allele (`1`, `0/1` or `1/1`) counts once: in `N_HOM_ALT`, and as `hom` in `variant-info`. A `0/1` call is not treated as an error on chrM, and chrM carriers are never counted as hemizygous (`N_HEMI`), a term that applies to the single-copy sex chromosomes in males.
|
|
195
|
+
|
|
194
196
|
## Common Pitfalls
|
|
195
197
|
|
|
196
198
|
### What if AN is very low?
|
|
@@ -226,7 +228,7 @@ Without stratification, rare variant interpretation in mixed cohorts can be misl
|
|
|
226
228
|
AFQuery is purpose-built for fast subcohort AF computation and is not a general-purpose genomic database:
|
|
227
229
|
|
|
228
230
|
- **Not a joint genotyper**: AFQuery does not perform joint genotyping. Input VCFs should be individually called before ingestion.
|
|
229
|
-
- **Not a genotype store**: AFQuery stores genotype summaries as bitmaps, not raw FORMAT fields. Use `variant-info` to list carriers and their genotype class (het/hom) at a specific position; for full per-sample VCF fields (GQ, DP, AD, etc.), consult the source VCFs.
|
|
231
|
+
- **Not a genotype store**: AFQuery stores genotype summaries as bitmaps, not raw FORMAT fields. Use `variant-info` to list carriers and their genotype class (het/hom/hemi) at a specific position; for full per-sample VCF fields (GQ, DP, AD, etc.), consult the source VCFs.
|
|
230
232
|
- **No statistical genetics**: AFQuery does not compute Hardy-Weinberg equilibrium, population stratification, or other statistical genetics metrics.
|
|
231
233
|
- **Batch queries**: The `--from-file` batch mode supports variants across multiple chromosomes in a single call. Point queries (`--locus`) and region queries (`--region`) target a single position or range; for multi-position multi-chromosome lookups, use `--from-file`.
|
|
232
234
|
- **Cohort size limit**: Performance at >100K samples has not been validated. Memory requirements for the build phase scale with cohort size.
|