From 66a80e07bc2fbcad46b13520baba2449d3039a05 Mon Sep 17 00:00:00 2001 From: nicksh Date: Wed, 18 Jan 2023 15:11:04 -0800 Subject: [PATCH 1/3] Fixed bug where changes to column values such as "Protein Note" made in the Fold Change grid seem to disappear immediately. Also, simplify class "SkylineObjectList" by removing generic argument "TKey" so the class's only generic argument is "TItem". --- .../Skyline/Controls/AuditLog/AuditLogForm.cs | 13 +----- .../FoldChangeBindingSource.cs | 5 ++- .../Collections/FixedSkylineObjectList.cs | 41 +++++++++++++++++++ .../Collections/MultiResultList.cs | 10 +++++ .../Model/Databinding/Collections/NodeList.cs | 6 ++- .../Databinding/Collections/ReplicateList.cs | 16 +++----- .../Databinding/Collections/ResultList.cs | 37 ++++------------- .../Collections/SkylineObjectList.cs | 20 ++------- .../Skyline/Model/Lists/ListRowSource.cs | 24 ++--------- pwiz_tools/Skyline/Skyline.csproj | 1 + 10 files changed, 81 insertions(+), 92 deletions(-) create mode 100644 pwiz_tools/Skyline/Model/Databinding/Collections/FixedSkylineObjectList.cs diff --git a/pwiz_tools/Skyline/Controls/AuditLog/AuditLogForm.cs b/pwiz_tools/Skyline/Controls/AuditLog/AuditLogForm.cs index 222307795d..c897db7cba 100644 --- a/pwiz_tools/Skyline/Controls/AuditLog/AuditLogForm.cs +++ b/pwiz_tools/Skyline/Controls/AuditLog/AuditLogForm.cs @@ -19,7 +19,6 @@ using System; using System.Collections; -using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Windows.Forms; @@ -185,22 +184,12 @@ public static AuditLogForm MakeAuditLogForm(SkylineWindow skylineWindow) return new AuditLogForm(viewContext, viewInfos[2].Name); } - private class AuditLogRowSource : SkylineObjectList + private class AuditLogRowSource : SkylineObjectList { public AuditLogRowSource(SkylineDataSchema dataSchema) : base(dataSchema) { } - protected override IEnumerable ListKeys() - { - throw new InvalidOperationException(); - } - - protected override AuditLogRow ConstructItem(object key) - { - throw new InvalidOperationException(); - } - private static AuditLogRow GetRow(AuditLogEntry entry, SkylineDataSchema skylineDataSchema, int id) { return new AuditLogRow(skylineDataSchema, entry, id); diff --git a/pwiz_tools/Skyline/Controls/GroupComparison/FoldChangeBindingSource.cs b/pwiz_tools/Skyline/Controls/GroupComparison/FoldChangeBindingSource.cs index 55f4eed528..4b09dc0c0a 100644 --- a/pwiz_tools/Skyline/Controls/GroupComparison/FoldChangeBindingSource.cs +++ b/pwiz_tools/Skyline/Controls/GroupComparison/FoldChangeBindingSource.cs @@ -28,6 +28,7 @@ using pwiz.Skyline.Controls.Databinding; using pwiz.Skyline.Model; using pwiz.Skyline.Model.Databinding; +using pwiz.Skyline.Model.Databinding.Collections; using pwiz.Skyline.Model.Databinding.Entities; using pwiz.Skyline.Model.GroupComparison; using pwiz.Skyline.Model.Hibernate; @@ -161,9 +162,9 @@ private IList CreateRowSourceInfos(IList foldChang var rowSourceInfos = new List() { - new RowSourceInfo(new StaticRowSource(foldChangeRows), + new RowSourceInfo(new FixedSkylineObjectList(_skylineDataSchema, foldChangeRows), new ViewInfo(_skylineDataSchema, typeof(FoldChangeRow), defaultViewSpec).ChangeViewGroup(ViewGroup.BUILT_IN)), - new RowSourceInfo(new StaticRowSource(detailRows), + new RowSourceInfo(new FixedSkylineObjectList(_skylineDataSchema, detailRows), new ViewInfo(_skylineDataSchema, typeof(FoldChangeDetailRow), clusteredViewSpec).ChangeViewGroup(ViewGroup.BUILT_IN)) }; return rowSourceInfos; diff --git a/pwiz_tools/Skyline/Model/Databinding/Collections/FixedSkylineObjectList.cs b/pwiz_tools/Skyline/Model/Databinding/Collections/FixedSkylineObjectList.cs new file mode 100644 index 0000000000..5df2cc9107 --- /dev/null +++ b/pwiz_tools/Skyline/Model/Databinding/Collections/FixedSkylineObjectList.cs @@ -0,0 +1,41 @@ +/* + * Original author: Nicholas Shulman , + * MacCoss Lab, Department of Genome Sciences, UW + * + * Copyright 2022 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.Collections; +using System.Collections.Generic; +using pwiz.Common.Collections; + +namespace pwiz.Skyline.Model.Databinding.Collections +{ + /// + /// A list whose contents do not change when the Skyline document changes. + /// + public class FixedSkylineObjectList : SkylineObjectList + { + private ImmutableList _items; + public FixedSkylineObjectList(SkylineDataSchema schema, IEnumerable items) : base(schema) + { + _items = ImmutableList.ValueOf(items); + } + + public override IEnumerable GetItems() + { + return _items; + } + } +} diff --git a/pwiz_tools/Skyline/Model/Databinding/Collections/MultiResultList.cs b/pwiz_tools/Skyline/Model/Databinding/Collections/MultiResultList.cs index 9c2592d557..583b6083c2 100644 --- a/pwiz_tools/Skyline/Model/Databinding/Collections/MultiResultList.cs +++ b/pwiz_tools/Skyline/Model/Databinding/Collections/MultiResultList.cs @@ -16,6 +16,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +using System.Collections; using System.Collections.Generic; using System.Linq; using pwiz.Common.Collections; @@ -34,6 +36,14 @@ protected MultiResultList(SkylineDataSchema dataSchema, IEnumerable do } public IList DocNodes { get; private set; } + + public override IEnumerable GetItems() + { + return ListKeys().Select(ConstructItem); + } + + protected abstract IEnumerable ListKeys(); + protected abstract TMultiResult ConstructItem(ResultFileKey key); } public class MultiTransitionResultList : MultiResultList { diff --git a/pwiz_tools/Skyline/Model/Databinding/Collections/NodeList.cs b/pwiz_tools/Skyline/Model/Databinding/Collections/NodeList.cs index fc36becb63..8495eb31a5 100644 --- a/pwiz_tools/Skyline/Model/Databinding/Collections/NodeList.cs +++ b/pwiz_tools/Skyline/Model/Databinding/Collections/NodeList.cs @@ -25,7 +25,7 @@ namespace pwiz.Skyline.Model.Databinding.Collections { - public abstract class NodeList : SkylineObjectList where TNode : SkylineDocNode + public abstract class NodeList : SkylineObjectList where TNode : SkylineDocNode { private IList _ancestorIdentityPaths = ImmutableList.Empty(); @@ -64,7 +64,7 @@ public void SetAncestorIdentityPaths(IEnumerable identityPaths) } - protected override IEnumerable ListKeys() + protected IEnumerable ListKeys() { return RecurseListingKeys(IdentityPath.ROOT, SrmDocument); } @@ -119,6 +119,8 @@ protected static bool StartsWith(IdentityPath child, IdentityPath ancestor) return true; } + protected abstract TNode ConstructItem(IdentityPath key); + public override IEnumerable GetItems() { return ListKeys().Select(ConstructItem); diff --git a/pwiz_tools/Skyline/Model/Databinding/Collections/ReplicateList.cs b/pwiz_tools/Skyline/Model/Databinding/Collections/ReplicateList.cs index 3396eea164..aaea2df679 100644 --- a/pwiz_tools/Skyline/Model/Databinding/Collections/ReplicateList.cs +++ b/pwiz_tools/Skyline/Model/Databinding/Collections/ReplicateList.cs @@ -17,29 +17,25 @@ * limitations under the License. */ -using System.Collections.Generic; +using System; +using System.Collections; using System.Linq; using pwiz.Skyline.Model.Databinding.Entities; namespace pwiz.Skyline.Model.Databinding.Collections { - public class ReplicateList : SkylineObjectList + public class ReplicateList : SkylineObjectList { public ReplicateList(SkylineDataSchema dataSchema) : base(dataSchema) { } - protected override IEnumerable ListKeys() + public override IEnumerable GetItems() { if (!DataSchema.Document.Settings.HasResults) { - return new int[0]; + return Array.Empty(); } - return Enumerable.Range(0, DataSchema.Document.Settings.MeasuredResults.Chromatograms.Count); - } - - protected override Replicate ConstructItem(int key) - { - return new Replicate(DataSchema, key); + return Enumerable.Range(0, DataSchema.Document.Settings.MeasuredResults.Chromatograms.Count).Select(i=>new Replicate(DataSchema, i)); } } } diff --git a/pwiz_tools/Skyline/Model/Databinding/Collections/ResultList.cs b/pwiz_tools/Skyline/Model/Databinding/Collections/ResultList.cs index ae8e39ed8f..3d60d2a67b 100644 --- a/pwiz_tools/Skyline/Model/Databinding/Collections/ResultList.cs +++ b/pwiz_tools/Skyline/Model/Databinding/Collections/ResultList.cs @@ -17,23 +17,17 @@ * limitations under the License. */ -using System.Collections.Generic; -using System.Linq; +using System.Collections; using pwiz.Skyline.Model.Databinding.Entities; namespace pwiz.Skyline.Model.Databinding.Collections { - public abstract class ResultList : SkylineObjectList where TResult : Result + public abstract class ResultList : SkylineObjectList where TResult : Result { protected ResultList(SkylineDataSchema dataSchema) : base(dataSchema) { } - public ResultFileKey GetKey(TResult value) - { - return GetResultFileKey(value); - } - public ResultFileKey GetResultFileKey(Result result) { return new ResultFileKey(result.GetResultFile().Replicate.ReplicateIndex, result.GetResultFile().ChromFileInfoId, result.GetResultFile().OptimizationStep); @@ -53,14 +47,9 @@ public PeptideResultList(Entities.Peptide peptide) : base(peptide.DataSchema) } public Entities.Peptide Peptide { get; private set; } - protected override IEnumerable ListKeys() - { - return Peptide.Results.Values.Select(GetKey); - } - - protected override PeptideResult ConstructItem(ResultFileKey key) + public override IEnumerable GetItems() { - return new PeptideResult(Peptide, GetResultFile(key)); + return Peptide.Results.Values; } } @@ -72,14 +61,9 @@ public PrecursorResultList(Precursor precursor) : base(precursor.DataSchema) } public Precursor Precursor { get; private set; } - protected override IEnumerable ListKeys() + public override IEnumerable GetItems() { - return Precursor.Results.Values.Select(GetKey); - } - - protected override PrecursorResult ConstructItem(ResultFileKey key) - { - return new PrecursorResult(Precursor, GetResultFile(key)); + return Precursor.Results.Values; } } @@ -90,14 +74,9 @@ public TransitionResultList(Entities.Transition transition) : base(transition.Da Transition = transition; } public Entities.Transition Transition { get; private set; } - protected override IEnumerable ListKeys() - { - return Transition.Results.Values.Select(GetKey); - } - - protected override TransitionResult ConstructItem(ResultFileKey key) + public override IEnumerable GetItems() { - return new TransitionResult(Transition, GetResultFile(key)); + return Transition.Results; } } } diff --git a/pwiz_tools/Skyline/Model/Databinding/Collections/SkylineObjectList.cs b/pwiz_tools/Skyline/Model/Databinding/Collections/SkylineObjectList.cs index 37487ea454..4c5a31c340 100644 --- a/pwiz_tools/Skyline/Model/Databinding/Collections/SkylineObjectList.cs +++ b/pwiz_tools/Skyline/Model/Databinding/Collections/SkylineObjectList.cs @@ -17,17 +17,14 @@ * limitations under the License. */ -using System.Collections; -using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; -using System.Linq; using System.Threading; using pwiz.Common.DataBinding; namespace pwiz.Skyline.Model.Databinding.Collections { - public abstract class SkylineObjectList : AbstractRowSource + public abstract class SkylineObjectList : AbstractRowSource { private IDocumentChangeListener _documentChangeListener; @@ -64,19 +61,10 @@ private void DocumentOnChanged(object sender, DocumentChangedEventArgs documentC FireListChanged(); } - public override IEnumerable GetItems() - { - return ListKeys().Select(ConstructItem); - } - - protected abstract IEnumerable ListKeys(); - - - private class DocumentChangeListener : IDocumentChangeListener { - private readonly SkylineObjectList _skylineObjectList; - public DocumentChangeListener(SkylineObjectList skylineObjectList) + private readonly SkylineObjectList _skylineObjectList; + public DocumentChangeListener(SkylineObjectList skylineObjectList) { _skylineObjectList = skylineObjectList; } @@ -86,7 +74,5 @@ public void DocumentOnChanged(object sender, DocumentChangedEventArgs args) _skylineObjectList.DocumentOnChanged(sender, args); } } - - protected abstract TItem ConstructItem(TKey key); } } diff --git a/pwiz_tools/Skyline/Model/Lists/ListRowSource.cs b/pwiz_tools/Skyline/Model/Lists/ListRowSource.cs index fea5969c14..71253f38c1 100644 --- a/pwiz_tools/Skyline/Model/Lists/ListRowSource.cs +++ b/pwiz_tools/Skyline/Model/Lists/ListRowSource.cs @@ -16,15 +16,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +using System; using System.Collections; -using System.Collections.Generic; using System.Linq; using pwiz.Skyline.Model.Databinding; using pwiz.Skyline.Model.Databinding.Collections; namespace pwiz.Skyline.Model.Lists { - public class ListRowSource : SkylineObjectList where TItem : ListItem + public class ListRowSource : SkylineObjectList where TItem : ListItem { public ListRowSource(SkylineDataSchema dataSchema) : base(dataSchema) { @@ -33,33 +34,16 @@ public ListRowSource(SkylineDataSchema dataSchema) : base(dataSchema) public string ListName { get; private set; } - protected override TItem ConstructItem(ListItemId key) - { - var listData = DataSchema.Document.Settings.DataSettings.FindList(ListName); - return (TItem) ListItem.ExistingRecord(listData, key); - } - public override IEnumerable GetItems() { var listData = DataSchema.Document.Settings.DataSettings.Lists.FirstOrDefault(list => list.ListDef.Name == ListName); if (listData == null) { - return new TItem[0]; + return Array.Empty(); } return Enumerable.Range(0, listData.RowCount) .Select(rowIndex => ListItem.ExistingRecord(typeof(TItem), listData, rowIndex)); } - - protected override IEnumerable ListKeys() - { - var listData = - DataSchema.Document.Settings.DataSettings.Lists.FirstOrDefault(list => list.ListDef.Name == ListName); - if (listData == null) - { - return new ListItemId[0]; - } - return listData.ListItemIds; - } } } diff --git a/pwiz_tools/Skyline/Skyline.csproj b/pwiz_tools/Skyline/Skyline.csproj index a4f40445ab..374a4ed128 100644 --- a/pwiz_tools/Skyline/Skyline.csproj +++ b/pwiz_tools/Skyline/Skyline.csproj @@ -464,6 +464,7 @@ True PropertyNames.resx + True From 4983804e2dc1880b7c569beb432f1053d0d0f327 Mon Sep 17 00:00:00 2001 From: nicksh Date: Fri, 9 Jun 2023 10:37:14 -0700 Subject: [PATCH 2/3] Add "LibraryRetentionTimes" to "Peptide" in the document grid. The "LibraryRetentionTimes" column will contain a comma-separated list of all of the retention times that were found in any of the spectral libraries. There are sub-properties "MinLibraryRetentionTime", "MaxLibraryRetentionTime", "MeanLibraryRetentionTime" Issue 138: Add report value for spectral library retention time --- .../Databinding/SkylineViewContext.cs | 2 + .../Entities/ColumnCaptions.Designer.cs | 36 +++++++++ .../Databinding/Entities/ColumnCaptions.resx | 12 +++ .../Entities/ColumnToolTips.Designer.cs | 36 +++++++++ .../Databinding/Entities/ColumnToolTips.resx | 12 +++ .../Model/Databinding/Entities/Peptide.cs | 10 +++ .../Entities/RetentionTimeValues.cs | 80 +++++++++++++++++++ pwiz_tools/Skyline/Skyline.csproj | 1 + 8 files changed, 189 insertions(+) create mode 100644 pwiz_tools/Skyline/Model/Databinding/Entities/RetentionTimeValues.cs diff --git a/pwiz_tools/Skyline/Controls/Databinding/SkylineViewContext.cs b/pwiz_tools/Skyline/Controls/Databinding/SkylineViewContext.cs index 4c82514fd8..cd472f0ac7 100644 --- a/pwiz_tools/Skyline/Controls/Databinding/SkylineViewContext.cs +++ b/pwiz_tools/Skyline/Controls/Databinding/SkylineViewContext.cs @@ -498,6 +498,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))); foreach (var prop in MoleculeAccessionNumbers.PREFERRED_ACCESSION_TYPE_ORDER) columnsToRemove.Add(PropertyPath.Root.Property(prop)); // By default don't show CAS, InChI etc if (docHasOnlyCustomIons) diff --git a/pwiz_tools/Skyline/Model/Databinding/Entities/ColumnCaptions.Designer.cs b/pwiz_tools/Skyline/Model/Databinding/Entities/ColumnCaptions.Designer.cs index 68a492c5a9..0941faa8c4 100644 --- a/pwiz_tools/Skyline/Model/Databinding/Entities/ColumnCaptions.Designer.cs +++ b/pwiz_tools/Skyline/Model/Databinding/Entities/ColumnCaptions.Designer.cs @@ -1464,6 +1464,15 @@ public static string LibraryRank { } } + /// + /// Looks up a localized string similar to Library Retention Times. + /// + public static string LibraryRetentionTimes { + get { + return ResourceManager.GetString("LibraryRetentionTimes", resourceCulture); + } + } + /// /// Looks up a localized string similar to Library Score1. /// @@ -1644,6 +1653,15 @@ public static string MaxHeight { } } + /// + /// Looks up a localized string similar to Max Library Retention Time. + /// + public static string MaxLibraryRetentionTime { + get { + return ResourceManager.GetString("MaxLibraryRetentionTime", resourceCulture); + } + } + /// /// Looks up a localized string similar to Max Retention Time. /// @@ -1707,6 +1725,15 @@ public static string MeanFwhm { } } + /// + /// Looks up a localized string similar to Mean Library Retention Time. + /// + public static string MeanLibraryRetentionTime { + get { + return ResourceManager.GetString("MeanLibraryRetentionTime", resourceCulture); + } + } + /// /// Looks up a localized string similar to Mean Max Fwhm. /// @@ -1824,6 +1851,15 @@ public static string MinFoldChange { } } + /// + /// Looks up a localized string similar to Min Library Retention Time. + /// + public static string MinLibraryRetentionTime { + get { + return ResourceManager.GetString("MinLibraryRetentionTime", resourceCulture); + } + } + /// /// Looks up a localized string similar to Min Retention Time. /// diff --git a/pwiz_tools/Skyline/Model/Databinding/Entities/ColumnCaptions.resx b/pwiz_tools/Skyline/Model/Databinding/Entities/ColumnCaptions.resx index 72972cc111..da7111ed0f 100644 --- a/pwiz_tools/Skyline/Model/Databinding/Entities/ColumnCaptions.resx +++ b/pwiz_tools/Skyline/Model/Databinding/Entities/ColumnCaptions.resx @@ -585,6 +585,9 @@ Library Rank + + Library Retention Times + Library Score1 @@ -645,6 +648,9 @@ Max Height + + Max Library Retention Time + Max Retention Time @@ -666,6 +672,9 @@ Mean Fwhm + + Mean Library Retention Time + Mean Max Fwhm @@ -705,6 +714,9 @@ Min Fold Change + + Min Library Retention Time + Min Retention Time diff --git a/pwiz_tools/Skyline/Model/Databinding/Entities/ColumnToolTips.Designer.cs b/pwiz_tools/Skyline/Model/Databinding/Entities/ColumnToolTips.Designer.cs index 23eeaad9f7..d0d1141dc1 100644 --- a/pwiz_tools/Skyline/Model/Databinding/Entities/ColumnToolTips.Designer.cs +++ b/pwiz_tools/Skyline/Model/Databinding/Entities/ColumnToolTips.Designer.cs @@ -1511,6 +1511,15 @@ public static string LibraryRank { } } + /// + /// Looks up a localized string similar to Comma separated list of the retention times for the peptide or molecule found in any spectral library.. + /// + public static string LibraryRetentionTimes { + get { + return ResourceManager.GetString("LibraryRetentionTimes", resourceCulture); + } + } + /// /// Looks up a localized string similar to Raw peptide library score that may or may not be used to rank among ///precursors of a protein.. @@ -1700,6 +1709,15 @@ public static string MaxHeight { } } + /// + /// Looks up a localized string similar to Maximum retention time for the peptide or molecule found in any spectral library. + /// + public static string MaxLibraryRetentionTime { + get { + return ResourceManager.GetString("MaxLibraryRetentionTime", resourceCulture); + } + } + /// /// Looks up a localized string similar to Maximum of the transition RetentionTime values.. /// @@ -1763,6 +1781,15 @@ public static string MeanFwhm { } } + /// + /// Looks up a localized string similar to Average of the retention times for the peptide or molecule found in any spectral library. + /// + public static string MeanLibraryRetentionTime { + get { + return ResourceManager.GetString("MeanLibraryRetentionTime", resourceCulture); + } + } + /// /// Looks up a localized string similar to Mean of the precursor MaxFwhm (peak width) values.. /// @@ -1883,6 +1910,15 @@ public static string MinFoldChange { } } + /// + /// Looks up a localized string similar to Minimum retention time for the peptide or molecule found in any spectral library. + /// + public static string MinLibraryRetentionTime { + get { + return ResourceManager.GetString("MinLibraryRetentionTime", resourceCulture); + } + } + /// /// Looks up a localized string similar to Minimum of the transition RetentionTime values.. /// diff --git a/pwiz_tools/Skyline/Model/Databinding/Entities/ColumnToolTips.resx b/pwiz_tools/Skyline/Model/Databinding/Entities/ColumnToolTips.resx index 87b0d17756..8186e431ed 100644 --- a/pwiz_tools/Skyline/Model/Databinding/Entities/ColumnToolTips.resx +++ b/pwiz_tools/Skyline/Model/Databinding/Entities/ColumnToolTips.resx @@ -613,6 +613,9 @@ spectrum is associated with the precursor ion. The rank based on LibraryIntensity of this transition among all transitions allowed by the transition Filter settings, shown in the user interface as “(rank #)”. + + Comma separated list of the retention times for the peptide or molecule found in any spectral library. + Raw peptide library score that may or may not be used to rank among precursors of a protein. @@ -682,6 +685,9 @@ precursor. Max Height + + Maximum retention time for the peptide or molecule found in any spectral library + Maximum of the transition RetentionTime values. @@ -703,6 +709,9 @@ precursor. Mean of the transition Fwhm (peak width) values. + + Average of the retention times for the peptide or molecule found in any spectral library + Mean of the precursor MaxFwhm (peak width) values. @@ -745,6 +754,9 @@ If there are no internal standard peak areas, then the median transition peak ar The lower bound of the confidence interval of the fold change. + + Minimum retention time for the peptide or molecule found in any spectral library + Minimum of the transition RetentionTime values. diff --git a/pwiz_tools/Skyline/Model/Databinding/Entities/Peptide.cs b/pwiz_tools/Skyline/Model/Databinding/Entities/Peptide.cs index c72a0dc4e2..58677253a6 100644 --- a/pwiz_tools/Skyline/Model/Databinding/Entities/Peptide.cs +++ b/pwiz_tools/Skyline/Model/Databinding/Entities/Peptide.cs @@ -371,6 +371,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 diff --git a/pwiz_tools/Skyline/Model/Databinding/Entities/RetentionTimeValues.cs b/pwiz_tools/Skyline/Model/Databinding/Entities/RetentionTimeValues.cs new file mode 100644 index 0000000000..2b46613685 --- /dev/null +++ b/pwiz_tools/Skyline/Model/Databinding/Entities/RetentionTimeValues.cs @@ -0,0 +1,80 @@ +/* + * Original author: Nicholas Shulman , + * 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 +{ + /// + /// 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. + /// + public class RetentionTimeValues : IFormattable + { + private ImmutableList _times; + private RetentionTimeValues(ImmutableList times) + { + _times = times; + } + + public static RetentionTimeValues ForTimes(IEnumerable 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(_times).ToString(format, formatProvider); + } + + public override string ToString() + { + return new FormattableList(_times).ToString(); + } + } +} diff --git a/pwiz_tools/Skyline/Skyline.csproj b/pwiz_tools/Skyline/Skyline.csproj index 374a4ed128..2561c397fe 100644 --- a/pwiz_tools/Skyline/Skyline.csproj +++ b/pwiz_tools/Skyline/Skyline.csproj @@ -471,6 +471,7 @@ True ColumnCaptions.resx + True From ef8276b1f8a5937278a6c9400a36d6b4da41deb3 Mon Sep 17 00:00:00 2001 From: nicksh Date: Fri, 9 Jun 2023 10:45:35 -0700 Subject: [PATCH 3/3] Fix bad merge --- .../Skyline/Model/Databinding/Collections/ResultList.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pwiz_tools/Skyline/Model/Databinding/Collections/ResultList.cs b/pwiz_tools/Skyline/Model/Databinding/Collections/ResultList.cs index 8bceb0be2d..6950a8747a 100644 --- a/pwiz_tools/Skyline/Model/Databinding/Collections/ResultList.cs +++ b/pwiz_tools/Skyline/Model/Databinding/Collections/ResultList.cs @@ -76,11 +76,7 @@ public TransitionResultList(Entities.Transition transition) : base(transition.Da public Entities.Transition Transition { get; private set; } public override IEnumerable GetItems() { -<<<<<<< HEAD - return Transition.Results; -======= return Transition.Results.Values; ->>>>>>> remotes/origin/master } } }