#define EPI(x) (LIBUSB_ENDPOINT_IN | (unsigned char)(x)) #define EPO(x) (LIBUSB_ENDPOINT_OUT | (unsigned char)(x)) #ifdef WIN32 #define BITFORCE_TIMEOUT_MS 500 #define MODMINER_TIMEOUT_MS 200 #else #define BITFORCE_TIMEOUT_MS 200 #define MODMINER_TIMEOUT_MS 100 #endif #ifdef USE_BITFORCE // N.B. transfer size is 512 with USB2.0, but only 64 with USB1.1 static struct usb_endpoints bfl_eps[] = { { LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(1), 0 }, { LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(2), 0 } }; #endif #ifdef USE_MODMINER static struct usb_endpoints mmq_eps[] = { { LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(3), 0 }, { LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(3), 0 } }; #endif // TODO: Add support for (at least) Isochronous endpoints static struct usb_find_devices find_dev[] = { /* #ifdef USE_ICARUS
void Plink::driverSCREEPI() { /////////////////////////////// // Gene-based epistasis ////////////////////////////////////////// // Case-control samples only affCoding(*this); ////////////////////////////////////////// // SNP-major mode analysis if (!par::SNP_major) Ind2SNP(); ////////////////////////////////////////// // Requires that sets have been speciefied if (par::set_test) readSet(); else error("Need to specify genes with --set {filename} when using --genepi\n"); ////////////////// // SET statistics Set S(snpset); ////////////////////////////////////////////// // Prune SET (0-sized sets, MAF==0 SNPs, etc) S.pruneSets(*this); int ns = snpset.size(); if (ns < 2) error("Need to specify at least two fully valid sets\n"); int n = 0; int ncase = 0; ///////////////////////////////////////////////////////// // Prune based on VIF string original_outfile = par::output_file_name; // Case-control? Prune cases and controls together... if (!par::epi_caseonly) { printLOG("\nConsidering cases and controls: "); setFlags(false); vector<Individual*>::iterator person = sample.begin(); while ( person != sample.end() ) { if ( ! (*person)->missing ) { (*person)->flag = true; n++; } person++; } par::output_file_name += ".all"; S.pruneMC(*this,false,par::vif_threshold); //S.pruneMC(*this,false,1000); } // Case-only? Prune cases only... else { printLOG("\nConsidering cases: "); setFlags(false); vector<Individual*>::iterator person = sample.begin(); while ( person != sample.end() ) { if ( (*person)->aff && ! (*person)->missing ) { (*person)->flag = true; ncase++; } person++; n++; } par::output_file_name += ".case"; S.pruneMC(*this,false,par::vif_threshold); //S.pruneMC(*this,false,1000); } par::output_file_name = original_outfile; // Write finalized set ofstream SET1, SET2; string f = par::output_file_name + ".all.set.in"; printLOG("Writing combined pruned-in set file to [ " + f + " ]\n"); SET1.open(f.c_str(),ios::out); f = par::output_file_name + ".all.set.out"; printLOG("Writing combined pruned-out set file to [ " + f + " ]\n"); SET2.open(f.c_str(),ios::out); for (int s=0; s<snpset.size(); s++) { int nss = snpset[s].size(); SET1 << setname[s] << "\n"; SET2 << setname[s] << "\n"; for (int j=0; j<nss; j++) { if (S.cur[s][j]) SET1 << locus[snpset[s][j]]->name << "\n"; else SET2 << locus[snpset[s][j]]->name << "\n"; } SET1 << "END\n\n"; SET2 << "END\n\n"; } SET1.close(); SET2.close(); // Prune empty sets once more: S.pruneSets(*this); ns = snpset.size(); if (ns < 2) error("Need to specify at least two fully valid sets\n"); //////////////////////////////// // Set up permutation structure // Specialized (i.e. cannot use Perm class) as this // requires a block-locus permutation // First block is fixed vector<vector<int> > blperm(ns); vector<vector<int> > blperm_case(ns); vector<vector<int> > blperm_control(ns); for (int i=0; i<ns; i++) { // A slot for each individual per locus for (int j=0; j<n; j++) if ( ! sample[j]->missing ) blperm[i].push_back(j); // A slot for each individual per locus for (int j=0; j<n; j++) if ( ! sample[j]->missing && sample[j]->aff ) blperm_case[i].push_back(j); // A slot for each individual per locus for (int j=0; j<n; j++) if ( ! sample[j]->missing && !sample[j]->aff ) blperm_control[i].push_back(j); } //////////////////////////////////////////// // Open file and print header for results ofstream EPI(f.c_str(), ios::out); EPI.open(f.c_str(), ios::out); EPI.precision(4); //////////////////////////////////////// // Analysis (calls genepi functions) if (!par::epi_caseonly) CCA_logit(false,blperm,S,*this); else CCA_caseonly(false,blperm_case,S,*this); if (!par::permute) return; if (!par::silent) cout << "\n"; } // End of screepi