我正在尝试使用 GraphQL API 从 gnomAD 数据库获取变体详细信息,包括种群等位基因频率 ( af
)。但是,查询不会返回种群的等位基因频率。当我af
在 下添加时populations
,出现以下错误:
GraphQLError: Cannot query field 'af' on type 'VariantPopulation'. Did you mean 'ac' or 'an'?
GraphQL request:10:9
9 | populations {
10 | af
| ^
11 | id
我的疑问:
from gql import gql, Client
from gql.transport.aiohttp import AIOHTTPTransport
# GraphQL query to fetch variant details
query = gql(
"""
query VariantsInGene {
gene(gene_symbol: "PTH", reference_genome: GRCh38) {
variants(dataset: gnomad_r4) {
variant_id
pos
exome {
af
populations {
id
af
}
}
}
}
}
"""
)
res = await client.execute_async(query)
我尝试过的:
- 在外显子组水平获取等位基因频率(
af
) (工作正常)。 - 添加
af
内部populations
(导致错误)。 - 检查可用字段
VariantPopulation
(建议ac
和an
,但不建议af
)。
问题:
如何在 gnomAD GraphQL 中检索每个人群的等位基因频率 (af
) ?如果我从查询中删除 af,它会执行,但不会检索到人群的 af: