| 972 | } |
| 973 | |
| 974 | void InspectOutfile::getLabels( |
| 975 | const String& source_database_filename, |
| 976 | String& ac_label, |
| 977 | String& sequence_start_label, |
| 978 | String& sequence_end_label, |
| 979 | String& comment_label, |
| 980 | String& species_label) |
| 981 | { |
| 982 | ac_label = sequence_start_label = sequence_end_label = comment_label = species_label = ""; |
| 983 | ifstream source_database(source_database_filename.c_str()); |
| 984 | if (!source_database) |
| 985 | { |
| 986 | throw Exception::FileNotFound(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, source_database_filename); |
| 987 | } |
| 988 | |
| 989 | String line; |
| 990 | while (getline(source_database, line) && (sequence_start_label.empty())) |
| 991 | { |
| 992 | if (!line.empty() && (line[line.length() - 1] < 33)) |
| 993 | { |
| 994 | line.resize(line.length() - 1); |
| 995 | } |
| 996 | if (line.trim().empty()) |
| 997 | { |
| 998 | continue; |
| 999 | } |
| 1000 | else if (line.hasPrefix(">")) |
| 1001 | { |
| 1002 | ac_label = ">"; |
| 1003 | sequence_start_label = ">"; |
| 1004 | sequence_end_label = ">"; |
| 1005 | comment_label = ";"; |
| 1006 | species_label = ">"; |
| 1007 | } |
| 1008 | else if (line.hasPrefix("SQ")) |
| 1009 | { |
| 1010 | ac_label = "AC"; |
| 1011 | sequence_start_label = "SQ"; |
| 1012 | sequence_end_label = "//"; |
| 1013 | comment_label = "CC"; |
| 1014 | species_label = "OS"; |
| 1015 | } |
| 1016 | } |
| 1017 | source_database.close(); |
| 1018 | source_database.clear(); |
| 1019 | |
| 1020 | // if no known start separator is found |
| 1021 | if (sequence_start_label.empty()) |
| 1022 | { |
| 1023 | throw Exception::ParseError(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "database has unknown file format (neither trie nor FASTA nor swissprot)", source_database_filename); |
| 1024 | } |
| 1025 | } |
| 1026 | |
| 1027 | vector<Size> InspectOutfile::getWantedRecords(const String& result_filename, double p_value_threshold) |
| 1028 | { |
no test coverage detected