< record number, number of protein in a vector >
| 297 | |
| 298 | // < record number, number of protein in a vector > |
| 299 | vector<Size> |
| 300 | InspectOutfile::getSequences( |
| 301 | const String& database_filename, |
| 302 | const map<Size, Size>& wanted_records, |
| 303 | vector<String>& sequences) |
| 304 | { |
| 305 | ifstream database(database_filename.c_str()); |
| 306 | if (!database) |
| 307 | { |
| 308 | throw Exception::FileNotFound(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, database_filename); |
| 309 | } |
| 310 | |
| 311 | vector<Size> not_found; |
| 312 | Size seen_records(0); |
| 313 | stringbuf sequence; |
| 314 | database.seekg(0, ios::end); |
| 315 | streampos sp = database.tellg(); |
| 316 | database.seekg(0, ios::beg); |
| 317 | |
| 318 | for (map<Size, Size>::const_iterator wr_i = wanted_records.begin(); wr_i != wanted_records.end(); ++wr_i) |
| 319 | { |
| 320 | for (; seen_records < wr_i->first; ++seen_records) |
| 321 | { |
| 322 | database.ignore(sp, trie_delimiter_); |
| 323 | } |
| 324 | database.get(sequence, trie_delimiter_); |
| 325 | sequences.emplace_back(sequence.str()); |
| 326 | if (sequences.back().empty()) |
| 327 | { |
| 328 | not_found.push_back(wr_i->first); |
| 329 | } |
| 330 | sequence.str(""); |
| 331 | } |
| 332 | |
| 333 | // close the filestreams |
| 334 | database.close(); |
| 335 | database.clear(); |
| 336 | |
| 337 | return not_found; |
| 338 | } |
| 339 | |
| 340 | void |
| 341 | InspectOutfile::getACAndACType( |