else {
//valid paramters for this command
- string Array[] = {"phylip","column","name","cutoff","precision","method","showabund","timing","hard","processors","splitcutoff","outputdir","inputdir"};
+ string Array[] = {"phylip","column","name","cutoff","precision","method","showabund","timing","hard","processors","outputdir","inputdir"};
vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
OptionParser parser(option);
convert(temp, cutoff);
if (!hard) { cutoff += (5 / (precision * 10.0)); }
- temp = validParameter.validFile(parameters, "splitcutoff", false);
- if (temp == "not found") { temp = "0.10"; }
- convert(temp, splitcutoff);
- if (!hard) { splitcutoff += (5 / (precision * 10.0)); }
-
method = validParameter.validFile(parameters, "method", false);
if (method == "not found") { method = "furthest"; }
//if user gave a phylip file convert to column file
if (format == "phylip") {
+
ReadCluster* convert = new ReadCluster(distfile, cutoff, outputDir, false);
NameAssignment* nameMap = NULL;
+ convert->setFormat("phylip");
convert->read(nameMap);
if (m->control_pressed) { delete convert; return 0; }
- string distfile = convert->getOutputFile();
-
+ distfile = convert->getOutputFile();
+
//if no names file given with phylip file, create it
ListVector* listToMakeNameFile = convert->getListVector();
if (namefile == "") { //you need to make a namefile for split matrix
delete listToMakeNameFile;
delete convert;
}
-
if (m->control_pressed) { return 0; }
time_t estart = time(NULL);
//split matrix into non-overlapping groups
- SplitMatrix* split = new SplitMatrix(distfile, namefile, splitcutoff);
+ SplitMatrix* split = new SplitMatrix(distfile, namefile, cutoff);
split->split();
if (m->control_pressed) { delete split; return 0; }
dividedNames[(processToAssign-1)].push_back(distName[i]);
}
+ //not lets reverse the order of ever other process, so we balance big files running with little ones
+ for (int i = 0; i < processors; i++) {
+ int remainder = ((i+1) % processors);
+ if (remainder) { reverse(dividedNames[i].begin(), dividedNames[i].end()); }
+ }
+
createProcesses(dividedNames);
if (m->control_pressed) { return 0; }
//get the list info from each file
for (int k = 0; k < listNames.size(); k++) {
+ if (m->control_pressed) {
+ if (listSingle != NULL) { delete listSingle; remove(singleton.c_str()); }
+ for (int i = 0; i < listNames.size(); i++) { delete inputs[i]; remove(listNames[i].c_str()); }
+ delete merged; merged = NULL;
+ return 0;
+ }
+
ListVector* list = inputs[k]->getListVector();
//this file has reached the end
if (listSingle != NULL) { delete listSingle; remove(singleton.c_str()); }
for (int i = 0; i < listNames.size(); i++) { delete inputs[i]; remove(listNames[i].c_str()); }
+
+ return 0;
}
catch(exception& e) {
m->errorOut(e, "ClusterSplitCommand", "mergeLists");