Skip to content

Commit ae7730e

Browse files
authored
Merge pull request #750 from broadinstitute/qh/browser_tables
Add browser tables to resources
2 parents 0ad49fa + 73397eb commit ae7730e

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

gnomad/resources/grch37/gnomad.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,21 @@ def _public_pext_path(pext_type: str = "base_level") -> str:
141141
return pext_paths[pext_type]
142142

143143

144+
def _public_browser_gene_ht_path() -> str:
145+
"""
146+
Get public browser gene table path.
147+
148+
.. note::
149+
150+
This table has smaller number of partitions (n=100) for faster computation and
151+
contains pext data compared to gnomad.genes.GRCh37.GENCODEv19.ht (which was
152+
used by the browser for ES export) under the same path.
153+
154+
:return: Path to browser gene Table.
155+
"""
156+
return "gs://gnomad-public-requester-pays/resources/grch37/browser/gnomad.genes.GRCh37.GENCODEv19.pext.ht"
157+
158+
144159
def public_release(data_type: str) -> VersionedTableResource:
145160
"""
146161
Retrieve publicly released versioned table resource.
@@ -275,3 +290,12 @@ def constraint() -> GnomadPublicTableResource:
275290
:return: Gene constraint Table.
276291
"""
277292
return GnomadPublicTableResource(path=_public_constraint_ht_path())
293+
294+
295+
def browser_gene() -> GnomadPublicTableResource:
296+
"""
297+
Retrieve browser gene table.
298+
299+
:return: Browser gene Table.
300+
"""
301+
return GnomadPublicTableResource(path=_public_browser_gene_ht_path())

gnomad/resources/grch38/gnomad.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
CURRENT_GENOME_RELEASE = "4.1"
2727
CURRENT_JOINT_RELEASE = "4.1"
2828

29+
CURRENT_BROWSER_RELEASE = "4.1"
30+
2931
CURRENT_EXOME_COVERAGE_RELEASE = "4.0"
3032
CURRENT_GENOME_COVERAGE_RELEASE = "3.0.1"
3133

@@ -35,6 +37,7 @@
3537
EXOME_RELEASES = ["4.0", "4.1"]
3638
GENOME_RELEASES = ["3.0", "3.1", "3.1.1", "3.1.2", "4.0", "4.1"]
3739
JOINT_RELEASES = ["4.1"]
40+
BROWSER_RELEASES = ["4.1"]
3841

3942
EXOME_COVERAGE_RELEASES = ["4.0"]
4043
GENOME_COVERAGE_RELEASES = ["3.0", "3.0.1"]
@@ -391,6 +394,31 @@ def _public_constraint_ht_path(version: str) -> str:
391394
return f"gs://gnomad-public-requester-pays/release/{version}/constraint/gnomad.v{version}.constraint_metrics.ht"
392395

393396

397+
def _public_browser_variant_ht_path(version: str) -> str:
398+
"""
399+
Get public browser variant table path.
400+
401+
:param version: One of the release versions of gnomAD on GRCh38.
402+
:return: Path to browser variant Table.
403+
"""
404+
return f"gs://gnomad-public-requester-pays/release/{version}/ht/browser/gnomad.browser.v{version}.sites.ht"
405+
406+
407+
def _public_browser_gene_ht_path() -> str:
408+
"""
409+
Get public browser gene table path.
410+
411+
.. note::
412+
413+
This table has smaller number of partitions (n=100) for faster computation and
414+
contains pext data compared to gnomad.genes.GRCh38.GENCODEv39.ht (which was
415+
used by the browser for ES export) under the same path.
416+
417+
:return: Path to browser gene Table.
418+
"""
419+
return "gs://gnomad-public-requester-pays/resources/grch38/browser/gnomad.genes.GRCh38.GENCODEv39.pext.ht"
420+
421+
394422
def public_release(data_type: str) -> VersionedTableResource:
395423
"""
396424
Retrieve publicly released versioned table resource.
@@ -759,3 +787,29 @@ def constraint(version: str = CURRENT_EXOME_RELEASE) -> VersionedTableResource:
759787
for release in EXOME_RELEASES
760788
},
761789
)
790+
791+
792+
def browser_variant() -> VersionedTableResource:
793+
"""
794+
Retrieve browser variant table.
795+
796+
:return: Browser variant Table.
797+
"""
798+
return VersionedTableResource(
799+
CURRENT_BROWSER_RELEASE,
800+
{
801+
release: GnomadPublicTableResource(
802+
path=_public_browser_variant_ht_path(release)
803+
)
804+
for release in BROWSER_RELEASES
805+
},
806+
)
807+
808+
809+
def browser_gene() -> GnomadPublicTableResource:
810+
"""
811+
Retrieve browser gene table.
812+
813+
:return: Browser gene Table.
814+
"""
815+
return GnomadPublicTableResource(path=_public_browser_gene_ht_path())

0 commit comments

Comments
 (0)