Skip to content

Commit 0d4cf02

Browse files
committed
fix tryLoadChromatogram
1 parent 5de3383 commit 0d4cf02

File tree

1 file changed

+20
-24
lines changed

1 file changed

+20
-24
lines changed

src/org/labkey/targetedms/parser/SkylineDocumentParser.java

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3179,9 +3179,6 @@ private List<ChromGroupHeaderInfo> tryLoadChromatogram(
31793179
GeneralPrecursor<?> precursor,
31803180
double tolerance)
31813181
{
3182-
// Add precursor matches to a list, if they match at least 1 transition
3183-
// in this group, and are potentially the maximal transition match.
3184-
31853182
if (_binaryParser != null && _binaryParser.getChromatograms() != null)
31863183
{
31873184
// ChromatogramCache.TryLoadChromInfo() in Skyline code:
@@ -3198,43 +3195,42 @@ private List<ChromGroupHeaderInfo> tryLoadChromatogram(
31983195
List<ChromGroupHeaderInfo> result = new ArrayList<>();
31993196

32003197
// Add entries to a list until they no longer match
3201-
List<ChromGroupHeaderInfo> chromsToMatchByTransitionMz = new ArrayList<>();
32023198
while (i < chromHeaders.length &&
32033199
matchMz(precursor.getSignedMz(), chromHeaders[i].getPrecursor(), tolerance))
32043200
{
32053201
ChromGroupHeaderInfo chrom = chromHeaders[i++];
3202+
// If explicit retention time info is available, use that to discard obvious mismatches
3203+
if (explicitRT != null && chrom.excludesTime(explicitRT))
3204+
{
3205+
continue;
3206+
}
3207+
32063208
// Sequence matching for extracted chromatogram data added in v1.5
32073209
ChromatogramGroupId chromTextId = _binaryParser.getTextId(chrom);
32083210
if (chromTextId != null)
32093211
{
32103212
// If we match based on textId, consider it a chromatogram worth storing
3211-
if (molecule.targetMatches(chromTextId.getTarget()))
3213+
if (!molecule.targetMatches(chromTextId.getTarget()))
32123214
{
3213-
try
3214-
{
3215-
SpectrumFilter spectrumFilter = SpectrumFilter.fromByteArray(precursor.getSpectrumFilter());
3216-
if (Objects.equals(spectrumFilter, chromTextId.getSpectrumFilter()))
3217-
{
3218-
result.add(chrom);
3219-
}
3220-
}
3221-
catch (InvalidProtocolBufferException e)
3215+
continue;
3216+
}
3217+
try
3218+
{
3219+
SpectrumFilter spectrumFilter = SpectrumFilter.fromByteArray(precursor.getSpectrumFilter());
3220+
if (!Objects.equals(spectrumFilter, chromTextId.getSpectrumFilter()))
32223221
{
3223-
_log.warn("Error parsing spectrum filter", e);
3224-
return Collections.emptyList();
3222+
continue;
32253223
}
3224+
}
3225+
catch (InvalidProtocolBufferException e)
3226+
{
3227+
_log.warn("Error parsing spectrum filter", e);
32263228
continue;
32273229
}
32283230
}
3229-
3230-
// If explicit retention time info is available, use that to discard obvious mismatches
3231-
if (explicitRT == null || !chrom.excludesTime(explicitRT))
3232-
{
3233-
// See if we can find a match based on transition mz instead for SRM-style data
3234-
chromsToMatchByTransitionMz.add(chrom);
3235-
}
3231+
result.add(chrom);
32363232
}
3237-
return findChromatogramsWithMostTransitions(precursor.getMz(), transitions, chromsToMatchByTransitionMz);
3233+
return findChromatogramsWithMostTransitions(precursor.getMz(), transitions, result);
32383234
}
32393235

32403236
return Collections.emptyList();

0 commit comments

Comments
 (0)