if (m->control_pressed) { out.close(); return 0; }
- out << (j+1) << '\t' << indicatorValues[j] << '\t';
+ out << m->currentBinLabels[j] << '\t' << indicatorValues[j] << '\t';
if (pValues[j] > (1/(float)iters)) { out << pValues[j] << endl; }
else { out << "<" << (1/(float)iters) << endl; }
if (pValues[j] <= 0.05) {
- cout << "OTU" << j+1 << '\t' << indicatorValues[j] << '\t';
+ cout << m->currentBinLabels[j] << '\t' << indicatorValues[j] << '\t';
string pValueString = "<" + toString((1/(float)iters));
if (pValues[j] > (1/(float)iters)) { pValueString = toString(pValues[j]); cout << pValues[j];}
else { cout << "<" << (1/(float)iters); }
- m->mothurOutJustToLog("OTU" + toString(j+1) + "\t" + toString(indicatorValues[j]) + "\t" + pValueString);
+ m->mothurOutJustToLog(m->currentBinLabels[j] + "\t" + toString(indicatorValues[j]) + "\t" + pValueString);
m->mothurOutEndLine();
}
}
//print headings
out << "TreeNode\t";
- for (int i = 0; i < numBins; i++) { out << "OTU" << (i+1) << "_IndValue" << '\t' << "pValue" << '\t'; }
+ for (int i = 0; i < numBins; i++) { out << m->currentBinLabels[i] << "_IndValue" << '\t' << "pValue" << '\t'; }
out << endl;
m->mothurOutEndLine(); m->mothurOut("Node\tSpecies\tIndicatorValue\tpValue\n");
}
if (pValues[j] <= 0.05) {
- cout << i+1 << "\tOTU" << j+1 << '\t' << indicatorValues[j] << '\t';
+ cout << i+1 << '\t' << m->currentBinLabels[j] << '\t' << indicatorValues[j] << '\t';
string pValueString = "<" + toString((1/(float)iters));
if (pValues[j] > (1/(float)iters)) { pValueString = toString(pValues[j]); cout << pValues[j];}
else { cout << "<" << (1/(float)iters); }
- m->mothurOutJustToLog(toString(i) + "\tOTU" + toString(j+1) + "\t" + toString(indicatorValues[j]) + "\t" + pValueString);
+ m->mothurOutJustToLog(toString(i) + "\t" + m->currentBinLabels[j] + "\t" + toString(indicatorValues[j]) + "\t" + pValueString);
m->mothurOutEndLine();
}
}
outputNames.pop_back();
}else {
- ofstream outTemp;
- string tempOut = outputDir + "data." + setA + "-" + setB + ".matrix";
- m->openOutputFile(tempOut, outTemp);
- for (int i = 0; i < subset.size(); i++) { outTemp << '\t' << subset[i]->getGroup(); }
- outTemp << endl;
-
-
//fill data
for (int j = 0; j < thisLookUp[0]->getNumBins(); j++) {
//data[j] = new double[subset.size()];
data2[j].resize(subset.size(), 0.0);
- outTemp << "OTU" << (j+1);
+
for (int i = 0; i < subset.size(); i++) {
data2[j][i] = (subset[i]->getAbundance(j));
- outTemp << '\t' << subset[i]->getAbundance(j);
}
- outTemp << endl;
}
- outTemp.close();
+
m->mothurOut("Comparing " + setA + " and " + setB + "..."); m->mothurOutEndLine();
//metastat_main(output, thisLookUp[0]->getNumBins(), subset.size(), threshold, iters, data, setACount);
else if (method == "kendall") { coef = linear.calcKendall(xy[i], xy[k], sig); }
else { m->mothurOut("[ERROR]: invalid method, choices are spearman, pearson or kendall."); m->mothurOutEndLine(); m->control_pressed = true; }
- if (m->binLabelsInFile.size() != 0) { out << m->binLabelsInFile[i] << '\t' << m->binLabelsInFile[k] << '\t' << coef << '\t' << sig << endl; }
- else { out << i+1 << '\t' << k+1 << '\t' << coef << '\t' << sig << endl; }
+ out << m->binLabelsInFile[i] << '\t' << m->binLabelsInFile[k] << '\t' << coef << '\t' << sig << endl;
}
}
else if (method == "kendall") { coef = linear.calcKendall(xy[i], xy[k], sig); }
else { m->mothurOut("[ERROR]: invalid method, choices are spearman, pearson or kendall."); m->mothurOutEndLine(); m->control_pressed = true; }
- if (m->binLabelsInFile.size() != 0) { out << m->binLabelsInFile[i] << '\t' << m->binLabelsInFile[k] << '\t' << coef << '\t' << sig << endl; }
- else { out << i+1 << '\t' << k+1 << '\t' << coef << '\t' << sig << endl; }
+ out << m->binLabelsInFile[i] << '\t' << m->binLabelsInFile[k] << '\t' << coef << '\t' << sig << endl;
}
}
//are we at the beginning of the file??
if (m->saveNextLabel == "") {
f >> label;
-
+
//is this a shared file that has headers
if (label == "label") {
//gets "group"
if (m->control_pressed) { break; }
string temp;
iStringStream >> temp; m->gobble(iStringStream);
-
+
m->binLabelsInFile.push_back(temp);
}
- f >> label;
- }
- }else { label = m->saveNextLabel; }
+ f >> label >> groupN >> num;
+ }else {
+ //read in first row since you know there is at least 1 group.
+ f >> groupN >> num;
+
+ //make binlabels because we don't have any
+ string snumBins = toString(num);
+ m->binLabelsInFile.clear();
+ for (int i = 0; i < num; i++) {
+ //if there is a bin label use it otherwise make one
+ string binLabel = "Otu";
+ string sbinNumber = toString(i+1);
+ if (sbinNumber.length() < snumBins.length()) {
+ int diff = snumBins.length() - sbinNumber.length();
+ for (int h = 0; h < diff; h++) { binLabel += "0"; }
+ }
+ binLabel += sbinNumber;
+ m->binLabelsInFile.push_back(binLabel);
+ }
+ }
+ }else {
+ label = m->saveNextLabel;
+
+ //read in first row since you know there is at least 1 group.
+ f >> groupN >> num;
+ }
//reset labels, currentLabels may have gotten changed as otus were eliminated because of group choices or sampling
m->currentBinLabels = m->binLabelsInFile;
- //read in first row since you know there is at least 1 group.
- f >> groupN >> num;
-
holdLabel = label;
//add new vector to lookup
m->binLabelsInFile.push_back(temp);
}
- f >> label;
- }
- }else { label = m->saveNextLabel; }
+ f >> label >> groupN >> num;
+ }else {
+ //read in first row since you know there is at least 1 group.
+ f >> groupN >> num;
+
+ //make binlabels because we don't have any
+ string snumBins = toString(num);
+ m->binLabelsInFile.clear();
+ for (int i = 0; i < num; i++) {
+ //if there is a bin label use it otherwise make one
+ string binLabel = "Otu";
+ string sbinNumber = toString(i+1);
+ if (sbinNumber.length() < snumBins.length()) {
+ int diff = snumBins.length() - sbinNumber.length();
+ for (int h = 0; h < diff; h++) { binLabel += "0"; }
+ }
+ binLabel += sbinNumber;
+ m->binLabelsInFile.push_back(binLabel);
+ }
+ }
+ }else {
+ label = m->saveNextLabel;
+
+ //read in first row since you know there is at least 1 group.
+ f >> groupN >> num;
+ }
//reset labels, currentLabels may have gotten changed as otus were eliminated because of group choices or sampling
m->currentBinLabels = m->binLabelsInFile;
- //read in first row since you know there is at least 1 group.
- f >> groupN >> num;
-
holdLabel = label;
//add new vector to lookup