-
Notifications
You must be signed in to change notification settings - Fork 31
Updates needed for polished v3.1 release code #349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
5a02fc7
Updates needed for polished v3.1 release code
gtiao 342faa9
Run Black
gtiao 342bb8b
Reformatting docstrings to pass PR build documentation check"
gtiao c8a13f7
Creating release.py to house general-use release functions
gtiao 6132fe8
Addressed Julia's PR comments
gtiao 62fde8c
Add missing imports found during PyLint check
gtiao edd0967
Add missing import statement
gtiao c2e7d38
Moving set_female_y_metrics_to_na() function to release.py
gtiao 667ffb4
Update gnomad/utils/annotations.py
gtiao b16ea04
Update gnomad/utils/release.py
gtiao 9fd9a19
Addressing Julia's PR comments
gtiao 9202d59
Updating make_faf_index_dict() code to match style for make_freq_inde…
gtiao a3778c6
Update gnomad/utils/release.py
gtiao 4457b03
Update gnomad/utils/release.py
gtiao d9f8367
Update gnomad/utils/release.py
gtiao 109c999
Update gnomad/utils/release.py
gtiao 13beea3
Update gnomad/utils/release.py
gtiao 8ccb770
Update gnomad/utils/release.py
gtiao 63ab349
Update gnomad/utils/release.py
gtiao 1b41b2d
Update gnomad/utils/release.py
gtiao a413c4a
Update gnomad/utils/release.py
gtiao b22a3bb
Update gnomad/utils/release.py
gtiao 5af023b
Update gnomad/utils/release.py
gtiao 7b92bc2
Update gnomad/utils/release.py
gtiao 4f8caf9
Update gnomad/utils/release.py
gtiao e938866
Tweaking code to address Julia's PR comments
gtiao 53b8d29
Merge branch 'gt_v3.1_changes' of https://github.com/broadinstitute/g…
gtiao d9edbd2
Update gnomad/utils/release.py
gtiao 4e18dfd
Merge branch 'gt_v3.1_changes' of https://github.com/broadinstitute/g…
gtiao 0904f7f
Update gnomad/utils/annotations.py
gtiao 0d400b3
Update gnomad/utils/annotations.py
gtiao 44a41f3
Update gnomad/utils/release.py
gtiao 791c476
Update gnomad/utils/release.py
gtiao 56adae2
Merge branch 'master' into gt_v3.1_changes
gtiao c62af51
Fixing indent issue identified by PyLint
gtiao d29041e
Merge branch 'gt_v3.1_changes' of https://github.com/broadinstitute/g…
gtiao dcf575a
Ran Black
gtiao ad250d4
Listing new functions in changelog
gtiao 408ee90
Run black and remove blank lines
jkgoodrich f29eee9
Add ``# noqa: D100` to release.py
jkgoodrich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# noqa: D100 | ||
|
||
from typing import Dict, List, Optional | ||
|
||
from gnomad.resources.grch38.gnomad import ( | ||
GROUPS, | ||
POPS, | ||
SEXES, | ||
SUBSETS, | ||
) | ||
from gnomad.utils.vcf import index_globals | ||
|
||
|
||
def make_faf_index_dict( | ||
faf_meta: List[Dict[str, str]], | ||
groups: List[str] = ["adj"], | ||
pops: List[str] = POPS, | ||
sexes: List[str] = SEXES, | ||
label_delimiter: str = "_", | ||
) -> Dict[str, int]: | ||
""" | ||
Create a look-up Dictionary for entries contained in the filter allele frequency annotation array. | ||
|
||
:param faf_meta: Global annotation containing the set of groupings for each element of the faf array | ||
(e.g., [{'group': 'adj'}, {'group': 'adj', 'pop': 'nfe'}]) | ||
:param groups: List of sample groups [adj, raw]. Default is GROUPS | ||
:param pops: List of sample global population names for gnomAD genomes. Default is POPS | ||
:param sexes: List of sample sexes used in VCF export. Default is SEXES | ||
:param label_delimiter: String used as delimiter when making group label combinations | ||
:return: Dictionary of faf annotation population groupings, where values are the corresponding 0-based indices for the | ||
groupings in the faf_meta array | ||
""" | ||
|
||
def _get_index(label_groups): | ||
return index_globals(faf_meta, label_groups, label_delimiter) | ||
|
||
index_dict = { | ||
**_get_index(dict(group=groups)), | ||
**_get_index(dict(group=groups, pop=pops)), | ||
**_get_index(dict(group=groups, sex=sexes)), | ||
**_get_index(dict(group=groups, pop=pops, sex=sexes)), | ||
} | ||
return index_dict | ||
|
||
|
||
def make_freq_index_dict( | ||
freq_meta: List[Dict[str, str]], | ||
groups: List[str] = GROUPS, | ||
pops: List[str] = POPS, | ||
sexes: List[str] = SEXES, | ||
subsets: List[str] = SUBSETS, | ||
downsamplings: Optional[List[int]] = None, | ||
label_delimiter: str = "_", | ||
) -> Dict[str, int]: | ||
""" | ||
Create a look-up Dictionary for entries contained in the frequency annotation array. | ||
|
||
.. note: | ||
|
||
Downsampling groupings are only computed on 'adj'-filtered genotypes | ||
|
||
:param freq_meta: List containing the set of groupings for each element of the freq array | ||
(e.g., [{'group': 'adj'}, {'group': 'adj', 'pop': 'nfe'}]) | ||
:param groups: List of sample groups [adj, raw]. Default is GROUPS | ||
:param pops: List of sample global population names for gnomAD genomes. Default is POPS | ||
:param sexes: List of sample sexes used in VCF export. Default is SEXES | ||
:param subset_list: List of sample subsets in dataset. Default is SUBSETS | ||
:param downsamplings: List of downsampling cohort sizes present in global frequency array | ||
:param label_delimiter: String used as delimiter when making group label combinations | ||
:return: Dictionary keyed by the grouping combinations found in the frequency array, where values are the corresponding | ||
0-based indices for the groupings in the freq_meta array | ||
""" | ||
|
||
def _get_index(label_groups): | ||
return index_globals(freq_meta, label_groups, label_delimiter) | ||
|
||
index_dict = { | ||
**_get_index(dict(group=groups)), | ||
**_get_index(dict(group=groups, pop=pops)), | ||
**_get_index(dict(group=groups, sex=sexes)), | ||
**_get_index(dict(group=groups, pop=pops, sex=sexes)), | ||
**_get_index(dict(group=groups, subset=subsets)), | ||
**_get_index(dict(group=groups, subset=subsets, pop=pops)), | ||
**_get_index(dict(group=groups, subset=subsets, sex=sexes)), | ||
**_get_index(dict(group=groups, subset=subsets, pop=pops, sex=sexes)), | ||
} | ||
|
||
if downsamplings: | ||
index_dict.update( | ||
{**_get_index(dict(downsampling=downsamplings, group=["adj"], pop=pops))} | ||
) | ||
|
||
return index_dict |
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
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.
Uh oh!
There was an error while loading. Please reload this page.