+ for (int h = line.start; h < (line.start + line.num); h++) {
+ count = h;
+ int midpoint = midpoints[h];
+
+ //initialize pref[count]
+ for (int i = 0; i < numSeqs; i++ ) {
+ pref[count][i].name = seqs[i]->getName();
+ pref[count][i].midpoint = midpoint;
+ }
+
+ if (m->control_pressed) { return 0; }
+
+ //create 2 vectors of sequences, 1 for left side and one for right side
+ vector<Sequence> left; vector<Sequence> right;
+
+ for (int i = 0; i < seqs.size(); i++) {
+
+ if (m->control_pressed) { return 0; }
+
+ //cout << "midpoint = " << midpoint << "\twindow = " << window << endl;
+ //cout << "whole = " << seqs[i]->getAligned().length() << endl;
+ //save left side
+ string seqLeft = seqs[i]->getAligned().substr(midpoint-window, window);
+ Sequence tempLeft;
+ tempLeft.setName(seqs[i]->getName());
+ tempLeft.setAligned(seqLeft);
+ left.push_back(tempLeft);
+ //cout << "left = " << tempLeft.getAligned().length() << endl;
+ //save right side
+ string seqRight = seqs[i]->getAligned().substr(midpoint, window);
+ Sequence tempRight;
+ tempRight.setName(seqs[i]->getName());
+ tempRight.setAligned(seqRight);
+ right.push_back(tempRight);
+ //cout << "right = " << seqRight.length() << endl;
+ }
+
+ //this should be parallelized
+ //perference = sum of (| distance of my left to sequence j's left - distance of my right to sequence j's right | )
+ //create a matrix containing the distance from left to left and right to right
+ //calculate distances
+ SparseMatrix* SparseLeft = new SparseMatrix();
+ SparseMatrix* SparseRight = new SparseMatrix();
+
+ createSparseMatrix(0, left.size(), SparseLeft, left);
+
+ if (m->control_pressed) { delete SparseLeft; delete SparseRight; return 0; }
+
+ createSparseMatrix(0, right.size(), SparseRight, right);
+
+ if (m->control_pressed) { delete SparseLeft; delete SparseRight; return 0; }
+
+ left.clear(); right.clear();
+ vector<SeqMap> distMapRight;
+ vector<SeqMap> distMapLeft;