-vector<seqDist> HClusterCommand::getSeqs(ifstream& filehandle){
- try {
- string firstName, secondName;
- float distance, prevDistance;
- vector<seqDist> sameSeqs;
- prevDistance = -1;
-
- //if you are not at the beginning of the file
- if (exitedBreak) {
- sameSeqs.push_back(next);
- prevDistance = next.dist;
- exitedBreak = false;
- }
-
- //get entry
- while (filehandle) {
-
- filehandle >> firstName >> secondName >> distance;
-//cout << firstName << '\t' << secondName << '\t' << distance << endl;
- gobble(filehandle);
-
- //save first one
- if (prevDistance == -1) { prevDistance = distance; }
-
- map<string,int>::iterator itA = globaldata->nameMap->find(firstName);
- map<string,int>::iterator itB = globaldata->nameMap->find(secondName);
-
- if(itA == globaldata->nameMap->end()){
- cerr << "AAError: Sequence '" << firstName << "' was not found in the names file, please correct\n";
- }
- if(itB == globaldata->nameMap->end()){
- cerr << "ABError: Sequence '" << secondName << "' was not found in the names file, please correct\n";
- }
-
- //using cutoff
- if (distance > cutoff) { break; }
-
- if (distance != -1) { //-1 means skip me
-
- //are the distances the same
- if (distance == prevDistance) { //save in vector
- seqDist temp;
- temp.seq1 = itA->second;
- temp.seq2 = itB->second;
- temp.dist = distance;
- sameSeqs.push_back(temp);
- exitedBreak = false;
- //what about precision??
-
- }else{
- next.seq1 = itA->second;
- next.seq2 = itB->second;
- next.dist = distance;
- exitedBreak = true;
- break;
- }
-
- }
- }
-
- return sameSeqs;
- }
- catch(exception& e) {
- errorOut(e, "HClusterCommand", "getSeqs");
- exit(1);
- }
-
-
-}
-
-//**********************************************************************************************************************
-