public override int CompareTo(object obj) { IPeak secondPeak = obj as IPeak; if (secondPeak == null) { return(-1); } else { //we need a system level global parameter that is the tolerance in PPM //TODO double toleranceInPPM = 20; double differenceInPPM = Math.Abs(1000000 * (secondPeak.XValue - this.MSPeak.XValue) / this.MSPeak.XValue); if (differenceInPPM <= toleranceInPPM) { return(0); } else { return(this.MSPeak.XValue.CompareTo(secondPeak.XValue)); } } }
public List <GUI> FindGlucoseUnits(ISpectrum spectrum) { List <GUI> units = new List <GUI>(); List <IPeak> peaks = spectrum.GetPeaks(); int scan = spectrum.GetScanNum(); for (int i = 0; i < Glucose.Length; i++) { double mass = Glucose[i]; double bestIntensity = 0; IPeak bestPeak = null; List <double> mzCandidates = Calculator.To.ComputeMZ(mass, maxCharge); foreach (double mz in mzCandidates) { int idx = BinarySearchPoints(peaks, mz); if (idx > 0 && peaks[idx].GetIntensity() > bestIntensity) { bestIntensity = peaks[idx].GetIntensity(); bestPeak = peaks[idx]; } } if (bestPeak is null) { continue; } units.Add(new GUI(i + 2, scan, bestPeak)); } return(units); }
// peptide seq, glycan* public Dictionary <string, HashSet <int> > Search(List <IPeak> peaks, int max_charge, Dictionary <string, List <model.glycan.IGlycan> > candidate) { InitSearch(candidate); Dictionary <string, HashSet <int> > results = new Dictionary <string, HashSet <int> >(); // search peaks for (int i = 0; i < peaks.Count; i++) { IPeak peak = peaks[i]; for (int charge = 1; charge < max_charge; charge++) { double target = util.mass.Spectrum.To.Compute(peak.GetMZ(), charge); List <string> glyco_sequences = searcher_.Search(target); foreach (string seq in glyco_sequences) { if (!results.ContainsKey(seq)) { results[seq] = new HashSet <int>(); } results[seq].Add(i); } } } return(results); }
public double Area(IPeak peak) { int left = bounder.Left(peak); int right = bounder.Right(peak); return(calculator.Area(left, right)); }
public int CompareTo(IPeak other) { if (other == null) { return(1); } return(MZ.CompareTo(other.X)); }
public bool Equals(IPeak other) { if (ReferenceEquals(this, other)) { return(true); } return(MZ.Equals(other.X) && Intensity.Equals(other.Y)); }
protected bool MatchPeakGlycoPeptideMass(IPeak peak, int charge, List <double> massList) { for (int i = 1; i <= charge; i++) { double mass = calculator.CalcChargeMass(peak.GetMZ(), i, option);; // peak.GetMZ() * charge; if (MassBinarySearch.Find(mass, massList, parameter.GetTolerance())) { return(true); } } return(false); }
private int Compare(IPeak peak, double mz) { double ppm = Calculator.To.ComputePPM(mz, peak.GetMZ()); if (ppm < tol) { return(0); } if (peak.GetMZ() > mz) { return(1); } return(-1); }
private int Compare(IPeak peak, double mz) { double ppm = IonMassCalc.Instance.ComputePPM(mz, peak.GetMZ()); if (ppm < tol) { return(0); } if (peak.GetMZ() > mz) { return(1); } return(-1); }
protected List <IGlycoPeptide> MatchPoints(IPeak peak, int parentCharge) { HashSet <IGlycoPeptide> g = new HashSet <IGlycoPeptide>(); for (int i = 1; i <= parentCharge; i++) { double mass = calculator.CalcChargeMass(peak.GetMZ(), i, option); BinSearchAnnotatedPoint p = new BinSearchAnnotatedPoint(mass); foreach (Point pt in matcher.GetSearchResult(p, parameter as BinarySearchParameter)) { g.UnionWith((pt as BinSearchAnnotatedPoint).GetGlycoPeptide()); } } return(g.ToList()); }
private void AddScoreWithType(IPeak peak, MassType type) { if (!matches.ContainsKey(type)) { matches[type] = new List <double>(); } double mz = peak.GetMZ(); if (!peakInclude.Contains(mz)) { peakInclude.Add(mz); matches[type].Add(alpha * peak.GetIntensity() + beta); } }
public QuantPeak(TagInformation tag, IPeak peak, double injectionTime, MsnDataScan scan, double noise = 0, bool isNoiseCapped = false) { Tag = tag; if (peak == null) { RawIntensity = 0; MZ = 0; } else { RawIntensity = peak.Y; MZ = peak.X; } //DataScan = scan; InjectionTime = injectionTime; Noise = noise; IsNoisedCapped = isNoiseCapped; }
public bool FindPeakWithinFeatures(IPeak value, int frameNum, int scanNum, int toleranceInPPM, int netTolRange, int driftTolRange) { BinaryTreeNode <T> node = this.head; while (node != null) { try { MSResultPeakWithLocation thisFeature = node.Value as MSResultPeakWithLocation; MSPeak msPeak = value as MSPeak; //now check if the peak value is within the mass tolerance of this UMC int number = thisFeature.containsPeak(msPeak, frameNum, scanNum, toleranceInPPM, netTolRange, driftTolRange); if (number == 0) { //we've found a node that contains that feature value return(true); } else if (number < 0) { //search in the left tree node = node.LeftChild; } else { //search in the right tree node = node.RightChild; } } catch (InvalidCastException invalidCast) { Console.WriteLine("The node is not of type UMC"); Console.WriteLine(invalidCast.Message); } } return(false); }
public int CompareTo(IPeak other) { return Time.CompareTo(other.X); }