}
/***********************************************************************/
-void FormatColumnMatrix::read(NameAssignment* nameMap){
+int FormatColumnMatrix::read(NameAssignment* nameMap){
try {
string firstName, secondName;
while(fileHandle && lt == 1){ //let's assume it's a triangular matrix...
+ if (m->control_pressed) { out.close(); remove(tempOutFile.c_str()); fileHandle.close(); delete reading; return 0; }
+
fileHandle >> firstName >> secondName >> distance; // get the row and column names and distance
map<string,int>::iterator itA = nameMap->find(firstName);
if(itB == nameMap->end()){ cerr << "ABError: Sequence '" << secondName << "' was not found in the names file, please correct\n"; exit(1); }
if (distance == -1) { distance = 1000000; }
-
- if(distance < cutoff && itA != itB){
-
+
+ if((distance < cutoff) && (itA != itB)){
if(refRow == refCol){ // in other words, if we haven't loaded refRow and refCol...
refRow = itA->second;
refCol = itB->second;
}
out.close();
fileHandle.close();
-
+
string squareFile;
if(lt == 0){ // oops, it was square
squareFile = filename;
system(command.c_str());
#endif
+ if (m->control_pressed) { remove(tempOutFile.c_str()); remove(outfile.c_str()); delete reading; return 0; }
//output to new file distance for each row and save positions in file where new row begins
ifstream in;
for(int k = 0; k < firstString.length(); k++) { in.putback(firstString[k]); }
while(!in.eof()) {
+
+ if (m->control_pressed) { in.close(); out.close(); remove(distFile.c_str()); remove(tempOutFile.c_str()); remove(outfile.c_str()); delete reading; return 0; }
+
in >> first >> second >> dist; gobble(in);
if (first != currentRow) {
rowMap.clear();
//save row you just read
- rowMap[second] = dist;
-
+ if (dist < cutoff) {
+ rowMap[second] = dist;
+ }
}else{
- rowMap[second] = dist;
+ if (dist < cutoff) {
+ rowMap[second] = dist;
+ }
}
}
in.close();
out.close();
+ if (m->control_pressed) { remove(distFile.c_str()); remove(tempOutFile.c_str()); remove(outfile.c_str()); delete reading; return 0; }
remove(tempOutFile.c_str());
remove(outfile.c_str());
reading->finish();
+
+ delete reading;
list->setLabel("0");
+
+ if (m->control_pressed) { remove(distFile.c_str()); return 0; }
+
+ return 1;
}
catch(exception& e) {
- errorOut(e, "FormatColumnMatrix", "read");
+ m->errorOut(e, "FormatColumnMatrix", "read");
exit(1);
}
}