private static MSScan GetScanFromFile(int argScanNo, double argSingleToNoise, double argPeakBackground, double argPeptideBackground, short argMaxCharge, GlypID.Readers.clsRawData Raw) { float[] _cidMzs = null; float[] _cidIntensities = null; GlypID.Peaks.clsPeak[] _cidPeaks = new GlypID.Peaks.clsPeak[1]; GlypID.Peaks.clsPeak[] _parentPeaks = new GlypID.Peaks.clsPeak[1]; GlypID.HornTransform.clsHornTransform mobjTransform = new GlypID.HornTransform.clsHornTransform(); GlypID.HornTransform.clsHornTransformParameters mobjTransformParameters = new GlypID.HornTransform.clsHornTransformParameters(); GlypID.HornTransform.clsHornTransformResults[] _transformResult; GlypID.Peaks.clsPeakProcessor cidPeakProcessor = new GlypID.Peaks.clsPeakProcessor(); GlypID.Peaks.clsPeakProcessorParameters cidPeakParameters = new GlypID.Peaks.clsPeakProcessorParameters(); GlypID.Peaks.clsPeakProcessor parentPeakProcessor = new GlypID.Peaks.clsPeakProcessor(); GlypID.Peaks.clsPeakProcessorParameters parentPeakParameters = new GlypID.Peaks.clsPeakProcessorParameters(); //Start Read Scan MSScan scan = new MSScan(argScanNo); Raw.GetSpectrum(argScanNo, ref _cidMzs, ref _cidIntensities); scan.MsLevel = Raw.GetMSLevel(Convert.ToInt32(argScanNo)); double min_peptide_intensity = 0; scan.Time = Raw.GetScanTime(scan.ScanNo); scan.ScanHeader = Raw.GetScanDescription(scan.ScanNo); if (scan.MsLevel != 1) { float[] _parentRawMzs = null; float[] _parentRawIntensitys = null; string Header = Raw.GetScanDescription(argScanNo); cidPeakProcessor.ProfileType = GlypID.enmProfileType.CENTROIDED; if (Header.Substring(Header.IndexOf("+") + 1).Trim().StartsWith("p")) { cidPeakProcessor.ProfileType = GlypID.enmProfileType.PROFILE; } // cidPeakProcessor.DiscoverPeaks(ref _cidMzs, ref _cidIntensities, ref _cidPeaks, // Convert.ToSingle(mobjTransformParameters.MinMZ), Convert.ToSingle(mobjTransformParameters.MaxMZ), false); for (int chNum = 0; chNum < _cidMzs.Length; chNum++) { scan.MSPeaks.Add(new MSPeak( Convert.ToSingle(_cidMzs[chNum]), Convert.ToSingle(_cidIntensities[chNum]))); } //for (int chNum = 0; chNum < _cidMzs.Length; chNum++) //{ // scan.MSPeaks.Add(new MSPeak( // Convert.ToSingle(_cidMzs[chNum]), // Convert.ToSingle(_cidIntensities[chNum]))); //} // Get parent information scan.ParentScanNo = Raw.GetParentScan(scan.ScanNo); Raw.GetSpectrum(scan.ParentScanNo, ref _parentRawMzs, ref _parentRawIntensitys); parentPeakProcessor.ProfileType = GlypID.enmProfileType.PROFILE; parentPeakProcessor.DiscoverPeaks(ref _parentRawMzs, ref _parentRawIntensitys, ref _parentPeaks, Convert.ToSingle(mobjTransformParameters.MinMZ), Convert.ToSingle(mobjTransformParameters.MaxMZ), true); float _parentBackgroundIntensity = (float)parentPeakProcessor.GetBackgroundIntensity(ref _parentRawIntensitys); _transformResult = new GlypID.HornTransform.clsHornTransformResults[1]; bool found = false; if (Raw.IsFTScan(scan.ParentScanNo)) { // High resolution data found = mobjTransform.FindPrecursorTransform(Convert.ToSingle(_parentBackgroundIntensity), Convert.ToSingle(min_peptide_intensity), ref _parentRawMzs, ref _parentRawIntensitys, ref _parentPeaks, Convert.ToSingle(scan.ParentMZ), ref _transformResult); } if (!found)//de-isotope fail { // Low resolution data or bad high res spectra short cs = Raw.GetMonoChargeFromHeader(scan.ScanNo); double monoMZ = Raw.GetMonoMzFromHeader(scan.ScanNo); List <float> ParentMzs = new List <float>(_parentRawMzs); int CloseIdx = MassUtility.GetClosestMassIdx(ParentMzs, Convert.ToSingle(monoMZ)); if (cs > 0) { short[] charges = new short[1]; charges[0] = cs; mobjTransform.AllocateValuesToTransform(Convert.ToSingle(scan.ParentMZ), Convert.ToInt32(_parentRawIntensitys[CloseIdx]), ref charges, ref _transformResult); } else { // instrument has no charge just store 2 and 3. short[] charges = new short[2]; charges[0] = 2; charges[1] = 3; mobjTransform.AllocateValuesToTransform(Convert.ToSingle(scan.ParentMZ), Convert.ToInt32(_parentRawIntensitys[CloseIdx]), ref charges, ref _transformResult); } } if (_transformResult[0].mint_peak_index == -1) //De-isotope parent scan { //Get parent info MSScan _parentScan = GetScanFromFile(scan.ParentScanNo, argSingleToNoise, argPeakBackground, argPeptideBackground, argMaxCharge, Raw); float[] _MSMzs = null; float[] _MSIntensities = null; Raw.GetSpectrum(scan.ParentScanNo, ref _MSMzs, ref _MSIntensities); // Now find peaks parentPeakParameters.SignalToNoiseThreshold = 0; parentPeakParameters.PeakBackgroundRatio = 0.01; parentPeakProcessor.SetOptions(parentPeakParameters); parentPeakProcessor.ProfileType = GlypID.enmProfileType.PROFILE; parentPeakProcessor.DiscoverPeaks(ref _MSMzs, ref _MSIntensities, ref _cidPeaks, Convert.ToSingle(mobjTransformParameters.MinMZ), Convert.ToSingle(mobjTransformParameters.MaxMZ), true); //Look for charge and mono. float[] monoandcharge = FindChargeAndMono(_cidPeaks, Convert.ToSingle(Raw.GetParentMz(scan.ScanNo)), scan.ScanNo, Raw); //scan.ParentMonoMW = _parentScan.MSPeaks[ClosedIdx].MonoMass; //scan.ParentAVGMonoMW = _parentScan.MSPeaks[ClosedIdx].; scan.ParentMZ = monoandcharge[0]; if (monoandcharge[1] == 0.0f) { scan.ParentCharge = Convert.ToInt32(Raw.GetMonoChargeFromHeader(scan.ParentScanNo)); } else { scan.ParentCharge = Convert.ToInt32(monoandcharge[1]); } scan.ParentMonoMW = (monoandcharge[0] - Atoms.ProtonMass) * monoandcharge[1]; } else { scan.ParentMonoMW = (float)_transformResult[0].mdbl_mono_mw; scan.ParentAVGMonoMW = (float)_transformResult[0].mdbl_average_mw; scan.ParentMZ = (float)_transformResult[0].mdbl_mz; scan.ParentCharge = (int)_transformResult[0].mshort_cs; } scan.IsCIDScan = Raw.IsCIDScan(argScanNo); scan.IsFTScan = Raw.IsFTScan(argScanNo); Array.Clear(_transformResult, 0, _transformResult.Length); Array.Clear(_cidPeaks, 0, _cidPeaks.Length); Array.Clear(_cidMzs, 0, _cidMzs.Length); Array.Clear(_cidIntensities, 0, _cidIntensities.Length); Array.Clear(_parentRawMzs, 0, _parentRawMzs.Length); Array.Clear(_parentRawIntensitys, 0, _parentRawIntensitys.Length); } else //MS Scan { scan.ParentMZ = 0.0f; double mdbl_current_background_intensity = 0; // Now find peaks parentPeakParameters.SignalToNoiseThreshold = argSingleToNoise; parentPeakParameters.PeakBackgroundRatio = argPeakBackground; parentPeakProcessor.SetOptions(parentPeakParameters); parentPeakProcessor.ProfileType = GlypID.enmProfileType.PROFILE; parentPeakProcessor.DiscoverPeaks(ref _cidMzs, ref _cidIntensities, ref _cidPeaks, Convert.ToSingle(mobjTransformParameters.MinMZ), Convert.ToSingle(mobjTransformParameters.MaxMZ), true); mdbl_current_background_intensity = parentPeakProcessor.GetBackgroundIntensity(ref _cidIntensities); // Settings min_peptide_intensity = mdbl_current_background_intensity * mobjTransformParameters.PeptideMinBackgroundRatio; if (mobjTransformParameters.UseAbsolutePeptideIntensity) { if (min_peptide_intensity < mobjTransformParameters.AbsolutePeptideIntensity) { min_peptide_intensity = mobjTransformParameters.AbsolutePeptideIntensity; } } mobjTransformParameters.PeptideMinBackgroundRatio = argPeptideBackground; mobjTransformParameters.MaxCharge = argMaxCharge; mobjTransform.TransformParameters = mobjTransformParameters; // Now perform deisotoping _transformResult = new GlypID.HornTransform.clsHornTransformResults[1]; mobjTransform.PerformTransform(Convert.ToSingle(mdbl_current_background_intensity), Convert.ToSingle(min_peptide_intensity), ref _cidMzs, ref _cidIntensities, ref _cidPeaks, ref _transformResult); // for getting results for (int chNum = 0; chNum < _transformResult.Length; chNum++) { double sumintensity = 0.0; double mostIntenseIntensity = 0.0; for (int i = 0; i < _transformResult[chNum].marr_isotope_peak_indices.Length; i++) { sumintensity = sumintensity + _cidPeaks[_transformResult[chNum].marr_isotope_peak_indices[i]].mdbl_intensity; if (Math.Abs(_transformResult[chNum].mdbl_most_intense_mw - (_cidPeaks[_transformResult[chNum].marr_isotope_peak_indices[i]].mdbl_mz * _transformResult[chNum].mshort_cs - Atoms.ProtonMass * _transformResult[chNum].mshort_cs)) < 1.0 / _transformResult[chNum].mshort_cs) { mostIntenseIntensity = _cidPeaks[_transformResult[chNum].mint_peak_index].mdbl_intensity; } } scan.MSPeaks.Add(new MSPeak( Convert.ToSingle(_transformResult[chNum].mdbl_mono_mw), _transformResult[chNum].mint_mono_intensity, _transformResult[chNum].mshort_cs, Convert.ToSingle(_transformResult[chNum].mdbl_mz), Convert.ToSingle(_transformResult[chNum].mdbl_fit), Convert.ToSingle(_transformResult[chNum].mdbl_most_intense_mw), mostIntenseIntensity, sumintensity )); } Array.Clear(_transformResult, 0, _transformResult.Length); Array.Clear(_cidPeaks, 0, _cidPeaks.Length); Array.Clear(_cidMzs, 0, _cidMzs.Length); Array.Clear(_cidIntensities, 0, _cidIntensities.Length); } return(scan); }
public Class1(string argFileName,int argScanNo) { _scanNum = argScanNo; _filename = argFileName; GlypID.HornTransform.clsHornTransform Transform = new GlypID.HornTransform.clsHornTransform(); GlypID.Peaks.clsPeakProcessor cidPeakProcessor = new GlypID.Peaks.clsPeakProcessor(); GlypID.Peaks.clsPeakProcessor parentPeakProcessor = new GlypID.Peaks.clsPeakProcessor(); GlypID.HornTransform.clsHornTransformParameters transform_parameters = new GlypID.HornTransform.clsHornTransformParameters(); GlypID.Peaks.clsPeakProcessorParameters peak_parameters = new GlypID.Peaks.clsPeakProcessorParameters(); Raw = new GlypID.Readers.clsRawData(_filename, GlypID.Readers.FileType.FINNIGAN); Raw.GetSpectrum(_scanNum, ref _cidMzs, ref _cidIntensities); Transform.TransformParameters = transform_parameters; _msLevel = Raw.GetMSLevel(_scanNum); if (_msLevel > 1) { _parentScanNum = Raw.GetParentScan(_scanNum); _parentMz = (float)Raw.GetParentMz(_scanNum); } else { return; //MS scan } Raw.GetSpectrum(_parentScanNum, ref _parentRawMzs, ref _parentRawIntensitys); _cidPeaks = new GlypID.Peaks.clsPeak[1]; cidPeakProcessor.ProfileType = GlypID.enmProfileType.CENTROIDED; cidPeakProcessor.DiscoverPeaks(ref _cidMzs, ref _cidIntensities, ref _cidPeaks, Convert.ToSingle(transform_parameters.MinMZ), Convert.ToSingle(transform_parameters.MaxMZ), false); _parentPeaks = new GlypID.Peaks.clsPeak[1]; parentPeakProcessor.ProfileType = GlypID.enmProfileType.PROFILE; parentPeakProcessor.DiscoverPeaks(ref _parentRawMzs, ref _parentRawIntensitys, ref _parentPeaks, Convert.ToSingle(transform_parameters.MinMZ), Convert.ToSingle(transform_parameters.MaxMZ), true); _parentBackgroundIntensity = (float)parentPeakProcessor.GetBackgroundIntensity(ref _parentRawIntensitys); double min_peptide_intensity = _parentBackgroundIntensity * transform_parameters.PeptideMinBackgroundRatio; if (transform_parameters.UseAbsolutePeptideIntensity) { if (min_peptide_intensity < transform_parameters.AbsolutePeptideIntensity) min_peptide_intensity = transform_parameters.AbsolutePeptideIntensity; } _transformResult = new GlypID.HornTransform.clsHornTransformResults[1]; bool found = Transform.FindPrecursorTransform(Convert.ToSingle(_parentBackgroundIntensity), Convert.ToSingle(min_peptide_intensity), ref _parentRawMzs, ref _parentRawIntensitys, ref _parentPeaks, Convert.ToSingle(_parentMz), ref _transformResult); if (Raw.IsFTScan(_parentScanNum)) { // High resolution data found = Transform.FindPrecursorTransform(Convert.ToSingle(_parentBackgroundIntensity), Convert.ToSingle(min_peptide_intensity), ref _parentRawMzs, ref _parentRawIntensitys, ref _parentPeaks, Convert.ToSingle(_parentMz), ref _transformResult); } if (!found) { // Low resolution data or bad high res spectra short cs = Raw.GetMonoChargeFromHeader(_scanNum); if (cs > 0) { short[] charges = new short[1]; charges[0] = cs; Transform.AllocateValuesToTransform(Convert.ToSingle(_parentMz),500, ref charges, ref _transformResult); } else { // instrument has no charge just store 2 and 3. short[] charges = new short[2]; charges[0] = 2; charges[1] = 3; Transform.AllocateValuesToTransform(Convert.ToSingle(_parentMz), 500,ref charges, ref _transformResult); } } _parentMonoMW = (float)_transformResult[0].mdbl_mono_mw; _parentCharge = (int)_transformResult[0].mshort_cs; MaxIntensityPeak(); Raw.Close(); }
public Class1(string argFileName, int argScanNo) { _scanNum = argScanNo; _filename = argFileName; GlypID.HornTransform.clsHornTransform Transform = new GlypID.HornTransform.clsHornTransform(); GlypID.Peaks.clsPeakProcessor cidPeakProcessor = new GlypID.Peaks.clsPeakProcessor(); GlypID.Peaks.clsPeakProcessor parentPeakProcessor = new GlypID.Peaks.clsPeakProcessor(); GlypID.HornTransform.clsHornTransformParameters transform_parameters = new GlypID.HornTransform.clsHornTransformParameters(); GlypID.Peaks.clsPeakProcessorParameters peak_parameters = new GlypID.Peaks.clsPeakProcessorParameters(); Raw = new GlypID.Readers.clsRawData(_filename, GlypID.Readers.FileType.FINNIGAN); Raw.GetSpectrum(_scanNum, ref _cidMzs, ref _cidIntensities); Transform.TransformParameters = transform_parameters; _msLevel = Raw.GetMSLevel(_scanNum); if (_msLevel > 1) { _parentScanNum = Raw.GetParentScan(_scanNum); _parentMz = (float)Raw.GetParentMz(_scanNum); } else { return; //MS scan } Raw.GetSpectrum(_parentScanNum, ref _parentRawMzs, ref _parentRawIntensitys); _cidPeaks = new GlypID.Peaks.clsPeak[1]; cidPeakProcessor.ProfileType = GlypID.enmProfileType.CENTROIDED; cidPeakProcessor.DiscoverPeaks(ref _cidMzs, ref _cidIntensities, ref _cidPeaks, Convert.ToSingle(transform_parameters.MinMZ), Convert.ToSingle(transform_parameters.MaxMZ), false); _parentPeaks = new GlypID.Peaks.clsPeak[1]; parentPeakProcessor.ProfileType = GlypID.enmProfileType.PROFILE; parentPeakProcessor.DiscoverPeaks(ref _parentRawMzs, ref _parentRawIntensitys, ref _parentPeaks, Convert.ToSingle(transform_parameters.MinMZ), Convert.ToSingle(transform_parameters.MaxMZ), true); _parentBackgroundIntensity = (float)parentPeakProcessor.GetBackgroundIntensity(ref _parentRawIntensitys); double min_peptide_intensity = _parentBackgroundIntensity * transform_parameters.PeptideMinBackgroundRatio; if (transform_parameters.UseAbsolutePeptideIntensity) { if (min_peptide_intensity < transform_parameters.AbsolutePeptideIntensity) { min_peptide_intensity = transform_parameters.AbsolutePeptideIntensity; } } _transformResult = new GlypID.HornTransform.clsHornTransformResults[1]; bool found = Transform.FindPrecursorTransform(Convert.ToSingle(_parentBackgroundIntensity), Convert.ToSingle(min_peptide_intensity), ref _parentRawMzs, ref _parentRawIntensitys, ref _parentPeaks, Convert.ToSingle(_parentMz), ref _transformResult); if (Raw.IsFTScan(_parentScanNum)) { // High resolution data found = Transform.FindPrecursorTransform(Convert.ToSingle(_parentBackgroundIntensity), Convert.ToSingle(min_peptide_intensity), ref _parentRawMzs, ref _parentRawIntensitys, ref _parentPeaks, Convert.ToSingle(_parentMz), ref _transformResult); } if (!found) { // Low resolution data or bad high res spectra short cs = Raw.GetMonoChargeFromHeader(_scanNum); if (cs > 0) { short[] charges = new short[1]; charges[0] = cs; Transform.AllocateValuesToTransform(Convert.ToSingle(_parentMz), 500, ref charges, ref _transformResult); } else { // instrument has no charge just store 2 and 3. short[] charges = new short[2]; charges[0] = 2; charges[1] = 3; Transform.AllocateValuesToTransform(Convert.ToSingle(_parentMz), 500, ref charges, ref _transformResult); } } _parentMonoMW = (float)_transformResult[0].mdbl_mono_mw; _parentCharge = (int)_transformResult[0].mshort_cs; MaxIntensityPeak(); Raw.Close(); }
private MSScan GetScanFromFile(int argScanNo) { MSScan scan = new MSScan(argScanNo); float[] _cidMzs = null; float[] _cidIntensities = null; Raw.GetSpectrum(argScanNo, ref _cidMzs, ref _cidIntensities); scan.MsLevel = Raw.GetMSLevel(argScanNo); double min_peptide_intensity = 0; scan.Time = Raw.GetScanTime(scan.ScanNo); scan.ScanHeader = Raw.GetScanDescription(scan.ScanNo); if (scan.MsLevel != 1) { float[] _parentRawMzs = null; float[] _parentRawIntensitys = null; scan.ParentMZ = (float)Raw.GetParentMz(argScanNo); cidPeakProcessor.ProfileType = GlypID.enmProfileType.CENTROIDED; cidPeakProcessor.DiscoverPeaks(ref _cidMzs, ref _cidIntensities, ref _cidPeaks, Convert.ToSingle(mobjTransformParameters.MinMZ), Convert.ToSingle(mobjTransformParameters.MaxMZ), false); for (int chNum = 0; chNum < _cidPeaks.Length; chNum++) { scan.MSPeaks.Add(new MSPeak( Convert.ToSingle(_cidPeaks[chNum].mdbl_mz), Convert.ToSingle(_cidPeaks[chNum].mdbl_intensity))); } //for (int chNum = 0; chNum < _cidMzs.Length; chNum++) //{ // scan.MSPeaks.Add(new MSPeak( // Convert.ToSingle(_cidMzs[chNum]), // Convert.ToSingle(_cidIntensities[chNum]))); //} // Get parent information scan.ParentScanNo = Raw.GetParentScan(scan.ScanNo); Raw.GetSpectrum(scan.ParentScanNo, ref _parentRawMzs, ref _parentRawIntensitys); parentPeakProcessor.ProfileType = GlypID.enmProfileType.PROFILE; parentPeakProcessor.DiscoverPeaks(ref _parentRawMzs, ref _parentRawIntensitys, ref _parentPeaks, Convert.ToSingle(mobjTransformParameters.MinMZ), Convert.ToSingle(mobjTransformParameters.MaxMZ), true); float _parentBackgroundIntensity = (float)parentPeakProcessor.GetBackgroundIntensity(ref _parentRawIntensitys); bool found = mobjTransform.FindPrecursorTransform(Convert.ToSingle(_parentBackgroundIntensity), Convert.ToSingle(min_peptide_intensity), ref _parentRawMzs, ref _parentRawIntensitys, ref _parentPeaks, Convert.ToSingle(scan.ParentMZ), ref _transformResult); if (Raw.IsFTScan(scan.ParentScanNo)) { // High resolution data found = mobjTransform.FindPrecursorTransform(Convert.ToSingle(_parentBackgroundIntensity), Convert.ToSingle(min_peptide_intensity), ref _parentRawMzs, ref _parentRawIntensitys, ref _parentPeaks, Convert.ToSingle(scan.ParentMZ), ref _transformResult); } //if (!found) //de-isotope fail //{ // // Low resolution data or bad high res spectra // short cs = Raw.GetMonoChargeFromHeader(scan.ScanNo); // if (cs > 0) // { // short[] charges = new short[1]; // charges[0] = cs; // mobjTransform.AllocateValuesToTransform(Convert.ToSingle(scan.ParentMZ), ref charges, ref _transformResult); // } // else // { // // instrument has no charge just store 2 and 3. // short[] charges = new short[2]; // charges[0] = 2; // charges[1] = 3; // mobjTransform.AllocateValuesToTransform(Convert.ToSingle(scan.ParentMZ), ref charges, ref _transformResult); // } //} scan.ParentMonoMW = (float)_transformResult[0].mdbl_mono_mw; scan.ParentAVGMonoMW = (float)_transformResult[0].mdbl_average_mw; scan.ParentCharge = (int)_transformResult[0].mshort_cs; Array.Clear(_transformResult, 0, _transformResult.Length); Array.Clear(_cidPeaks, 0, _cidPeaks.Length); Array.Clear(_cidMzs, 0, _cidMzs.Length); Array.Clear(_cidIntensities, 0, _cidIntensities.Length); Array.Clear(_parentRawMzs, 0, _parentRawMzs.Length); Array.Clear(_parentRawIntensitys, 0, _parentRawIntensitys.Length); } else //MS Scan { scan.ParentMZ = 0.0f; double mdbl_current_background_intensity = 0; // Now find peaks parentPeakParameters.SignalToNoiseThreshold = _singleToNoiseRatio; parentPeakParameters.PeakBackgroundRatio = _peakBackgroundRatio; parentPeakProcessor.SetOptions(parentPeakParameters); parentPeakProcessor.ProfileType = GlypID.enmProfileType.PROFILE; parentPeakProcessor.DiscoverPeaks(ref _cidMzs, ref _cidIntensities, ref _cidPeaks, Convert.ToSingle(mobjTransformParameters.MinMZ), Convert.ToSingle(mobjTransformParameters.MaxMZ), true); mdbl_current_background_intensity = parentPeakProcessor.GetBackgroundIntensity(ref _cidIntensities); // Settings min_peptide_intensity = mdbl_current_background_intensity * mobjTransformParameters.PeptideMinBackgroundRatio; if (mobjTransformParameters.UseAbsolutePeptideIntensity) { if (min_peptide_intensity < mobjTransformParameters.AbsolutePeptideIntensity) min_peptide_intensity = mobjTransformParameters.AbsolutePeptideIntensity; } mobjTransformParameters.PeptideMinBackgroundRatio = _peptideMinBackgroundRatio; mobjTransformParameters.MaxCharge = _maxCharge; mobjTransform.TransformParameters = mobjTransformParameters; // Now perform deisotoping _transformResult = new GlypID.HornTransform.clsHornTransformResults[1]; mobjTransform.PerformTransform(Convert.ToSingle(mdbl_current_background_intensity), Convert.ToSingle(min_peptide_intensity), ref _cidMzs, ref _cidIntensities, ref _cidPeaks, ref _transformResult); // for getting results for (int chNum = 0; chNum < _transformResult.Length; chNum++) { double sumintensity = 0.0; double mostIntenseIntensity = 0.0; for (int i = 0; i < _transformResult[chNum].marr_isotope_peak_indices.Length; i++) { sumintensity = sumintensity + _cidPeaks[_transformResult[chNum].marr_isotope_peak_indices[i]].mdbl_intensity; if (Math.Abs(_transformResult[chNum].mdbl_most_intense_mw - (_cidPeaks[_transformResult[chNum].marr_isotope_peak_indices[i]].mdbl_mz * _transformResult[chNum].mshort_cs - Atoms.ProtonMass * _transformResult[chNum].mshort_cs) ) < 1.0 / _transformResult[chNum].mshort_cs ) { mostIntenseIntensity = _cidPeaks[_transformResult[chNum].mint_peak_index].mdbl_intensity; } } scan.MSPeaks.Add(new MSPeak( Convert.ToSingle(_transformResult[chNum].mdbl_mono_mw), _transformResult[chNum].mint_mono_intensity, _transformResult[chNum].mshort_cs, Convert.ToSingle(_transformResult[chNum].mdbl_mz), Convert.ToSingle(_transformResult[chNum].mdbl_fit), Convert.ToSingle(_transformResult[chNum].mdbl_most_intense_mw), mostIntenseIntensity, sumintensity)); } Array.Clear(_transformResult, 0, _transformResult.Length); Array.Clear(_cidPeaks, 0, _cidPeaks.Length); Array.Clear(_cidMzs, 0, _cidMzs.Length); Array.Clear(_cidIntensities, 0, _cidIntensities.Length); } return scan; }