Skip to content

Commit 1c6a5c6

Browse files
committed
Add support for a time range for RTINSECONDS in .mgf files
1 parent 4d14403 commit 1c6a5c6

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/main/java/edu/ucsd/msjava/parser/MgfSpectrumParser.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,19 @@ public Spectrum readSpectrum(LineReader lineReader) {
183183
activation = ActivationMethod.get(activationName);
184184
spec.setActivationMethod(activation);
185185
} else if (buf.startsWith("RTINSECONDS")) {
186+
// This could be a single time:
187+
// RTINSECONDS=347.9825
188+
189+
// Or a time range
190+
// RTINSECONDS=200.1054-204.3903
191+
186192
String[] token = buf.substring(buf.indexOf("=") + 1).split("\\s+");
187-
elutionTimeSeconds = Float.valueOf(token[0]);
193+
int dashIndex = token[0].indexOf("-");
194+
195+
if (dashIndex > 0)
196+
elutionTimeSeconds = Float.valueOf(token[0].substring(0, dashIndex));
197+
else
198+
elutionTimeSeconds = Float.valueOf(token[0]);
188199
}
189200
// else if(buf.startsWith("TOL="))
190201
// {

0 commit comments

Comments
 (0)