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

Add "Library Retention Times" column to the Document Grid #2613

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
2 changes: 2 additions & 0 deletions pwiz_tools/Skyline/Controls/Databinding/SkylineViewContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,8 @@ public static ViewInfo GetDefaultViewInfo(ColumnDescriptor columnDescriptor)
columnsToRemove.Add(PropertyPath.Root.Property("NormalizationMethod"));
columnsToRemove.Add(PropertyPath.Root.Property(nameof(Model.Databinding.Entities.Peptide.AutoSelectPrecursors)));
columnsToRemove.Add(PropertyPath.Root.Property(nameof(Model.Databinding.Entities.Peptide.AttributeGroupId)));
columnsToRemove.Add(
PropertyPath.Root.Property(nameof(Model.Databinding.Entities.Peptide.LibraryRetentionTimes)));
columnsToRemove.Add(PropertyPath.Root.Property(nameof(Model.Databinding.Entities.Peptide.SurrogateExternalStandard)));
foreach (var prop in MoleculeAccessionNumbers.PREFERRED_ACCESSION_TYPE_ORDER)
columnsToRemove.Add(PropertyPath.Root.Property(prop)); // By default don't show CAS, InChI etc
Expand Down

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

12 changes: 12 additions & 0 deletions pwiz_tools/Skyline/Model/Databinding/Entities/ColumnCaptions.resx
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,9 @@
<data name="LibraryRank">
<value>Library Rank</value>
</data>
<data name="LibraryRetentionTimes">
<value>Library Retention Times</value>
</data>
<data name="LibraryScore1">
<value>Library Score1</value>
</data>
Expand Down Expand Up @@ -669,6 +672,9 @@
<data name="MaxHeight">
<value>Max Height</value>
</data>
<data name="MaxLibraryRetentionTime">
<value>Max Library Retention Time</value>
</data>
<data name="MaxRetentionTime">
<value>Max Retention Time</value>
</data>
Expand All @@ -690,6 +696,9 @@
<data name="MeanFwhm">
<value>Mean Fwhm</value>
</data>
<data name="MeanLibraryRetentionTime">
<value>Mean Library Retention Time</value>
</data>
<data name="MeanMaxFwhm">
<value>Mean Max Fwhm</value>
</data>
Expand Down Expand Up @@ -732,6 +741,9 @@
<data name="MinFoldChange">
<value>Min Fold Change</value>
</data>
<data name="MinLibraryRetentionTime">
<value>Min Library Retention Time</value>
</data>
<data name="MinRetentionTime">
<value>Min Retention Time</value>
</data>
Expand Down

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

12 changes: 12 additions & 0 deletions pwiz_tools/Skyline/Model/Databinding/Entities/ColumnToolTips.resx
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,9 @@ spectrum is associated with the precursor ion.</value>
<value>The rank based on LibraryIntensity of this transition among all transitions
allowed by the transition Filter settings, shown in the user interface as “(rank #)”.</value>
</data>
<data name="LibraryRetentionTimes">
<value>Comma separated list of the retention times for the peptide or molecule found in any spectral library.</value>
</data>
<data name="LibraryScore1">
<value>Raw peptide library score that may or may not be used to rank among
precursors of a protein.</value>
Expand Down Expand Up @@ -707,6 +710,9 @@ precursor.</value>
<data name="MaxHeight">
<value>Max Height</value>
</data>
<data name="MaxLibraryRetentionTime">
<value>Maximum retention time for the peptide or molecule found in any spectral library</value>
</data>
<data name="MaxRetentionTime">
<value>Maximum of the transition RetentionTime values.</value>
</data>
Expand All @@ -728,6 +734,9 @@ precursor.</value>
<data name="MeanFwhm">
<value>Mean of the transition Fwhm (peak width) values.</value>
</data>
<data name="MeanLibraryRetentionTime">
<value>Average of the retention times for the peptide or molecule found in any spectral library</value>
</data>
<data name="MeanMaxFwhm">
<value>Mean of the precursor MaxFwhm (peak width) values.</value>
</data>
Expand Down Expand Up @@ -773,6 +782,9 @@ If there are no internal standard peak areas, then the median transition peak ar
<data name="MinFoldChange">
<value>The lower bound of the confidence interval of the fold change.</value>
</data>
<data name="MinLibraryRetentionTime">
<value>Minimum retention time for the peptide or molecule found in any spectral library</value>
</data>
<data name="MinRetentionTime">
<value>Minimum of the transition RetentionTime values.</value>
</data>
Expand Down
10 changes: 10 additions & 0 deletions pwiz_tools/Skyline/Model/Databinding/Entities/Peptide.cs
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,16 @@ public override string ToString()
return DocNode.GetCrosslinkedSequence();
}

[Format(Formats.RETENTION_TIME)]
[ChildDisplayName("{0}LibraryRetentionTime")]
public RetentionTimeValues LibraryRetentionTimes
{
get
{
return RetentionTimeValues.ForTimes(SrmDocument.Settings.GetUnalignedRetentionTimes(DocNode.Target, DocNode.ExplicitMods).Distinct());
}
}

[InvariantDisplayName("PeptideDocumentLocation")]
[Obsolete]
public DocumentLocation DocumentLocation
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* Original author: Nicholas Shulman <nicksh .at. u.washington.edu>,
* MacCoss Lab, Department of Genome Sciences, UW
*
* Copyright 2023 University of Washington - Seattle, WA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using pwiz.Common.Collections;
using pwiz.Common.DataBinding.Attributes;
using pwiz.Skyline.Model.Hibernate;
using pwiz.Skyline.Util;

namespace pwiz.Skyline.Model.Databinding.Entities
{
/// <summary>
/// Formattable list of retention time values which also has "Min", "Max" and "Mean" sub-properties.
/// Suitable for displaying a list of retention times in the Document Grid.
/// </summary>
public class RetentionTimeValues : IFormattable
{
private ImmutableList<double> _times;
private RetentionTimeValues(ImmutableList<double> times)
{
_times = times;
}

public static RetentionTimeValues ForTimes(IEnumerable<double> times)
{
var list = ImmutableList.ValueOf(times.OrderBy(t => t));
if (list.Count == 0)
{
return null;
}

return new RetentionTimeValues(list);
}

[Format(Formats.RETENTION_TIME)]
public double Min
{
get { return _times[0]; }
}

[Format(Formats.RETENTION_TIME)]
public double Max
{
get { return _times[_times.Count - 1]; }
}

[Format(Formats.RETENTION_TIME)]
public double Mean
{
get { return _times.Average(); }
}

public string ToString(string format, IFormatProvider formatProvider)
{
return new FormattableList<double>(_times).ToString(format, formatProvider);
}

public override string ToString()
{
return new FormattableList<double>(_times).ToString();
}
}
}
1 change: 1 addition & 0 deletions pwiz_tools/Skyline/Skyline.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@
</Compile>
<Compile Include="Model\Databinding\Collections\FixedSkylineObjectList.cs" />
<Compile Include="Model\Databinding\Entities\CalibrationCurveMetrics.cs" />
<Compile Include="Model\Databinding\Entities\RetentionTimeValues.cs" />
<Compile Include="Model\Databinding\Entities\ColumnCaptions.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
Expand Down