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<mysql++.hh>
00031 #include "setTemplates.C"
00032 #include "motifDataset.h"
00033 using namespace std;
00034
00035 #ifndef DATABASE_MOTIFDATASETGREG
00036 #define DATABASE_MOTIFDATASETGREG
00037
00038 class database : public motifDataset
00039 {
00040 private:
00041 vector<string> columnToName,rowToName;
00042 map<string,int> nameToColumn,nameToRow;
00043 vector<vector<double> > data;
00044 vector<vector<bool> > mExists;
00045 vector<vector<int> > mClassToExperiments;
00046 vector<vector<int> > mExperimentsToClass;
00047 vector<string> classLabels;
00048 Connection *con;
00049 vector<int> expSet,geneSet;
00050 int mRunID;
00051
00052 template<class T> string toa(T in);
00053 template<class T> T ato(string in);
00054 void getData(int);
00055 double atod(string in);
00056 Result select(string);
00057 void makeConnection();
00058
00059 public:
00060 database(int);
00061 database(string);
00062 void writeData(string outfile);
00063
00064 virtual vector<string> probes();
00065 virtual vector<string> samples();
00066 virtual double operator()(int,int);
00067 virtual double operator()(string,string);
00068 virtual bool exists(int,int);
00069 virtual bool exists(string,string);
00070 virtual vector<vector<int> > classToExperiments();
00071 virtual vector<vector<int> > experimentsToClass();
00072 virtual vector<string> classes();
00073 };
00074
00075 #endif