private void CopyFromStruct(udtScanHeaderInfoType udtScanHeaderInfoType) { MSLevel = udtScanHeaderInfoType.MSLevel; EventNumber = udtScanHeaderInfoType.EventNumber; SIMScan = udtScanHeaderInfoType.SIMScan; MRMScanType = udtScanHeaderInfoType.MRMScanType; ZoomScan = udtScanHeaderInfoType.ZoomScan; NumPeaks = udtScanHeaderInfoType.NumPeaks; RetentionTime = udtScanHeaderInfoType.RetentionTime; LowMass = udtScanHeaderInfoType.LowMass; HighMass = udtScanHeaderInfoType.HighMass; TotalIonCurrent = udtScanHeaderInfoType.TotalIonCurrent; BasePeakMZ = udtScanHeaderInfoType.BasePeakMZ; BasePeakIntensity = udtScanHeaderInfoType.BasePeakIntensity; FilterText = udtScanHeaderInfoType.FilterText; ParentIonMZ = udtScanHeaderInfoType.ParentIonMZ; CollisionMode = udtScanHeaderInfoType.CollisionMode; ActivationType = udtScanHeaderInfoType.ActivationType; IonMode = udtScanHeaderInfoType.IonMode; MRMInfo = udtScanHeaderInfoType.MRMInfo; NumChannels = udtScanHeaderInfoType.NumChannels; UniformTime = udtScanHeaderInfoType.UniformTime; Frequency = udtScanHeaderInfoType.Frequency; IsCentroided = udtScanHeaderInfoType.IsCentroidScan; StoreScanEvents(udtScanHeaderInfoType.ScanEventNames, udtScanHeaderInfoType.ScanEventValues); StoreStatusLog(udtScanHeaderInfoType.StatusLogNames, udtScanHeaderInfoType.StatusLogValues); }
public clsScanInfo(int scan, udtScanHeaderInfoType udtScanHeaderInfo) : this(scan) { CopyFromStruct(udtScanHeaderInfo); }
public void TestScanInfoCopyFromStruct(string rawFileName, int scanStart, int scanEnd) { var dataFile = GetRawDataFile(rawFileName); using (var reader = new XRawFileIO(dataFile.FullName)) { Console.WriteLine("Checking clsScanInfo initializing from a struct using {0}", dataFile.Name); for (var scanNumber = scanStart; scanNumber <= scanEnd; scanNumber++) { clsScanInfo scanInfo; var success = reader.GetScanInfo(scanNumber, out scanInfo); Assert.IsTrue(success, "GetScanInfo returned false for scan {0}", scanNumber); #pragma warning disable 618 var udtScanHeaderInfo = new udtScanHeaderInfoType { MSLevel = scanInfo.MSLevel, EventNumber = scanInfo.EventNumber, SIMScan = scanInfo.SIMScan, MRMScanType = scanInfo.MRMScanType, ZoomScan = scanInfo.ZoomScan, NumPeaks = scanInfo.NumPeaks, RetentionTime = scanInfo.RetentionTime, LowMass = scanInfo.LowMass, HighMass = scanInfo.HighMass, TotalIonCurrent = scanInfo.TotalIonCurrent, BasePeakMZ = scanInfo.BasePeakMZ, BasePeakIntensity = scanInfo.BasePeakIntensity, FilterText = scanInfo.FilterText, ParentIonMZ = scanInfo.ParentIonMZ, ActivationType = scanInfo.ActivationType, CollisionMode = scanInfo.CollisionMode, IonMode = scanInfo.IonMode, MRMInfo = scanInfo.MRMInfo, NumChannels = scanInfo.NumChannels, UniformTime = scanInfo.UniformTime, Frequency = scanInfo.Frequency, IsCentroidScan = scanInfo.IsCentroided, ScanEventNames = new string[scanInfo.ScanEvents.Count], ScanEventValues = new string[scanInfo.ScanEvents.Count], StatusLogNames = new string[scanInfo.StatusLog.Count], StatusLogValues = new string[scanInfo.StatusLog.Count] }; #pragma warning restore 618 var targetIndex = 0; foreach (var scanEvent in scanInfo.ScanEvents) { udtScanHeaderInfo.ScanEventNames[targetIndex] = scanEvent.Key; udtScanHeaderInfo.ScanEventValues[targetIndex] = scanEvent.Value; targetIndex++; } targetIndex = 0; foreach (var scanEvent in scanInfo.StatusLog) { udtScanHeaderInfo.StatusLogNames[targetIndex] = scanEvent.Key; udtScanHeaderInfo.StatusLogValues[targetIndex] = scanEvent.Value; targetIndex++; } #pragma warning disable 618 var scanInfoFromStruct = new clsScanInfo(scanInfo.ScanNumber, udtScanHeaderInfo); #pragma warning restore 618 Assert.AreEqual(scanInfoFromStruct.MSLevel, scanInfo.MSLevel); Assert.AreEqual(scanInfoFromStruct.IsCentroided, scanInfo.IsCentroided); Assert.AreEqual(scanInfoFromStruct.FilterText, scanInfo.FilterText); Assert.AreEqual(scanInfoFromStruct.BasePeakIntensity, scanInfo.BasePeakIntensity, 0.0001); Assert.AreEqual(scanInfoFromStruct.TotalIonCurrent, scanInfo.TotalIonCurrent, 0.0001); } } }
private udtScanHeaderInfoType ScanInfoClassToStruct(clsScanInfo scanInfo) { var udtScanInfo = new udtScanHeaderInfoType { MSLevel = scanInfo.MSLevel, EventNumber = scanInfo.EventNumber, SIMScan = scanInfo.SIMScan, MRMScanType = scanInfo.MRMScanType, ZoomScan = scanInfo.ZoomScan, NumPeaks = scanInfo.NumPeaks, RetentionTime = scanInfo.RetentionTime, LowMass = scanInfo.LowMass, HighMass = scanInfo.HighMass, TotalIonCurrent = scanInfo.TotalIonCurrent, BasePeakMZ = scanInfo.BasePeakMZ, BasePeakIntensity = scanInfo.BasePeakIntensity, FilterText = scanInfo.FilterText, ParentIonMZ = scanInfo.ParentIonMZ, ActivationType = scanInfo.ActivationType, CollisionMode = scanInfo.CollisionMode, IonMode = scanInfo.IonMode, MRMInfo = scanInfo.MRMInfo, NumChannels = scanInfo.NumChannels, UniformTime = scanInfo.UniformTime, Frequency = scanInfo.Frequency, IsCentroidScan = scanInfo.IsCentroided, ScanEventNames = new string[scanInfo.ScanEvents.Count], ScanEventValues = new string[scanInfo.ScanEvents.Count] }; for (var i = 0; i < scanInfo.ScanEvents.Count; i++) { udtScanInfo.ScanEventNames[i] = scanInfo.ScanEvents[i].Key; udtScanInfo.ScanEventValues[i] = scanInfo.ScanEvents[i].Value; } udtScanInfo.StatusLogNames = new string[scanInfo.StatusLog.Count]; udtScanInfo.StatusLogValues = new string[scanInfo.StatusLog.Count]; for (var i = 0; i < scanInfo.StatusLog.Count; i++) { udtScanInfo.StatusLogNames[i] = scanInfo.StatusLog[i].Key; udtScanInfo.StatusLogValues[i] = scanInfo.StatusLog[i].Value; } return udtScanInfo; }
public bool GetScanInfo(int scan, out udtScanHeaderInfoType udtScanInfo) { clsScanInfo scanInfo; var success = GetScanInfo(scan, out scanInfo); if (success) { udtScanInfo = ScanInfoClassToStruct(scanInfo); } else { udtScanInfo = new udtScanHeaderInfoType(); } return success; }
public int GetScanData2D(int scan, out double[,] massIntensityPairs, ref udtScanHeaderInfoType udtScanInfo, int maxNumberOfPeaks) { return GetScanData2D(scan, out massIntensityPairs, maxNumberOfPeaks, centroidData: false); }
public int GetScanData(int scan, out double[] mzList, out double[] intensityList, out udtScanHeaderInfoType udtScanInfo, int intMaxNumberOfPeaks, bool centroidData) { udtScanInfo = new udtScanHeaderInfoType(); return GetScanData(scan, out mzList, out intensityList, intMaxNumberOfPeaks, centroidData); }
public int GetScanData(int scan, out double[] mzList, out double[] intensityList, ref udtScanHeaderInfoType udtScanInfo, bool centroidData) { const int intMaxNumberOfPeaks = 0; return GetScanData(scan, out mzList, out intensityList, intMaxNumberOfPeaks, centroidData); }