MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / getWantedRecords

Method getWantedRecords

src/openms/source/FORMAT/InspectOutfile.cpp:1027–1119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1025 }
1026
1027 vector<Size> InspectOutfile::getWantedRecords(const String& result_filename, double p_value_threshold)
1028 {
1029 // check whether the p_value is correct
1030 if ((p_value_threshold < 0) || (p_value_threshold > 1))
1031 {
1032 throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "the parameters 'p_value_threshold' must be >= 0 and <=1 !");
1033 }
1034
1035 ifstream result_file(result_filename.c_str());
1036 if (!result_file)
1037 {
1038 throw Exception::FileNotFound(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, result_filename);
1039 }
1040
1041 String line;
1042 vector<String> substrings;
1043
1044 set<Size> wanted_records_set;
1045
1046 vector<Size>
1047 wanted_records,
1048 corrupted_lines;
1049
1050 Size line_number(0);
1051
1052 // get the header
1053 Int
1054 spectrum_file_column(-1),
1055 scan_column(-1),
1056 peptide_column(-1),
1057 protein_column(-1),
1058 charge_column(-1),
1059 MQ_score_column(-1),
1060 p_value_column(-1),
1061 record_number_column(-1),
1062 DB_file_pos_column(-1),
1063 spec_file_pos_column(-1);
1064
1065 Size number_of_columns(0);
1066
1067 if (!getline(result_file, line))
1068 {
1069 result_file.close();
1070 result_file.clear();
1071 throw Exception::FileEmpty(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, result_filename);
1072 }
1073 ++line_number;
1074 readOutHeader(result_filename, line, spectrum_file_column, scan_column, peptide_column, protein_column, charge_column, MQ_score_column, p_value_column, record_number_column, DB_file_pos_column, spec_file_pos_column, number_of_columns);
1075
1076 while (getline(result_file, line))
1077 {
1078 ++line_number;
1079 if (!line.empty() && (line[line.length() - 1] < 33))
1080 {
1081 line.resize(line.length() - 1);
1082 }
1083 line.trim();
1084 if (line.empty())

Callers 1

Calls 12

toFloatMethod · 0.80
toIntMethod · 0.80
closeMethod · 0.45
clearMethod · 0.45
emptyMethod · 0.45
resizeMethod · 0.45
splitMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
insertMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected