Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -219,19 +219,25 @@ public override void UpdateGraph(bool selectionChanged)

var document = GraphSummary.DocumentUIContainer.DocumentUI;
var graphSettings = GraphSettings.FromSettings();
var aggregateOp = GraphValues.AggregateOp.FromCurrentSettings();

// Only create graph data (and recalculate abundances)
// if settings have changed, the document has changed, or if it
// is not yet created
var dataChanged = false;
var oldGraphData = _graphData;
if (_graphData?.GraphPointList == null ||
!ReferenceEquals(document, _graphData.Document) ||
!Equals(graphSettings, _graphData.GraphSettings))
!Equals(graphSettings, _graphData.GraphSettings) ||
!Equals(_graphData.AggregateOp, aggregateOp))
{
_graphData = CreateGraphData(document, graphSettings);
}

// Calculate y values and order which can change based on the
// replicate display option or the show CV option
_graphData.CalcDataPositions(GraphSummary.ResultsIndex, selectedProtein);
dataChanged = _graphData.MinY != oldGraphData?.MinY || _graphData.MaxY != oldGraphData?.MaxY;

// For proper z-order, add the selected points, then the matched points, then the unmatched points
var selectedPoints = new PointPairList();
Expand Down Expand Up @@ -278,7 +284,8 @@ public override void UpdateGraph(bool selectionChanged)
}
}
AddPoints(new PointPairList(unmatchedPoints), Color.Gray, DotPlotUtil.PointSizeToFloat(PointSize.normal), false, PointSymbol.Circle);
UpdateAxes();
if(dataChanged || Settings.Default.RelativeAbundanceLogScale != YAxis.Scale.IsLog)
UpdateAxes();
if (Settings.Default.GroupComparisonAvoidLabelOverlap)
AdjustLabelSpacings(_labeledPoints, GraphSummary.GraphControl);
else
Expand Down Expand Up @@ -357,7 +364,14 @@ protected virtual void UpdateAxes()
YAxis.Scale.MinAuto = true;
XAxis.Scale.MaxAuto = true;
XAxis.Scale.MinAuto = true;
if (Settings.Default.AreaLogScale )

if (CurveList.FirstOrDefault() is LineItem curve)
{
// if markers are overlapping leave a little space between the X axis and the first marker
if(curve.Symbol.Size * _graphData.PointPairList.Count > Chart.Rect.Width)
XAxis.Scale.Min = -(_graphData.PointPairList.Last().X - _graphData.PointPairList.First().X) * 0.02;
}
if (Settings.Default.RelativeAbundanceLogScale )
{
YAxis.Title.Text = TextUtil.SpaceSeparate(GraphsResources.SummaryPeptideGraphPane_UpdateAxes_Log, YAxis.Title.Text);
YAxis.Type = AxisType.Log;
Expand Down Expand Up @@ -436,6 +450,7 @@ protected GraphData(SrmDocument document, GraphSettings graphSettings)
{
Document = document;
GraphSettings = graphSettings;
AggregateOp = GraphValues.AggregateOp.FromCurrentSettings();
var schema = SkylineDataSchema.MemoryDataSchema(document, SkylineDataSchema.GetLocalizedSchemaLocalizer());
bool anyMolecules = document.HasSmallMolecules;
// Build the list of points to show.
Expand Down Expand Up @@ -475,6 +490,7 @@ protected GraphData(SrmDocument document, GraphSettings graphSettings)

public SrmDocument Document { get; }
public GraphSettings GraphSettings { get; }
public GraphValues.AggregateOp AggregateOp { get; }

public void CalcDataPositions(int iResult, PeptideGroupDocNode selectedProtein)
{
Expand Down
11 changes: 11 additions & 0 deletions pwiz_tools/Skyline/Properties/Settings.Designer.cs

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

3 changes: 3 additions & 0 deletions pwiz_tools/Skyline/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -884,5 +884,8 @@
<Setting Name="GroupComparisonSuspendLabelLayout" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="RelativeAbundanceLogScale" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings>
</SettingsFile>
10 changes: 10 additions & 0 deletions pwiz_tools/Skyline/Skyline.Designer.cs

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/Skyline.resx
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,12 @@
<data name="peptideLogScaleContextMenuItem.Text" xml:space="preserve">
<value>Log Scale</value>
</data>
<data name="relativeAbundanceLogScaleContextMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>209, 22</value>
</data>
<data name="relativeAbundanceLogScaleContextMenuItem.Text" xml:space="preserve">
<value>Log Scale</value>
</data>
<data name="peptideCvsContextMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>209, 22</value>
</data>
Expand Down Expand Up @@ -2967,6 +2973,12 @@
<data name="&gt;&gt;showDotProductToolStripMenuItem.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;relativeAbundanceLogScaleContextMenuItem.Name" xml:space="preserve">
<value>relativeAbundanceLogScaleContextMenuItem</value>
</data>
<data name="&gt;&gt;relativeAbundanceLogScaleContextMenuItem.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;peptideLogScaleContextMenuItem.Name" xml:space="preserve">
<value>peptideLogScaleContextMenuItem</value>
</data>
Expand Down
27 changes: 25 additions & 2 deletions pwiz_tools/Skyline/SkylineGraphs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3918,8 +3918,16 @@ private void BuildAreaGraphMenu(GraphSummary graphSummary, ToolStrip menuStrip,
peptideCvsContextMenuItem.Checked = set.ShowPeptideCV;
}

menuStrip.Items.Insert(iInsert++, peptideLogScaleContextMenuItem);
peptideLogScaleContextMenuItem.Checked = set.AreaLogScale;
if (graphType != GraphTypeSummary.abundance)
{
menuStrip.Items.Insert(iInsert++, peptideLogScaleContextMenuItem);
peptideLogScaleContextMenuItem.Checked = set.AreaLogScale;
}
else
{
menuStrip.Items.Insert(iInsert++, relativeAbundanceLogScaleContextMenuItem);
relativeAbundanceLogScaleContextMenuItem.Checked = set.RelativeAbundanceLogScale;
}
selectionContextMenuItem.Checked = set.ShowReplicateSelection;
menuStrip.Items.Insert(iInsert++, selectionContextMenuItem);
if (graphType == GraphTypeSummary.abundance)
Expand Down Expand Up @@ -4636,6 +4644,17 @@ public void ShowPeptideLogScale(bool isChecked)
UpdateSummaryGraphs();
}

private void relativeAbundanceLogScaleContextMenuItem_Click(object sender, EventArgs e)
{
ShowRelativeAbundanceLogScale(relativeAbundanceLogScaleContextMenuItem.Checked);
}

public void ShowRelativeAbundanceLogScale(bool isChecked)
{
Settings.Default.RelativeAbundanceLogScale = isChecked ;
UpdateRelativeAbundanceGraphs();
}

private void peptideCvsContextMenuItem_Click(object sender, EventArgs e)
{
ShowCVValues(peptideCvsContextMenuItem.Checked);
Expand Down Expand Up @@ -4764,6 +4783,10 @@ public void UpdatePeakAreaGraph()
_listGraphPeakArea.ForEach(g => g.UpdateUI());
}

public void UpdateRelativeAbundanceGraphs()
{
_listGraphPeakArea.FindAll(g => g.Type == GraphTypeSummary.abundance).ForEach(g => g.UpdateUI());
}
private void UpdateSummaryGraphs()
{
UpdateRetentionTimeGraph();
Expand Down
3 changes: 3 additions & 0 deletions pwiz_tools/Skyline/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,9 @@
<setting name="GroupComparisonAvoidLabelOverlap" serializeAs="String">
<value>True</value>
</setting>
<setting name="RelativeAbundanceLogScale" serializeAs="String">
<value>True</value>
</setting>
</pwiz.Skyline.Properties.Settings>
</userSettings>
<applicationSettings>
Expand Down