Skip to content

Commit b1166a5

Browse files
authored
Merge pull request #825 from broadinstitute/jg/add_mutation_rate_ht_resource
Add constraint release versioning and mutation rate table path functions
2 parents 6d3ce87 + 264e4cb commit b1166a5

File tree

1 file changed

+35
-3
lines changed

1 file changed

+35
-3
lines changed

gnomad/resources/grch38/gnomad.py

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
CURRENT_EXOME_AN_RELEASE = "4.1"
3535
CURRENT_GENOME_AN_RELEASE = "4.1"
3636

37+
CURRENT_CONSTRAINT_RELEASE = "4.1.1"
38+
3739
EXOME_RELEASES = ["4.0", "4.1"]
3840
GENOME_RELEASES = ["3.0", "3.1", "3.1.1", "3.1.2", "4.0", "4.1"]
3941
JOINT_RELEASES = ["4.1"]
@@ -45,6 +47,9 @@
4547
EXOME_AN_RELEASES = ["4.1"]
4648
GENOME_AN_RELEASES = ["4.1"]
4749

50+
CONSTRAINT_RELEASES = ["4.0", "4.1", "4.1.1"]
51+
CONSTRAINT_MUTATION_RATE_RELEASES = ["4.1.1"]
52+
4853
DATA_TYPES = ["exomes", "genomes", "joint"]
4954
MAJOR_RELEASES = ["v3", "v4"]
5055
CURRENT_MAJOR_RELEASE = MAJOR_RELEASES[-1]
@@ -422,12 +427,22 @@ def _public_constraint_ht_path(version: str) -> str:
422427
"""
423428
Get public constraint table path.
424429
425-
:param version: One of the release versions of gnomAD on GRCh38.
430+
:param version: One of the constraint release versions of gnomAD on GRCh38.
426431
:return: Path to gene constraint Table.
427432
"""
428433
return f"gs://gnomad-public-requester-pays/release/{version}/constraint/gnomad.v{version}.constraint_metrics.ht"
429434

430435

436+
def _public_constraint_mutation_rate_ht_path(version: str) -> str:
437+
"""
438+
Get public constraint mutation rate table path.
439+
440+
:param version: One of the constraint mutation rate release versions of gnomAD on GRCh38.
441+
:return: Path to mutation rate Table.
442+
"""
443+
return f"gs://gnomad-public-requester-pays/release/{version}/constraint/model/gnomad.v{version}.mutation_rate.ht"
444+
445+
431446
def _public_browser_variant_ht_path(version: str) -> str:
432447
"""
433448
Get public browser variant table path.
@@ -833,10 +848,27 @@ def constraint() -> VersionedTableResource:
833848
:return: Gene constraint Table.
834849
"""
835850
return VersionedTableResource(
836-
CURRENT_EXOME_RELEASE,
851+
CURRENT_CONSTRAINT_RELEASE,
837852
{
838853
release: GnomadPublicTableResource(path=_public_constraint_ht_path(release))
839-
for release in EXOME_RELEASES
854+
for release in CONSTRAINT_RELEASES
855+
},
856+
)
857+
858+
859+
def constraint_mutation_rate() -> VersionedTableResource:
860+
"""
861+
Retrieve constraint mutation rate Table.
862+
863+
:return: Mutation rate Table.
864+
"""
865+
return VersionedTableResource(
866+
CURRENT_CONSTRAINT_RELEASE,
867+
{
868+
release: GnomadPublicTableResource(
869+
path=_public_constraint_mutation_rate_ht_path(release)
870+
)
871+
for release in CONSTRAINT_MUTATION_RATE_RELEASES
840872
},
841873
)
842874

0 commit comments

Comments
 (0)