Skip to content

Commit

Permalink
Merge branch 'master' into Skyline/work/20241006_import_pep_list_order
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanx67 authored Oct 8, 2024
2 parents 28a2bed + 0f98e37 commit 5278882
Show file tree
Hide file tree
Showing 22 changed files with 108 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ protected virtual DataGridViewColumn CreateCustomColumn(PropertyDescriptor prope
}
catch (Exception exception)
{
Trace.TraceError(@"Exception constructing column of type {0}:{1}", columnTypeAttribute.ColumnType, exception);
Messages.WriteAsyncDebugMessage(@"Exception constructing column of type {0}:{1}", columnTypeAttribute.ColumnType, exception);
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using pwiz.Common.Properties;
using pwiz.Common.SystemUtil;

namespace pwiz.Common.DataBinding.Controls.Editor
{
Expand Down Expand Up @@ -301,7 +301,7 @@ private void DataGridViewFilterOnCellEnter(object sender, DataGridViewCellEventA

private void dataGridViewFilter_DataError(object sender, DataGridViewDataErrorEventArgs e)
{
Trace.TraceError(@"DataGridViewFilterOnDataError:{0}", e.Exception);
Messages.WriteAsyncDebugMessage(@"DataGridViewFilterOnDataError:{0}", e.Exception);
}

protected override void OnLoad(EventArgs e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
using pwiz.Common.DataBinding.Clustering;
using pwiz.Common.DataBinding.Controls;
using pwiz.Common.DataBinding.Layout;
using pwiz.Common.SystemUtil;

namespace pwiz.Common.DataBinding.Internal
{
Expand Down Expand Up @@ -533,7 +534,7 @@ public void Dispose()

public void OnUnhandledException(Exception exception)
{
Trace.TraceError(@"BindingListView unhandled exception {0}", exception);
Messages.WriteAsyncDebugMessage(@"BindingListView unhandled exception {0}", exception);
var unhandledExceptionEvent = UnhandledExceptionEvent;
if (null != unhandledExceptionEvent)
{
Expand Down
4 changes: 2 additions & 2 deletions pwiz_tools/Shared/Common/DataBinding/Internal/Pivoter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using pwiz.Common.Collections;
using pwiz.Common.SystemUtil;

namespace pwiz.Common.DataBinding.Internal
{
Expand Down Expand Up @@ -261,7 +261,7 @@ IDictionary<IList<Tuple<PropertyPath, PivotKey, object>>, List<GroupedRow>> allR
}
else
{
Trace.TraceWarning(@"Unable to pivot on column {0} because it is already pivoted.", pivotColumn.PropertyPath);
Messages.WriteAsyncDebugMessage(@"Unable to pivot on column {0} because it is already pivoted.", pivotColumn.PropertyPath); // N.B. see TraceWarningListener for output details
}
}
var pivotOnKey = PivotKey.GetPivotKey(allPivotKeys, pivotOnKeyValues);
Expand Down
4 changes: 2 additions & 2 deletions pwiz_tools/Shared/Common/Graph/CurveDataHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using pwiz.Common.SystemUtil;
using ZedGraph;

namespace pwiz.Common.Graph
Expand Down Expand Up @@ -232,7 +232,7 @@ protected virtual Func<PointPair, double> ValueOfPointFuncForAxis(DataFrameBuild
{
return point => point.Y;
}
Trace.TraceError(@"Could not determine type of axis {0}", axis);
Messages.WriteAsyncDebugMessage(@"Could not determine type of axis {0}", axis);
return null;
}

Expand Down
7 changes: 4 additions & 3 deletions pwiz_tools/Shared/CommonUtil/CommonUtil.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@
<SubType>Form</SubType>
</Compile>
<Compile Include="SystemUtil\CommonTextUtil.cs" />
<Compile Include="SystemUtil\Messages.cs" />
<Compile Include="SystemUtil\FileSize.cs" />
<Compile Include="SystemUtil\FileSizeFormatProvider.cs" />
<Compile Include="SystemUtil\IFormView.cs" />
Expand Down Expand Up @@ -270,20 +271,20 @@
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="CommonResources\GeneralTerms.ja.resx">
<EmbeddedResource Include="CommonResources\GeneralTerms.ja.resx">
<DependentUpon>GeneralTerms.resx</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="CommonResources\GeneralTerms.zh-CHS.resx">
<DependentUpon>GeneralTerms.resx</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="CommonResources\GeneralTerms.resx">
<EmbeddedResource Include="CommonResources\GeneralTerms.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>GeneralTerms.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="CommonResources\Images.ja.resx">
<EmbeddedResource Include="CommonResources\Images.ja.resx">
<DependentUpon>Images.resx</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
Expand Down
3 changes: 1 addition & 2 deletions pwiz_tools/Shared/CommonUtil/SystemUtil/Caching/Receiver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* limitations under the License.
*/
using System;
using System.Diagnostics;
using System.Windows.Forms;

namespace pwiz.Common.SystemUtil.Caching
Expand Down Expand Up @@ -135,7 +134,7 @@ public void Dispose()
_workOrder = null;
if (OwnerControl != null)
{
Trace.TraceInformation("CalculatedValueListener destroyed: {0}", Producer.ValueType);
Messages.WriteAsyncDebugMessage("CalculatedValueListener destroyed: {0}", Producer.ValueType); // N.B. see TraceWarningListener for output details
OwnerControl.HandleDestroyed -= OwnerControlHandleDestroyed;
OwnerControl = null;
}
Expand Down
3 changes: 1 addition & 2 deletions pwiz_tools/Shared/CommonUtil/SystemUtil/CommonActionUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* limitations under the License.
*/
using System;
using System.Diagnostics;
using System.Threading;
using System.Windows.Forms;

Expand Down Expand Up @@ -53,7 +52,7 @@ public static void HandleException(Exception exception)
{
return;
}
Trace.TraceWarning(@"Unhandled Exception: {0}", exception);
Messages.WriteAsyncDebugMessage(@"Unhandled Exception: {0}", exception); // N.B. see TraceWarningListener for output details
}

public static bool SafeBeginInvoke(Control control, Action action)
Expand Down
45 changes: 45 additions & 0 deletions pwiz_tools/Shared/CommonUtil/SystemUtil/Messages.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Original author: Brian Pratt <bspratt .at. proteinms . net>,
* MacCoss Lab, Department of Genome Sciences, UW
*
* Copyright 2024 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.Diagnostics;

namespace pwiz.Common.SystemUtil
{
/// <summary>
/// Provides a mechanism for showing non-blocking messages.
///
/// Really just a wrapper for Trace, which we don't want to call
/// directly as it looks too much like leftover debug code.
///
/// </summary>
public static class Messages
{
public static void WriteAsyncDebugMessage(string message, params object[] args)
{
Trace.TraceInformation(message, args);
}

public static void WriteAsyncUserMessage(string message, params object[] args)
{
// For Skyline UI, the TraceWarningListener class causes these messages to appear in the
// Immediate Window, for commandline they appear in the console.
Trace.TraceWarning(message, args);
}
}
}
5 changes: 3 additions & 2 deletions pwiz_tools/Shared/ProteomeDb/API/ProteinMatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using NHibernate;
using pwiz.ProteomeDatabase.DataModel;
using pwiz.ProteomeDatabase.Util;
using pwiz.Common.Collections;
using pwiz.Common.SystemUtil;

namespace pwiz.ProteomeDatabase.API
{
/// <summary>
Expand Down Expand Up @@ -252,7 +253,7 @@ private void ExecuteBackground()
{
return;
}
Trace.TraceError(@"Unhandled exception: {0}", exception);
Messages.WriteAsyncDebugMessage(@"Unhandled exception: {0}", exception);
}
}

Expand Down
2 changes: 1 addition & 1 deletion pwiz_tools/Shared/zedgraph/ZedGraph/ZedGraphControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ protected override void OnPaint( PaintEventArgs e )
}
catch (Exception exception)
{
Trace.TraceWarning(@"Error when painting a zedGraph:{0}", exception);
Trace.TraceInformation(@"Error when painting a zedGraph:{0}", exception); // N.B. see TraceWarningListener for output details
}
}

Expand Down
4 changes: 2 additions & 2 deletions pwiz_tools/Skyline/Alerts/ReportShutdownDlg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
*/

using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
using pwiz.Common.SystemUtil;
using pwiz.Skyline.Util;
using pwiz.Skyline.Util.Extensions;

Expand Down Expand Up @@ -75,7 +75,7 @@ public static void SaveExceptionFile(Exception exception, bool forced = false)

if (!forced)
{
Trace.TraceError(exceptionInfo);
Messages.WriteAsyncDebugMessage(exceptionInfo);
Console.WriteLine(exceptionInfo);
}

Expand Down
6 changes: 3 additions & 3 deletions pwiz_tools/Skyline/Model/Databinding/ReportSpecConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using pwiz.Common.DataBinding;
using pwiz.Common.SystemUtil;
using pwiz.Skyline.Model.DocSettings;
using pwiz.Skyline.Model.Hibernate;

Expand Down Expand Up @@ -270,7 +270,7 @@ private ColumnSpec ConvertReportColumn(ReportColumn reportColumn)
oldCaption = null;
if (null == propertyPath)
{
Trace.TraceWarning(@"Unable to parse ratio property {0}", part);
Messages.WriteAsyncDebugMessage(@"Unable to parse ratio property {0}", part);
propertyPath = PropertyPath.Root.Property(part);
}
}
Expand All @@ -283,7 +283,7 @@ private ColumnSpec ConvertReportColumn(ReportColumn reportColumn)
PropertyInfo property = component.GetProperty(part);
if (null == property)
{
Trace.TraceWarning(@"Could not find property {0}", part);
Messages.WriteAsyncDebugMessage(@"Could not find property {0}", part);
continue;
}
propertyPath = PropertyPath.Root.Property(part);
Expand Down
2 changes: 2 additions & 0 deletions pwiz_tools/Skyline/Model/DocSettings/TransitionSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,7 @@ public bool Equals(TransitionFilter obj)
ArrayUtil.EqualsDeep(obj._peptideProductCharges, _peptideProductCharges) &&
ArrayUtil.EqualsDeep(obj._peptideIonTypes, _peptideIonTypes) &&
ArrayUtil.EqualsDeep(obj._smallMoleculePrecursorAdducts, _smallMoleculePrecursorAdducts) &&
ArrayUtil.EqualsDeep(obj._smallMoleculeFragmentAdducts, _smallMoleculeFragmentAdducts) &&
ArrayUtil.EqualsDeep(obj._smallMoleculeIonTypes, _smallMoleculeIonTypes) &&
Equals(obj.FragmentRangeFirst, FragmentRangeFirst) &&
Equals(obj.FragmentRangeLast, FragmentRangeLast) &&
Expand All @@ -1205,6 +1206,7 @@ public override int GetHashCode()
result = (result * 397) ^ _peptideProductCharges.GetHashCodeDeep();
result = (result * 397) ^ _peptideIonTypes.GetHashCodeDeep();
result = (result * 397) ^ _smallMoleculePrecursorAdducts.GetHashCodeDeep();
result = (result * 397) ^ _smallMoleculeFragmentAdducts.GetHashCodeDeep();
result = (result * 397) ^ _smallMoleculeIonTypes.GetHashCodeDeep();
result = (result * 397) ^ FragmentRangeFirst.GetHashCode();
result = (result*397) ^ FragmentRangeLast.GetHashCode();
Expand Down
5 changes: 2 additions & 3 deletions pwiz_tools/Skyline/Model/Lib/ChromLib/ChromatogramLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -571,7 +570,7 @@ private bool LoadLibraryFromDatabase(ILoadMonitor loader)
}
catch (Exception e)
{
Trace.TraceWarning(ChromLibResources.ChromatogramLibrary_LoadLibraryFromDatabase_Error_loading_chromatogram_library__0_, e);
Messages.WriteAsyncUserMessage(ChromLibResources.ChromatogramLibrary_LoadLibraryFromDatabase_Error_loading_chromatogram_library__0_, e);
return false;
}
}
Expand Down Expand Up @@ -692,7 +691,7 @@ private bool LoadFromCache(ILoadMonitor loadMonitor, ProgressStatus status)
}
catch (Exception exception)
{
Trace.TraceWarning(ChromLibResources.ChromatogramLibrary_LoadFromCache_Exception_reading_cache__0_, exception);
Messages.WriteAsyncUserMessage(ChromLibResources.ChromatogramLibrary_LoadFromCache_Exception_reading_cache__0_, exception);
return false;
}
}
Expand Down
3 changes: 1 addition & 2 deletions pwiz_tools/Skyline/Model/Lib/EncylopeDiaLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
using System.Data;
using System.Data.Common;
using System.Data.SQLite;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
Expand Down Expand Up @@ -466,7 +465,7 @@ private bool LoadFromCache(ILoadMonitor loader)
}
catch (Exception exception)
{
Trace.TraceWarning(@"Exception loading cache: {0}", exception);
Messages.WriteAsyncDebugMessage(@"Exception loading cache: {0}", exception);
return false;
}
}
Expand Down
10 changes: 5 additions & 5 deletions pwiz_tools/Skyline/Model/Results/PeptideChromData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using pwiz.Common.Collections;
using pwiz.Common.PeakFinding;
using pwiz.Common.SystemUtil;
using pwiz.Skyline.Model.DocSettings;
using pwiz.Skyline.Model.Results.Scoring;
using pwiz.Skyline.Util;
Expand Down Expand Up @@ -959,11 +959,11 @@ public bool FilterByRetentionTime()
string precursorText = GetTextForNode(NodePep, dataSet.NodeGroup, null);
if (dataSet.MinRawTime > dataSet.MaxRawTime)
{
Trace.TraceWarning(ResultsResources.PeptideChromDataSets_FilterByRetentionTime_Discarding_empty_chromatograms_for__0_, precursorText);
Messages.WriteAsyncUserMessage(ResultsResources.PeptideChromDataSets_FilterByRetentionTime_Discarding_empty_chromatograms_for__0_, precursorText);
}
else
{
Trace.TraceWarning(ResultsResources.PeptideChromDataSets_FilterByRetentionTime_Discarding_chromatograms_for___0___because_the_explicit_retention_time__1__is_not_between__2__and__3_,
Messages.WriteAsyncUserMessage(ResultsResources.PeptideChromDataSets_FilterByRetentionTime_Discarding_chromatograms_for___0___because_the_explicit_retention_time__1__is_not_between__2__and__3_,
precursorText, explicitRT, dataSet.MinRawTime, dataSet.MaxRawTime);
}
DataSets.RemoveAt(i);
Expand All @@ -978,11 +978,11 @@ public bool FilterByRetentionTime()
string transitionText = GetTextForNode(NodePep, dataSet.NodeGroup, chrom.DocNode);
if (!chrom.Times.Any())
{
Trace.TraceWarning(ResultsResources.PeptideChromDataSets_FilterByRetentionTime_Discarding_empty_chromatograms_for__0_, transitionText);
Messages.WriteAsyncUserMessage(ResultsResources.PeptideChromDataSets_FilterByRetentionTime_Discarding_empty_chromatograms_for__0_, transitionText);
}
else
{
Trace.TraceWarning(ResultsResources.PeptideChromDataSets_FilterByRetentionTime_Discarding_chromatograms_for___0___because_the_explicit_retention_time__1__is_not_between__2__and__3_,
Messages.WriteAsyncUserMessage(ResultsResources.PeptideChromDataSets_FilterByRetentionTime_Discarding_chromatograms_for___0___because_the_explicit_retention_time__1__is_not_between__2__and__3_,
transitionText, explicitRT, chrom.Times.First(), chrom.Times.Last());
}
dataSet.Chromatograms.RemoveAt(j);
Expand Down
Loading

0 comments on commit 5278882

Please sign in to comment.