Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions pwiz_tools/Skyline/Model/PeakMatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ private static void GetReferenceData(SrmDocument doc, PeptideDocNode nodePep, Tr
var chromGroupInfo = chromGroupInfos.FirstOrDefault(info => Equals(chromSet.GetFileInfo(tranGroupChromInfo.FileId).FilePath, info.FilePath));
if (chromGroupInfo == null || chromGroupInfo.NumPeaks == 0 || !chromGroupInfo.TimeIntensitiesGroup.HasAnyPoints)
return;
if (!GetTransitionChromatogramInfos(nodeTranGroup, chromGroupInfo, mzMatchTolerance).Any())
return;

runTime = chromGroupInfo.RunStartTime;

Expand Down Expand Up @@ -221,6 +223,8 @@ private static PeakMatch GetPeakMatch(SrmDocument doc, ChromatogramSet chromSet,
var chromGroupInfo = loadInfos.FirstOrDefault(info => Equals(info.FilePath, fileInfo.FilePath));
if (chromGroupInfo == null || chromGroupInfo.NumPeaks == 0 || !chromGroupInfo.TimeIntensitiesGroup.HasAnyPoints)
return null;
if (!GetTransitionChromatogramInfos(nodeTranGroup, chromGroupInfo, mzMatchTolerance).Any())
return null;

var matchData = new List<PeakMatchData>();
double totalArea = chromGroupInfo.TransitionPointSets.Sum(chromInfo => chromInfo.Peaks.Sum(peak => peak.Area));
Expand Down Expand Up @@ -306,18 +310,23 @@ private static PeakMatch GetPeakMatch(SrmDocument doc, ChromatogramSet chromSet,
ChromatogramGroupInfo chromGroupInfo, int peakIndex, float mzMatchTolerance)
{
ChromPeak? largestPeak = null;
foreach (var peak in
from transitionDocNode in nodeTranGroup.Transitions
select chromGroupInfo.GetTransitionInfo(transitionDocNode, mzMatchTolerance)
into chromInfo where chromInfo != null
select chromInfo.GetPeak(peakIndex))
foreach (var peak in GetTransitionChromatogramInfos(nodeTranGroup, chromGroupInfo, mzMatchTolerance)
.Select(chromInfo => chromInfo.GetPeak(peakIndex)))
{
if (largestPeak == null || peak.Height > largestPeak.Value.Height)
largestPeak = peak;
}
return largestPeak;
}

private static IEnumerable<ChromatogramInfo> GetTransitionChromatogramInfos(TransitionGroupDocNode nodeTranGroup,
ChromatogramGroupInfo chromGroupInfo, float mzMatchTolerance)
{
return nodeTranGroup.Transitions
.Select(transition => chromGroupInfo.GetTransitionInfo(transition, mzMatchTolerance))
.Where(chromatogramInfo => chromatogramInfo != null);
}

private static PeakMatch MakePeakMatchBetween(float scale, PeakMatchData referenceTarget, PeakAlignment prev, PeakAlignment next)
{
if (prev == null && next == null)
Expand Down