public void CalculateIntensityForThisFeature(bool integrate) { if (IsotopicEnvelopes.Any()) { double maxIntensity = IsotopicEnvelopes.Max(p => p.Intensity); Apex = IsotopicEnvelopes.Where(p => p.Intensity == maxIntensity).First(); if (integrate) { Intensity = IsotopicEnvelopes.Sum(p => p.Intensity); } else { Intensity = Apex.Intensity; } MassError = Identifications.Min(p => ((ClassExtensions.ToMass(Apex.IndexedPeak.Mz, Apex.ChargeState) - p.monoisotopicMass) / p.monoisotopicMass) * 1e6); NumChargeStatesObserved = IsotopicEnvelopes.Select(p => p.ChargeState).Distinct().Count(); } else { Intensity = 0; MassError = double.NaN; NumChargeStatesObserved = 0; Apex = null; } }