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

Skyline: Raised the peak truncation threshold #3361

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,9 @@
<data name="ProductNeutralMass">
<value>Product Neutral Mass</value>
</data>
<data name="ProportionTruncated">
<value>Proportion Truncated</value>
</data>
<data name="Protein">
<value>Protein</value>
</data>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ appeared on the heavy transitions.</value>
<value>If true, then Skyline will automatically add or remove transitions from the precursor depending on the Transition Settings Filter, spectral library, etc.</value>
</data>
<data name="AverageMassErrorPPM">
<value>Average Mass Error PPM</value>
<value>The area weighted mean for all transitions of the difference between the expected and measured m/z values expressed in parts per million (PPM)</value>
</data>
<data name="AverageMasses">
<value>The modified sequence which specifies modifications with their average masses, e.g. "C[+57.05162]".</value>
Expand Down Expand Up @@ -319,7 +319,7 @@ specific default collision energy equation within Skyline</value>
<data name="CountTruncated">
<value>The number of transitions for a precursor that integrate a peak with a
boundary at either end of the acquisition time range, where intensity at the end is
greater than 1% of the entire peak height higher than the other extent.</value>
greater than 25% of the background-subtracted peak height higher than the other extent.</value>
</data>
<data name="Cv">
<value>Cv</value>
Expand Down Expand Up @@ -1246,6 +1246,11 @@ the decoy m/z.</value>
<data name="ProductNeutralMass">
<value>Neutral mass of the product ion peptide fragment in Daltons.</value>
</data>
<data name="ProportionTruncated">
<value>The area weighted mean (0 to 1.0) of transitions for a precursor that integrate a peak with a
boundary at either end of the acquisition time range, where intensity at the end is
greater than 25% of the background-subtracted peak height higher than the other extent.</value>
</data>
<data name="Protein">
<value>Protein</value>
</data>
Expand Down Expand Up @@ -1651,8 +1656,8 @@ using the Results Grid.</value>
<value>Transitions</value>
</data>
<data name="Truncated">
<value>True if the integrated a peak has a boundary at either end of the acquisition
time range, where intensity at the end is greater than 1% of the entire peak height
<value>True if the integrate peak has a boundary at either end of the acquisition
time range, where intensity at the end is greater than 25% of the background-subtracted peak height
higher than the other extent.</value>
</data>
<data name="TurningPoint">
Expand Down
45 changes: 45 additions & 0 deletions pwiz_tools/Skyline/Model/Databinding/Entities/PrecursorResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ public double? RatioDotProduct {
public double? AverageMassErrorPPM { get { return ChromInfo.MassError; } }
[Format(NullValue = TextUtil.EXCEL_NA)]
public int? CountTruncated { get { return ChromInfo.Truncated; } }
[Format(Formats.Percent, NullValue = TextUtil.EXCEL_NA)]
public double? ProportionTruncated { get { return CalculateProportionTruncated(); } }
public PeakIdentification Identified { get { return ChromInfo.Identified; } }
[Format(Formats.STANDARD_RATIO, NullValue = TextUtil.EXCEL_NA)]
public double? LibraryDotProduct { get { return ChromInfo.LibraryDotProduct; } }
Expand Down Expand Up @@ -488,5 +490,48 @@ private LcPeakIonMetrics GetIonMetrics(ResultFileMetaData resultFileMetadata, IL

return lcPeakIonMetrics;
}

private double? CalculateProportionTruncated()
{
double totalArea = 0;
double truncatedArea = 0;
var srmSettings = DataSchema.Document.Settings;
var resultFile = GetResultFile();
foreach (var transition in Precursor.DocNode.Transitions)
{
if (!transition.IsQuantitative(srmSettings))
{
continue;
}

foreach (var transitionChromInfo in transition.GetSafeChromInfo(
resultFile.Replicate.ReplicateIndex))
{
if (transitionChromInfo.OptimizationStep != resultFile.OptimizationStep ||
!ReferenceEquals(transitionChromInfo.FileId, resultFile.ChromFileInfoId))
{
continue;
}

if (!transitionChromInfo.IsTruncated.HasValue || transitionChromInfo.Area <= 0)
{
continue;
}

totalArea += transitionChromInfo.Area;
if (transitionChromInfo.IsTruncated.Value)
{
truncatedArea += transitionChromInfo.Area;
}
}
}

if (totalArea <= 0)
{
return null;
}

return truncatedArea / totalArea;
}
}
}
2 changes: 1 addition & 1 deletion pwiz_tools/Skyline/Model/Results/ChromHeaderInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@ public ChromPeak(IPeakFinder finder,
// recorded values, where the intensity is higher than the other extent
// by more than 1% of the peak height.
_flagValues |= FlagValues.peak_truncation_known;
const double truncationTolerance = 0.01;
const double truncationTolerance = 0.25;
double deltaIntensityExtents = (intensities[peak.EndIndex] - intensities[peak.StartIndex]) / Height;
if ((peak.StartIndex == 0 && deltaIntensityExtents < -truncationTolerance) ||
(peak.EndIndex == times.Count - 1 && deltaIntensityExtents > truncationTolerance))
Expand Down
10 changes: 9 additions & 1 deletion pwiz_tools/Skyline/Test/MProphetResultsHandlerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,15 @@ public void TestMProphetResultsHandler()
AssertEx.FileEquals(mProphetExpected, mProphetActual);

// 4. Export mProphet -> Import Peak Boundaries leads to same result as reintegrate
var resultsHandlerQAll = new MProphetResultsHandler(docOriginal, peakScoringModel) { QValueCutoff = 1.0 };

// Remove RWSSIPLSQLHLI because its truncation values change between 24.11 and 24.12
// That is the ChromPeak.Truncated value stored in the .skyd file is different from
// what gets recalculated during peak boundary import.
var pepRemovePath = docOriginal.EnumeratePathsAtLevel(IdentityPath.ROOT, SrmDocument.Level.Molecules)
.First(path => path.Child is Peptide { Sequence: @"RWSSIPLSQLHLI" });
var docRemoved = (SrmDocument) docOriginal.RemoveChild(pepRemovePath.Parent, docOriginal.FindNode(pepRemovePath));

var resultsHandlerQAll = new MProphetResultsHandler(docRemoved, peakScoringModel) { QValueCutoff = 1.0 };
resultsHandlerQAll.ScoreFeatures();
var docNewQAll = resultsHandlerQAll.ChangePeaks();
var peakBoundaryImporter = new PeakBoundaryImporter(docNewQAll);
Expand Down
6 changes: 3 additions & 3 deletions pwiz_tools/Skyline/TestPerf/DiaSwathTutorialTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@ public void TestQeData(bool fullSet)
new[] { 2.2, 4.6 },
new[] { 1.9, 4.7 },
},
DiffPeptideCounts = new[] { 10459, 6387, 2238, 1823 },
UnpolishedProteins = 1647,
PolishedProteins = 1647,
DiffPeptideCounts = new[] { 10467, 6391, 2242, 1823 },
UnpolishedProteins = 1653,
PolishedProteins = 2031,
};
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ private void ExploreTopPeptides()
OkDialog(findDlg, findDlg.Close);

var findView = WaitForOpenForm<FindResultsForm>();
int expectedItems = IsFullData ? 454 : 290;
int expectedItems = IsFullData ? 228 : 151;
try
{
WaitForConditionUI(1000, () => findView.ItemCount == expectedItems);
Expand Down Expand Up @@ -610,9 +610,9 @@ private void AddTruncatedPrecursorsView(DocumentGridForm documentGrid, bool init
OkDialog(viewEditor, viewEditor.OkDialog);

var pathTruncated = PropertyPath.Parse("Results!*.Value.CountTruncated");
int expectedItems = 148;
int expectedItems = 86;
if (IsFullData)
expectedItems = 221; // initialTestExecution ? 223 : 221;
expectedItems = 129;
try
{
WaitForConditionUI(1000, () => documentGrid.RowCount == expectedItems &&
Expand Down Expand Up @@ -1155,7 +1155,7 @@ private void PrepareForStatistics()

PauseForScreenShot<DocumentGridForm>("Document Grid with MissingData field");

int expectedRows = IsFullData ? 222 : 149;
int expectedRows = IsFullData ? 133 : 89;
const int expectedRowsAbbreviated = 221; // When not all of the tests are run
RunUI(() =>
{
Expand Down
Loading