@@ -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 }
0 commit comments