From a6b16392ff5536b6588dc0b14228a790b0d33866 Mon Sep 17 00:00:00 2001 From: MICHAEL SHORTREED Date: Thu, 18 Nov 2021 12:30:51 -0600 Subject: [PATCH 1/6] correct Within calculation --- MassSpectrometry/MzSpectra/SpectralSimilarity.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MassSpectrometry/MzSpectra/SpectralSimilarity.cs b/MassSpectrometry/MzSpectra/SpectralSimilarity.cs index e9600bfdd..4fcc00e77 100644 --- a/MassSpectrometry/MzSpectra/SpectralSimilarity.cs +++ b/MassSpectrometry/MzSpectra/SpectralSimilarity.cs @@ -14,7 +14,7 @@ public SpectralSimilarity(MzSpectrum primary, MzSpectrum secondary, SpectrumNorm primaryXArray = primary.XArray; secondaryYarray = Normalize(secondary.YArray, scheme); secondaryXArray = secondary.XArray; - localTolerance = toleranceInPpm / 1000000.0; + ppmTolerance = toleranceInPpm; _intensityPairs = IntensityPairs(allPeaks); } @@ -24,7 +24,7 @@ public SpectralSimilarity(MzSpectrum primary, double[] secondaryX, double[] seco primaryXArray = primary.XArray; secondaryYarray = Normalize(secondaryY, scheme); secondaryXArray = secondaryX; - localTolerance = toleranceInPpm / 1000000.0; + ppmTolerance = toleranceInPpm; _intensityPairs = IntensityPairs(allPeaks); } @@ -32,7 +32,7 @@ public SpectralSimilarity(MzSpectrum primary, double[] secondaryX, double[] seco public double[] primaryXArray { get; private set; } public double[] secondaryYarray { get; private set; } public double[] secondaryXArray { get; private set; } - private double localTolerance; + private double ppmTolerance; private List<(double, double)> _intensityPairs = new List<(double, double)>(); public List<(double, double)> intensityPairs @@ -236,7 +236,7 @@ public double DotProduct() private bool Within(double mz1, double mz2) { - return (Math.Abs(mz1 - mz2) < localTolerance); + return (Math.Abs(mz1 - mz2)/mz1*1000000.0 < ppmTolerance); } public enum SpectrumNormalizationScheme From fa4da8bb9e174a4343c6b530b47172f1449c730e Mon Sep 17 00:00:00 2001 From: MICHAEL SHORTREED Date: Thu, 18 Nov 2021 12:42:10 -0600 Subject: [PATCH 2/6] update unit tests --- Test/TestSpectralSimilarity.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Test/TestSpectralSimilarity.cs b/Test/TestSpectralSimilarity.cs index 356158e04..ebc19e9af 100644 --- a/Test/TestSpectralSimilarity.cs +++ b/Test/TestSpectralSimilarity.cs @@ -117,10 +117,10 @@ public void TestAllSpectrumSimilarities() //explore bounds of binary search primary = new MzSpectrum(new double[] { 1, 2, 3, 4 }, new double[] { 1, 2, 3, 4 }, false); - secondary = new MzSpectrum(new double[] { 1.000009, 1.99999, 3.00004, 3.99995 }, new double[] { 1, 2, 3, 4 }, false); + secondary = new MzSpectrum(new double[] { 1.000011, 1.99997, 3.000031, 3.99995 }, new double[] { 1, 2, 3, 4 }, false); s = new SpectralSimilarity(primary, secondary, SpectralSimilarity.SpectrumNormalizationScheme.spectrumSum, ppmTolerance, true); - Assert.AreEqual(7, s.intensityPairs.Count); + Assert.AreEqual(8, s.intensityPairs.Count); //Test alternate constructor primary = new MzSpectrum(new double[] { 1, 2, 3 }, new double[] { 2, 4, 6 }, false); From 892fa451204f0b54f3e54301a0bc5b250410f48a Mon Sep 17 00:00:00 2001 From: MICHAEL SHORTREED Date: Fri, 18 Feb 2022 09:57:06 -0600 Subject: [PATCH 3/6] this is the spot --- FlashLFQ/FlashLfqEngine.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/FlashLFQ/FlashLfqEngine.cs b/FlashLFQ/FlashLfqEngine.cs index 0bc9d5818..6037e2098 100644 --- a/FlashLFQ/FlashLfqEngine.cs +++ b/FlashLFQ/FlashLfqEngine.cs @@ -914,6 +914,8 @@ private void QuantifyMatchBetweenRunsPeaks(SpectraFileInfo idAcceptorFile) } } + //here is where we get the cosine similarity. + _results.Peaks[idAcceptorFile].Add(best); } From b4ad2317ed6e7df53d0d1956faa79692a669c95b Mon Sep 17 00:00:00 2001 From: Michael Shortreed Date: Thu, 29 Jun 2023 11:09:39 -0500 Subject: [PATCH 4/6] add space --- mzLib/Test/TestBayesianEstimation.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/mzLib/Test/TestBayesianEstimation.cs b/mzLib/Test/TestBayesianEstimation.cs index e7045e5a6..05c83a0e9 100644 --- a/mzLib/Test/TestBayesianEstimation.cs +++ b/mzLib/Test/TestBayesianEstimation.cs @@ -95,6 +95,7 @@ public static void TestOneSampleBayesianEstimation() Assert.That(Math.Round(highestDensityInterval.hdi_end, 3) == 1.062); } + [Test] /// /// Bayesian estimation of the difference in means between two samples. From c5cbf42c5a6889987c39efe8e14d962e2fd0fb6a Mon Sep 17 00:00:00 2001 From: Michael Shortreed Date: Tue, 12 Dec 2023 11:22:46 -0600 Subject: [PATCH 5/6] fas --- mzLib/UsefulProteomicsDatabases/ProteinDbRetriever.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mzLib/UsefulProteomicsDatabases/ProteinDbRetriever.cs b/mzLib/UsefulProteomicsDatabases/ProteinDbRetriever.cs index 0d2784dad..518ecbc21 100644 --- a/mzLib/UsefulProteomicsDatabases/ProteinDbRetriever.cs +++ b/mzLib/UsefulProteomicsDatabases/ProteinDbRetriever.cs @@ -237,7 +237,7 @@ public enum IncludeIsoforms no } - /// + /// /// Columns to select for retrieving results in tab or xls format. /// https://www.uniprot.org/help/return_fields /// From 8697892927de935b094fe389b9362dc813554463 Mon Sep 17 00:00:00 2001 From: Michael Shortreed Date: Tue, 12 Dec 2023 12:35:42 -0600 Subject: [PATCH 6/6] ok here3 it is --- mzLib/UsefulProteomicsDatabases/ProteinDbRetriever.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/mzLib/UsefulProteomicsDatabases/ProteinDbRetriever.cs b/mzLib/UsefulProteomicsDatabases/ProteinDbRetriever.cs index 518ecbc21..91cec4955 100644 --- a/mzLib/UsefulProteomicsDatabases/ProteinDbRetriever.cs +++ b/mzLib/UsefulProteomicsDatabases/ProteinDbRetriever.cs @@ -241,6 +241,7 @@ public enum IncludeIsoforms /// Columns to select for retrieving results in tab or xls format. /// https://www.uniprot.org/help/return_fields /// + public enum Columns { }