public Ms2ScanWithSpecificMass(MsDataScan mzLibScan, double precursorMonoisotopicPeakMz, int precursorCharge, string fullFilePath, CommonParameters commonParam, IsotopicEnvelope[] neutralExperimentalFragments = null) { PrecursorMonoisotopicPeakMz = precursorMonoisotopicPeakMz; PrecursorCharge = precursorCharge; PrecursorMass = PrecursorMonoisotopicPeakMz.ToMass(precursorCharge); FullFilePath = fullFilePath; ChildScans = new List <Ms2ScanWithSpecificMass>(); NativeId = mzLibScan.NativeId; TheScan = mzLibScan; if (commonParam.DissociationType != DissociationType.LowCID) { ExperimentalFragments = neutralExperimentalFragments ?? GetNeutralExperimentalFragments(mzLibScan, commonParam); } if (ExperimentalFragments != null && ExperimentalFragments.Any()) { DeconvolutedMonoisotopicMasses = ExperimentalFragments.Select(p => p.MonoisotopicMass).ToArray(); } else { DeconvolutedMonoisotopicMasses = new double[0]; } }
public Ms2ScanWithSpecificMass(MsDataScan mzLibScan, double precursorMonoisotopicPeakMz, int precursorCharge, string fullFilePath, CommonParameters commonParam, IsotopicEnvelope[] neutralExperimentalFragments = null) { PrecursorMonoisotopicPeakMz = precursorMonoisotopicPeakMz; PrecursorCharge = precursorCharge; PrecursorMass = PrecursorMonoisotopicPeakMz.ToMass(precursorCharge); FullFilePath = fullFilePath; ChildScans = new List <Ms2ScanWithSpecificMass>(); TheScan = mzLibScan; ExperimentalFragments = neutralExperimentalFragments ?? GetNeutralExperimentalFragments(mzLibScan, commonParam); if (ExperimentalFragments.Any()) { DeconvolutedMonoisotopicMasses = ExperimentalFragments.Select(p => p.monoisotopicMass).ToArray(); } }
//look for IsotopicEnvelopes which are in the range of acceptable mass public IsotopicEnvelope[] GetClosestExperimentalIsotopicEnvelopeList(double minimumMass, double maxMass) { if (DeconvolutedMonoisotopicMasses.Length == 0) { return(null); } //if no mass is in this range, then return null if (DeconvolutedMonoisotopicMasses[0] > maxMass || DeconvolutedMonoisotopicMasses.Last() < minimumMass) { return(null); } int startIndex = GetClosestFragmentMass(minimumMass); int endIndex = GetClosestFragmentMass(maxMass); //the index we get from GetClosestFragmentMass is the closest mass, while the acceptable mass we need is between minimumMass and maxMass //so the startIndex mass is supposed to be larger than minimumMass, if not , then startIndex increases by 1; //the endIndex mass is supposed to be smaller than maxMass, if not , then endIndex decreases by 1; if (DeconvolutedMonoisotopicMasses[startIndex] < minimumMass) { startIndex = startIndex + 1; } if (DeconvolutedMonoisotopicMasses[endIndex] > maxMass) { endIndex = endIndex - 1; } int length = endIndex - startIndex + 1; if (length < 1) { return(null); } IsotopicEnvelope[] isotopicEnvelopes = ExperimentalFragments.Skip(startIndex).Take(length).ToArray(); return(isotopicEnvelopes); }