Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made updates pertaining to PIP-ECHO #2468

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MetaMorpheus/GUI/TaskWindows/CalibrateTaskWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,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, fieldNotUsed, fieldNotUsed, fieldNotUsed, null, null, fieldNotUsed, MaxModsPerPeptideTextBox.Text, fieldNotUsed,
fieldNotUsed, fieldNotUsed, fieldNotUsed, fieldNotUsed, fieldNotUsed, fieldNotUsed, null, null, fieldNotUsed, MaxModsPerPeptideTextBox.Text, fieldNotUsed,
null, null, null))
{
return;
Expand Down
2 changes: 1 addition & 1 deletion MetaMorpheus/GUI/TaskWindows/GPTMDTaskWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,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, DeconHostViewModel.PrecursorDeconvolutionParameters.MaxAssumedChargeState.ToString(), NumberOfPeaksToKeepPerWindowTextBox.Text, MinimumAllowedIntensityRatioToBasePeakTexBox.Text,
fieldNotUsed, fieldNotUsed, fieldNotUsed, DeconHostViewModel.PrecursorDeconvolutionParameters.MaxAssumedChargeState.ToString(), NumberOfPeaksToKeepPerWindowTextBox.Text, MinimumAllowedIntensityRatioToBasePeakTexBox.Text,
null, null, fieldNotUsed, fieldNotUsed, fieldNotUsed, null, null, null))
{
return;
Expand Down
2 changes: 1 addition & 1 deletion MetaMorpheus/GUI/TaskWindows/GlycoSearchTaskWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ private void SaveButton_Click(object sender, RoutedEventArgs e)

if (!GlobalGuiSettings.CheckTaskSettingsValidity(PrecusorMsTlTextBox.Text, productMassToleranceTextBox.Text, missedCleavagesTextBox.Text,
maxModificationIsoformsTextBox.Text, MinPeptideLengthTextBox.Text, MaxPeptideLengthTextBox.Text, maxThreadsTextBox.Text, minScoreAllowed.Text,
fieldNotUsed, fieldNotUsed, DeconHostViewModel.PrecursorDeconvolutionParameters.MaxAssumedChargeState.ToString(), TopNPeaksTextBox.Text, MinRatioTextBox.Text, null, null, numberOfDatabaseSearchesTextBox.Text, TxtBoxMaxModPerPep.Text,
fieldNotUsed, fieldNotUsed, fieldNotUsed, DeconHostViewModel.PrecursorDeconvolutionParameters.MaxAssumedChargeState.ToString(), TopNPeaksTextBox.Text, MinRatioTextBox.Text, null, null, numberOfDatabaseSearchesTextBox.Text, TxtBoxMaxModPerPep.Text,
fieldNotUsed, null, null, null))
{
return;
Expand Down
27 changes: 24 additions & 3 deletions MetaMorpheus/GUI/TaskWindows/SearchTaskWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -428,10 +428,10 @@
<ToolTip Content="Intensity of reporter ions are reported as additional columns in AllPeptides.psmtsv and AllPSMs.psmtsv" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500"/>
</ToolTipService.ToolTip>
</RadioButton>
<RadioButton x:Name="CheckBoxLFQwSpectralRecovery" Content="LFQ + Spectral Recovery: Spectral recovery finds misidentified MS/MS spectra common in single-cell proteomics data"
<RadioButton x:Name="CheckBoxLFQwSpectralRecovery" Content="LFQ + Spectral Recovery: Spectral recovery finds missed MS/MS spectra common in single-cell proteomics data"
GroupName="QuantType" Click="SpectralRecoveryUpdate">
<ToolTipService.ToolTip>
<ToolTip Content="Match between runs analysis via spectral library search" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500" />
<ToolTip Content="Re-analyzes MS/MS spectra based on the results of MBR to find spectra that may have been missed during the inital search" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500" />
</ToolTipService.ToolTip>
</RadioButton>

Expand Down Expand Up @@ -508,7 +508,7 @@
</MultiBinding>
</CheckBox.Visibility>
<ToolTipService.ToolTip>
<ToolTip Content="(LFQ) Use MS2 identifications from one run to quantify those same peptides in other runs where they were not identified&#x0a;Selecting &quot;Write Spectral Library&quot; in the Output Options below will enable additional MBR analysis" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500" />
<ToolTip Content="(LFQ) Use MS2 identifications from one run to quantify those same peptides in other runs where they were not identified" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500" />
</ToolTipService.ToolTip>
</CheckBox>
<CheckBox x:Name="CheckBoxNormalize" Content="Normalize quantification results">
Expand Down Expand Up @@ -545,6 +545,27 @@
<ToolTip Content="Use peptide sequences shared between proteins for protein quantification" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500" />
</ToolTipService.ToolTip>
</CheckBox>
<StackPanel Orientation="Horizontal">
<StackPanel.IsEnabled>
<MultiBinding Converter="{StaticResource boolOrConverter}">
<Binding ElementName="CheckBoxLFQ" Path ="IsChecked"/>
<Binding ElementName="CheckBoxLFQwSpectralRecovery" Path ="IsChecked"/>
</MultiBinding>
</StackPanel.IsEnabled>
<StackPanel.Visibility>
<MultiBinding Converter="{StaticResource boolOr2VisConverter}">
<Binding ElementName="CheckBoxLFQ" Path ="IsChecked"/>
<Binding ElementName="CheckBoxLFQwSpectralRecovery" Path ="IsChecked"/>
</MultiBinding>
</StackPanel.Visibility>

<local:DoubleTextBoxControl x:Name="MbrFdrThresholdTextBox" Width="45" Height="20">
<ToolTipService.ToolTip>
<ToolTip Content="Q-Value Threshold for MBR&#x0a;Determines which MBR matches will be reported in the AllQuantifiedPeptides and AllQuantifiedProteinGroups outputs" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500" />
</ToolTipService.ToolTip>
</local:DoubleTextBoxControl>
<Label x:Name="MbrFdrThreshold" Content=" MBR Q-Value Threshold" />
</StackPanel>

<!-- Multiplex Options -->
<StackPanel Orientation="Horizontal" Margin="5 5 5 0" Grid.Column="0" Grid.Row="0">
Expand Down
3 changes: 3 additions & 0 deletions MetaMorpheus/GUI/TaskWindows/SearchTaskWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ private void UpdateFieldsFromTask(SearchTask task)
CheckBoxQuantifyUnlabeledForSilac.IsChecked = task.CommonParameters.DigestionParams.GeneratehUnlabeledProteinsForSilac;
PeakFindingToleranceTextBox.Text = task.SearchParameters.QuantifyPpmTol.ToString(CultureInfo.InvariantCulture);
CheckBoxMatchBetweenRuns.IsChecked = task.SearchParameters.MatchBetweenRuns;
MbrFdrThresholdTextBox.Text = task.SearchParameters.MbrFdrThreshold.ToString(CultureInfo.InvariantCulture);
CheckBoxNormalize.IsChecked = task.SearchParameters.Normalize;
ModPepsAreUnique.IsChecked = task.SearchParameters.ModPeptidesAreDifferent;
CheckBoxHistogramAnalysis.IsChecked = task.SearchParameters.DoHistogramAnalysis;
Expand Down Expand Up @@ -441,6 +442,7 @@ private void SaveButton_Click(object sender, RoutedEventArgs e)
MaxThreadsTextBox.Text,
MinScoreAllowed.Text,
PeakFindingToleranceTextBox.Text,
MbrFdrThresholdTextBox.Text,
HistogramBinWidthTextBox.Text,
DeconHostViewModel.PrecursorDeconvolutionParameters.MaxAssumedChargeState.ToString(),
NumberOfPeaksToKeepPerWindowTextBox.Text,
Expand Down Expand Up @@ -640,6 +642,7 @@ private void SaveButton_Click(object sender, RoutedEventArgs e)
TheTask.SearchParameters.MultiplexModId = (string)MultiplexComboBox.SelectedItem;
TheTask.SearchParameters.Normalize = CheckBoxNormalize.IsChecked.Value;
TheTask.SearchParameters.MatchBetweenRuns = CheckBoxMatchBetweenRuns.IsChecked.Value;
TheTask.SearchParameters.MbrFdrThreshold = double.Parse(MbrFdrThresholdTextBox.Text, CultureInfo.InvariantCulture);
TheTask.SearchParameters.ModPeptidesAreDifferent = ModPepsAreUnique.IsChecked.Value;
TheTask.SearchParameters.QuantifyPpmTol = double.Parse(PeakFindingToleranceTextBox.Text, CultureInfo.InvariantCulture);
TheTask.SearchParameters.SearchTarget = CheckBoxTarget.IsChecked.Value;
Expand Down
2 changes: 1 addition & 1 deletion MetaMorpheus/GUI/TaskWindows/XLSearchTaskWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ private void SaveButton_Click(object sender, RoutedEventArgs e)

if (!GlobalGuiSettings.CheckTaskSettingsValidity(XLPrecusorMsTlTextBox.Text, productMassToleranceTextBox.Text, missedCleavagesTextBox.Text,
maxModificationIsoformsTextBox.Text, MinPeptideLengthTextBox.Text, MaxPeptideLengthTextBox.Text, maxThreadsTextBox.Text, minScoreAllowed.Text,
fieldNotUsed, fieldNotUsed, DeconHostViewModel.PrecursorDeconvolutionParameters.MaxAssumedChargeState.ToString(), TopNPeaksTextBox.Text, MinRatioTextBox.Text, null, null, numberOfDatabaseSearchesTextBox.Text,
fieldNotUsed, fieldNotUsed, fieldNotUsed, DeconHostViewModel.PrecursorDeconvolutionParameters.MaxAssumedChargeState.ToString(), TopNPeaksTextBox.Text, MinRatioTextBox.Text, null, null, numberOfDatabaseSearchesTextBox.Text,
fieldNotUsed, fieldNotUsed, null, null, null))
{
return;
Expand Down
15 changes: 14 additions & 1 deletion MetaMorpheus/GUI/Util/GlobalGuiSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public static bool CheckTaskSettingsValidity(string precursorMassTolerance,
string maxThreads,
string minScore,
string peakFindingTolerance,
string mbrFdrThreshold,
string histogramBinWidth,
string deconMaxAssumedCharge,
string numberOfPeaksToKeepPerWindow,
Expand Down Expand Up @@ -50,6 +51,7 @@ string minInternalIonLength
(CheckMaxThreads(maxThreads)),
(CheckMinScoreAllowed(minScore)),
(CheckPeakFindingTolerance(peakFindingTolerance)),
(CheckMbrFdrThreshold(mbrFdrThreshold)),
(CheckHistogramBinWidth(histogramBinWidth)),
(CheckDeconvolutionMaxAssumedChargeState(deconMaxAssumedCharge)),
(CheckTopNPeaks(numberOfPeaksToKeepPerWindow)),
Expand Down Expand Up @@ -271,7 +273,18 @@ public static bool CheckPeakFindingTolerance(string text)
}
return true;
}


public static bool CheckMbrFdrThreshold(string text)
{
if (!double.TryParse(text, NumberStyles.Any, CultureInfo.InvariantCulture, out double mbrFdrThreshold) || mbrFdrThreshold > 1)
{
MessageBox.Show("The MBR FDR Threshold is invalid. \n You entered " + '"' + text + '"' + "\n Please enter a positive number less than or equal to 1.");
return false;
}
return true;
}


public static bool CheckHistogramBinWidth(string text)
{
if (!double.TryParse(text, NumberStyles.Any, CultureInfo.InvariantCulture, out double binWidth) || binWidth < 0 || binWidth > 1)
Expand Down
25 changes: 15 additions & 10 deletions MetaMorpheus/TaskLayer/FilteredPsms.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,18 +162,23 @@ public static IEnumerable<SpectralMatch> FilterByQValue(this IEnumerable<Spectra
{
yield return psm;
}
else if (filterType == FilterType.PepQValue)
else if (psm.GetFdrInfo(filterAtPeptideLevel) != null)
{
if (psm.GetFdrInfo(filterAtPeptideLevel).PEP_QValue <= qValueThreshold)
switch(filterType)
{
yield return psm;
}
}
else
{
if (psm.GetFdrInfo(filterAtPeptideLevel).QValue <= qValueThreshold && psm.GetFdrInfo(filterAtPeptideLevel).QValueNotch <= qValueThreshold)
{
yield return psm;
case FilterType.PepQValue:
if (psm.GetFdrInfo(filterAtPeptideLevel).PEP_QValue <= qValueThreshold)
{
yield return psm;
}
break;
case FilterType.QValue:
default:
if (psm.GetFdrInfo(filterAtPeptideLevel).QValue <= qValueThreshold && psm.GetFdrInfo(filterAtPeptideLevel).QValueNotch <= qValueThreshold)
{
yield return psm;
}
break;
}
}
}
Expand Down
30 changes: 26 additions & 4 deletions MetaMorpheus/TaskLayer/SearchTask/PostSearchAnalysisTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,22 @@ private void QuantificationAnalysis()
// get PSMs to pass to FlashLFQ
var psmsForQuantification = FilteredPsms.Filter(Parameters.AllPsms,
CommonParameters,
includeDecoys: false,
includeDecoys: Parameters.SearchParameters.MatchBetweenRuns, // Decoys are required for PIP-ECHO, but are not written to the output file
includeContaminants: true,
includeAmbiguous: false,
includeAmbiguousMods: false,
includeHighQValuePsms: false);

// Only these peptides will be written to the AllQuantifiedPeptides.tsv output file
var peptideSequencesForQuantification = FilteredPsms.Filter(Parameters.AllPsms,
CommonParameters,
includeDecoys: false,
nbollis marked this conversation as resolved.
Show resolved Hide resolved
includeContaminants: true,
includeAmbiguous: false,
includeAmbiguousMods: false,
includeHighQValuePsms: false,
filterAtPeptideLevel: true).Select(p => p.FullSequence).ToList();

// pass protein group info for each PSM
var psmToProteinGroups = new Dictionary<SpectralMatch, List<FlashLFQ.ProteinGroup>>();
if (ProteinGroups != null && ProteinGroups.Count != 0) //ProteinGroups can be null if parsimony wasn't done, and it can be empty if you're doing the two peptide rule
Expand Down Expand Up @@ -501,12 +511,22 @@ private void QuantificationAnalysis()
var flashLFQIdentifications = new List<Identification>();
foreach (var spectraFile in psmsGroupedByFile)
{
var rawfileinfo = spectraFileInfo.Where(p => p.FullFilePathWithExtension.Equals(spectraFile.Key)).First();
var rawfileinfo = spectraFileInfo.First(p => p.FullFilePathWithExtension.Equals(spectraFile.Key));

foreach (var psm in spectraFile)
{
flashLFQIdentifications.Add(new Identification(rawfileinfo, psm.BaseSequence, psm.FullSequence,
psm.BioPolymerWithSetModsMonoisotopicMass.Value, psm.ScanRetentionTime, psm.ScanPrecursorCharge, psmToProteinGroups[psm]));
flashLFQIdentifications.Add(
new Identification(
fileInfo: rawfileinfo,
psm.BaseSequence,
psm.FullSequence,
psm.BioPolymerWithSetModsMonoisotopicMass.Value,
psm.ScanRetentionTime,
psm.ScanPrecursorCharge,
psmToProteinGroups[psm],
psmScore: psm.Score,
qValue: psmsForQuantification.FilterType == FilterType.QValue ? psm.FdrInfo.QValue : psm.FdrInfo.PEP_QValue,
decoy: psm.IsDecoy));
}
}

Expand All @@ -517,7 +537,9 @@ private void QuantificationAnalysis()
ppmTolerance: Parameters.SearchParameters.QuantifyPpmTol,
matchBetweenRunsPpmTolerance: Parameters.SearchParameters.QuantifyPpmTol, // If these tolerances are not equivalent, then MBR will falsely classify peptides found in the initial search as MBR peaks
matchBetweenRuns: Parameters.SearchParameters.MatchBetweenRuns,
matchBetweenRunsFdrThreshold: Parameters.SearchParameters.MbrFdrThreshold,
useSharedPeptidesForProteinQuant: Parameters.SearchParameters.UseSharedPeptidesForLFQ,
peptideSequencesToQuantify: Parameters.SearchParameters.SilacLabels == null ? peptideSequencesForQuantification : null, // Silac is doing it's own thing, no need to pass in peptide sequences
silent: true,
maxThreads: CommonParameters.MaxThreadsToUsePerFile);

Expand Down
2 changes: 2 additions & 0 deletions MetaMorpheus/TaskLayer/SearchTask/SearchParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public SearchParameters()
UseSharedPeptidesForLFQ = false;
DoSpectralRecovery = false;
QuantifyPpmTol = 5;
MbrFdrThreshold = 0.01;
SearchTarget = true;
DecoyType = DecoyType.Reverse;
DoHistogramAnalysis = false;
Expand Down Expand Up @@ -67,6 +68,7 @@ public SearchParameters()
public bool ModPeptidesAreDifferent { get; set; }
public bool NoOneHitWonders { get; set; }
public bool MatchBetweenRuns { get; set; }
public double MbrFdrThreshold { get; set; }
public bool Normalize { get; set; }
public double QuantifyPpmTol { get; set; }
public bool DoHistogramAnalysis { get; set; }
Expand Down
Loading