X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=corraxescommand.cpp;h=ea98dfb4f35d91c0968898a9ab6ef931cc137d5c;hb=8742edef7a51b82834289e570d336f5a81ba1f2b;hp=82cfa3683cbd0801da4a9805a567c84f67d3c427;hpb=ca9ac1d80c62f57270b0dcd49410ebe08a8aecd6;p=mothur.git diff --git a/corraxescommand.cpp b/corraxescommand.cpp index 82cfa36..ea98dfb 100644 --- a/corraxescommand.cpp +++ b/corraxescommand.cpp @@ -46,7 +46,7 @@ string CorrAxesCommand::getHelpString(){ helpString += "The corr.axes command should be in the following format: corr.axes(axes=yourPcoaFile, shared=yourSharedFile, method=yourMethod).\n"; helpString += "Example corr.axes(axes=genus.pool.thetayc.genus.lt.pcoa, shared=genus.pool.shared, method=kendall).\n"; helpString += "The corr.axes command outputs a .corr.axes file.\n"; - helpString += "Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n\n"; + helpString += "Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n"; return helpString; } catch(exception& e) { @@ -74,6 +74,7 @@ CorrAxesCommand::CorrAxesCommand(string option) { //allow user to run help if(option == "help") { help(); abort = true; calledHelp = true; } + else if(option == "citation") { citation(); abort = true; calledHelp = true;} else { vector myArray = setParameters(); @@ -139,12 +140,12 @@ CorrAxesCommand::CorrAxesCommand(string option) { sharedfile = validParameter.validFile(parameters, "shared", true); if (sharedfile == "not open") { abort = true; } else if (sharedfile == "not found") { sharedfile = ""; } - else { inputFileName = sharedfile; } + else { inputFileName = sharedfile; m->setSharedFile(sharedfile); } relabundfile = validParameter.validFile(parameters, "relabund", true); if (relabundfile == "not open") { abort = true; } else if (relabundfile == "not found") { relabundfile = ""; } - else { inputFileName = relabundfile; } + else { inputFileName = relabundfile; m->setRelAbundFile(relabundfile); } metadatafile = validParameter.validFile(parameters, "metadata", true); if (metadatafile == "not open") { abort = true; } @@ -758,6 +759,7 @@ int CorrAxesCommand::eliminateZeroOTUS(vector& thisloo } //for each bin + vector newBinLabels; for (int i = 0; i < thislookup[0]->getNumBins(); i++) { if (m->control_pressed) { for (int j = 0; j < newLookup.size(); j++) { delete newLookup[j]; } return 0; } @@ -772,12 +774,19 @@ int CorrAxesCommand::eliminateZeroOTUS(vector& thisloo for (int j = 0; j < thislookup.size(); j++) { newLookup[j]->push_back(thislookup[j]->getAbundance(i), thislookup[j]->getGroup()); } + + //if there is a bin label use it otherwise make one + string binLabel = "Otu" + toString(i+1); + if (i < m->currentBinLabels.size()) { binLabel = m->currentBinLabels[i]; } + + newBinLabels.push_back(binLabel); } } for (int j = 0; j < thislookup.size(); j++) { delete thislookup[j]; } thislookup = newLookup; + m->currentBinLabels = newBinLabels; return 0; @@ -862,14 +871,14 @@ int CorrAxesCommand::getMetadata(){ //read the first label, because it refers to the groups string columnLabel; iss >> columnLabel; m->gobble(iss); - + //save names of columns you are reading while (!iss.eof()) { iss >> columnLabel; m->gobble(iss); metadataLabels.push_back(columnLabel); } int count = metadataLabels.size(); - + //read rest of file while (!in.eof()) { @@ -878,7 +887,7 @@ int CorrAxesCommand::getMetadata(){ string group = ""; in >> group; m->gobble(in); groupNames.push_back(group); - + SharedRAbundFloatVector* tempLookup = new SharedRAbundFloatVector(); tempLookup->setGroup(group); tempLookup->setLabel("1"); @@ -886,7 +895,6 @@ int CorrAxesCommand::getMetadata(){ for (int i = 0; i < count; i++) { float temp = 0.0; in >> temp; - tempLookup->push_back(temp, group); }