else if(commandName == "tree.shared") { command = new TreeGroupCommand(); }
else if(commandName == "bootstrap.shared") { command = new BootSharedCommand(); }
else if(commandName == "concensus") { command = new ConcensusCommand(); }
- else if(commandName == "dist.seq") { command = new DistanceCommand(); }
+ else if(commandName == "dist.seqs") { command = new DistanceCommand(); }
else { command = new NoCommand(); }
return command;
remove(distFile.c_str());
- if(processors == 1){
- driver(distCalculator, seqDB, 0, numSeqs, distFile, cutoff);
- }
- else if(processors == 2){
+ // # if defined (WIN_VERSION)
+ // driver(distCalculator, seqDB, 0, numSeqs, distFile, cutoff);
+ // # endif
- int pid = fork();
- if(pid > 0){
- driver(distCalculator, seqDB, 0, (numSeqs/sqrt(2)), distFile + "tempa", cutoff);
- appendFiles((distFile+"tempa"), distFile);
- remove((distFile + "tempa").c_str());
- }
- else{
- driver(distCalculator, seqDB, (numSeqs/sqrt(2)), numSeqs, distFile + "tempb", cutoff);
- appendFiles((distFile+"tempb"), distFile);
- remove((distFile + "tempb").c_str());
- }
- wait(NULL);
-
- }
- else if(processors == 3){
- int pid1 = fork();
- if(pid1 > 0){
- int pid2 = fork();
- if(pid2 > 0){
- driver(distCalculator, seqDB, 0, sqrt(3) * numSeqs / 3, distFile + "tempa", cutoff);
- appendFiles(distFile+"tempa", distFile);
+ // # if defined (LINUX_VERSION)
+ if(processors == 1){
+ driver(distCalculator, seqDB, 0, numSeqs, distFile, cutoff);
+ }
+ else if(processors == 2){
+
+ int pid = fork();
+ if(pid > 0){
+ driver(distCalculator, seqDB, 0, (numSeqs/sqrt(2)), distFile + "tempa", cutoff);
+ appendFiles((distFile+"tempa"), distFile);
remove((distFile + "tempa").c_str());
}
else{
- driver(distCalculator, seqDB, sqrt(3) * numSeqs / 3, sqrt(6) * numSeqs / 3, distFile + "tempb", cutoff);
- appendFiles(distFile+"tempb", distFile);
- remove((distFile + "tempb").c_str());
+ driver(distCalculator, seqDB, (numSeqs/sqrt(2)), numSeqs, distFile + "tempb", cutoff);
+ appendFiles((distFile+"tempb"), distFile);
+ remove((distFile + "tempb").c_str());
}
wait(NULL);
+
}
- else{
- driver(distCalculator, seqDB, sqrt(6) * numSeqs / 3, numSeqs, distFile + "tempc", cutoff);
- appendFiles(distFile+"tempc", distFile);
- remove((distFile + "tempc").c_str());
- }
- wait(NULL);
- }
- else if(processors == 4){
- int pid1 = fork();
- if(pid1 > 0){
- int pid2 = fork();
- if(pid2 > 0){
- driver(distCalculator, seqDB, 0, numSeqs / 2, distFile + "tempa", cutoff);
- appendFiles(distFile+"tempa", distFile);
- remove((distFile + "tempa").c_str());
+ else if(processors == 3){
+ int pid1 = fork();
+ if(pid1 > 0){
+ int pid2 = fork();
+ if(pid2 > 0){
+ driver(distCalculator, seqDB, 0, sqrt(3) * numSeqs / 3, distFile + "tempa", cutoff);
+ appendFiles(distFile+"tempa", distFile);
+ remove((distFile + "tempa").c_str());
+ }
+ else{
+ driver(distCalculator, seqDB, sqrt(3) * numSeqs / 3, sqrt(6) * numSeqs / 3, distFile + "tempb", cutoff);
+ appendFiles(distFile+"tempb", distFile);
+ remove((distFile + "tempb").c_str());
+ }
+ wait(NULL);
}
else{
- driver(distCalculator, seqDB, numSeqs / 2, (numSeqs/sqrt(2)), distFile + "tempb", cutoff);
- appendFiles(distFile+"tempb", distFile);
- remove((distFile + "tempb").c_str());
+ driver(distCalculator, seqDB, sqrt(6) * numSeqs / 3, numSeqs, distFile + "tempc", cutoff);
+ appendFiles(distFile+"tempc", distFile);
+ remove((distFile + "tempc").c_str());
}
wait(NULL);
}
- else{
- int pid3 = fork();
- if(pid3 > 0){
- driver(distCalculator, seqDB, (numSeqs/sqrt(2)), (sqrt(3) * numSeqs / 2), distFile + "tempc", cutoff);
- appendFiles(distFile+"tempc", distFile);
- remove((distFile + "tempc").c_str());
+ else if(processors == 4){
+ int pid1 = fork();
+ if(pid1 > 0){
+ int pid2 = fork();
+ if(pid2 > 0){
+ driver(distCalculator, seqDB, 0, numSeqs / 2, distFile + "tempa", cutoff);
+ appendFiles(distFile+"tempa", distFile);
+ remove((distFile + "tempa").c_str());
+ }
+ else{
+ driver(distCalculator, seqDB, numSeqs / 2, (numSeqs/sqrt(2)), distFile + "tempb", cutoff);
+ appendFiles(distFile+"tempb", distFile);
+ remove((distFile + "tempb").c_str());
+ }
+ wait(NULL);
}
else{
- driver(distCalculator, seqDB, (sqrt(3) * numSeqs / 2), numSeqs, distFile + "tempd", cutoff);
- appendFiles(distFile+"tempd", distFile);
- remove((distFile + "tempd").c_str());
+ int pid3 = fork();
+ if(pid3 > 0){
+ driver(distCalculator, seqDB, (numSeqs/sqrt(2)), (sqrt(3) * numSeqs / 2), distFile + "tempc", cutoff);
+ appendFiles(distFile+"tempc", distFile);
+ remove((distFile + "tempc").c_str());
+ }
+ else{
+ driver(distCalculator, seqDB, (sqrt(3) * numSeqs / 2), numSeqs, distFile + "tempd", cutoff);
+ appendFiles(distFile+"tempd", distFile);
+ remove((distFile + "tempd").c_str());
+ }
+ wait(NULL);
}
wait(NULL);
}
wait(NULL);
- }
- wait(NULL);
+ //# endif
delete distCalculator;
for(int i=startLine;i<endLine;i++){
- for(int j=0;j<i;j++){
+ for(int j=0;j<i;j++){
+//cout << "unaligned" << endl;
+//cout << align->get(i).getUnaligned() << " " << align->get(j).getUnaligned() << endl;
+//cout << "aligned" << endl;
+//cout << align->get(i).getAligned() << " " << align->get(j).getAligned() << endl;
distCalculator->calcDist(align->get(i), align->get(j));
double dist = distCalculator->getDist();
int start = 0;
for(int i=0; i<A.getLength(); i++){
- if(A.getUnaligned()[i] != '.' || B.getUnaligned()[i] != '.'){
+ if(A.getAligned()[i] != '.' || B.getAligned()[i] != '.'){
start = i;
break;
}
}
for(int i=start;i<A.getLength();i++){
- if((A.getUnaligned()[i] == '-' || B.getUnaligned()[i] == '-') && (A.getUnaligned()[i] == '.' || B.getUnaligned()[i] == '.')){}
- else if(A.getUnaligned()[i] == '.' && B.getUnaligned()[i] == '.'){
+ if((A.getAligned()[i] == '-' || B.getAligned()[i] == '-') && (A.getAligned()[i] == '.' || B.getAligned()[i] == '.')){}
+ else if(A.getAligned()[i] == '.' && B.getAligned()[i] == '.'){
break;
}
- else if(A.getUnaligned()[i] != '-' && B.getUnaligned()[i] != '-'){
- if(A.getUnaligned()[i] != B.getUnaligned()[i]){
+ else if(A.getAligned()[i] != '-' && B.getAligned()[i] != '-'){
+ if(A.getAligned()[i] != B.getAligned()[i]){
diff++;
}
length++;
}
- else if(A.getUnaligned()[i] != '-' || B.getUnaligned()[i] != '-'){
+ else if(A.getAligned()[i] != '-' || B.getAligned()[i] != '-'){
diff++;
length++;
}
int end = 0;
for(int i=0;i<A.getLength();i++){
- if(A.getUnaligned()[i] == '.' || B.getUnaligned()[i] == '.' || A.getUnaligned()[i] == '-' || B.getUnaligned()[i] == '-'){
+ if(A.getAligned()[i] == '.' || B.getAligned()[i] == '.' || A.getAligned()[i] == '-' || B.getAligned()[i] == '-'){
}
else{
start = i;
}
}
for(int i=A.getLength()-1;i>=0;i--){
- if(A.getUnaligned()[i] == '.' || B.getUnaligned()[i] == '.' || A.getUnaligned()[i] == '-' || B.getUnaligned()[i] == '-'){
+ if(A.getAligned()[i] == '.' || B.getAligned()[i] == '.' || A.getAligned()[i] == '-' || B.getAligned()[i] == '-'){
}
else{
end = i;
}
for(int i=start;i<=end;i++){
- if(A.getUnaligned()[i] == '-' && B.getUnaligned()[i] == '-'){}
- else if(A.getUnaligned()[i] == '.' || B.getUnaligned()[i] == '.'){
+ if(A.getAligned()[i] == '-' && B.getAligned()[i] == '-'){}
+ else if(A.getAligned()[i] == '.' || B.getAligned()[i] == '.'){
break;
}
- else if(A.getUnaligned()[i] != '-' && B.getUnaligned()[i] != '-'){
- if(A.getUnaligned()[i] != B.getUnaligned()[i]){
+ else if(A.getAligned()[i] != '-' && B.getAligned()[i] != '-'){
+ if(A.getAligned()[i] != B.getAligned()[i]){
diff++;
}
length++;
}
- else if(A.getUnaligned()[i] != '-' || B.getUnaligned()[i] != '-'){
+ else if(A.getAligned()[i] != '-' || B.getAligned()[i] != '-'){
diff++;
length++;
}
}
}
- if ((commandName == "filter.seqs") || (commandName == "dist.seq")) {
+ if ((commandName == "filter.seqs") || (commandName == "dist.seqs")) {
if ((fastafile == "") && (nexusfile == "") && (clustalfile == "") && (phylipfile == "")) {
cout << "You must read either a fasta, nexus, clustal, or phylip file before you can use the filter.seqs command." << endl; return false;
}
}
//set default value for cutoff
- if (commandName == "dist.seq") { cutoff = "1.0"; }
+ if (commandName == "dist.seqs") { cutoff = "1.0"; }
string key, value;
//reads in parameters and values
Estimators.clear();
splitAtDash(calc, Estimators);
}
- if (commandName == "dist.seq") {
+ if (commandName == "dist.seqs") {
if ((calc == "default") || (calc == "")) { calc = "onegap"; }
Estimators.clear();
splitAtDash(calc, Estimators);
cout << "The deconvolute command parameter is fasta and it is required." << "\n";
cout << "The deconvolute command should be in the following format: " << "\n";
cout << "deconvolute(fasta=yourFastaFile) " << "\n";
- }else if (globaldata->helpRequest == "dist.seq") {
- cout << "The dist.seq command reads a file containing sequences and creates a distance file." << "\n";
- cout << "The dist.seq command parameters are fasta, phylip, clustal, nexus, calc, ends, cutoff and processors. " << "\n";
+ }else if (globaldata->helpRequest == "dist.seqs") {
+ cout << "The dist.seqs command reads a file containing sequences and creates a distance file." << "\n";
+ cout << "The dist.seqs command parameters are fasta, phylip, clustal, nexus, calc, ends, cutoff and processors. " << "\n";
cout << "You must use one of the following parameters for your filename: fasta, phylip, clustal or nexus. " << "\n";
cout << "The calc parameter allows you to specify the method of calculating the distances. Your options are: nogaps, onegap or eachgap. The default is onegap." << "\n";
cout << "The ends parameter allows you to specify whether to include terminal gaps in distance. Your options are: T or F. The default is T." << "\n";
cout << "The cutoff parameter allows you to specify maximum distance to keep. The default is 1.0." << "\n";
cout << "The processors parameter allows you to specify number of processors to use. The default is 1, but you can use up to 4 processors." << "\n";
- cout << "The dist.seq command should be in the following format: " << "\n";
- cout << "dist.seq(fasta=yourFastaFile, calc=yourCalc, ends=yourEnds, cutoff= yourCutOff, processors=yourProcessors) " << "\n";
- cout << "Example dist.seq(fasta=amazon.fasta, calc=eachgap, ends=F, cutoff= 2.0, processors=3)." << "\n";
+ cout << "The dist.seqs command should be in the following format: " << "\n";
+ cout << "dist.seqs(fasta=yourFastaFile, calc=yourCalc, ends=yourEnds, cutoff= yourCutOff, processors=yourProcessors) " << "\n";
+ cout << "Example dist.seqs(fasta=amazon.fasta, calc=eachgap, ends=F, cutoff= 2.0, processors=3)." << "\n";
cout << "Note: No spaces between parameter labels (i.e. calc), '=' and parameters (i.e.yourCalc)." << "\n" << "\n";
}else if (globaldata->helpRequest == "collect.single") {
cout << "The collect.single command can only be executed after a successful read.otu command. WITH ONE EXECEPTION. " << "\n";
int end = 0;
for(int i=0;i<A.getLength();i++){
- if(A.getUnaligned()[i] == '.' || B.getUnaligned()[i] == '.' || A.getUnaligned()[i] == '-' || B.getUnaligned()[i] == '-'){
+ if(A.getAligned()[i] == '.' || B.getAligned()[i] == '.' || A.getAligned()[i] == '-' || B.getAligned()[i] == '-'){
}
else{
start = i;
}
}
for(int i=A.getLength()-1;i>=0;i--){
- if(A.getUnaligned()[i] == '.' || B.getUnaligned()[i] == '.' || A.getUnaligned()[i] == '-' || B.getUnaligned()[i] == '-'){
+ if(A.getAligned()[i] == '.' || B.getAligned()[i] == '.' || A.getAligned()[i] == '-' || B.getAligned()[i] == '-'){
}
else{
end = i;
}
for(int i=start; i<=end; i++){
- if(A.getUnaligned()[i] == '.' || B.getUnaligned()[i] == '.'){
+ if(A.getAligned()[i] == '.' || B.getAligned()[i] == '.'){
break;
}
- else if((A.getUnaligned()[i] != '-' && B.getUnaligned()[i] != '-')){
- if(A.getUnaligned()[i] != B.getUnaligned()[i]){
+ else if((A.getAligned()[i] != '-' && B.getAligned()[i] != '-')){
+ if(A.getAligned()[i] != B.getAligned()[i]){
diff++;
}
length++;
int start = 0;
for(int i=0;i<A.getLength();i++){
- if(A.getUnaligned()[i] == '.' && B.getUnaligned()[i] == '.'){
+ if(A.getAligned()[i] == '.' && B.getAligned()[i] == '.'){
}
else{
start = i;
}
}
for(int i=start;i<A.getLength();i++){
- if((A.getUnaligned()[i] == '-' || B.getUnaligned()[i] == '-') && (A.getUnaligned()[i] == '.' || B.getUnaligned()[i] == '.')){}
- else if(A.getUnaligned()[i] == '-' && B.getUnaligned()[i] != '-' && B.getUnaligned()[i] != '.'){
+ if((A.getAligned()[i] == '-' || B.getAligned()[i] == '-') && (A.getAligned()[i] == '.' || B.getAligned()[i] == '.')){}
+ else if(A.getAligned()[i] == '-' && B.getAligned()[i] != '-' && B.getAligned()[i] != '.'){
if(openGapA == 0){
difference++;
minLength++;
openGapB = 0;
}
}
- else if(A.getUnaligned()[i] != '-' && B.getUnaligned()[i] == '-' && A.getUnaligned()[i] != '.'){
+ else if(A.getAligned()[i] != '-' && B.getAligned()[i] == '-' && A.getAligned()[i] != '.'){
if(openGapB == 0){
difference++;
minLength++;
openGapB = 1;
}
}
- else if(A.getUnaligned()[i] != '-' && B.getUnaligned()[i] != '-'){
- if(A.getUnaligned()[i] != B.getUnaligned()[i]){
+ else if(A.getAligned()[i] != '-' && B.getAligned()[i] != '-'){
+ if(A.getAligned()[i] != B.getAligned()[i]){
difference++;
minLength++;
openGapA = 0;
openGapB = 0;
}
}
- else if(A.getUnaligned()[i] == '.' && B.getUnaligned()[i] == '.'){
+ else if(A.getAligned()[i] == '.' && B.getAligned()[i] == '.'){
break;
}
}
int end = 0;
for(int i=0;i<A.getLength();i++){
- if(A.getUnaligned()[i] == '.' || B.getUnaligned()[i] == '.' || A.getUnaligned()[i] == '-' || B.getUnaligned()[i] == '-'){
+ if(A.getAligned()[i] == '.' || B.getAligned()[i] == '.' || A.getAligned()[i] == '-' || B.getAligned()[i] == '-'){
}
else{
start = i;
}
}
for(int i=A.getLength()-1;i>=0;i--){
- if(A.getUnaligned()[i] == '.' || B.getUnaligned()[i] == '.' || A.getUnaligned()[i] == '-' || B.getUnaligned()[i] == '-'){
+ if(A.getAligned()[i] == '.' || B.getAligned()[i] == '.' || A.getAligned()[i] == '-' || B.getAligned()[i] == '-'){
}
else{
end = i;
for(int i=start;i<=end;i++){
- if(A.getUnaligned()[i] == '-' && B.getUnaligned()[i] == '-'){}
- else if(A.getUnaligned()[i] == '-' && B.getUnaligned()[i] != '-'){
+ if(A.getAligned()[i] == '-' && B.getAligned()[i] == '-'){}
+ else if(A.getAligned()[i] == '-' && B.getAligned()[i] != '-'){
if(openGapA == 0){
difference++;
minLength++;
openGapB = 0;
}
}
- else if(A.getUnaligned()[i] != '-' && B.getUnaligned()[i] == '-'){
+ else if(A.getAligned()[i] != '-' && B.getAligned()[i] == '-'){
if(openGapB == 0){
difference++;
minLength++;
openGapB = 1;
}
}
- else if(A.getUnaligned()[i] != '-' && B.getUnaligned()[i] != '-'){
- if(A.getUnaligned()[i] != B.getUnaligned()[i]){
+ else if(A.getAligned()[i] != '-' && B.getAligned()[i] != '-'){
+ if(A.getAligned()[i] != B.getAligned()[i]){
difference++;
minLength++;
openGapA = 0;
delete singleCalc;
}
-
+ delete sabund;
/******************* 2 Groups **************************/
}else if (lookup.size() == 2) {
//close file
outsvg << "</g>\n</svg>\n";
outsvg.close();
- delete sabundA;
- delete sabundB;
delete singleCalc;
}
-
+ delete sabundA;
+ delete sabundB;
/******************* 3 Groups **************************/
}else if (lookup.size() == 3) {
outsvg.close();
delete singleCalc;
}
-
+ delete sabundA;
+ delete sabundB;
+ delete sabundC;
/******************* 4 Groups **************************/
}else if (lookup.size() == 4) {
delete singleCalc;
}
}
-
+ delete sabundA;
+ delete sabundB;
+ delete sabundC;
+ delete sabundD;
}
}