/// <summary> /// Get corresponding isolation scan /// </summary> /// <param name="scan"></param> /// <returns></returns> protected virtual int GetIsolationScan(int scan) { var mslevel = RawReader.GetMsLevel(scan); var targetlevel = mslevel - 1; scan--; while (scan >= FirstScan) { if (targetlevel == RawReader.GetMsLevel(scan)) { return(scan); } } return(scan); }
protected override int GetMS2Scan(int scan) { var result = scan; while (true) { var msLevel = RawReader.GetMsLevel(result); if (msLevel == 2) { break; } result--; if (result < FirstScan) { result = scan; break; } } return(result); }
public override List <IsobaricItem> ReadFromFile(string fileName) { var result = new List <IsobaricItem>(); RawReader.Open(fileName); try { int startScan = RawReader.GetFirstSpectrumNumber(); int endScan = RawReader.GetLastSpectrumNumber(); Progress.SetRange(startScan, endScan); for (int scan = startScan; scan <= endScan; scan++) { if (Progress.IsCancellationPending()) { throw new UserTerminatedException(); } Progress.SetPosition(scan); if (2 == RawReader.GetMsLevel(scan)) { string scanMode = RawReader.GetScanMode(scan); if (string.IsNullOrEmpty(scanMode)) { AppendScan(result, scan, "UNKNOWN"); continue; } scanMode = scanMode.ToLower(); if (scanMode.Equals("pqd")) { AppendScan(result, scan, "PQD"); } else if (scanMode.Equals("cid")) { //如果上一个scan是pqd,那么,现在这个cid的结果从该pqd读取。 if (result.Count > 0 && result[result.Count - 1].RawPeaks.ScanTimes[0].Scan == scan - 1 && result[result.Count - 1].RawPeaks.ScanMode == "PQD") { var lastItem = result[result.Count - 1]; var item = new IsobaricItem(lastItem); item.Scan = RawReader.GetScanTime(scan); item.ScanMode = "CID"; result.Add(item); } else//否则,从自己的peaklist中读取。 { AppendScan(result, scan, "CID"); } } else { Console.WriteLine("Scan {0} is skipped with mode {1}", scan, scanMode); } } } } finally { RawReader.Close(); } return(result); }
public virtual List <IsobaricItem> ReadFromFile(string fileName) { var result = new List <IsobaricItem>(); var askedScanMode = GetScanMode(); var lowerScanMode = new HashSet <string>(from a in askedScanMode select a.ToLower()); RawReader.Open(fileName); try { FirstScan = RawReader.GetFirstSpectrumNumber(); EndScan = RawReader.GetLastSpectrumNumber(); DoAfterFileOpen(); var firstIsolationWidth = 0.0; var icount = 0; for (int scan = FirstScan; scan <= EndScan; scan++) { if (!RawReader.IsScanValid(scan)) { continue; } if (this.MsLevel == RawReader.GetMsLevel(scan)) { firstIsolationWidth = RawReader.GetIsolationWidth(scan); if (firstIsolationWidth > 0 && firstIsolationWidth < 5) { break; } icount++; if (icount > 10) { break; } } } if (firstIsolationWidth == 0.0) { firstIsolationWidth = defaultIsolationWidth; } Progress.SetMessage("Reading channel information ..."); Progress.SetRange(FirstScan, EndScan); for (int scan = FirstScan; scan <= EndScan; scan++) { if (Progress.IsCancellationPending()) { throw new UserTerminatedException(); } if (!RawReader.IsScanValid(scan)) { continue; } Progress.SetPosition(scan); if (this.MsLevel == RawReader.GetMsLevel(scan)) { string scanMode = RawReader.GetScanMode(scan).ToLower(); if (string.IsNullOrEmpty(scanMode)) { AppendScan(result, scan, "UNKNOWN", firstIsolationWidth); } else if (lowerScanMode.Count == 0 || lowerScanMode.Contains(scanMode)) { AppendScan(result, scan, scanMode.ToUpper(), firstIsolationWidth); } else { Console.WriteLine("Scan {0} is skipped with mode {1}", scan, scanMode); } } } } finally { RawReader.Close(); } return(result); }