+//**********************************************************************************************************************
+void GetSeqsCommand::readList(){
+ try {
+ string outputFileName = getRootName(listfile) + "pick" + getExtension(listfile);
+ ofstream out;
+ openOutputFile(outputFileName, out);
+
+ ifstream in;
+ openInputFile(listfile, in);
+
+ bool wroteSomething = false;
+
+ while(!in.eof()){
+ //read in list vector
+ ListVector list(in);
+
+ //make a new list vector
+ ListVector newList;
+ newList.setLabel(list.getLabel());
+
+ //for each bin
+ for (int i = 0; i < list.getNumBins(); i++) {
+
+ //parse out names that are in accnos file
+ string binnames = list.get(i);
+
+ string newNames = "";
+ while (binnames.find_first_of(',') != -1) {
+ string name = binnames.substr(0,binnames.find_first_of(','));
+ binnames = binnames.substr(binnames.find_first_of(',')+1, binnames.length());
+
+ //if that name is in the .accnos file, add it
+ if (names.count(name) == 1) { newNames += name + ","; }
+ }
+
+ //get last name
+ if (names.count(binnames) == 1) { newNames += binnames; }
+
+ //if there are names in this bin add to new list
+ if (newNames != "") { newList.push_back(newNames); }
+ }
+
+ //print new listvector
+ if (newList.getNumBins() != 0) {
+ wroteSomething = true;
+ newList.print(out);
+ }
+
+ gobble(in);
+ }
+ in.close();
+ out.close();
+
+ if (wroteSomething == false) {
+ mothurOut("Your file does not contain any sequence from the .accnos file."); mothurOutEndLine();
+ remove(outputFileName.c_str());
+ }