bio-clinical-databases-gnomad-frequencies
Query gnomAD for population allele frequencies to assess variant rarity. Use when filtering variants by population frequency for rare disease analysis or determining if a variant is common in the general population.
Best use case
bio-clinical-databases-gnomad-frequencies is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Query gnomAD for population allele frequencies to assess variant rarity. Use when filtering variants by population frequency for rare disease analysis or determining if a variant is common in the general population.
Teams using bio-clinical-databases-gnomad-frequencies should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/bio-clinical-databases-gnomad-frequencies/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How bio-clinical-databases-gnomad-frequencies Compares
| Feature / Agent | bio-clinical-databases-gnomad-frequencies | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Query gnomAD for population allele frequencies to assess variant rarity. Use when filtering variants by population frequency for rare disease analysis or determining if a variant is common in the general population.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
## Version Compatibility
Reference examples tested with: requests 2.31+, pandas 2.2+
Before using code patterns, verify installed versions match. If versions differ:
- Python: `pip show <package>` then `help(module.function)` to check signatures
If code throws ImportError, AttributeError, or TypeError, introspect the installed
package and adapt the example to match the actual API rather than retrying.
# gnomAD Frequency Queries
## gnomAD REST API
**Goal:** Retrieve exome and genome allele frequencies from gnomAD for individual variants.
**Approach:** Send a GraphQL query to the gnomAD API with variant ID and dataset version, then parse exome/genome frequency fields.
**"Check how common this variant is in the population"** → Query gnomAD for allele frequency, allele count, and homozygote count.
- Python: GraphQL via `requests.post()` (requests)
- Python: `myvariant.MyVariantInfo().getvariant()` (myvariant)
### Query Single Variant
```python
import requests
def query_gnomad(chrom, pos, ref, alt, dataset='gnomad_r4'):
'''Query gnomAD API for variant frequency
dataset options: gnomad_r4, gnomad_r3, gnomad_r2_1
'''
url = 'https://gnomad.broadinstitute.org/api'
query = '''
query ($variantId: String!, $dataset: DatasetId!) {
variant(variantId: $variantId, dataset: $dataset) {
exome {
ac
an
af
homozygote_count
}
genome {
ac
an
af
homozygote_count
}
}
}
'''
variant_id = f'{chrom}-{pos}-{ref}-{alt}'
variables = {'variantId': variant_id, 'dataset': dataset}
response = requests.post(url, json={'query': query, 'variables': variables})
return response.json()
```
### Parse gnomAD Response
```python
def parse_gnomad_result(result):
'''Extract allele frequencies from gnomAD response'''
data = result.get('data', {}).get('variant', {})
if not data:
return None
exome = data.get('exome', {}) or {}
genome = data.get('genome', {}) or {}
return {
'exome_af': exome.get('af'),
'exome_ac': exome.get('ac'),
'exome_an': exome.get('an'),
'exome_hom': exome.get('homozygote_count'),
'genome_af': genome.get('af'),
'genome_ac': genome.get('ac'),
'genome_an': genome.get('an'),
'genome_hom': genome.get('homozygote_count')
}
```
## Query via myvariant.info
**Goal:** Retrieve gnomAD frequencies through the myvariant.info aggregation layer for simpler API access.
**Approach:** Query myvariant.info by HGVS notation with gnomAD fields specified, extracting exome and genome allele frequencies.
```python
import myvariant
mv = myvariant.MyVariantInfo()
def get_gnomad_via_myvariant(variant_hgvs):
'''Get gnomAD frequencies via myvariant.info'''
result = mv.getvariant(variant_hgvs, fields=['gnomad_exome', 'gnomad_genome'])
exome = result.get('gnomad_exome', {})
genome = result.get('gnomad_genome', {})
return {
'exome_af': exome.get('af', {}).get('af'),
'genome_af': genome.get('af', {}).get('af')
}
```
## Population-Specific Frequencies
**Goal:** Retrieve ancestry-specific allele frequencies to assess variant rarity within relevant populations.
**Approach:** Query the gnomAD population-stratified AF fields (AFR, AMR, ASJ, EAS, FIN, NFE, SAS) via myvariant.info.
```python
def get_population_frequencies(variant_hgvs):
'''Get gnomAD frequencies by ancestry population'''
mv = myvariant.MyVariantInfo()
result = mv.getvariant(variant_hgvs, fields=['gnomad_exome.af'])
af_data = result.get('gnomad_exome', {}).get('af', {})
populations = {
'af': af_data.get('af'), # Global
'af_afr': af_data.get('af_afr'), # African
'af_amr': af_data.get('af_amr'), # Admixed American
'af_asj': af_data.get('af_asj'), # Ashkenazi Jewish
'af_eas': af_data.get('af_eas'), # East Asian
'af_fin': af_data.get('af_fin'), # Finnish
'af_nfe': af_data.get('af_nfe'), # Non-Finnish European
'af_sas': af_data.get('af_sas'), # South Asian
}
return populations
```
## Filtering Thresholds
Common frequency cutoffs for variant filtering:
| Threshold | Use Case |
|-----------|----------|
| < 0.01 (1%) | Rare disease, ACMG PM2 |
| < 0.001 (0.1%) | Stringent rare disease |
| < 0.0001 (0.01%) | Ultra-rare |
| Absent | Novel variant |
## Filter Variants by Frequency
**Goal:** Apply population frequency thresholds to retain only rare variants for downstream analysis.
**Approach:** Compare the maximum allele frequency across exome and genome datasets against a configurable threshold (default 1% per ACMG PM2).
```python
def is_rare(gnomad_af, threshold=0.01):
'''Check if variant is rare based on gnomAD AF
threshold: Default 0.01 (1%) per ACMG PM2 supporting criterion
Use 0.001 for more stringent filtering
'''
if gnomad_af is None:
return True # Absent from gnomAD = rare
return gnomad_af < threshold
def filter_rare_variants(variants, threshold=0.01):
'''Filter list of variants to keep only rare ones'''
rare = []
for v in variants:
exome_af = v.get('gnomad_exome_af')
genome_af = v.get('gnomad_genome_af')
max_af = max(filter(None, [exome_af, genome_af]), default=None)
if is_rare(max_af, threshold):
rare.append(v)
return rare
```
## Batch Query with Local gnomAD
**Goal:** Perform large-scale frequency lookups using a local gnomAD Hail Table for high throughput.
**Approach:** Load the gnomAD sites Hail Table from Google Cloud Storage and filter by allele frequency threshold.
For large-scale analysis, use local gnomAD VCF/Hail Table:
```python
# Using Hail for gnomAD v4
import hail as hl
ht = hl.read_table('gs://gcp-public-data--gnomad/release/4.0/ht/exomes/gnomad.exomes.v4.0.sites.ht')
# Filter to rare variants
rare_ht = ht.filter(ht.freq[0].AF < 0.01)
```
## Related Skills
- myvariant-queries - Aggregated queries including gnomAD
- variant-prioritization - Filter by frequency thresholds
- population-genetics/population-structure - Population stratification analysisRelated Skills
designing-databases
データベーススキーマ設計と最適化を支援します。正規化戦略、インデックス設計、パフォーマンス最適化を提供します。データモデル設計、データベース構造の最適化が必要な場合に使用してください。
databases
Work with MongoDB (document database, BSON documents, aggregation pipelines, Atlas cloud) and PostgreSQL (relational database, SQL queries, psql CLI, pgAdmin). Use when designing database schemas, writing queries and aggregations, optimizing indexes for performance, performing database migrations, configuring replication and sharding, implementing backup and restore strategies, managing database users and permissions, analyzing query performance, or administering production databases.
databases-architecture-skill
Master database design (SQL, NoSQL), system architecture, API design (REST, GraphQL), and building scalable systems. Learn PostgreSQL, MongoDB, system design patterns, and enterprise architectures.
acsets-algebraic-databases
ACSets (Attributed C-Sets): Algebraic databases as in-memory data structures. Category-theoretic formalism for relational databases generalizing graphs and data frames.
bgo
Automates the complete Blender build-go workflow, from building and packaging your extension/add-on to removing old versions, installing, enabling, and launching Blender for quick testing and iteration.
django-expert
Expert Django backend development guidance. Use when creating Django models, views, serializers, or APIs; debugging ORM queries or migrations; optimizing database performance; implementing authentication; writing tests; or working with Django REST Framework. Follows Django best practices and modern patterns.
django-developer
Expert Django developer specializing in Async Views, Django Ninja (FastAPI-like), and HTMX patterns for modern full-stack apps.
django-api
Django API development for 2025. Covers Django Ninja (modern, async-first, type-safe) and Django REST Framework (mature, ecosystem-rich). Use when building REST APIs, choosing between frameworks, implementing authentication, permissions, filtering, pagination, or async endpoints.
distributed-tracing
Implement distributed tracing with Jaeger and Tempo to track requests across microservices and identify performance bottlenecks. Use when debugging microservices, analyzing request flows, or implementing observability for distributed systems.
distributed-debugging-debug-trace
You are a debugging expert specializing in setting up comprehensive debugging environments, distributed tracing, and diagnostic tools. Configure debugging workflows, implement tracing solutions, an...
distinctive-frontend-design
Creates distinctive, production-grade frontend interfaces that avoid generic AI aesthetics. Guides bold aesthetic direction, typography, color, motion, and spatial composition for memorable UI. Use when building frontend components, pages, applications, or interfaces, or when the user asks for UI/UX design, styling, or visually striking interfaces.
discovery-interview
Deep interview process to transform vague ideas into detailed specs. Works for technical and non-technical users.