Skip to content

Commit

Permalink
Analyte type (#2434)
Browse files Browse the repository at this point in the history
* 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 <nbollis@wisc.edu>
Co-authored-by: trishorts <mshort@chem.wisc.edu>
  • Loading branch information
3 people authored Dec 12, 2024
1 parent b82cfaf commit a06bc0d
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 43 deletions.
56 changes: 56 additions & 0 deletions MetaMorpheus/EngineLayer/AnalyteType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using System.Collections.Generic;

namespace EngineLayer
{
public enum AnalyteType
{
Peptide,
Proteoform,
Oligo
}

/// <summary>
/// Accessor methods for specific information about certain analyte types
/// </summary>
public static class AnalyteTypeExtensions
{
private static readonly Dictionary<AnalyteType, AnalyteTypeData> 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;
}

/// <summary>
/// Represents an analyte type and is used to determine the output format of the analyte type.
/// </summary>
internal class AnalyteTypeData(string spectralMatchLabel, string uniqueFormLabel, string bioPolymerLabel, string spectralMatchExtension)
{
/// <summary>
/// Gets or sets the label for spectral matches (e.g. PSM).
/// </summary>
internal string SpectralMatchLabel { get; init; } = spectralMatchLabel;

/// <summary>
/// Extension for spectral matches (e.g. psmtsv).
/// </summary>
internal string SpectralMatchExtension { get; init; } = spectralMatchExtension;

/// <summary>
/// Gets or sets the label for unique forms (e.g. Peptide).
/// </summary>
internal string UniqueFormLabel { get; init; } = uniqueFormLabel;

/// <summary>
/// Gets or sets the label for grouped forms (e.g. Protein).
/// </summary>
internal string BioPolymerLabel { get; init; } = bioPolymerLabel;
}
}

4 changes: 2 additions & 2 deletions MetaMorpheus/EngineLayer/GlobalVariables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> ErrorsReadingMods;

Expand Down Expand Up @@ -65,7 +65,7 @@ public static void SetUpGlobalVariables()
Loaders.LoadElements();
AcceptedDatabaseFormats = new List<string> { ".fasta", ".fa", ".xml", ".msp" };
AcceptedSpectraFormats = new List<string> { ".raw", ".mzml", ".mgf" };
AnalyteType = "Peptide";
AnalyteType = AnalyteType.Peptide;
_InvalidAminoAcids = new char[] { 'X', 'B', 'J', 'Z', ':', '|', ';', '[', ']', '{', '}', '(', ')', '+', '-' };
ExperimentalDesignFileName = "ExperimentalDesign.tsv";
SeparationTypes = new List<string> { { "HPLC" }, { "CZE" } };
Expand Down
3 changes: 3 additions & 0 deletions MetaMorpheus/MetaMorpheus.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=Analyte/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Calib/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=coisolation/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=crosslinked/@EntryIndexedValue">True</s:Boolean>
Expand All @@ -20,9 +21,11 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Nterm/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Ogly/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=oglyco/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Oligo/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Phospho/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=prot/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=proteingroup/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Proteoform/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=psmtsv/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=pwsm/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Silac/@EntryIndexedValue">True</s:Boolean>
Expand Down
4 changes: 2 additions & 2 deletions MetaMorpheus/TaskLayer/MetaMorpheusTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
Loading

0 comments on commit a06bc0d

Please sign in to comment.