Skip to content

Commit d4ef7de

Browse files
ttfilizespenhgn
andauthored
gwas.py: fixed gwas demo run and IID column position (#234)
* Added --firth option. Plink2 output files, *.glm.firth and *.glm.logistic.hybrid, are now renamed to *.logistic. * shorten long lines * fix typo * Added fix for #232 * update version.py and changelog * Update CHANGELOG.md set version as 1.8.1 * Update version.py set version as 1.8.1 --------- Co-authored-by: Espen Hagen <2492641+espenhgn@users.noreply.github.com>
1 parent 1d9a4ec commit d4ef7de

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

CHANGELOG.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,31 @@ If MD5 sum is not listed for a certain release then it means that the container
2121

2222
### Added
2323

24-
* Additions goes here
24+
* Additions go here
2525

2626
### Updated
2727

28-
* Updates goes here
28+
* Updates go here
2929

3030
### Fixed
3131

32-
* Fixes goes here
32+
* Fixes go here
3333

3434
### Removed
3535

36-
* Removals goes here
36+
* Removals go here
3737

3838
### Misc
3939

4040
* Miscellaneous goes here
4141

42+
## [1.8.1] - 2024-03-05
43+
44+
### Fixed
45+
46+
* Fixed parsing of `IID` field in `pheno.dict`
47+
* Fixed issue with files with different suffixes produced by plink2 for binary phenotypes in `gwas.py`
48+
4249
## [1.8.0] - 2024-02-22
4350

4451
### Added

scripts/gwas/gwas.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ def parse_args(args):
114114
help="covariates to control for (must be columns of the --pheno-file); individuals with "
115115
"missing values for any covariates will be excluded not just from <out>.covar, but also "
116116
"from <out>.pheno file")
117+
pheno_parser.add_argument("--firth", type=str, default="firth-fallback",
118+
help="regression mode for binary phenotypes. select between no-firth, firth-fallback and "
119+
"firth")
117120
pheno_parser.add_argument("--variance-standardize", type=str, default=None, nargs='*',
118121
help="the list of continuous phenotypes to standardize variance; accept the list of "
119122
"columns from the --pheno file (if empty, applied to all); doesn't apply to dummy "
@@ -536,6 +539,10 @@ def make_saige_merge_commands(args, logistic, array_spec):
536539

537540
def make_plink2_merge_commands(args, logistic):
538541
cmd = ''
542+
# Move *.glm.logistic.hybrid and *.glm.firth to *.glm.logistic
543+
cmd += """find . -type f -name "*.glm.logistic.hybrid" -exec sh -c 'mv "$1" "${1%.glm.logistic.hybrid}.glm"""
544+
cmd += """.logistic"' _ {} \\;\n"""
545+
cmd += """find . -type f -name "*.glm.firth" -exec sh -c 'mv "$1" "${1%.glm.firth}.glm.logistic"' _ {} \\;\n"""
539546
for pheno in args.pheno:
540547
cmd += '$PYTHON gwas.py merge-plink2 ' + \
541548
pass_arguments_along(args, ['info-file', 'info', 'maf', 'hwe', 'geno']) + \
@@ -1121,7 +1128,7 @@ def append_job(args, commands, array_spec, slurm_job_index, cmd_file, submit_job
11211128
def rename_iid_column(log, pheno_dict, pheno):
11221129
if np.sum(pheno_dict['TYPE'] == 'IID') != 1:
11231130
raise ValueError('Exacly one column in the dictionary file must be marked as IID')
1124-
iid_column_name = pheno_dict.loc[pheno_dict['TYPE'] == 'IID', 'FIELD'][0]
1131+
iid_column_name = pheno_dict.loc[pheno_dict['TYPE'] == 'IID', 'FIELD'].values[0]
11251132
if iid_column_name not in pheno.columns:
11261133
raise ValueError(f'IID column ({iid_column_name}) not present in --pheno-file')
11271134
if (iid_column_name != 'IID') and ('IID' in pheno.columns):

version/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
_MINOR = "8"
33
# On main and in a nightly release the patch should be one ahead of the last
44
# released build.
5-
_PATCH = "2"
5+
_PATCH = "1"
66
# This is mainly for nightly builds which have the suffix ".dev$DATE". See
77
# https://semver.org/#is-v123-a-semantic-version for the semantics.
88
_SUFFIX = ""

0 commit comments

Comments
 (0)