Skip to content

Commit

Permalink
Merge branch 'master' into speedierGptmd
Browse files Browse the repository at this point in the history
  • Loading branch information
trishorts authored Jan 31, 2025
2 parents 50f2843 + e6cf8e7 commit e347f26
Show file tree
Hide file tree
Showing 49 changed files with 6,868 additions and 203 deletions.
2 changes: 1 addition & 1 deletion MetaMorpheus/CMD/CMD.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<PackageReference Include="Microsoft.ML.CpuMath" Version="3.0.1" />
<PackageReference Include="Microsoft.ML.FastTree" Version="3.0.1" />
<PackageReference Include="Microsoft.NETCore.App" Version="2.2.8" />
<PackageReference Include="mzLib" Version="1.0.553" />
<PackageReference Include="mzLib" Version="1.0.558" />
<PackageReference Include="Nett" Version="0.15.0" />
</ItemGroup>

Expand Down
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;
}
}

2 changes: 1 addition & 1 deletion MetaMorpheus/EngineLayer/EngineLayer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<PackageReference Include="Microsoft.ML.CpuMath" Version="3.0.1" />
<PackageReference Include="Microsoft.ML.FastTree" Version="3.0.1" />
<PackageReference Include="Microsoft.NETCore.App" Version="2.2.8" />
<PackageReference Include="mzLib" Version="1.0.553" />
<PackageReference Include="mzLib" Version="1.0.558" />
<PackageReference Include="NETStandard.Library" Version="2.0.3" />
<PackageReference Include="Nett" Version="0.15.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ private Tuple<int, PeptideWithSetModifications> Accepts(List<Product> fragments,
updatedMods.Add(key, mod.Value);
}
}
if (terminalMod != null)
if (terminalMod != null && !updatedMods.Keys.Contains(startResidue - 1))
{
updatedMods.Add(startResidue - 1, terminalMod);
}
Expand Down
2 changes: 1 addition & 1 deletion MetaMorpheus/GUI/GUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<PackageReference Include="Microsoft.ML.CpuMath" Version="3.0.1" />
<PackageReference Include="Microsoft.ML.FastTree" Version="3.0.1" />
<PackageReference Include="Microsoft.NETCore.App" Version="2.2.8" />
<PackageReference Include="mzLib" Version="1.0.553" />
<PackageReference Include="mzLib" Version="1.0.558" />
<PackageReference Include="Nett" Version="0.15.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="OxyPlot.Core" Version="2.0.0" />
Expand Down
29 changes: 1 addition & 28 deletions MetaMorpheus/GUI/TaskWindows/GPTMDTaskWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,34 +48,7 @@
<GroupBox Header="File Loading Parameters" DockPanel.Dock="Top">
<Expander x:Name="FileLoadExpander" >
<StackPanel>
<GroupBox Header="Deisotoping">
<StackPanel>
<CheckBox x:Name="UseProvidedPrecursor" Content="Use Provided Precursor" IsChecked="True" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500">
<CheckBox.ToolTip>
<TextBlock>
Use the charge states and precursor masses determined by the instrument controller.
</TextBlock>
</CheckBox.ToolTip>
</CheckBox>
<CheckBox x:Name="DeconvolutePrecursors" Content="Deconvolute Precursors" IsChecked="True" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500">
<CheckBox.ToolTip>
<TextBlock>
Additionally searches for coisolated peptides, allowing for multiple peptides to be identified from a single MS2.
</TextBlock>
</CheckBox.ToolTip>
</CheckBox>
<StackPanel Orientation="Horizontal" Margin="5">
<Label Content="Deconvolution Max Assumed Charge State" />
<local:IntegerTexBoxControl x:Name="DeconvolutionMaxAssumedChargeStateTextBox" Width="45" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500">
<TextBox.ToolTip>
<TextBlock>
The maximum charge state that deconvolution should allow. Minimum is 1.
</TextBlock>
</TextBox.ToolTip>
</local:IntegerTexBoxControl>
</StackPanel>
</StackPanel>
</GroupBox>
<local:HostDeconParamControl x:Name="DeisotopingControl" DataContext="{Binding}"/>
<GroupBox Header="Peak Trimming">
<StackPanel>
<CheckBox x:Name="TrimMs1" Content="Trim MS1 Peaks" IsChecked="True" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500">
Expand Down
28 changes: 18 additions & 10 deletions MetaMorpheus/GUI/TaskWindows/GPTMDTaskWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public partial class GptmdTaskWindow : Window
private readonly ObservableCollection<ModTypeForTreeViewModel> GptmdModTypeForTreeViewObservableCollection = new ObservableCollection<ModTypeForTreeViewModel>();
private bool AutomaticallyAskAndOrUpdateParametersBasedOnProtease = true;
private CustomFragmentationWindow CustomFragmentationWindow;
private DeconHostViewModel DeconHostViewModel;

public GptmdTaskWindow(GptmdTask myGPTMDtask)
{
Expand All @@ -39,6 +40,7 @@ public GptmdTaskWindow(GptmdTask myGPTMDtask)
PopulateChoices();
UpdateFieldsFromTask(TheTask);
AutomaticallyAskAndOrUpdateParametersBasedOnProtease = true;
DeisotopingControl.DataContext = DeconHostViewModel;

if (myGPTMDtask == null)
{
Expand All @@ -62,10 +64,10 @@ private void Row_DoubleClick(object sender, MouseButtonEventArgs e)

private void UpdateFieldsFromTask(GptmdTask task)
{
DeconHostViewModel = new DeconHostViewModel(TheTask.CommonParameters.PrecursorDeconvolutionParameters,
TheTask.CommonParameters.ProductDeconvolutionParameters,
TheTask.CommonParameters.UseProvidedPrecursorInfo, TheTask.CommonParameters.DoPrecursorDeconvolution);
ProteaseComboBox.SelectedItem = task.CommonParameters.DigestionParams.Protease; //protease needs to come first or recommended settings can overwrite the actual settings
UseProvidedPrecursor.IsChecked = task.CommonParameters.UseProvidedPrecursorInfo;
DeconvolutePrecursors.IsChecked = task.CommonParameters.DoPrecursorDeconvolution;
DeconvolutionMaxAssumedChargeStateTextBox.Text = task.CommonParameters.DeconvolutionMaxAssumedChargeState.ToString();
MissedCleavagesTextBox.Text = task.CommonParameters.DigestionParams.MaxMissedCleavages == int.MaxValue ? "" : task.CommonParameters.DigestionParams.MaxMissedCleavages.ToString(CultureInfo.InvariantCulture);
MinPeptideLengthTextBox.Text = task.CommonParameters.DigestionParams.MinPeptideLength.ToString(CultureInfo.InvariantCulture);
MaxPeptideLengthTextBox.Text = task.CommonParameters.DigestionParams.MaxPeptideLength == int.MaxValue ? "" : task.CommonParameters.DigestionParams.MaxPeptideLength.ToString(CultureInfo.InvariantCulture);
Expand Down Expand Up @@ -260,8 +262,8 @@ private void ProteaseSpecificUpdate(object sender, SelectionChangedEventArgs e)
case "top-down":
if (UpdateGUISettings.UseTopDownRecommendedSettings())
{
UseProvidedPrecursor.IsChecked = false;
DeconvolutionMaxAssumedChargeStateTextBox.Text = "60";
DeconHostViewModel.UseProvidedPrecursors = false;
DeconHostViewModel.PrecursorDeconvolutionParameters.MaxAssumedChargeState = 60;
TrimMsMs.IsChecked = false;
//uncheck all variable mods
foreach (var mod in VariableModTypeForTreeViewObservableCollection)
Expand Down Expand Up @@ -354,7 +356,7 @@ private void SaveButton_Click(object sender, RoutedEventArgs e)

if (!GlobalGuiSettings.CheckTaskSettingsValidity(PrecursorMassToleranceTextBox.Text, ProductMassToleranceTextBox.Text, MissedCleavagesTextBox.Text,
MaxModificationIsoformsTextBox.Text, MinPeptideLengthTextBox.Text, MaxPeptideLengthTextBox.Text, MaxThreadsTextBox.Text, MinScoreAllowed.Text,
fieldNotUsed, fieldNotUsed, DeconvolutionMaxAssumedChargeStateTextBox.Text, NumberOfPeaksToKeepPerWindowTextBox.Text, MinimumAllowedIntensityRatioToBasePeakTexBox.Text,
fieldNotUsed, fieldNotUsed, DeconHostViewModel.PrecursorDeconvolutionParameters.MaxAssumedChargeState.ToString(), NumberOfPeaksToKeepPerWindowTextBox.Text, MinimumAllowedIntensityRatioToBasePeakTexBox.Text,
null, null, fieldNotUsed, fieldNotUsed, fieldNotUsed, null, null, null))
{
return;
Expand Down Expand Up @@ -441,10 +443,14 @@ private void SaveButton_Click(object sender, RoutedEventArgs e)
}
bool parseMaxThreadsPerFile = int.Parse(MaxThreadsTextBox.Text, CultureInfo.InvariantCulture) <= Environment.ProcessorCount && int.Parse(MaxThreadsTextBox.Text, CultureInfo.InvariantCulture) > 0;

DeconvolutionParameters precursorDeconvolutionParameters = DeconHostViewModel.PrecursorDeconvolutionParameters.Parameters;
DeconvolutionParameters productDeconvolutionParameters = DeconHostViewModel.ProductDeconvolutionParameters.Parameters;
bool useProvidedPrecursorInfo = DeconHostViewModel.UseProvidedPrecursors;
bool doPrecursorDeconvolution = DeconHostViewModel.DoPrecursorDeconvolution;

CommonParameters commonParamsToSave = new CommonParameters(
useProvidedPrecursorInfo: UseProvidedPrecursor.IsChecked.Value,
deconvolutionMaxAssumedChargeState: int.Parse(DeconvolutionMaxAssumedChargeStateTextBox.Text, CultureInfo.InvariantCulture),
doPrecursorDeconvolution: DeconvolutePrecursors.IsChecked.Value,
useProvidedPrecursorInfo: useProvidedPrecursorInfo,
doPrecursorDeconvolution: doPrecursorDeconvolution,
taskDescriptor: OutputFileNameTextBox.Text != "" ? OutputFileNameTextBox.Text : "GPTMDTask",
maxThreadsToUsePerFile: parseMaxThreadsPerFile ? int.Parse(MaxThreadsTextBox.Text, CultureInfo.InvariantCulture) : new CommonParameters().MaxThreadsToUsePerFile,
digestionParams: new DigestionParams(
Expand All @@ -468,7 +474,9 @@ private void SaveButton_Click(object sender, RoutedEventArgs e)
assumeOrphanPeaksAreZ1Fragments: protease.Name != "top-down",
addCompIons: AddCompIonCheckBox.IsChecked.Value,
minVariantDepth: minVariantDepth,
maxHeterozygousVariants: maxHeterozygousVariants);
maxHeterozygousVariants: maxHeterozygousVariants,
precursorDeconParams: precursorDeconvolutionParameters,
productDeconParams: productDeconvolutionParameters);

TheTask.GptmdParameters.ListOfModsGptmd = new List<(string, string)>();
foreach (var heh in GptmdModTypeForTreeViewObservableCollection)
Expand Down
15 changes: 1 addition & 14 deletions MetaMorpheus/GUI/TaskWindows/GlycoSearchTaskWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,20 +159,7 @@
</Style>
</Expander.Style>
<StackPanel>
<GroupBox Header="File Load Parameters">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<StackPanel>
<StackPanel Margin="5">
<CheckBox x:Name="useProvidedPrecursor" Content="Use Provided Precursor"/>
<CheckBox x:Name="deconvolutePrecursors" Content="Deconvolute Precursors"/>
</StackPanel>
</StackPanel>
</Grid>
</GroupBox>
<local:HostDeconParamControl x:Name="DeisotopingControl" DataContext="{Binding}"/>
<GroupBox Header="Peak Trimming">
<StackPanel>
<CheckBox x:Name="trimMs1" Content="Trim MS1 Peaks"/>
Expand Down
Loading

0 comments on commit e347f26

Please sign in to comment.