public override XYData GetMassSpectrum(DeconTools.Backend.Core.ScanSet scanset, double minMZ, double maxMZ) { //TODO: Update upon error fix.... the YAFMS library is throwing an error if I give an m/z outside it's expected range. So until that is fixed, I'll go get all the m/z values and trim them myself double[] xvals = null; float[] yvals = null; if (scanset.IndexValues.Count <= 1) { m_reader.GetSpectrum(this.SpectraID, scanset.PrimaryScanNumber, ref xvals, ref yvals); } else { xvals = new double[0]; yvals = new float[0]; this.getSummedSpectrum(scanset, ref xvals, ref yvals, minMZ, maxMZ); } var xydata = new XYData(); xydata.Xvalues = xvals; xydata.Yvalues = yvals.Select(p => (double)p).ToArray(); return(xydata); }
public virtual void AddSelectedChromPeakAndScanSet(ChromPeak bestPeak, ScanSet scanSet, Globals.IsotopicProfileType isotopicProfileType) { if (isotopicProfileType == Globals.IsotopicProfileType.UNLABELED) { ChromPeakSelected = bestPeak; ScanSet = scanSet; if (ScanSet != null) { NumMSScansSummed = ScanSet.IndexValues.Count; } var failedChromPeakSelection = (ChromPeakSelected == null || Math.Abs(ChromPeakSelected.XValue) < double.Epsilon); if (failedChromPeakSelection) { FailedResult = true; FailureType = Globals.TargetedResultFailureType.ChrompeakNotFoundWithinTolerances; } else { FailedResult = false; FailureType = Globals.TargetedResultFailureType.None; } } else { throw new NotSupportedException("Cannot add data for a labeled result in this base class"); } }
//NOTE: code duplication here... see BrukerRun too public override void GetMassSpectrum(DeconTools.Backend.Core.ScanSet scanSet, double minMZ, double maxMZ) { Check.Require(scanSet != null, "Can't get mass spectrum; inputted set of scans is null"); Check.Require(scanSet.IndexValues.Count > 0, "Can't get mass spectrum; no scan numbers inputted"); int totScans = this.GetNumMSScans(); double[] xvals = new double[0]; double[] yvals = new double[0]; if (scanSet.IndexValues.Count == 1) //this is the case of only wanting one MS spectrum { this.RawData.GetSpectrum(scanSet.IndexValues[0], ref xvals, ref yvals); } else // need to sum spectra { //assume: each scan has exactly same x values //get first spectrum this.RawData.GetSpectrum(scanSet.IndexValues[0], ref xvals, ref yvals); // double[] summedYvals = new double[xvals.Length]; yvals.CopyTo(summedYvals, 0); for (int i = 1; i < scanSet.IndexValues.Count; i++) { this.RawData.GetSpectrum(scanSet.IndexValues[i], ref xvals, ref yvals); for (int n = 0; n < xvals.Length; n++) { summedYvals[n] += yvals[n]; } } yvals = summedYvals; } this.XYData.SetXYValues(ref xvals, ref yvals); if (this.XYData.Xvalues == null || this.XYData.Xvalues.Length == 0) { return; } bool needsFiltering = (minMZ > this.XYData.Xvalues[0] || maxMZ < this.XYData.Xvalues[this.XYData.Xvalues.Length - 1]); if (needsFiltering) { this.FilterXYPointsByMZRange(minMZ, maxMZ); } }
public override void AddSelectedChromPeakAndScanSet(ChromPeak bestPeak, ScanSet scanset, Globals.IsotopicProfileType isotopicProfileType) { //if result was not previously processed, will do a standard add of selected chrom peak and scanset //if result was previously processed, add new data to the Labelled results if (isotopicProfileType == Globals.IsotopicProfileType.UNLABELLED) { base.AddSelectedChromPeakAndScanSet(bestPeak, scanset, isotopicProfileType); } else { ChromPeakSelectedN15 = bestPeak; ScanSetForN15Profile = scanset; } }
//NOTE: code duplication here... see BrukerRun too public override XYData GetMassSpectrum(DeconTools.Backend.Core.ScanSet scanSet, double minMZ, double maxMZ) { Check.Require(scanSet != null, "Can't get mass spectrum; inputted set of scans is null"); Check.Require(scanSet.IndexValues.Count > 0, "Can't get mass spectrum; no scan numbers inputted"); var totScans = this.GetNumMSScans(); var xvals = new double[0]; var yvals = new double[0]; if (scanSet.IndexValues.Count == 1) //this is the case of only wanting one MS spectrum { this.RawData.GetSpectrum(scanSet.IndexValues[0], ref xvals, ref yvals, false); } else // need to sum spectra { //assume: each scan has exactly same x values //get first spectrum this.RawData.GetSpectrum(scanSet.IndexValues[0], ref xvals, ref yvals, false); // var summedYvals = new double[xvals.Length]; yvals.CopyTo(summedYvals, 0); for (var i = 1; i < scanSet.IndexValues.Count; i++) { this.RawData.GetSpectrum(scanSet.IndexValues[i], ref xvals, ref yvals, false); for (var n = 0; n < xvals.Length; n++) { summedYvals[n] += yvals[n]; } } yvals = summedYvals; } var xydata = new XYData(); xydata.Xvalues = xvals; xydata.Yvalues = yvals; xydata = xydata.TrimData(minMZ, maxMZ); return(xydata); }
public void TrimScans(ScanSet scanSet, int maxScansAllowed) { Check.Require(maxScansAllowed > 0, "Scans cannot be trimmed to fewer than one"); if (scanSet.IndexValues.Count > maxScansAllowed) { var numScansToBeRemoved = (scanSet.IndexValues.Count - maxScansAllowed + 1) / 2; var newScans = new List <int>(); for (var i = numScansToBeRemoved; i < (scanSet.IndexValues.Count - numScansToBeRemoved); i++) //this loop will cleave off the first n scans and the last n scans { newScans.Add(scanSet.IndexValues[i]); } scanSet.IndexValues = newScans; } }
protected ScanResult(ScanSet scanSet) { ScanSet = scanSet; }
public StandardScanResult(ScanSet scanSet) : base(scanSet) { }
/// <summary> /// Constructor that takes run, LC scan set, and an IMS scan set /// </summary> /// <param name="run"></param> /// <param name="lcScanSet"></param> /// <param name="scanSet"></param> public UIMFIsosResult(Run run, ScanSet lcScanSet, IMSScanSet scanSet) { Run = run; ScanSet = lcScanSet; IMSScanSet = scanSet; }
public UimfScanResult(ScanSet frameSet) { ScanSet = frameSet; }
public UimfScanResult(ScanSet frameset) { this.ScanSet = frameset; }
public UserState(Run currentRun, ScanSet scanSet, FrameSet frameset) { this.currentRun = currentRun; this.currentScanSet = scanSet; this.currentFrameSet = frameset; }
public ScanResult(ScanSet scanset) { ScanSet = scanset; }
public UIMFIsosResult(Run run, ScanSet lcScanset, IMSScanSet scanset) { this.Run = run; this.ScanSet = lcScanset; this.IMSScanSet = scanset; }
public virtual XYData GetMassSpectrum(ScanSet lcScanset, ScanSet imsScanset, double minMZ, double maxMZ) { throw new NotSupportedException("This overload of GetMassSpectrum is only supported in IMS dataset types"); }
public abstract XYData GetMassSpectrum(ScanSet scanset, double minMZ, double maxMZ);
public virtual XYData GetMassSpectrum(ScanSet scanset) { //set a wide mz range so we get everything return(GetMassSpectrum(scanset, 0, 100000)); }