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

Method getScanIdentifier

src/openms/source/FORMAT/PercolatorInfile.cpp:37–57  ·  view source on GitHub ↗

uses spectrum_reference, if empty uses spectrum_id, if also empty fall back to using index

Source from the content-addressed store, hash-verified

35
36 // uses spectrum_reference, if empty uses spectrum_id, if also empty fall back to using index
37 String PercolatorInfile::getScanIdentifier(const PeptideIdentification& pid, size_t index)
38 {
39 // MSGF+ uses this field, is empty if not specified
40 String scan_identifier = pid.getSpectrumReference();
41
42 if (scan_identifier.empty())
43 {
44 // XTandem uses this (integer) field
45 // these ids are 1-based in contrast to the index which is 0-based. This might be problematic to use for merging
46 if (pid.metaValueExists("spectrum_id") && !pid.getMetaValue("spectrum_id").toString().empty())
47 {
48 scan_identifier = "scan=" + pid.getMetaValue("spectrum_id").toString();
49 }
50 else
51 {
52 scan_identifier = "index=" + String(index); // fall back
53 OPENMS_LOG_WARN << "no known spectrum identifiers, using index [1,n] - use at own risk." << endl;
54 }
55 }
56 return scan_identifier.removeWhitespaces();
57 }
58
59 vector<PeptideIdentification> PercolatorInfile::load(
60 const String& pin_file,

Callers

nothing calls this directly

Calls 6

getSpectrumReferenceMethod · 0.80
metaValueExistsMethod · 0.80
getMetaValueMethod · 0.80
StringClass · 0.50
emptyMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected