From 1dc99fc2167a8317e5bac8650826109309a6fcc8 Mon Sep 17 00:00:00 2001 From: Nic Bollis Date: Thu, 11 Jan 2024 13:32:10 -0600 Subject: [PATCH] Changed behavior of masked members in Digestionparams (#756) * Changed behavior of masked members in Digestionparams * Added unit test * Added unit test --- .../ProteolyticDigestion/DigestionParams.cs | 21 ++++++++++++++++--- mzLib/Test/TestDigestionMotif.cs | 15 +++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/mzLib/Proteomics/ProteolyticDigestion/DigestionParams.cs b/mzLib/Proteomics/ProteolyticDigestion/DigestionParams.cs index a63a2f541..9e80b9de9 100644 --- a/mzLib/Proteomics/ProteolyticDigestion/DigestionParams.cs +++ b/mzLib/Proteomics/ProteolyticDigestion/DigestionParams.cs @@ -51,9 +51,24 @@ public DigestionParams(string protease = "trypsin", int maxMissedCleavages = 2, #region Properties overridden by more generic interface public Protease Protease { get; private set; } - public int MinPeptideLength => MinLength; - public int MaxPeptideLength => MaxLength; - public int MaxModsForPeptide => MaxMods; + + public int MinPeptideLength + { + get => MinLength; + set => MinLength = value; + } + + public int MaxPeptideLength + { + get => MaxLength; + set => MaxLength = value; + } + + public int MaxModsForPeptide + { + get => MaxMods; + set => MaxMods = value; + } #endregion diff --git a/mzLib/Test/TestDigestionMotif.cs b/mzLib/Test/TestDigestionMotif.cs index 23041d823..91f8cf059 100644 --- a/mzLib/Test/TestDigestionMotif.cs +++ b/mzLib/Test/TestDigestionMotif.cs @@ -578,5 +578,20 @@ public static void TestProteolyticDigestion() Assert.IsFalse(pwsmsN.Any(x => x.Length < speedySemiN.MinLength)); Assert.IsFalse(pwsmsC.Any(x => x.Length < speedySemiC.MinLength)); } + + [Test] + public void TestDigestionParamsMaskedProperties() + { + var digestionParams = new DigestionParams(); + digestionParams.MinPeptideLength = 1; + Assert.That(digestionParams.MinLength, Is.EqualTo(digestionParams.MinPeptideLength)); + + digestionParams.MaxPeptideLength = 2; + Assert.That(digestionParams.MaxLength, Is.EqualTo(digestionParams.MaxPeptideLength)); + + + digestionParams.MaxModsForPeptide = 3; + Assert.That(digestionParams.MaxMods, Is.EqualTo(digestionParams.MaxModsForPeptide)); + } } } \ No newline at end of file