Biorithm  1.1
 All Classes Functions Variables Typedefs Friends
database.h
00001 /**************************************************************************
00002  * Copyright (c) 2005-2011 T. M. Murali                                   *
00003  * Copyright (c) 2008-2011 Naveed Massjouni                               *
00004  * Copyright (c) 2004 Greg Grothaus                                       *
00005  *                                                                        *
00006  * This file is part of Biorithm.                                         *
00007  *                                                                        *
00008  * Biorithm is free software: you can redistribute it and/or modify       *
00009  * it under the terms of the GNU General Public License as published by   *
00010  * the Free Software Foundation, either version 3 of the License, or      *
00011  * (at your option) any later version.                                    *
00012  *                                                                        *
00013  * Biorithm is distributed in the hope that it will be useful,            *
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of         *
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
00016  * GNU General Public License for more details.                           *
00017  *                                                                        *
00018  * You should have received a copy of the GNU General Public License      *
00019  * along with Biorithm.  If not, see <http://www.gnu.org/licenses/>.      *
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
 All Classes Functions Variables Typedefs Friends