Skip to content

Commit be147a3

Browse files
committed
Add constraint release versioning and mutation rate table path functions
- Introduced CURRENT_CONSTRAINT_RELEASE variable set to "4.1.1". - Updated CONSTRAINT_RELEASES list to include "4.1" and "4.1.1". - Added _public_constraint_mutation_rate_ht_path function to retrieve mutation rate table paths. - Modified constraint and constraint_mutation_rate functions to utilize the new constraint release versioning.
1 parent 6d3ce87 commit be147a3

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

gnomad/resources/grch38/gnomad.py

Lines changed: 33 additions & 2 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,8 @@
4547
EXOME_AN_RELEASES = ["4.1"]
4648
GENOME_AN_RELEASES = ["4.1"]
4749

50+
CONSTRAINT_RELEASES = ["4.1", "4.1.1"]
51+
4852
DATA_TYPES = ["exomes", "genomes", "joint"]
4953
MAJOR_RELEASES = ["v3", "v4"]
5054
CURRENT_MAJOR_RELEASE = MAJOR_RELEASES[-1]
@@ -428,6 +432,16 @@ def _public_constraint_ht_path(version: str) -> str:
428432
return f"gs://gnomad-public-requester-pays/release/{version}/constraint/gnomad.v{version}.constraint_metrics.ht"
429433

430434

435+
def _public_constraint_mutation_rate_ht_path(version: str) -> str:
436+
"""
437+
Get public constraint mutation rate table path.
438+
439+
:param version: One of the constraint release versions of gnomAD on GRCh38.
440+
:return: Path to mutation rate Table.
441+
"""
442+
return f"gs://gnomad-public-requester-pays/release/{version}/constraint/model/gnomad.v{version}.mutation_rate.ht"
443+
444+
431445
def _public_browser_variant_ht_path(version: str) -> str:
432446
"""
433447
Get public browser variant table path.
@@ -833,10 +847,27 @@ def constraint() -> VersionedTableResource:
833847
:return: Gene constraint Table.
834848
"""
835849
return VersionedTableResource(
836-
CURRENT_EXOME_RELEASE,
850+
CURRENT_CONSTRAINT_RELEASE,
837851
{
838852
release: GnomadPublicTableResource(path=_public_constraint_ht_path(release))
839-
for release in EXOME_RELEASES
853+
for release in CONSTRAINT_RELEASES
854+
},
855+
)
856+
857+
858+
def constraint_mutation_rate() -> VersionedTableResource:
859+
"""
860+
Retrieve constraint mutation rate Table.
861+
862+
:return: Mutation rate Table.
863+
"""
864+
return VersionedTableResource(
865+
CURRENT_CONSTRAINT_RELEASE,
866+
{
867+
release: GnomadPublicTableResource(
868+
path=_public_constraint_mutation_rate_ht_path(release)
869+
)
870+
for release in CONSTRAINT_RELEASES
840871
},
841872
)
842873

0 commit comments

Comments
 (0)