00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include<string>
00024 #include<iostream>
00025 #include<fstream>
00026 #include<vector>
00027 #include<map>
00028 #include<sstream>
00029 #include<set>
00030 #include "setTemplates.C"
00031 #include "motifDataset.h"
00032 using namespace std;
00033
00034 #ifndef READFILE_MOTIFDATASETGREG
00035 #define READFILE_MOTIFDATASETGREG
00036
00037 class readfile : public motifDataset
00038 {
00039 private:
00040
00041 string filename;
00042 vector<string> columnToName,rowToName,columnToNameLO;
00043 map<string,int> nameToColumn,nameToRow,nameToColumnLO;
00044 vector<vector<double> > data, dataLO;
00045 vector<vector<bool> > mExists,mExistsLO;
00046 vector<vector<int> > mClassToExperiments;
00047 vector<vector<int> > mExperimentsToClass;
00048 vector<string> classLabels;
00049 string classString;
00050
00051 void doRead(string infile);
00052 void readClasses();
00053 double atod(string in);
00054
00055 public:
00056 static const int MISSING_VALUE;
00057
00058 readfile(set<int>,string,string);
00059 readfile(const readfile& in);
00060
00069 virtual void readProbeAliases(string aliasFile);
00070
00081 virtual void readProbeInfo(string infoFile);
00082
00083
00084
00085 void refactor(set<int> leaveOut);
00086
00090 virtual bool isProbe(string id) const;
00091
00092 virtual vector<string>* probes();
00093 virtual vector<string>* samples();
00094 virtual double operator()(int,int);
00095 virtual double operator()(string,string);
00096 virtual bool exists(int,int);
00097 virtual bool exists(string,string);
00098 virtual vector<vector<int> >* classToExperiments();
00099 virtual vector<vector<int> >* experimentsToClass();
00100
00101
00114 virtual string computeClassNameForSamples(const set< int > &columnSet, double frac = 1) const;
00115
00118 virtual int computeClassIndexForSamples(const set< int > &columnSet, double frac = 1) const;
00119
00121 virtual string getClassNameForSample(unsigned int index) const;
00122
00124 virtual unsigned int getClassIndexForSample(unsigned int index) const;
00125
00127 virtual string getClassName(unsigned int index) const;
00128
00130 virtual unsigned int getClassSize(unsigned int index) const;
00131
00133 virtual unsigned int getNumClasses() const
00134 {
00135 return(classLabels.size());
00136 }
00137
00138
00141 virtual int getColumnIndex(string name) const;
00142
00145 virtual int getRowIndex(string name) const;
00146
00148 virtual string getRowName(unsigned int index) const;
00149
00150
00151 };
00152
00153 #endif