From 6838dd6e43418d9931f293ab1dc998deef685160 Mon Sep 17 00:00:00 2001 From: julianu Date: Tue, 16 Jul 2024 10:53:58 +0200 Subject: [PATCH] treating "scan start time" and "retention time" equivalently for PSMs --- .../compiler/parser/MzIdentMLFileParser.java | 26 +++++++++++++++++-- .../de/mpc/pia/tools/OntologyConstants.java | 1 + 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/mpc/pia/intermediate/compiler/parser/MzIdentMLFileParser.java b/src/main/java/de/mpc/pia/intermediate/compiler/parser/MzIdentMLFileParser.java index 9d8c2454..7983f7f3 100755 --- a/src/main/java/de/mpc/pia/intermediate/compiler/parser/MzIdentMLFileParser.java +++ b/src/main/java/de/mpc/pia/intermediate/compiler/parser/MzIdentMLFileParser.java @@ -520,11 +520,33 @@ private static Double parseRetentionTime(SpectrumIdentificationResult specIdResu Double rt = null; // get the "scan start time" cvParams - List scanStartCvParams = specIdResult.getCvParam().stream() + List 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 scanTimeCvParams) { + Double rt = null; - for (CvParam cvParam : scanStartCvParams) { + for (CvParam cvParam : scanTimeCvParams) { try { rt = Double.parseDouble(cvParam.getValue()); diff --git a/src/main/java/de/mpc/pia/tools/OntologyConstants.java b/src/main/java/de/mpc/pia/tools/OntologyConstants.java index be74ea84..49bcf998 100755 --- a/src/main/java/de/mpc/pia/tools/OntologyConstants.java +++ b/src/main/java/de/mpc/pia/tools/OntologyConstants.java @@ -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"),