Sha256: 62001f1d5a7806a579f90b85f981e9f081a6ac9e5f0c54c2a9f551255f2c8bca
Contents?: true
Size: 1.53 KB
Versions: 5
Compression:
Stored size: 1.53 KB
Contents
#include <iostream> #include <set> #include <vector> #include <string> #include <sstream> #include <pqxx/transactor.hxx> #include <pqxx/result.hxx> using std::cout; using std::cerr; using std::endl; using std::set; using std::vector; using std::string; using std::ostringstream; using pqxx::transactor; using pqxx::result; typedef unsigned int uint; class Fetcher : public transactor <> { public: Fetcher() : transactor<>("Fetcher") {} uint matrix_id; uint experiment_id; vector< set<uint> > known_correct; string query; void operator()(argument_type &T) { result R; query = make_known_correct_query().c_str(); try { R = T.exec(query); vector< set<uint> > known(R.size()); // Get the row and add it to the results set for (result::const_iterator it = R.begin(); it != R.end(); ++it) { uint i; uint j; (*it)[1].to(j); // Get column (*it)[2].to(i); // Get gene known[j].insert(i); } known_correct = known; } catch (pqxx::sql_error e) { cerr << "SQL error in Fetcher transactor." << endl; cerr << "Query: " << e.query() << endl; cerr << "Error: " << e.what() << endl; } } protected: string make_known_correct_query() const { ostringstream q; q << "SELECT id, j, i FROM entries WHERE matrix_id = " << matrix_id << " AND type = 'Cell' ORDER BY j,i;"; return q.str(); } };
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
rocker-0.0.8 | ext/rocker/fetcher.h |
rocker-0.0.7 | ext/rocker/fetcher.h |
rocker-0.0.6 | ext/rocker/fetcher.h |
rocker-0.0.5 | ext/rocker/fetcher.h |
rocker-0.0.4 | ext/rocker/fetcher.h |