Genes¶
Endpoints para obtener la anotación de un gen y consultar sus variantes.
GET /genes/{symbol}¶
Devuelve la GeneAnnotation completa para un símbolo génico.
Parámetros:
| Parámetro | Tipo | Default | Descripción |
|---|---|---|---|
symbol |
path | — | Símbolo HGNC (e.g. BRCA1) |
source |
query | gencode |
Fuente de anotación génica |
Response: GeneAnnotation serializado.
{
"gene": {
"nomenclature": { "symbols": { "names": ["BRCA1"], "aliases": {} } },
"position": { "chromosome": "17", "start": 43044295, "end": 43125483 }
},
"biotype": "PROTEIN_CODING",
"transcripts": [ { "..." } ],
"genomic_scores": [ { "name": "pLI", "value": 0.99 } ],
"diseases": [ { "..." } ]
}
Ejemplo¶
import httpx
response = httpx.get("http://localhost:8000/genes/BRCA1")
gene = response.json()
print(gene["gene"]["position"])
GET /genes/{symbol}/variants¶
Devuelve todas las variantes en la región genómica del gen, anotadas con el pipeline seleccionado.
Parámetros:
| Parámetro | Tipo | Default | Descripción |
|---|---|---|---|
symbol |
path | — | Símbolo HGNC |
store |
query | mcps_af |
Region store para obtener variantes |
gene_source |
query | gencode |
Fuente para resolver la posición del gen |
profile |
query | gene_view |
Perfil de anotación a aplicar |
add |
query | [] |
Stores extra añadidos al pipeline |
exclude |
query | [] |
Stores excluidos del pipeline |
workers |
query | 4 |
Workers tabix paralelos |
Por qué gene_view como perfil default
El region store (mcps_af) ya adjunta frecuencias MCPS a las variantes
durante la consulta por región. El perfil gene_view excluye mcps_af
del pipeline de anotación para evitar re-anotar lo que ya viene incluido.
Response:
{
"gene": { "...GeneAnnotation..." },
"variants": [ { "...VariantAnnotation..." } ],
"total": 847,
"region_store": "mcps_af",
"stores_applied": ["clinvar", "loftee"]
}
Ejemplo¶
import httpx
from iris.adapters.driven.serializers.variant import converter
from iris.domain.genomics.entities import GeneAnnotation, VariantAnnotation
response = httpx.get(
"http://localhost:8000/genes/BRCA2/variants",
params={"profile": "clinical", "exclude": ["mcps_af"], "workers": 8},
)
data = response.json()
gene = converter.structure(data["gene"], GeneAnnotation)
variants = [converter.structure(v, VariantAnnotation) for v in data["variants"]]
print(f"{gene.gene.symbol}: {data['total']} variantes")
Referencia¶
iris.applications.api.routers.genes
¶
Genes API router — gene annotation and region-based variant queries.
gene_annotation
async
¶
Return the full GeneAnnotation for a gene symbol.
| PARAMETER | DESCRIPTION |
|---|---|
symbol
|
HGNC gene symbol (case-insensitive).
TYPE:
|
source
|
Which gene registry to query (default:
TYPE:
|
Source code in src/iris/applications/api/routers/genes.py
gene_variants
async
¶
gene_variants(
symbol,
store="mcps_af",
gene_source="gencode",
profile="gene_view",
add=[],
exclude=[],
workers=4,
)
Return all variants in a gene's genomic region, annotated through a pipeline.
Steps:
- Resolve
symbol→GeneAnnotation(fromgene_source). - Query all variants overlapping the gene's
GenomicPosition(fromstore). - Apply the annotation pipeline:
profilestores +add−exclude.
The gene_view profile excludes mcps_af by default because the
region store already attaches MCPS frequencies during step 2.
| PARAMETER | DESCRIPTION |
|---|---|
symbol
|
HGNC gene symbol.
TYPE:
|
store
|
Region store to pull variants from (default:
TYPE:
|
gene_source
|
Gene registry used to resolve the genomic position.
TYPE:
|
profile
|
Annotation profile (default:
TYPE:
|
add
|
Extra stores appended after the profile.
TYPE:
|
exclude
|
Stores to remove from the pipeline.
TYPE:
|
workers
|
Parallel tabix workers.
TYPE:
|