feat: variant page — reverse lookup (genes/tissues a variant is an eQTL for) (#6)#34
Open
boxiangliu wants to merge 1 commit into
Open
feat: variant page — reverse lookup (genes/tissues a variant is an eQTL for) (#6)#34boxiangliu wants to merge 1 commit into
boxiangliu wants to merge 1 commit into
Conversation
…TL for) (#6) Closes #6. No schema change (see #31): resolve the rsID's chromosome, then query the existing (chrom, rs_id) composite index. - repository.py: variant_chrom() (resolves chromosome via the SNP_A-indexed 1000G LD tables), eqtls_for_variant() (fast `WHERE chrom AND rs_id` fan-out), gene_by_id() (reverse gencode lookup, reconstructs the zero-padded ENSG). - web.py: GET /variant/{rsid} (reverse lookup, significant first, links each gene to its page); /search now routes rsIDs here. - templates/variant.html. - 100% coverage; verified live: rs62062621 -> chr17 -> 2485 associations / 119 genes across 25 tissues in ~3.5s. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Closes #6. A variant page: type an rsID → see every gene × tissue where it's an eQTL (the mirror of the gene page).
/searchnow routes rsIDs here.How — and why no schema change (#31)
The reverse lookup needs the chromosome to use the
(chrom, rs_id)composite index (a barers_idfull-scans 138M rows → timeout). So:variant_chrom(rs_id)resolves the chromosome by scanning the SNP_A-indexed 1000G LD tables (autosomes) — no external service, no DDL.eqtls_for_variant(chrom, rs_id, …)then doesWHERE chrom = C AND rs_id = Xper shard — a ~100-row index seek, not a scan.gene_by_idreverse-resolves gene symbols (reconstructs the zero-padded ENSG).Results sorted most-significant-first; each gene links to its gene page.
Testing
ruff/mypy --strict/ 100% coverage (hermetic). Verified live (read-only):rs62062621→ chr17 (1.8s) → 2,485 associations across 25 tissues / 119 genes (1.7s) → HTTP 200.Notes for review
templates/variant.html(a new file — doesn't touch your in-flight gene-page redesign).repository.py/web.pynear feat: regional-plot backend (cis_associations, ld_r2, JSON endpoints) #25 and feat: CSV/TSV download of a gene's eQTL table (#7) #33 → minor merge conflicts possible if those land first; straightforward to resolve.