if (distance != -1) { //-1 means skip me
seqDist temp(firstName, secondName, distance);
sameSeqs.push_back(temp);
- }
+ }else{ distance = 10000; }
}
if (mergedMinDist < distance) { //get minimum distance from mergedMin
}
/***********************************************************************/
-void HCluster::combineFile() {
+int HCluster::combineFile() {
try {
//int bufferSize = 64000; //512k - this should be a variable that the user can set to optimize code to their hardware
//char* inputBuffer;
in >> first >> second >> dist; gobble(in);
+ if (m->control_pressed) { in.close(); out.close(); remove(tempDistFile.c_str()); return 0; }
+
//while there are still values in mergedMin that are smaller than the distance read from file
while (count < mergedMin.size()) {
mergedMin.clear();
//rename tempfile to distfile
- int renameOK = remove(distfile.c_str());
- int ok = rename(tempDistFile.c_str(), distfile.c_str());
+ remove(distfile.c_str());
+ rename(tempDistFile.c_str(), distfile.c_str());
//cout << "remove = "<< renameOK << " rename = " << ok << endl;
//merge clustered rows averaging the distances
//sort merged values
sort(mergedMin.begin(), mergedMin.end(), compareSequenceDistance);
+
+ return 0;
}
catch(exception& e) {
m->errorOut(e, "HCluster", "combineFile");
}
}
/***********************************************************************/
-void HCluster::processFile() {
+int HCluster::processFile() {
try {
string firstName, secondName;
float distance;
//get entry
while (!in.eof()) {
+ if (m->control_pressed) { in.close(); out.close(); remove(outTemp.c_str()); return 0; }
in >> firstName >> secondName >> distance; gobble(in);
remove(distfile.c_str());
rename(outTemp.c_str(), distfile.c_str());
+
+ return 0;
}
catch(exception& e) {
m->errorOut(e, "HCluster", "processFile");