public override IsobaricResult ReadFromFile(string fileName) { IsobaricResult result = new IsobaricResult() { Mode = ITraqResultXmlFormatReader.GetMode(fileName) }; var reader = new ITraqResultXmlFormatReader() { Progress = this.Progress, Accept = this.Accept, ReadPeaks = this.ReadPeaks }; reader.OpenFile(fileName); try { IsobaricItem item; while (null != (item = reader.Next())) { result.Add(item); } } finally { reader.Close(); } return(result); }
public override IsobaricResult ReadFromFile(string fileName) { XElement root = XElement.Load(fileName); IsobaricResult result = new IsobaricResult(); foreach (var ele in root.Elements("ITraqScan")) { var item = new IsobaricItem(); item.PlexType = EnumUtils.StringToEnum(ele.Element("PlexType").Value, IsobaricType.PLEX4); item.Experimental = ele.Element("Experimental").Value; item.ScanMode = ele.Element("ScanMode").Value; item.Scan = new ScanTime(Convert.ToInt32(ele.Element("Scan").Value), MyConvert.ToDouble(ele.Element("RetentionTime").Value)); item.Scan.IonInjectionTime = MyConvert.ToDouble(ele.Element("IonInjectionTime").Value); var ppEle = ele.Element("PrecursorPercentage"); if (null != ppEle) { item.PrecursorPercentage = MyConvert.ToDouble(ppEle.Value); } if (!Accept(item)) { continue; } var ions = ele.Element("Ions"); var defs = item.Definition.Items; foreach (var def in defs) { item[def.Index] = MyConvert.ToDouble(ions.Element(def.Name).Value); } if (ReadPeaks) { item.RawPeaks = ElementToPeakList(ele, "RawPeaks", false); item.PeakInIsolationWindow = ElementToPeakList(ele, "PeakInIsolationWindow", true); } result.Add(item); } return(result); }
public virtual IsobaricResult GetITraqResult(List <IsobaricItem> pkls, List <MeanStandardDeviation> accs, double peakFolderTolerance, int minPeakCount) { IsobaricResult result = new IsobaricResult(); double[] ions = GetIons(); List <double> means = new List <double>(); List <double> peakTolerances = new List <double>(); for (int i = 0; i < ions.Length; i++) { var ion = ions[i]; means.Add(ion + accs[i].Mean); peakTolerances.Add(accs[i].StdDev * peakFolderTolerance); } List <Peak> peaks = new List <Peak>(); foreach (var pkl in pkls) { peaks.Clear(); int nullCount = 0; for (int i = 0; i < means.Count; i++) { Peak peak = pkl.RawPeaks.FindPeak(means[i], peakTolerances[i]).FindMaxIntensityPeak(); CheckPeakNull(ref peak, ref nullCount); peaks.Add(peak); } if (nullCount > ions.Length - minPeakCount) { continue; } AssignItraqItem(pkl, peaks); result.Add(pkl); } return(result); }
public void Setup() { t1 = new IsobaricItem() { Experimental = "S1", ScanMode = "HCD", PlexType = IsobaricType.PLEX4, PrecursorPercentage = 0.85, Scan = new ScanTime(255, 3.4), RawPeaks = new PeakList <Peak>(new Peak[] { new Peak(114.1, 114.1), new Peak(115.1, 115.1), new Peak(116.1, 116.1), new Peak(117.1, 117.1) }.ToList()), PeakInIsolationWindow = new PeakList <Peak>(new Peak[] { new Peak(214.1, 114.1), new Peak(215.1, 115.1), new Peak(216.1, 116.1), new Peak(217.1, 117.1) }.ToList()) { Precursor = new PrecursorPeak() { MasterScan = 1, Charge = 2, Intensity = 3.0, IsolationMass = 1800.1, IsolationWidth = 2.0, MonoIsotopicMass = 1879.1 } } }; t1[114] = 4.5; t1[115] = 5.5; t1[116] = 6.5; t1[117] = 7.5; t2 = new IsobaricItem() { Experimental = "S2", ScanMode = "ETD", PlexType = IsobaricType.PLEX8, PrecursorPercentage = 0.33, Scan = new ScanTime(355, 4.4), RawPeaks = new PeakList <Peak>(new Peak[] { new Peak(114.1, 1114.1), new Peak(115.1, 1115.1), new Peak(116.1, 1116.1), new Peak(117.1, 1117.1) }.ToList()), PeakInIsolationWindow = new PeakList <Peak>(new Peak[] { new Peak(1214.1, 114.1), new Peak(1215.1, 115.1), new Peak(1216.1, 116.1), new Peak(1217.1, 117.1) }.ToList()) { Precursor = new PrecursorPeak() { MasterScan = 3, Charge = 3, Intensity = 4.0, IsolationMass = 2800.1, IsolationWidth = 3.0, MonoIsotopicMass = 2879.1 } } }; t2[113] = 3.5; t2[114] = 4.5; t2[115] = 5.5; t2[116] = 6.5; t2[117] = 7.5; t2[118] = 8.5; t2[119] = 9.5; t2[121] = 11.5; tr = new IsobaricResult(); tr.Mode = "PQD"; tr.Add(t1); tr.Add(t2); }