+ for (int i = 0; i < numIters; i++) {
+ //random sampling with replacement.
+
+ if (m->control_pressed) { return 0; }
+
+ vector<snps> selectedLeft;
+
+ for (int j = 0; j < numLeft; j++) {
+ int index = int(rand() % left.size());
+ selectedLeft.push_back(left[index]);
+ }
+
+ vector<snps> selectedRight;
+ for (int j = 0; j < numRight; j++) {
+ int index = int(rand() % right.size());
+ selectedRight.push_back(right[index]);
+ }
+
+ /* A ------------------------------------------
+ # QLA QRA
+ # Q ------------------------------------------
+ # |
+ # |
+ # Q ------------------------------------------
+ # QLB QRB
+ # B ------------------------------------------ */
+
+
+ float QLA = snpQA(selectedLeft);
+ float QRA = snpQA(selectedRight);
+
+ float QLB = snpQB(selectedLeft);
+ float QRB = snpQB(selectedRight);
+
+ //in original - not used - not sure why?
+ //float ALB = snpAB(selectedLeft);
+ //float ARB = snpAB(selectedRight);
+
+ if ((QLA > QLB) && (QRB > QRA)) {
+ count_A++;
+ }
+
+ if ((QLB > QLA) && (QRA > QRB)) {
+ count_B++;
+ }
+
+//cout << "selected left snp: \n";
+//for (int j = 0; j < selectedLeft.size(); j++) { cout << selectedLeft[j].parentAChar; }
+//cout << endl;
+//for (int j = 0; j < selectedLeft.size(); j++) { cout << selectedLeft[j].queryChar; }
+//cout << endl;
+//for (int j = 0; j < selectedLeft.size(); j++) { cout << selectedLeft[j].parentBChar; }
+//cout << endl;
+//cout << "selected right snp: \n";
+//for (int j = 0; j < selectedRight.size(); j++) { cout << selectedRight[j].parentAChar; }
+//cout << endl;
+//for (int i = 0; i < selectedRight.size(); i++) { cout << selectedRight[i].queryChar; }
+//cout << endl;
+//for (int i = 0; i < selectedRight.size(); i++) { cout << selectedRight[i].parentBChar; }
+//cout << endl;
+ }
+
+
+ //cout << count_A << '\t' << count_B << endl;
+
+ BSA = (float) count_A / (float) numIters * 100;
+ BSB = (float) count_B / (float) numIters * 100;
+//cout << "bsa = " << BSA << " bsb = " << BSB << endl;
+
+ return 0;
+
+ }
+ catch(exception& e) {
+ m->errorOut(e, "Slayer", "bootstrapSNPS");
+ exit(1);
+ }
+}
+/***********************************************************************/
+float Slayer::snpQA(vector<snps> data) {
+ try {
+
+ int numIdentical = 0;
+
+ for (int i = 0; i < data.size(); i++) {
+ if (data[i].parentAChar == data[i].queryChar) {
+ numIdentical++;
+ }
+ }
+
+ float percentID = (numIdentical / (float) data.size()) * 100;