7 #include "nameassignment.hpp"
9 //**********************************************************************************************************************
11 NameAssignment::NameAssignment(string nameMapFile){
13 openInputFile(nameMapFile, fileHandle);
17 //**********************************************************************************************************************
19 void NameAssignment::readMap(int colA, int colB){
21 string firstCol, secondCol, skip;
24 int skipNCols = colB-colA-1;
26 map<string, string> data;
29 fileHandle >> firstCol; //read from first column
31 for(int i=0;i<skipNCols;i++){ //allows for anticipated file format
35 fileHandle >> secondCol; //read from second column
37 data[firstCol] = secondCol; //store data in map
44 map<string, string>::iterator it = data.begin();
45 for(it;it!=data.end();it++){
46 list.push_back(it->second); //adds data's value to list
47 (*this)[it->first] = rowIndex;
52 cout << "Standard Error: " << e.what() << " has occurred in the NameAssignment class Function readMap. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
56 cout << "An unknown error has occurred in the NameAssignment class function readMap. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
61 //**********************************************************************************************************************
63 ListVector NameAssignment::getListVector(void){
69 //**********************************************************************************************************************
71 void NameAssignment::print(void){
73 map<string,int>::iterator it = (*this).begin();
74 for(it;it!=(*this).end();it++){
75 cout << it->first << '\t' << it->second << endl; //prints out keys and values of the map this.
79 cout << "Standard Error: " << e.what() << " has occurred in the NameAssignment class Function print. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
83 cout << "An unknown error has occurred in the NameAssignment class function print. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
88 //**********************************************************************************************************************
90 int NameAssignment::get(string key){
96 //**********************************************************************************************************************