3 #include "nameassignment.hpp"
5 //**********************************************************************************************************************
7 NameAssignment::NameAssignment(string nameMapFile){
9 openInputFile(nameMapFile, fileHandle);
13 //**********************************************************************************************************************
15 void NameAssignment::readMap(int colA, int colB){
17 string firstCol, secondCol, skip;
20 int skipNCols = colB-colA-1;
22 map<string, string> data;
25 fileHandle >> firstCol; //read from first column
27 for(int i=0;i<skipNCols;i++){ //allows for anticipated file format
31 fileHandle >> secondCol; //read from second column
33 data[firstCol] = secondCol; //store data in map
40 map<string, string>::iterator it = data.begin();
41 for(it;it!=data.end();it++){
42 list.push_back(it->second); //adds data's value to list
43 (*this)[it->first] = rowIndex;
48 cout << "Standard Error: " << e.what() << " has occurred in the NameAssignment class Function readMap. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
52 cout << "An unknown error has occurred in the NameAssignment class function readMap. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
57 //**********************************************************************************************************************
59 ListVector NameAssignment::getListVector(void){
65 //**********************************************************************************************************************
67 void NameAssignment::print(void){
69 map<string,int>::iterator it = (*this).begin();
70 for(it;it!=(*this).end();it++){
71 cout << it->first << '\t' << it->second << endl; //prints out keys and values of the map this.
75 cout << "Standard Error: " << e.what() << " has occurred in the NameAssignment class Function print. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
79 cout << "An unknown error has occurred in the NameAssignment class function print. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
84 //**********************************************************************************************************************
86 int NameAssignment::get(string key){
92 //**********************************************************************************************************************