X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=seqnoise.cpp;h=8c712c3ab8bb08c8b8e9282e59e97b03c77d29fc;hb=6b32d112bb60e9f7eb6d4407a4eed4c49b67bced;hp=8e7a4395fbf20009d135502fde3774b2592a9440;hpb=d6c0a11d1cecfac18b323285e7ffadb7f58e848f;p=mothur.git diff --git a/seqnoise.cpp b/seqnoise.cpp index 8e7a439..8c712c3 100644 --- a/seqnoise.cpp +++ b/seqnoise.cpp @@ -9,6 +9,8 @@ #include "seqnoise.h" #include "sequence.hpp" +#include "listvector.hpp" +#include "inputdata.h" #define MIN_DELTA 1.0e-6 #define MIN_ITER 20 @@ -138,91 +140,93 @@ int seqNoise::getListData(string listFileName, double cutOff, vector& otuDa ifstream listFile; m->openInputFile(listFileName, listFile); - double threshold; - int numOTUs; - string line = ""; - bool adjustCutoff = true; - - if(listFile.peek() == 'u'){ m->getline(listFile); } - while(listFile){ - listFile >> threshold; - - if(threshold < cutOff){ - line = m->getline(listFile); m->gobble(listFile); - } - else{ - adjustCutoff = false; - listFile >> numOTUs; - otuFreq.resize(numOTUs, 0); - - for(int i=0;icontrol_pressed) { return 0; } - - string otu; - listFile >> otu; - - int count = 0; - - string number = ""; - - for(int j=0;jcontrol_pressed) { return 0; } - otuBySeqLookUp[otuData[i]].push_back(i); - } - for(int i=0;icontrol_pressed) { return 0; } - for(int j=otuBySeqLookUp[i].size();jgobble(listFile); //10/18/13 - change to reading with listvector to accomodate changes to the listfiel format. ie. adding header labels. + + string thisLabel = list.getLabel(); + lastLabel = thisLabel; + + if (thisLabel == "unique") {} //skip to next label in listfile + else { + double threshold; + m->mothurConvert(thisLabel, threshold); + + if(threshold < cutOff){} //skip to next label in listfile + else{ + adjustCutoff = false; + int numOTUs = list.getNumBins(); + otuFreq.resize(numOTUs, 0); + + for(int i=0;icontrol_pressed) { return 0; } + + string otu = list.get(i); + int count = 0; + string number = ""; + + for(int j=0;jcontrol_pressed) { return 0; } + otuBySeqLookUp[otuData[i]].push_back(i); + } + for(int i=0;icontrol_pressed) { return 0; } + for(int j=otuBySeqLookUp[i].size();j> numOTUs; - otuFreq.resize(numOTUs, 0); + + InputData input(listFileName, "list"); + ListVector* list = input.getListVector(lastLabel); + + int numOTUs = list->getNumBins(); + otuFreq.resize(numOTUs, 0); for(int i=0;icontrol_pressed) { return 0; } - string otu; - iss >> otu; + string otu = list->get(i); int count = 0; - string number = ""; for(int j=0;j& otuDa } } + delete list; } return 0;