public static void TestMs2ScanWithSpecificMass() { Ms2ScanWithSpecificMass scanB = new Ms2ScanWithSpecificMass( new MsDataScan( new MzSpectrum(new double[] { }, new double[] { }, false), 2, 1, true, Polarity.Positive, double.NaN, null, null, MZAnalyzerType.Orbitrap, double.NaN, null, null, "scan=1", double.NaN, null, null, double.NaN, null, DissociationType.AnyActivationType, 1, null), 100, 1, null, new CommonParameters(), null); var closestExperimentalMassB = scanB.GetClosestExperimentalIsotopicEnvelope(10); Assert.IsNull(closestExperimentalMassB); }
//Based on our implementation of Graph localization. We need to calculate cost between two nearby nodes (glycosites) public static double CalculateCost(Ms2ScanWithSpecificMass theScan, Tolerance productTolerance, List <double> fragments) { double score = 0; foreach (var f in fragments) { var closestExperimentalMass = theScan.GetClosestExperimentalIsotopicEnvelope(f); // is the mass error acceptable? if (productTolerance.Within(closestExperimentalMass.MonoisotopicMass, f) && closestExperimentalMass.Charge <= theScan.PrecursorCharge) { score += 1 + closestExperimentalMass.Peaks.Sum(p => p.intensity) / theScan.TotalIonCurrent; } } return(score); }
public static double[] ScanOxoniumIonFilter(Ms2ScanWithSpecificMass theScan, MassDiffAcceptor massDiffAcceptor, DissociationType dissociationType) { double[] oxoniumIonsintensities = new double[Glycan.AllOxoniumIons.Length]; if (dissociationType != DissociationType.HCD && dissociationType != DissociationType.CID && dissociationType != DissociationType.EThcD) { return(oxoniumIonsintensities); } for (int i = 0; i < Glycan.AllOxoniumIons.Length; i++) { var oxoMass = ((double)Glycan.AllOxoniumIons[i] / 1E5).ToMass(1); var envelope = theScan.GetClosestExperimentalIsotopicEnvelope(oxoMass); if (massDiffAcceptor.Accepts(envelope.MonoisotopicMass, oxoMass) >= 0) { oxoniumIonsintensities[i] = envelope.TotalIntensity; } } return(oxoniumIonsintensities); }