diff --git a/MetaMorpheus/EngineLayer/PsmTsv/PsmTsvReader.cs b/MetaMorpheus/EngineLayer/PsmTsv/PsmTsvReader.cs index 45345ed08..2714fab20 100644 --- a/MetaMorpheus/EngineLayer/PsmTsv/PsmTsvReader.cs +++ b/MetaMorpheus/EngineLayer/PsmTsv/PsmTsvReader.cs @@ -13,7 +13,7 @@ public static List ReadTsv(string filePath, out List warning List psms = new List(); warnings = new List(); - StreamReader reader = null; + StreamReader reader; try { reader = new StreamReader(filePath); @@ -46,7 +46,7 @@ public static List ReadTsv(string filePath, out List warning } catch (Exception e) { - warnings.Add("Could not read line: " + lineCount); + warnings.Add($"Could not read line: {lineCount} with error message: {e.Message}"); } } diff --git a/MetaMorpheus/GuiFunctions/MetaDraw/FragmentResearching/FragmentationReanalysisViewModel.cs b/MetaMorpheus/GuiFunctions/MetaDraw/FragmentResearching/FragmentationReanalysisViewModel.cs index 6e2315cde..681601582 100644 --- a/MetaMorpheus/GuiFunctions/MetaDraw/FragmentResearching/FragmentationReanalysisViewModel.cs +++ b/MetaMorpheus/GuiFunctions/MetaDraw/FragmentResearching/FragmentationReanalysisViewModel.cs @@ -31,7 +31,7 @@ public FragmentationReanalysisViewModel(bool isProtein = true) if (isProtein) { DissociationTypes = new ObservableCollection(Enum.GetValues() - .Where(p => p != DissociationType.AnyActivationType && Omics.Fragmentation.Peptide.DissociationTypeCollection.ProductsFromDissociationType.TryGetValue(p, out var prod) && prod.Any())); + .Where(p => p != DissociationType.AnyActivationType && Omics.Fragmentation.Peptide.DissociationTypeCollection.ProductsFromDissociationType.TryGetValue(p, out var prod) && prod.Count != 0)); PossibleProducts = new ObservableCollection(GetPossibleProducts(_isProtein)); SelectedDissociationType = DissociationType.HCD; } @@ -187,7 +187,7 @@ private void SetUseForFragmentsBasedUponDissociationType(DissociationType dissoc Omics.Fragmentation.Peptide.DissociationTypeCollection.ProductsFromDissociationType[dissociationType].ToArray() : Omics.Fragmentation.Oligo.DissociationTypeCollection.GetRnaProductTypesFromDissociationType(dissociationType).ToArray(); } - catch (Exception e) + catch (Exception) { _selectedDissociationType = DissociationType.HCD; dissociationTypeProducts = isProtein ? diff --git a/MetaMorpheus/GuiFunctions/MetaDraw/MetaDrawSettings.cs b/MetaMorpheus/GuiFunctions/MetaDraw/MetaDrawSettings.cs index 38fb9ee8f..a38b939b7 100644 --- a/MetaMorpheus/GuiFunctions/MetaDraw/MetaDrawSettings.cs +++ b/MetaMorpheus/GuiFunctions/MetaDraw/MetaDrawSettings.cs @@ -15,12 +15,12 @@ public static class MetaDrawSettings { #region Constants - public static char[] SubScriptNumbers = { + public static readonly char[] SubScriptNumbers = { '\u2080', '\u2081', '\u2082', '\u2083', '\u2084', '\u2085', '\u2086', '\u2087', '\u2088', '\u2089' }; - public static char[] SuperScriptNumbers = { + public static readonly char[] SuperScriptNumbers = { '\u2070', '\u00b9', '\u00b2', '\u00b3', '\u2074', '\u2075', '\u2076', '\u2077', '\u2078', '\u2079' }; @@ -509,7 +509,7 @@ public static void LoadSettings(MetaDrawSettingsSnapshot settings, out bool flag throw new MetaMorpheusException("Cannot parse Product Ion Color values"); } } - catch (Exception e) + catch (Exception) { Debugger.Break(); SetDefaultProductTypeColors(); @@ -546,7 +546,7 @@ public static void LoadSettings(MetaDrawSettingsSnapshot settings, out bool flag throw new MetaMorpheusException("Cannot parse Beta Product Ion Color values"); } } - catch (Exception e) + catch (Exception) { Debugger.Break(); SetDefaultBetaProductTypeColors(); @@ -582,7 +582,7 @@ public static void LoadSettings(MetaDrawSettingsSnapshot settings, out bool flag throw new MetaMorpheusException("Cannot parse Modification Color values"); } } - catch (Exception e) + catch (Exception) { Debugger.Break(); SetDefaultModificationColors(); @@ -618,7 +618,7 @@ public static void LoadSettings(MetaDrawSettingsSnapshot settings, out bool flag } } - catch (Exception e) + catch (Exception) { Debugger.Break(); SetDefaultCoverageTypeColors(); @@ -627,7 +627,7 @@ public static void LoadSettings(MetaDrawSettingsSnapshot settings, out bool flag try // Spectrum Descriptors { - if (!settings.SpectrumDescriptionValues.Any()) + if (settings.SpectrumDescriptionValues.Count == 0) throw new MetaMorpheusException("Cannot parse Spectrum Descriptor values"); var firstSplit = settings.SpectrumDescriptionValues.First().Split(','); @@ -657,7 +657,7 @@ public static void LoadSettings(MetaDrawSettingsSnapshot settings, out bool flag throw new MetaMorpheusException("Cannot parse Spectrum Descriptor values"); } } - catch (Exception e) + catch (Exception) { Debugger.Break(); SetDefaultProductTypeColors(); diff --git a/MetaMorpheus/GuiFunctions/ViewModels/SpectralAveragingParametersViewModel.cs b/MetaMorpheus/GuiFunctions/ViewModels/SpectralAveragingParametersViewModel.cs index 41656fa53..cd375066a 100644 --- a/MetaMorpheus/GuiFunctions/ViewModels/SpectralAveragingParametersViewModel.cs +++ b/MetaMorpheus/GuiFunctions/ViewModels/SpectralAveragingParametersViewModel.cs @@ -18,9 +18,7 @@ public class SpectralAveragingParametersViewModel : BaseViewModel, IEquatable spectralAveragingParameters; - set { spectralAveragingParameters = value; OnPropertyChanged(nameof(SpectralAveragingParameters)); UpdateVisualRepresentation(); } + get => _spectralAveragingParameters; + set { _spectralAveragingParameters = value; OnPropertyChanged(nameof(SpectralAveragingParameters)); UpdateVisualRepresentation(); } } public OutlierRejectionType RejectionType { - get => spectralAveragingParameters.OutlierRejectionType; - set { spectralAveragingParameters.OutlierRejectionType = value; OnPropertyChanged(nameof(RejectionType)); } + get => _spectralAveragingParameters.OutlierRejectionType; + set { _spectralAveragingParameters.OutlierRejectionType = value; OnPropertyChanged(nameof(RejectionType)); } } public SpectraWeightingType WeightingType { - get => spectralAveragingParameters.SpectralWeightingType; - set { spectralAveragingParameters.SpectralWeightingType = value; OnPropertyChanged(nameof(WeightingType)); } + get => _spectralAveragingParameters.SpectralWeightingType; + set { _spectralAveragingParameters.SpectralWeightingType = value; OnPropertyChanged(nameof(WeightingType)); } } public SpectraFileAveragingType SpectraFileAveragingType { - get => spectralAveragingParameters.SpectraFileAveragingType; - set { spectralAveragingParameters.SpectraFileAveragingType = value; OnPropertyChanged(nameof(SpectraFileAveragingType)); } + get => _spectralAveragingParameters.SpectraFileAveragingType; + set { _spectralAveragingParameters.SpectraFileAveragingType = value; OnPropertyChanged(nameof(SpectraFileAveragingType)); } } public bool PerformNormalization { - get => spectralAveragingParameters.NormalizationType == NormalizationType.RelativeToTics ? true : false; + get => _spectralAveragingParameters.NormalizationType == NormalizationType.RelativeToTics ? true : false; set { - spectralAveragingParameters.NormalizationType = value == true ? NormalizationType.RelativeToTics : NormalizationType.NoNormalization; + _spectralAveragingParameters.NormalizationType = value ? NormalizationType.RelativeToTics : NormalizationType.NoNormalization; OnPropertyChanged(nameof(PerformNormalization)); } } public double Percentile { - get => spectralAveragingParameters.Percentile; - set { spectralAveragingParameters.Percentile = value; OnPropertyChanged(nameof(Percentile)); } + get => _spectralAveragingParameters.Percentile; + set { _spectralAveragingParameters.Percentile = value; OnPropertyChanged(nameof(Percentile)); } } public double MinSigmaValue { - get => spectralAveragingParameters.MinSigmaValue; - set { spectralAveragingParameters.MinSigmaValue = value; OnPropertyChanged(nameof(MinSigmaValue)); } + get => _spectralAveragingParameters.MinSigmaValue; + set { _spectralAveragingParameters.MinSigmaValue = value; OnPropertyChanged(nameof(MinSigmaValue)); } } public double MaxSigmaValue { - get => spectralAveragingParameters.MaxSigmaValue; - set { spectralAveragingParameters.MaxSigmaValue = value; OnPropertyChanged(nameof(MaxSigmaValue)); } + get => _spectralAveragingParameters.MaxSigmaValue; + set { _spectralAveragingParameters.MaxSigmaValue = value; OnPropertyChanged(nameof(MaxSigmaValue)); } } public double BinSize { - get => spectralAveragingParameters.BinSize; - set { spectralAveragingParameters.BinSize = value; OnPropertyChanged(nameof(BinSize)); } + get => _spectralAveragingParameters.BinSize; + set { _spectralAveragingParameters.BinSize = value; OnPropertyChanged(nameof(BinSize)); } } public int NumberOfScansToAverage { - get => spectralAveragingParameters.NumberOfScansToAverage; + get => _spectralAveragingParameters.NumberOfScansToAverage; set { - spectralAveragingParameters.NumberOfScansToAverage = value; - spectralAveragingParameters.ScanOverlap = value - 1; + _spectralAveragingParameters.NumberOfScansToAverage = value; + _spectralAveragingParameters.ScanOverlap = value - 1; OnPropertyChanged(nameof(NumberOfScansToAverage)); } } public int MaxThreads { - get => spectralAveragingParameters.MaxThreadsToUsePerFile; + get => _spectralAveragingParameters.MaxThreadsToUsePerFile; set { - spectralAveragingParameters.MaxThreadsToUsePerFile = value; + _spectralAveragingParameters.MaxThreadsToUsePerFile = value; OnPropertyChanged(nameof(MaxThreads)); } } @@ -123,7 +121,7 @@ public int MaxThreads public SpectralAveragingParametersViewModel(SpectralAveragingParameters parameters) { // value initialization - spectralAveragingParameters = parameters; + _spectralAveragingParameters = parameters; RejectionTypes = (OutlierRejectionType[])Enum.GetValues(typeof(OutlierRejectionType)); WeightingTypes = new [] { SpectraWeightingType.WeightEvenly, SpectraWeightingType.TicValue}; SpectraFileAveragingTypes = new[] { SpectraFileAveragingType.AverageAll, SpectraFileAveragingType.AverageDdaScans, SpectraFileAveragingType.AverageEverynScansWithOverlap}; @@ -180,7 +178,7 @@ public void SetOtherParameters(object settingsNameToSet) throw new ArgumentException("This should never be hit!"); } - spectralAveragingParameters = parameters; + _spectralAveragingParameters = parameters; UpdateVisualRepresentation(); } diff --git a/MetaMorpheus/MetaMorpheus.sln.DotSettings b/MetaMorpheus/MetaMorpheus.sln.DotSettings new file mode 100644 index 000000000..3cb2a8c2a --- /dev/null +++ b/MetaMorpheus/MetaMorpheus.sln.DotSettings @@ -0,0 +1,34 @@ + + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True \ No newline at end of file diff --git a/MetaMorpheus/TaskLayer/AveragingTask/SpectralAveragingTask.cs b/MetaMorpheus/TaskLayer/AveragingTask/SpectralAveragingTask.cs index 04f8d621e..b44281e60 100644 --- a/MetaMorpheus/TaskLayer/AveragingTask/SpectralAveragingTask.cs +++ b/MetaMorpheus/TaskLayer/AveragingTask/SpectralAveragingTask.cs @@ -81,15 +81,14 @@ protected override MyTaskResults RunSpecific(string OutputFolder, List { taskId, "Individual Spectra Files", originalUnaveragedFilepathWithoutExtenstion }); diff --git a/MetaMorpheus/TaskLayer/GlycoSearchTask/PostGlycoSearchAnalysisTask.cs b/MetaMorpheus/TaskLayer/GlycoSearchTask/PostGlycoSearchAnalysisTask.cs index bc00fe9f8..a63750858 100644 --- a/MetaMorpheus/TaskLayer/GlycoSearchTask/PostGlycoSearchAnalysisTask.cs +++ b/MetaMorpheus/TaskLayer/GlycoSearchTask/PostGlycoSearchAnalysisTask.cs @@ -31,8 +31,6 @@ protected override MyTaskResults RunSpecific(string OutputFolder, List dbFilenameList, List currentRawFileList, string taskId, FileSpecificParameters[] fileSettingsList, List allPsms, CommonParameters commonParameters, GlycoSearchParameters glycoSearchParameters, List proteinList, List variableModifications, List fixedModifications, List localizeableModificationTypes, MyTaskResults MyTaskResults) { - List proteinGroups = null; - if (!Parameters.GlycoSearchParameters.WriteDecoys) { allPsms.RemoveAll(b => b.IsDecoy); diff --git a/MetaMorpheus/Test/SpectralRecoveryTest.cs b/MetaMorpheus/Test/SpectralRecoveryTest.cs index c69e03aa2..6a9cbb18b 100644 --- a/MetaMorpheus/Test/SpectralRecoveryTest.cs +++ b/MetaMorpheus/Test/SpectralRecoveryTest.cs @@ -97,7 +97,6 @@ public void SpectralRecoveryTestSetup() Path.Combine(TestContext.CurrentContext.TestDirectory, "TestData", @"SpectralRecoveryTest\K13_20ng_1min_frac1.mzML") }; databaseList = new List() {new DbForTask( Path.Combine(TestContext.CurrentContext.TestDirectory, "TestData", @"SpectralRecoveryTest\HumanFastaSlice.fasta"), false) }; - outputFolder = outputFolder; SearchTask searchTask = new SearchTask { diff --git a/MetaMorpheus/Test/TestDataFile.cs b/MetaMorpheus/Test/TestDataFile.cs index 3289041d2..f24a04b4d 100644 --- a/MetaMorpheus/Test/TestDataFile.cs +++ b/MetaMorpheus/Test/TestDataFile.cs @@ -419,7 +419,7 @@ public TestDataFile(PeptideWithSetModifications pepWithSetMods) Scans = ScansHere.ToArray(); } - public string FilePath + public new string FilePath { get { diff --git a/MetaMorpheus/Test/XLTest.cs b/MetaMorpheus/Test/XLTest.cs index f8a136ed7..515dd1c43 100644 --- a/MetaMorpheus/Test/XLTest.cs +++ b/MetaMorpheus/Test/XLTest.cs @@ -1636,7 +1636,7 @@ internal class XLTestDataFile : MsDataFile Scans = ScansHere.ToArray(); } - public static string FilePath + public new static string FilePath { get { @@ -1718,7 +1718,7 @@ internal class XLTestDataFileDiffSite : MsDataFile Scans = ScansHere.ToArray(); } - public string FilePath + public new string FilePath { get {