//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";
if (m->control_pressed) {
fileHandle.close();
if (!hclusterWanted) { delete matrix; }
- else { outOverlap.close(); remove(overlapFile.c_str()); outDist.close(); remove(distFile.c_str()); }
+ else { outOverlap.close(); m->mothurRemove(overlapFile); outDist.close(); m->mothurRemove(distFile); }
return 0;
}
}
}
}else { m->mothurOut("Error in your blast file, cannot read."); m->mothurOutEndLine(); exit(1); }
-
-
+string outDistFilem = "../kathryn/blastDist.dist";
+ ofstream outMDist;
+ m->openOutputFile(outDistFilem, outMDist);
//read file
while(!fileHandle.eof()){
if (m->control_pressed) {
fileHandle.close();
if (!hclusterWanted) { delete matrix; }
- else { outOverlap.close(); remove(overlapFile.c_str()); outDist.close(); remove(distFile.c_str()); }
+ else { outOverlap.close(); m->mothurRemove(overlapFile); outDist.close(); m->mothurRemove(distFile); }
delete reading;
return 0;
}
//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);
+ }
+ outMDist << itA->first << '\t' << nameMap->get(it->first) << '\t' << distance << endl;
}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;
}
if (m->control_pressed) {
fileHandle.close();
if (!hclusterWanted) { delete matrix; }
- else { outOverlap.close(); remove(overlapFile.c_str()); outDist.close(); remove(distFile.c_str()); }
+ else { outOverlap.close(); m->mothurRemove(overlapFile); outDist.close(); m->mothurRemove(distFile); }
delete reading;
return 0;
}
if (m->control_pressed) {
fileHandle.close();
if (!hclusterWanted) { delete matrix; }
- else { remove(overlapFile.c_str()); remove(distFile.c_str()); }
+ else { m->mothurRemove(overlapFile); m->mothurRemove(distFile); }
delete reading;
return 0;
}
ifstream in;
m->openInputFile(blastfile, in);
- //ofstream outName;
- //m->openOutputFile((blastfile + ".tempOutNames"), outName);
+ ofstream outName;
+ m->openOutputFile((blastfile + ".tempOutNames"), outName);
//read first line
in >> prevName;
if (name != prevName) {
prevName = name;
nameMap->push_back(name);
+ outName << name << '\t' << name << endl;
num++;
}
}