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

Make iRT work with gas phase fractionated datasets #3244

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft
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
111 changes: 98 additions & 13 deletions pwiz_tools/Skyline/FileUI/ImportResultsDlg.Designer.cs

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

101 changes: 45 additions & 56 deletions pwiz_tools/Skyline/FileUI/ImportResultsDlg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ public partial class ImportResultsDlg : FormEx, IAuditLogModifier<ImportResultsD

private readonly string _documentSavedPath;
private readonly bool _warnOnMultiInjection;
private bool _hasIrt;

public ImportResultsDlg(SrmDocument document, string savedPath)
{
_documentSavedPath = savedPath;
_warnOnMultiInjection = (document.MoleculeTransitionCount < MIN_MULTIPLE_TRANSITIONS);
_hasIrt = true == document.Settings.PeptideSettings.Prediction.RetentionTime?.IsAutoCalculated;

InitializeComponent();

Expand Down Expand Up @@ -93,6 +95,7 @@ public ImportResultsDlg(SrmDocument document, string savedPath)
comboSimultaneousFiles.SelectedIndex = Settings.Default.ImportResultsSimultaneousFiles;
cbShowAllChromatograms.Checked = Settings.Default.AutoShowAllChromatogramsGraph;
cbAutoRetry.Checked = Settings.Default.ImportResultsDoAutoRetry;
UpdateRadioSelection(radioCreateMultiple);
}

private string DefaultNewName
Expand All @@ -117,6 +120,12 @@ private string DefaultNewName

private bool IsOptimizing { get { return comboOptimizing.SelectedIndex != -1; } }

public bool IsMergeIrt
{
get { return checkBoxMergeIrt.Checked; }
set { checkBoxMergeIrt.Checked = value; }
}

public KeyValuePair<string, MsDataFileUri[]>[] NamedPathSets { get; set; }

public string OptimizationName
Expand Down Expand Up @@ -503,20 +512,20 @@ private void EnsureUniqueNames()
private void radioCreateMultiple_CheckedChanged(object sender, EventArgs e)
{
if (radioCreateMultiple.Checked)
UpdateRadioSelection();
UpdateRadioSelection(radioCreateMultiple);
}

private void radioCreateMultipleMulti_CheckedChanged(object sender, EventArgs e)
{
if (radioCreateMultipleMulti.Checked)
UpdateRadioSelection();
UpdateRadioSelection(radioCreateMultipleMulti);
}

private void radioCreateNew_CheckedChanged(object sender, EventArgs e)
{
if (radioCreateNew.Checked)
{
UpdateRadioSelection();
UpdateRadioSelection(radioCreateNew);
textName.Focus();
textName.SelectAll();
}
Expand All @@ -525,11 +534,16 @@ private void radioCreateNew_CheckedChanged(object sender, EventArgs e)
private void radioAddExisting_CheckedChanged(object sender, EventArgs e)
{
if (radioAddExisting.Checked)
UpdateRadioSelection();
UpdateRadioSelection(radioAddExisting);
}

private void UpdateRadioSelection()
private void UpdateRadioSelection(RadioButton radioChecked)
{
foreach (var radio in new[]
{ radioCreateMultiple, radioCreateMultipleMulti, radioCreateNew, radioAddExisting })
{
radio.Checked = ReferenceEquals(radio, radioChecked);
}
if (radioAddExisting.Checked)
{
textName.Text = string.Empty;
Expand All @@ -548,56 +562,29 @@ private void UpdateRadioSelection()
textName.Text = multiple ? string.Empty : DefaultNewName;
}

// If comboOptimizing is not supposed to be below radioCreateMulti and it is
if (!radioCreateMultiple.Checked && !radioAddExisting.Checked && comboOptimizing.Top < radioCreateMultipleMulti.Top)
{
// Move it to below radioCreateMultipleMulti
radioCreateMultipleMulti.Top = radioCreateMultiple.Top + (radioCreateNew.Top - radioCreateMultipleMulti.Top);
int shiftHeight = radioCreateMultipleMulti.Top - radioCreateMultiple.Top;
labelOptimizing.Top += shiftHeight;
comboOptimizing.Top += shiftHeight;
labelTuning.Top = labelOptimizing.Top;
comboTuning.Top = comboOptimizing.Top;
}
// If comboOptimizing is not supposed to be below radioCreateNew and it is
if (!radioCreateNew.Checked && comboOptimizing.Top > radioCreateNew.Top)
{
// Move it to below radioCreateMultipleMulti
int shiftHeight = radioAddExisting.Top - labelOptimizing.Top;
textName.Top += shiftHeight;
labelNameNew.Top += shiftHeight;
radioCreateNew.Top += shiftHeight;
shiftHeight = radioCreateNew.Top - labelOptimizing.Top - shiftHeight;
labelOptimizing.Top += shiftHeight;
comboOptimizing.Top += shiftHeight;
labelTuning.Top = labelOptimizing.Top;
comboTuning.Top = comboOptimizing.Top;
}
// If comboOptimizing is supposed to be below radioCreateNew, but it is not
if (radioCreateNew.Checked && comboOptimizing.Top < radioCreateNew.Top)
{
// Move it to below radioCreateNew, starting from being below radioCreateMultipleMulti
int shiftHeight = radioCreateNew.Top - labelOptimizing.Top;
radioCreateNew.Top -= shiftHeight;
labelNameNew.Top -= shiftHeight;
textName.Top -= shiftHeight;
shiftHeight = radioAddExisting.Top - labelOptimizing.Top - shiftHeight;
labelOptimizing.Top += shiftHeight;
comboOptimizing.Top += shiftHeight;
labelTuning.Top = labelOptimizing.Top;
comboTuning.Top = comboOptimizing.Top;
}
// If comboOptimizing is supposed to be below radioCreateMultiple, but it is not
if ((radioCreateMultiple.Checked || radioAddExisting.Checked) &&
comboOptimizing.Top > radioCreateMultipleMulti.Top)
{
// Move it to below radioCreateMultiple, starting from being below radioCreateMultipleMulti
int shiftHeight = radioCreateMultipleMulti.Top - labelOptimizing.Top;
labelOptimizing.Top += shiftHeight;
comboOptimizing.Top += shiftHeight;
labelTuning.Top = labelOptimizing.Top;
comboTuning.Top = comboOptimizing.Top;
radioCreateMultipleMulti.Top = radioCreateNew.Top - (radioCreateMultipleMulti.Top - radioCreateMultiple.Top);
var controls = flowLayoutPanelReplicates.Controls.Cast<Control>().ToList();
controls.Remove(flowLayoutPanelOptions);
if (radioCreateMultiple.Checked)
{
controls.Insert(1, flowLayoutPanelOptions);
}
else if (radioCreateMultipleMulti.Checked)
{
controls.Insert(2, flowLayoutPanelOptions);
}
else if (radioCreateNew.Checked)
{
controls.Insert(3, flowLayoutPanelOptions);
}
else if (radioAddExisting.Checked)
{
controls.Insert(4, flowLayoutPanelOptions);
}

if (!controls.SequenceEqual(flowLayoutPanelReplicates.Controls.Cast<Control>()))
{
flowLayoutPanelReplicates.Controls.Clear();
flowLayoutPanelReplicates.Controls.AddRange(controls.ToArray());
}

if (radioAddExisting.Checked)
Expand All @@ -613,6 +600,8 @@ private void UpdateRadioSelection()
comboOptimizing.SelectedIndex = comboTuning.SelectedIndex = 0;
}
}

panelMergeIrt.Visible = !radioCreateMultiple.Checked && !radioAddExisting.Checked && _hasIrt;
}

public int ImportSimultaneousIndex
Expand Down Expand Up @@ -739,7 +728,7 @@ private void cbShowAllChromatograms_CheckedChanged(object sender, EventArgs e)
private void comboOptimizing_SelectedIndexChanged(object sender, EventArgs e)
{
var selected = comboOptimizing.SelectedItem;
labelTuning.Visible = comboTuning.Visible = selected != null && selected.ToString().Equals(ExportOptimize.COV);
panelTuning.Visible = selected != null && selected.ToString().Equals(ExportOptimize.COV);
}

public bool CanExportCov { get { return comboOptimizing.Items.Contains(ExportOptimize.COV); } }
Expand Down
Loading