public void Complete(int maxPeaks, int chromIndex) { if (NodeGroups.Count <= maxPeaks) return; var statHeights = new Statistics(NodeGroups.Select(nodeGroup => GetHeight(nodeGroup.Results[chromIndex]))); double minHeight = statHeights.QNthItem(statHeights.Length - maxPeaks); var nodePeps = new List<PeptideDocNode>(); var nodeGroups = new List<TransitionGroupDocNode>(); var groupPaths = new List<IdentityPath>(); for (int i = 0; i < NodeGroups.Count; i++) { var nodeGroup = NodeGroups[i]; if (GetHeight(nodeGroup.Results[chromIndex]) < minHeight) continue; nodePeps.Add(NodePeps[i]); nodeGroups.Add(nodeGroup); groupPaths.Add(GroupPaths[i]); } NodePeps.Clear(); NodePeps.AddRange(nodePeps); NodeGroups.Clear(); NodeGroups.AddRange(nodeGroups); GroupPaths.Clear(); GroupPaths.AddRange(groupPaths); }