Skip to content

Commit 4b67616

Browse files
bug fixes
1 parent 06d4191 commit 4b67616

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

src/Pheno.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ void prep_run (struct in_files* files, struct filter* filters, struct param* par
10621062
// for step 2, check blup files
10631063
if (params->test_mode && !params->getCorMat){
10641064
// individuals not in blup file will have their phenotypes masked
1065-
blup_read(files, params, pheno_data, m_ests, sout);
1065+
blup_read(files, params, pheno_data, m_ests, filters, sout);
10661066
if(params->write_samples) write_ids(files, params, pheno_data, sout);
10671067
}
10681068

@@ -1229,7 +1229,7 @@ bool has_blup(string const& yname, map<string,string> const& y_read, struct para
12291229
}
12301230

12311231
// get list of blup files
1232-
void blup_read(struct in_files* files, struct param* params, struct phenodt* pheno_data, struct ests* m_ests, mstream& sout) {
1232+
void blup_read(struct in_files* files, struct param* params, struct phenodt* pheno_data, struct ests* m_ests, struct filter* filters, mstream& sout) {
12331233

12341234
int n_masked_prior, n_masked_post;
12351235
uint32_t indiv_index;
@@ -1315,6 +1315,16 @@ void blup_read(struct in_files* files, struct param* params, struct phenodt* phe
13151315
}
13161316

13171317
if( n_masked_post < n_masked_prior ){
1318+
if((params->trait_mode==1) || (params->trait_mode==3)){ // re-compute case-control indices
1319+
int event_index = ph;
1320+
if (params->trait_mode == 3) { // find event column index
1321+
std::vector<std::string>::iterator it_event = std::find(files->pheno_names.begin(), files->pheno_names.end(), files->t2e_map[files->pheno_names[ph]]);
1322+
event_index = std::distance(files->pheno_names.begin(), it_event);
1323+
}
1324+
get_both_indices(filters->case_control_indices[ph], pheno_data->phenotypes_raw.col(event_index).array() == 1, pheno_data->masked_indivs.col(ph).array());
1325+
params->pheno_counts(ph, 0) = filters->case_control_indices[ph][0].size();
1326+
params->pheno_counts(ph, 1) = filters->case_control_indices[ph][1].size();
1327+
}
13181328
sout << " + " << n_masked_prior - n_masked_post <<
13191329
" individuals with missing LOCO predictions will be ignored for the trait\n";
13201330
}

src/Pheno.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void rescale_mat(Eigen::Ref<Eigen::MatrixXd>,struct param const*);
8080
void prep_run(struct in_files*,struct filter*,struct param*,struct phenodt*,struct ests*,mstream&);
8181
void check_blup(struct in_files*,struct param*,mstream&);
8282
bool has_blup(std::string const&,std::map<std::string,std::string> const&,struct param const*,mstream&);
83-
void blup_read(struct in_files*,struct param*,struct phenodt*,struct ests*,mstream&);
83+
void blup_read(struct in_files*,struct param*,struct phenodt*,struct ests*,struct filter*,mstream&);
8484
void extract_interaction_prs(struct param*,struct in_files*,struct filter*,struct phenodt*,Eigen::Ref<ArrayXb>,mstream&);
8585
void read_prs(Eigen::Ref<Eigen::ArrayXd>,struct in_files*,struct param*,Eigen::Ref<ArrayXb>,mstream&);
8686
void check_phenos(Eigen::Ref<ArrayXb>,std::vector<std::string> const&,std::string const&,mstream&);

src/Regenie.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ void read_params_and_check(int& argc, char *argv[], struct param* params, struct
10201020
sout << "WARNING: must use --write-setlist with --write-mask.\n";
10211021
params->write_setlist = false; valid_args[ "write-setlist" ] = false;
10221022
}
1023-
if((vm.count("1") || vm.count("cc12")) && (params->trait_mode != 1 || params->trait_mode != 3)) valid_args[ "1" ] = valid_args[ "cc12" ] = false;
1023+
if((vm.count("1") || vm.count("cc12")) && !(params->trait_mode == 1 || params->trait_mode == 3)) valid_args[ "1" ] = valid_args[ "cc12" ] = false;
10241024
if( vm.count("write-mask-snplist") && (vm.count("mask-lovo") || vm.count("mask-lodo")) ) {
10251025
sout << "WARNING: cannot use --write-mask-snplist with LOVO/LODO.\n";
10261026
params->write_mask_snplist = false; valid_args[ "write-mask-snplist" ] = false;
@@ -1190,6 +1190,8 @@ void read_params_and_check(int& argc, char *argv[], struct param* params, struct
11901190
sout << "WARNING: Ignoring option --singleton-carrier when using --set-singletons.\n";
11911191
params->singleton_carriers = false; valid_args[ "singleton-carrier" ] = false;
11921192
}
1193+
if( (vm.count("t2e") + vm.count("bt") + vm.count("qt")) > 1)
1194+
throw "must use only one of --qt/--bt/--t2e";
11931195
if(params->use_loocv && (params->trait_mode == 3)) {
11941196
sout << "WARNING: option --loocv cannot be used with option --t2e.\n" ;
11951197
params->use_loocv = false; valid_args[ "loocv" ] = false;

0 commit comments

Comments
 (0)