//create objects needed for read
if (!hclusterWanted) {
- matrix = new SparseMatrix();
+ matrix = new SparseDistanceMatrix();
+ matrix->resize(nseqs);
}else{
overlapFile = m->getRootName(blastfile) + "overlap.dist";
distFile = m->getRootName(blastfile) + "hclusterDists.dist";
}
}else { m->mothurOut("Error in your blast file, cannot read."); m->mothurOutEndLine(); exit(1); }
-
+
//read file
while(!fileHandle.eof()){
//is this distance below cutoff
if (distance < cutoff) {
if (!hclusterWanted) {
- PCell value(itA->second, it->first, distance);
- matrix->addCell(value);
- }else{
+ if (itA->second < it->first) {
+ PDistCell value(it->first, distance);
+ matrix->addCell(itA->second, value);
+ }else {
+ PDistCell value(itA->second, distance);
+ matrix->addCell(it->first, value);
+ }
+ }else{
outDist << itA->first << '\t' << nameMap->get(it->first) << '\t' << distance << endl;
}
}
//is this distance below cutoff
if (distance < cutoff) {
if (!hclusterWanted) {
- PCell value(itA->second, it->first, distance);
- matrix->addCell(value);
+ if (itA->second < it->first) {
+ PDistCell value(it->first, distance);
+ matrix->addCell(itA->second, value);
+ }else {
+ PDistCell value(itA->second, distance);
+ matrix->addCell(it->first, value);
+ }
}else{
outDist << itA->first << '\t' << nameMap->get(it->first) << '\t' << distance << endl;
}
//is this a new name?
if (name != prevName) {
prevName = name;
- nameMap->push_back(name);
+
+ if (nameMap->get(name) != -1) { m->mothurOut("[ERROR]: trying to exact names from blast file, and I found dups. Are you sequence names unique? quitting.\n"); m->control_pressed = true; }
+ else {
+ nameMap->push_back(name);
+ }
+ //outName << name << '\t' << name << endl;
num++;
}
}