Skip to content

Commit

Permalink
treating "scan start time" and "retention time" equivalently for PSMs
Browse files Browse the repository at this point in the history
  • Loading branch information
julianu committed Jul 16, 2024
1 parent d7b183a commit 6838dd6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -520,11 +520,33 @@ private static Double parseRetentionTime(SpectrumIdentificationResult specIdResu
Double rt = null;

// get the "scan start time" cvParams
List<CvParam> scanStartCvParams = specIdResult.getCvParam().stream()
List<CvParam> rtCvParams = specIdResult.getCvParam().stream()
.filter(cvParam -> cvParam.getAccession().equals(OntologyConstants.SCAN_START_TIME.getPsiAccession()))
.toList();
rt = extractRTfromCVs(rtCvParams);

if (rt == null) {
// did not find the RT with this param, try "retention time"
rtCvParams = specIdResult.getCvParam().stream()
.filter(cvParam -> cvParam.getAccession().equals(OntologyConstants.RETENTION_TIME.getPsiAccession()))
.toList();
rt = extractRTfromCVs(rtCvParams);
}

return rt;
}


/**
* Extract scan time in seconds from the the retention time / scan start time CV params.
*
* @param scanTimeCvParams
* @return
*/
private static Double extractRTfromCVs(List<CvParam> scanTimeCvParams) {
Double rt = null;

for (CvParam cvParam : scanStartCvParams) {
for (CvParam cvParam : scanTimeCvParams) {
try {
rt = Double.parseDouble(cvParam.getValue());

Expand Down
1 change: 1 addition & 0 deletions src/main/java/de/mpc/pia/tools/OntologyConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public enum OntologyConstants {
SEARCH_ENGINE_PSM_SCORE("search engine specific score for PSMs", "MS:1001143"),
SPECTRUM_TITLE("spectrum title", "MS:1000796"),
SCAN_START_TIME("scan start time", "MS:1000016"),
RETENTION_TIME("retention time", "MS:1000894"),
SCAN_NUMBERS("scan number(s)", "MS:1001115"),
DELTA_MZ("delta m/z", "MS:1001975"),
CLEAVAGE_AGENT_NAME("cleavage agent name", "MS:1001045"),
Expand Down

0 comments on commit 6838dd6

Please sign in to comment.