X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=corraxescommand.cpp;h=ea98dfb4f35d91c0968898a9ab6ef931cc137d5c;hb=8742edef7a51b82834289e570d336f5a81ba1f2b;hp=791ec4978fd82d2fb692723fc105dfd5b6c041f0;hpb=e150b0b0664caec517485ee6d69dcdade6dcae77;p=mothur.git diff --git a/corraxescommand.cpp b/corraxescommand.cpp index 791ec49..ea98dfb 100644 --- a/corraxescommand.cpp +++ b/corraxescommand.cpp @@ -140,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; } @@ -759,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; } @@ -773,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; @@ -863,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()) { @@ -879,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"); @@ -887,7 +895,6 @@ int CorrAxesCommand::getMetadata(){ for (int i = 0; i < count; i++) { float temp = 0.0; in >> temp; - tempLookup->push_back(temp, group); }