@@ -112,7 +112,7 @@ def upfront_check(geno_path, args):
112
112
113
113
# if no pgen present, but bed is present, and skip fails is True, convert to pgen
114
114
if not os .path .isfile (f'{ geno_path } .pgen' ) and os .path .isfile (f'{ geno_path } .bed' ) and (not args ['skip_fails' ]):
115
- warnings .warn (f'{ geno_path } exists but it is in PLINK1.9 binary format. Converting to PLINK2 binaries...' )
115
+ warnings .warn (f'{ geno_path } exists but it is in PLINK1.9 binary format. Converting to PLINK2 binaries...' , stacklevel = 2 )
116
116
bfiles_to_pfiles (bfile_path = geno_path )
117
117
118
118
sam = pd .read_csv (f'{ geno_path } .psam' , sep = '\s+' )
@@ -155,25 +155,25 @@ def upfront_check(geno_path, args):
155
155
# skip sex check when no sex in fam or no X chromosome
156
156
if args ['sex' ] is not None :
157
157
if (1 not in sex_counts .keys ()) and (2 not in sex_counts .keys ()):
158
- warnings .warn ('You tried calling sex prune but no sample sex data is available. Skipping...' )
158
+ warnings .warn ('You tried calling sex prune but no sample sex data is available. Skipping...' , stacklevel = 2 )
159
159
args ['sex' ] = None
160
160
elif ('23' not in chr_counts .keys ()) and ('X' not in chr_counts .keys ()):
161
- warnings .warn ('You tried calling sex prune but no X chromosome data is available. Skipping...' )
161
+ warnings .warn ('You tried calling sex prune but no X chromosome data is available. Skipping...' , stacklevel = 2 )
162
162
args ['sex' ] = None
163
163
164
164
# change hwe prune to be run without controls filtered when no controls present
165
165
if (args ['hwe' ] is not None ) and (args ['filter_controls' ] == True ) and (1 not in pheno_counts .keys ()):
166
- warnings .warn ('You tried calling hwe prune with controls filtered but no controls are available. Skipping...' )
166
+ warnings .warn ('You tried calling hwe prune with controls filtered but no controls are available. Skipping...' , stacklevel = 2 )
167
167
args ['filter_controls' ] = False
168
168
169
169
# skip case control when called without cases or controls present
170
170
if (args ['case_control' ] is not None ) and ((1 not in pheno_counts .keys ()) or (2 not in pheno_counts .keys ())):
171
- warnings .warn ('You tried calling case-control prune but only cases or controls are available, not both. Skipping...' )
171
+ warnings .warn ('You tried calling case-control prune but only cases or controls are available, not both. Skipping...' , stacklevel = 2 )
172
172
args ['case_control' ] = None
173
173
174
174
# skip het prune if less than 50 samples are present
175
175
if (args ['het' ] is not None ) and (var .shape [0 ] < 50 ):
176
- warnings .warn ('You tried calling het prune with less than 50 samples. Skipping...' )
176
+ warnings .warn ('You tried calling het prune with less than 50 samples. Skipping...' , stacklevel = 2 )
177
177
args ['het' ] = None
178
178
179
179
return args
0 commit comments