MCPcopy Create free account
hub / github.com/BirolLab/abyss / assemblyStatsToDb

Method assemblyStatsToDb

DataBase/DB.cc:150–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150void DB::assemblyStatsToDb()
151{
152 string temp = getProperTableName(prog);
153 stringstream sqlStream, mapKeys, mapValues;
154 string id = initializeRun();
155
156 if (temp == "ABYSS" || temp == "ABYSS_P")
157 temp = "ABYSS_assembly";
158
159 sqlStream
160 << "\
161create table if not exists " << temp << " (\
162run_id text default null, run_stage integer default null, species_name text, strain_name text, library_name text, \
163exec_path text, command_line text, time_finish_" << temp << " not null default (datetime(current_timestamp,'localtime')), ";
164
165 mapKeys
166 << "run_id, run_stage, species_name, strain_name, library_name, exec_path, command_line, ";
167
168 if (id.length() == 0)
169 mapValues
170 << "null,null,";
171 else
172 mapValues
173 << "'" << id << "',(select stage from Run_pe where run_id = '" << id << "'),";
174
175 if ((id.length() > 0) && definePeVars(id))
176 mapValues
177 << "'" << peVars[0] << "', '" << peVars[1] << "', '" << peVars[2] << "', '";
178 else
179 mapValues
180 << "'" << initVars[2] << "', '" << initVars[1] << "', '" << initVars[0] << "', '";
181
182 mapValues
183 << getPath(prog)
184 << "', '" << cmd << "', ";
185
186 while (!statMap.empty()) {
187 mapKeys
188 << statMap.getFirst(statMap.begin())
189 << (statMap.size() == 1 ? "" : ", ");
190 mapValues
191 << statMap.getSecond(statMap.begin())
192 << (statMap.size() == 1 ? "" : ", ");
193 sqlStream
194 << statMap.getFirst(statMap.begin())
195 << (statMap.size() == 1 ? " int, foreign key(run_id) references Run_pe(run_id));" : " int, ");
196 statMap.erase(statMap.begin());
197 }
198
199 if (query(sqlStream.str()) && verbose_val > 1)
200 cerr << sqlStream.str() << endl;
201
202 sqlStream.str("");
203 sqlStream
204 << "insert into "<< temp << " (" << mapKeys.str() << ") values (" << mapValues.str() << ");";
205
206 if (query(sqlStream.str()) && verbose_val > 0)
207 cerr << sqlStream.str() << endl;

Callers

nothing calls this directly

Calls 7

eraseMethod · 0.80
getPathFunction · 0.50
lengthMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45
sizeMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected