From a06bc0dccfdb8dbf63f05907dc0a9c339f1af2f0 Mon Sep 17 00:00:00 2001 From: Nic Bollis Date: Thu, 12 Dec 2024 16:15:00 -0600 Subject: [PATCH] Analyte type (#2434) * Updated to MzLib 1.0.548 and fixed custom ions in search tasks * reverted calibration task change * merged in master bbbyy * Spectral Library from Command Line (#2386) * Updated to MzLib 1.0.548 and fixed custom ions in search tasks * reverted calibration task change * merged in master bbbyy * Enabled Library Loading from command line * Started Analyte Type Basics * replaced all strings in PostSearchAnalysisTask with analyte type references * Started Analyte Type Basics * replaced all strings in PostSearchAnalysisTask with analyte type references * Update ResultsDictionary keys and status messages Modified ResultsDictionary keys to use plural forms of analyte type labels by appending 's'. Updated status message for writing unique form results to use lowercase version of UniqueFormLabel. * Started Analyte Type Basics * replaced all strings in PostSearchAnalysisTask with analyte type references * Update ResultsDictionary keys and status messages Modified ResultsDictionary keys to use plural forms of analyte type labels by appending 's'. Updated status message for writing unique form results to use lowercase version of UniqueFormLabel. * Converted the AnalyteType to an enum * Added tests for the analyte type extensions * Added test case for the tostring * Removed ToString() from analyte type as it was never used --------- Co-authored-by: Nic Bollis Co-authored-by: trishorts --- MetaMorpheus/EngineLayer/AnalyteType.cs | 56 ++++++++++++++ MetaMorpheus/EngineLayer/GlobalVariables.cs | 4 +- MetaMorpheus/MetaMorpheus.sln.DotSettings | 3 + MetaMorpheus/TaskLayer/MetaMorpheusTask.cs | 4 +- .../SearchTask/PostSearchAnalysisTask.cs | 74 +++++++++---------- MetaMorpheus/Test/GlobalVariablesTest.cs | 35 +++++++++ MetaMorpheus/Test/MatchIonsOfAllCharges.cs | 2 +- MetaMorpheus/Test/TestTopDown.cs | 2 +- 8 files changed, 137 insertions(+), 43 deletions(-) create mode 100644 MetaMorpheus/EngineLayer/AnalyteType.cs diff --git a/MetaMorpheus/EngineLayer/AnalyteType.cs b/MetaMorpheus/EngineLayer/AnalyteType.cs new file mode 100644 index 000000000..8b8d754ce --- /dev/null +++ b/MetaMorpheus/EngineLayer/AnalyteType.cs @@ -0,0 +1,56 @@ +using System.Collections.Generic; + +namespace EngineLayer +{ + public enum AnalyteType + { + Peptide, + Proteoform, + Oligo + } + + /// + /// Accessor methods for specific information about certain analyte types + /// + public static class AnalyteTypeExtensions + { + private static readonly Dictionary AnalyteTypes = new() + { + { AnalyteType.Peptide, new AnalyteTypeData("PSM", "Peptide", "Protein", "psmtsv") }, + { AnalyteType.Proteoform, new AnalyteTypeData("PSM", "Proteoform", "Protein", "psmtsv") }, + { AnalyteType.Oligo, new AnalyteTypeData("OSM", "Oligo", "Transcript", "osmtsv") }, + }; + + public static string GetSpectralMatchLabel(this AnalyteType analyteType) => AnalyteTypes[analyteType].SpectralMatchLabel; + public static string GetSpectralMatchExtension(this AnalyteType analyteType) => AnalyteTypes[analyteType].SpectralMatchExtension; + public static string GetUniqueFormLabel(this AnalyteType analyteType) => AnalyteTypes[analyteType].UniqueFormLabel; + public static string GetBioPolymerLabel(this AnalyteType analyteType) => AnalyteTypes[analyteType].BioPolymerLabel; + } + + /// + /// Represents an analyte type and is used to determine the output format of the analyte type. + /// + internal class AnalyteTypeData(string spectralMatchLabel, string uniqueFormLabel, string bioPolymerLabel, string spectralMatchExtension) + { + /// + /// Gets or sets the label for spectral matches (e.g. PSM). + /// + internal string SpectralMatchLabel { get; init; } = spectralMatchLabel; + + /// + /// Extension for spectral matches (e.g. psmtsv). + /// + internal string SpectralMatchExtension { get; init; } = spectralMatchExtension; + + /// + /// Gets or sets the label for unique forms (e.g. Peptide). + /// + internal string UniqueFormLabel { get; init; } = uniqueFormLabel; + + /// + /// Gets or sets the label for grouped forms (e.g. Protein). + /// + internal string BioPolymerLabel { get; init; } = bioPolymerLabel; + } +} + diff --git a/MetaMorpheus/EngineLayer/GlobalVariables.cs b/MetaMorpheus/EngineLayer/GlobalVariables.cs index 96efe5960..51bfc06eb 100644 --- a/MetaMorpheus/EngineLayer/GlobalVariables.cs +++ b/MetaMorpheus/EngineLayer/GlobalVariables.cs @@ -34,7 +34,7 @@ public static class GlobalVariables private static char[] _InvalidAminoAcids; // this affects output labels, etc. and can be changed to "Proteoform" for top-down searches - public static string AnalyteType; + public static AnalyteType AnalyteType; public static List ErrorsReadingMods; @@ -65,7 +65,7 @@ public static void SetUpGlobalVariables() Loaders.LoadElements(); AcceptedDatabaseFormats = new List { ".fasta", ".fa", ".xml", ".msp" }; AcceptedSpectraFormats = new List { ".raw", ".mzml", ".mgf" }; - AnalyteType = "Peptide"; + AnalyteType = AnalyteType.Peptide; _InvalidAminoAcids = new char[] { 'X', 'B', 'J', 'Z', ':', '|', ';', '[', ']', '{', '}', '(', ')', '+', '-' }; ExperimentalDesignFileName = "ExperimentalDesign.tsv"; SeparationTypes = new List { { "HPLC" }, { "CZE" } }; diff --git a/MetaMorpheus/MetaMorpheus.sln.DotSettings b/MetaMorpheus/MetaMorpheus.sln.DotSettings index 3cb2a8c2a..f51848859 100644 --- a/MetaMorpheus/MetaMorpheus.sln.DotSettings +++ b/MetaMorpheus/MetaMorpheus.sln.DotSettings @@ -1,4 +1,5 @@  + True True True True @@ -20,9 +21,11 @@ True True True + True True True True + True True True True diff --git a/MetaMorpheus/TaskLayer/MetaMorpheusTask.cs b/MetaMorpheus/TaskLayer/MetaMorpheusTask.cs index 16c86ad4b..44bb83da6 100644 --- a/MetaMorpheus/TaskLayer/MetaMorpheusTask.cs +++ b/MetaMorpheus/TaskLayer/MetaMorpheusTask.cs @@ -1143,11 +1143,11 @@ public static void DetermineAnalyteType(CommonParameters commonParameters) && commonParameters.DigestionParams.Protease != null && commonParameters.DigestionParams.Protease.Name == "top-down") { - GlobalVariables.AnalyteType = "Proteoform"; + GlobalVariables.AnalyteType = AnalyteType.Proteoform; } else { - GlobalVariables.AnalyteType = "Peptide"; + GlobalVariables.AnalyteType = AnalyteType.Peptide; } } diff --git a/MetaMorpheus/TaskLayer/SearchTask/PostSearchAnalysisTask.cs b/MetaMorpheus/TaskLayer/SearchTask/PostSearchAnalysisTask.cs index e30b4549a..bf6734e70 100644 --- a/MetaMorpheus/TaskLayer/SearchTask/PostSearchAnalysisTask.cs +++ b/MetaMorpheus/TaskLayer/SearchTask/PostSearchAnalysisTask.cs @@ -136,11 +136,11 @@ private void CalculatePsmAndPeptideFdr(List psms, string analysis // for example, here it may be treated as a decoy PSM, where as in parsimony it will be determined by the parsimony algorithm which is agnostic of target/decoy assignments // this could cause weird PSM FDR issues - Status("Estimating PSM FDR...", Parameters.SearchTaskId); + Status($"Estimating {GlobalVariables.AnalyteType.GetSpectralMatchLabel()} FDR...", Parameters.SearchTaskId); new FdrAnalysisEngine(psms, Parameters.NumNotches, CommonParameters, this.FileSpecificParameters, new List { Parameters.SearchTaskId }, analysisType: analysisType, doPEP: doPep, outputFolder: Parameters.OutputFolder).Run(); - Status("Done estimating PSM FDR!", Parameters.SearchTaskId); + Status($"Done estimating {GlobalVariables.AnalyteType.GetSpectralMatchLabel()} FDR!", Parameters.SearchTaskId); } private void ProteinAnalysis() @@ -150,7 +150,7 @@ private void ProteinAnalysis() return; } - Status("Constructing protein groups...", Parameters.SearchTaskId); + Status($"Constructing {GlobalVariables.AnalyteType.GetBioPolymerLabel().ToLower()} groups...", Parameters.SearchTaskId); //if SILAC, modify the proteins to appear only light (we want a protein sequence to look like PROTEINK instead of PROTEINa) if (Parameters.SearchParameters.SilacLabels != null && Parameters.AllPsms.First() is PeptideSpectralMatch) @@ -178,7 +178,7 @@ private void ProteinAnalysis() ProteinGroups = proteinScoringAndFdrResults.SortedAndScoredProteinGroups; - Status("Done constructing protein groups!", Parameters.SearchTaskId); + Status($"Done constructing {GlobalVariables.AnalyteType.GetBioPolymerLabel().ToLower()} groups!", Parameters.SearchTaskId); } private void DoMassDifferenceLocalizationAnalysis() @@ -593,7 +593,7 @@ protected void WritePsmsToTsv(IEnumerable psms, string filePath, } private void WritePsmResults() { - Status("Writing PSM results...", Parameters.SearchTaskId); + Status($"Writing {GlobalVariables.AnalyteType.GetSpectralMatchLabel()} results...", Parameters.SearchTaskId); var psmsForPsmResults = FilteredPsms.Filter(Parameters.AllPsms, CommonParameters, includeDecoys: Parameters.SearchParameters.WriteDecoys, @@ -602,13 +602,13 @@ private void WritePsmResults() includeHighQValuePsms: Parameters.SearchParameters.WriteHighQValuePsms); // write PSMs - string writtenFile = Path.Combine(Parameters.OutputFolder, "AllPSMs.psmtsv"); + string writtenFile = Path.Combine(Parameters.OutputFolder, $"All{GlobalVariables.AnalyteType.GetSpectralMatchLabel()}s.{GlobalVariables.AnalyteType.GetSpectralMatchExtension()}"); WritePsmsToTsv(psmsForPsmResults.OrderByDescending(p=>p).ToList(), writtenFile, writePeptideLevelResults: false); FinishedWritingFile(writtenFile, new List { Parameters.SearchTaskId }); // write PSMs for percolator // percolator native read format is .tab - writtenFile = Path.Combine(Parameters.OutputFolder, "AllPSMs_FormattedForPercolator.tab"); + writtenFile = Path.Combine(Parameters.OutputFolder, $"All{GlobalVariables.AnalyteType.GetSpectralMatchLabel()}s_FormattedForPercolator.tab"); WritePsmsForPercolator(psmsForPsmResults.OrderByDescending(p=>p).ToList(), writtenFile); FinishedWritingFile(writtenFile, new List { Parameters.SearchTaskId }); @@ -617,16 +617,16 @@ private void WritePsmResults() { Parameters.SearchTaskResults.AddPsmPeptideProteinSummaryText( - "PEP could not be calculated due to an insufficient number of PSMs. Results were filtered by q-value." + + $"PEP could not be calculated due to an insufficient number of {GlobalVariables.AnalyteType.GetSpectralMatchLabel()}s. Results were filtered by q-value." + Environment.NewLine); } - string psmResultsText = "All target PSMs with " + psmsForPsmResults.GetFilterTypeString() + " <= " + Math.Round(psmsForPsmResults.FilterThreshold, 2) + ": " + + string psmResultsText = $"All target {GlobalVariables.AnalyteType.GetSpectralMatchLabel()}s with " + psmsForPsmResults.GetFilterTypeString() + " <= " + Math.Round(psmsForPsmResults.FilterThreshold, 2) + ": " + psmsForPsmResults.TargetPsmsAboveThreshold; - ResultsDictionary[("All", "PSMs")] = psmResultsText; + ResultsDictionary[("All", $"{GlobalVariables.AnalyteType.GetSpectralMatchLabel()}s")] = psmResultsText; } private void WritePeptideResults() { - Status("Writing peptide results...", Parameters.SearchTaskId); + Status($"Writing {GlobalVariables.AnalyteType.GetUniqueFormLabel().ToLower()} results...", Parameters.SearchTaskId); var peptidesForPeptideResults = FilteredPsms.Filter(Parameters.AllPsms, CommonParameters, @@ -637,7 +637,7 @@ private void WritePeptideResults() filterAtPeptideLevel: true); // write PSMs - string writtenFile = Path.Combine(Parameters.OutputFolder, $"All{GlobalVariables.AnalyteType}s.psmtsv"); + string writtenFile = Path.Combine(Parameters.OutputFolder, $"All{GlobalVariables.AnalyteType}s.{GlobalVariables.AnalyteType.GetSpectralMatchExtension()}"); WritePsmsToTsv(peptidesForPeptideResults.OrderByDescending(p => p).ToList(), writtenFile, writePeptideLevelResults: true); FinishedWritingFile(writtenFile, new List { Parameters.SearchTaskId }); @@ -645,16 +645,16 @@ private void WritePeptideResults() if (peptidesForPeptideResults.FilteringNotPerformed) { Parameters.SearchTaskResults.AddPsmPeptideProteinSummaryText( - "PEP could not be calculated due to an insufficient number of PSMs. Results were filtered by q-value." + Environment.NewLine); + $"PEP could not be calculated due to an insufficient number of {GlobalVariables.AnalyteType.GetSpectralMatchLabel()}s. Results were filtered by q-value." + Environment.NewLine); } - string peptideResultsText = $"All target {GlobalVariables.AnalyteType.ToLower()}s with " + peptidesForPeptideResults.GetFilterTypeString() + " <= " + Math.Round(peptidesForPeptideResults.FilterThreshold, 2) + ": " + + string peptideResultsText = $"All target {GlobalVariables.AnalyteType.GetUniqueFormLabel().ToLower()}s with " + peptidesForPeptideResults.GetFilterTypeString() + " <= " + Math.Round(peptidesForPeptideResults.FilterThreshold, 2) + ": " + peptidesForPeptideResults.TargetPsmsAboveThreshold; - ResultsDictionary[("All", GlobalVariables.AnalyteType)] = peptideResultsText; + ResultsDictionary[("All", GlobalVariables.AnalyteType.GetUniqueFormLabel())] = peptideResultsText; } private void WriteIndividualPsmResults() { - Status("Writing Individual PSM results...", Parameters.SearchTaskId); + Status($"Writing Individual {GlobalVariables.AnalyteType.GetSpectralMatchLabel()} results...", Parameters.SearchTaskId); var psmsGroupedByFile = Parameters.AllPsms.GroupBy(p => p.FullFilePath); foreach (var psmFileGroup in psmsGroupedByFile) @@ -674,24 +674,24 @@ private void WriteIndividualPsmResults() int count = psmsToWrite.Where(psm => psm.PsmFdrInfo.PEP <= 0.01).Count(); // write PSMs - string writtenFile = Path.Combine(Parameters.IndividualResultsOutputFolder, strippedFileName + "_PSMs.psmtsv"); + string writtenFile = Path.Combine(Parameters.IndividualResultsOutputFolder, strippedFileName + $"_{GlobalVariables.AnalyteType.GetSpectralMatchLabel()}s.{GlobalVariables.AnalyteType.GetSpectralMatchExtension()}"); WritePsmsToTsv(psmsToWrite, writtenFile); FinishedWritingFile(writtenFile, new List { Parameters.SearchTaskId, "Individual Spectra Files", psmFileGroup.Key }); // write PSMs for percolator - writtenFile = Path.Combine(Parameters.IndividualResultsOutputFolder, strippedFileName + "_PSMsFormattedForPercolator.tab"); + writtenFile = Path.Combine(Parameters.IndividualResultsOutputFolder, strippedFileName + $"_{GlobalVariables.AnalyteType.GetSpectralMatchLabel()}sFormattedForPercolator.tab"); WritePsmsForPercolator(psmsToWrite.FilteredPsmsList, writtenFile); FinishedWritingFile(writtenFile, new List { Parameters.SearchTaskId, "Individual Spectra Files", psmFileGroup.Key }); // write summary text - string psmResultsText = strippedFileName + " - Target PSMs with " + psmsToWrite.GetFilterTypeString() + " <= " + Math.Round(psmsToWrite.FilterThreshold, 2) + ": " + + string psmResultsText = strippedFileName + $" - Target {GlobalVariables.AnalyteType.GetSpectralMatchLabel()}s with " + psmsToWrite.GetFilterTypeString() + " <= " + Math.Round(psmsToWrite.FilterThreshold, 2) + ": " + psmsToWrite.TargetPsmsAboveThreshold; - ResultsDictionary[(strippedFileName, "PSMs")] = psmResultsText; + ResultsDictionary[(strippedFileName, $"{GlobalVariables.AnalyteType.GetSpectralMatchLabel()}s")] = psmResultsText; } } private void WriteIndividualPeptideResults() { - Status("Writing Individual Peptide results...", Parameters.SearchTaskId); + Status($"Writing Individual {GlobalVariables.AnalyteType} results...", Parameters.SearchTaskId); var peptidesGroupedByFile = Parameters.AllPsms.GroupBy(p => p.FullFilePath); foreach (var psmFileGroup in peptidesGroupedByFile) @@ -715,14 +715,14 @@ private void WriteIndividualPeptideResults() filterAtPeptideLevel: true); // write PSMs - string writtenFile = Path.Combine(Parameters.IndividualResultsOutputFolder, strippedFileName + $"_{GlobalVariables.AnalyteType}s.psmtsv"); + string writtenFile = Path.Combine(Parameters.IndividualResultsOutputFolder, strippedFileName + $"_{GlobalVariables.AnalyteType}s.{GlobalVariables.AnalyteType.GetSpectralMatchExtension()}"); WritePsmsToTsv(peptidesToWrite, writtenFile, writePeptideLevelResults: true); FinishedWritingFile(writtenFile, new List { Parameters.SearchTaskId, "Individual Spectra Files", psmFileGroup.Key }); // write summary text - string peptideResultsText = strippedFileName + $" - Target {GlobalVariables.AnalyteType.ToLower()}s with " + peptidesToWrite.GetFilterTypeString() + " <= " + Math.Round(peptidesToWrite.FilterThreshold, 2) + ": " + + string peptideResultsText = strippedFileName + $" - Target {GlobalVariables.AnalyteType.GetUniqueFormLabel().ToLower()}s with " + peptidesToWrite.GetFilterTypeString() + " <= " + Math.Round(peptidesToWrite.FilterThreshold, 2) + ": " + peptidesToWrite.TargetPsmsAboveThreshold; - ResultsDictionary[(strippedFileName, GlobalVariables.AnalyteType)] = peptideResultsText; + ResultsDictionary[(strippedFileName, GlobalVariables.AnalyteType.GetUniqueFormLabel())] = peptideResultsText; } } @@ -835,14 +835,14 @@ private void WriteProteinResults() } else { - string proteinResultsText = "All target protein groups with q-value <= 0.01 (1% FDR): " + ProteinGroups.Count(b => b.QValue <= 0.01 && !b.IsDecoy); - ResultsDictionary[("All", "Proteins")] = proteinResultsText; + string proteinResultsText = $"All target {GlobalVariables.AnalyteType.GetBioPolymerLabel().ToLower()} groups with q-value <= 0.01 (1% FDR): " + ProteinGroups.Count(b => b.QValue <= 0.01 && !b.IsDecoy); + ResultsDictionary[("All", $"{GlobalVariables.AnalyteType.GetBioPolymerLabel()}s")] = proteinResultsText; } - string fileName = "AllProteinGroups.tsv"; + string fileName = $"All{GlobalVariables.AnalyteType.GetBioPolymerLabel()}Groups.tsv"; if (Parameters.SearchParameters.DoLabelFreeQuantification) { - fileName = "AllQuantifiedProteinGroups.tsv"; + fileName = $"AllQuantified{GlobalVariables.AnalyteType.GetBioPolymerLabel()}Groups.tsv"; } //set peptide output values @@ -909,10 +909,10 @@ private void WriteProteinResults() { // write summary text string proteinResultsText = strippedFileName + " - Target protein groups within 1 % FDR: " + subsetProteinGroupsForThisFile.Count(b => b.QValue <= 0.01 && !b.IsDecoy); - ResultsDictionary[(strippedFileName, "Proteins")] = proteinResultsText; + ResultsDictionary[(strippedFileName, $"{GlobalVariables.AnalyteType.GetBioPolymerLabel()}s")] = proteinResultsText; // write result files - writtenFile = Path.Combine(Parameters.IndividualResultsOutputFolder, strippedFileName + "_ProteinGroups.tsv"); + writtenFile = Path.Combine(Parameters.IndividualResultsOutputFolder, strippedFileName + $"_{GlobalVariables.AnalyteType.GetBioPolymerLabel()}Groups.tsv"); WriteProteinGroupsToTsv(subsetProteinGroupsForThisFile, writtenFile, new List { Parameters.SearchTaskId, "Individual Spectra Files", fullFilePath }); } @@ -1790,7 +1790,7 @@ private static void WritePsmsForPercolator(List psmList, string w string header = "SpecId\tLabel\tScanNr\t"; header += String.Join("\t", PsmData.trainingInfos[searchType]); - header += "\tPeptide\tProteins"; + header += $"\t{GlobalVariables.AnalyteType.GetUniqueFormLabel()}s\t{GlobalVariables.AnalyteType.GetBioPolymerLabel()}s"; output.WriteLine(header); @@ -1860,8 +1860,8 @@ private void ConstructResultsDictionary() { ResultsDictionary = new() { - { ("All", "PSMs"), "" }, - { ("All", GlobalVariables.AnalyteType), "" } + { ("All", $"{GlobalVariables.AnalyteType.GetSpectralMatchLabel()}s"), "" }, + { ("All", GlobalVariables.AnalyteType.GetUniqueFormLabel()), "" } }; if (Parameters.CurrentRawFileList.Count > 1 && Parameters.SearchParameters.WriteIndividualFiles) @@ -1869,20 +1869,20 @@ private void ConstructResultsDictionary() foreach (var rawFile in Parameters.CurrentRawFileList) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(rawFile); - ResultsDictionary.Add((fileNameWithoutExtension, "PSMs"), ""); - ResultsDictionary.Add((fileNameWithoutExtension, GlobalVariables.AnalyteType), ""); + ResultsDictionary.Add((fileNameWithoutExtension, $"{GlobalVariables.AnalyteType.GetSpectralMatchLabel()}s"), ""); + ResultsDictionary.Add((fileNameWithoutExtension, GlobalVariables.AnalyteType.GetUniqueFormLabel()), ""); } } if (Parameters.SearchParameters.DoParsimony) { - ResultsDictionary.Add(("All", "Proteins"), ""); + ResultsDictionary.Add(("All", $"{GlobalVariables.AnalyteType.GetBioPolymerLabel()}s"), ""); if (Parameters.CurrentRawFileList.Count > 1 && Parameters.SearchParameters.WriteIndividualFiles) { foreach (var rawFile in Parameters.CurrentRawFileList) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(rawFile); - ResultsDictionary.Add((fileNameWithoutExtension, "Proteins"), ""); + ResultsDictionary.Add((fileNameWithoutExtension, $"{GlobalVariables.AnalyteType.GetBioPolymerLabel()}s"), ""); } } } diff --git a/MetaMorpheus/Test/GlobalVariablesTest.cs b/MetaMorpheus/Test/GlobalVariablesTest.cs index 88bf0f1fb..4ad665468 100644 --- a/MetaMorpheus/Test/GlobalVariablesTest.cs +++ b/MetaMorpheus/Test/GlobalVariablesTest.cs @@ -79,5 +79,40 @@ public static void TestCustomFileExtensionGetter() Assert.That(GlobalVariables.GetFileExtension(test7, getUncompressedExtension: true) == ".fasta"); Assert.That(GlobalVariables.GetFilenameWithoutExtension(test7) == "my.Fi.le"); } + + [Test] + public static void TestGetSpectralMatchLabel() + { + Assert.That(AnalyteType.Peptide.GetSpectralMatchLabel(), Is.EqualTo("PSM")); + Assert.That(AnalyteType.Proteoform.GetSpectralMatchLabel(), Is.EqualTo("PSM")); + Assert.That(AnalyteType.Oligo.GetSpectralMatchLabel(), Is.EqualTo("OSM")); + } + + [Test] + public static void TestGetSpectralMatchExtension() + { + Assert.That(AnalyteType.Peptide.GetSpectralMatchExtension(), Is.EqualTo("psmtsv")); + Assert.That(AnalyteType.Proteoform.GetSpectralMatchExtension(), Is.EqualTo("psmtsv")); + Assert.That(AnalyteType.Oligo.GetSpectralMatchExtension(), Is.EqualTo("osmtsv")); + } + + [Test] + public static void TestGetUniqueFormLabel() + { + Assert.That(AnalyteType.Peptide.GetUniqueFormLabel(), Is.EqualTo("Peptide")); + Assert.That(AnalyteType.Peptide.ToString(), Is.EqualTo("Peptide")); + Assert.That(AnalyteType.Proteoform.GetUniqueFormLabel(), Is.EqualTo("Proteoform")); + Assert.That(AnalyteType.Proteoform.ToString(), Is.EqualTo("Proteoform")); + Assert.That(AnalyteType.Oligo.GetUniqueFormLabel(), Is.EqualTo("Oligo")); + Assert.That(AnalyteType.Oligo.ToString(), Is.EqualTo("Oligo")); + } + + [Test] + public static void TestGetBioPolymerLabel() + { + Assert.That(AnalyteType.Peptide.GetBioPolymerLabel(), Is.EqualTo("Protein")); + Assert.That(AnalyteType.Proteoform.GetBioPolymerLabel(), Is.EqualTo("Protein")); + Assert.That(AnalyteType.Oligo.GetBioPolymerLabel(), Is.EqualTo("Transcript")); + } } } diff --git a/MetaMorpheus/Test/MatchIonsOfAllCharges.cs b/MetaMorpheus/Test/MatchIonsOfAllCharges.cs index 49de53381..7388b3d02 100644 --- a/MetaMorpheus/Test/MatchIonsOfAllCharges.cs +++ b/MetaMorpheus/Test/MatchIonsOfAllCharges.cs @@ -132,7 +132,7 @@ public static void TestMatchIonsOfAllChargesTopDown() MetaMorpheusTask.DetermineAnalyteType(CommonParameters); // test output file name (should be proteoform and not peptide) - Assert.That(GlobalVariables.AnalyteType == "Proteoform"); + Assert.That(GlobalVariables.AnalyteType.ToString() == "Proteoform"); var variableModifications = new List(); var fixedModifications = new List(); diff --git a/MetaMorpheus/Test/TestTopDown.cs b/MetaMorpheus/Test/TestTopDown.cs index c76f95057..13b5e4c8a 100644 --- a/MetaMorpheus/Test/TestTopDown.cs +++ b/MetaMorpheus/Test/TestTopDown.cs @@ -30,7 +30,7 @@ public static void TestClassicSearchEngineTopDown() MetaMorpheusTask.DetermineAnalyteType(CommonParameters); // test output file name (should be proteoform and not peptide) - Assert.That(GlobalVariables.AnalyteType == "Proteoform"); + Assert.That(GlobalVariables.AnalyteType == AnalyteType.Proteoform); var variableModifications = new List(); var fixedModifications = new List();