private static void CheckMassAnalyzer(string instrumentType, FullScanMassAnalyzerType massAnalyzer) { // NOTE: Change to a DIFFERENT mass analyzer than we expect. if (!Equals(instrumentType, ExportInstrumentType.AGILENT_TOF)) { RunUI(() => SkylineWindow.ModifyDocument("Change full-scan settings", doc => doc.ChangeSettings(doc.Settings.ChangeTransitionFullScan(fs => fs .ChangePrecursorResolution(FullScanMassAnalyzerType.tof, 10000, null) .ChangeProductResolution(FullScanMassAnalyzerType.tof, 10000, null) .ChangeAcquisitionMethod(FullScanAcquisitionMethod.Targeted, null))))); } else { RunUI(() => SkylineWindow.ModifyDocument("Change full-scan settings", doc => doc.ChangeSettings(doc.Settings.ChangeTransitionFullScan(fs => fs .ChangePrecursorResolution(FullScanMassAnalyzerType.orbitrap, 60000, 400) .ChangeProductResolution(FullScanMassAnalyzerType.orbitrap, 60000, 400) .ChangeAcquisitionMethod(FullScanAcquisitionMethod.Targeted, null))))); } var exportMethodDlg = ShowDialog <ExportMethodDlg>(() => SkylineWindow.ShowExportMethodDialog(ExportFileType.IsolationList)); RunUI(() => { exportMethodDlg.InstrumentType = instrumentType; }); RunDlg <MessageDlg>( exportMethodDlg.OkDialog, messageDlg => { AssertEx.AreComparableStrings(Resources.ExportMethodDlg_OkDialog_The_precursor_mass_analyzer_type_is_not_set_to__0__in_Transition_Settings_under_the_Full_Scan_tab, messageDlg.Message, 1); messageDlg.OkDialog(); }); OkDialog(exportMethodDlg, exportMethodDlg.CancelDialog); }
public bool ValidatePrecursorRes(MessageBoxHelper helper, double?precursorIsotopeFilter, out double?precursorRes, TabControl tabControl = null, int tabIndex = -1) { precursorRes = null; FullScanPrecursorIsotopes precursorIsotopes = PrecursorIsotopesCurrent; FullScanMassAnalyzerType precursorAnalyzerType = PrecursorMassAnalyzer; if (precursorIsotopes != FullScanPrecursorIsotopes.None) { if (precursorAnalyzerType == FullScanMassAnalyzerType.qit) { if (precursorIsotopes != FullScanPrecursorIsotopes.Count || precursorIsotopeFilter != 1) { if (null != tabControl) { helper.ShowTextBoxError(tabControl, tabIndex, textPrecursorIsotopeFilter, Resources. TransitionSettingsUI_OkDialog_For_MS1_filtering_with_a_QIT_mass_analyzer_only_1_isotope_peak_is_supported); } else { helper.ShowTextBoxError(textPrecursorIsotopeFilter, Resources. TransitionSettingsUI_OkDialog_For_MS1_filtering_with_a_QIT_mass_analyzer_only_1_isotope_peak_is_supported); } return(false); } } double minFilt, maxFilt; GetFilterMinMax(PrecursorMassAnalyzer, out minFilt, out maxFilt); double precRes; bool valid; if (null != tabControl) { valid = helper.ValidateDecimalTextBox(tabControl, tabIndex, textPrecursorRes, minFilt, maxFilt, out precRes); } else { valid = helper.ValidateDecimalTextBox(textPrecursorRes, minFilt, maxFilt, out precRes); } if (!valid) { return(false); } precursorRes = precRes; } return(true); }
private void GetFilterMinMax(FullScanMassAnalyzerType analyzerType, out double minFilt, out double maxFilt) { if (analyzerType == FullScanMassAnalyzerType.qit) { minFilt = TransitionFullScan.MIN_LO_RES; maxFilt = TransitionFullScan.MAX_LO_RES; } else if (analyzerType == FullScanMassAnalyzerType.centroided) { minFilt = TransitionFullScan.MIN_CENTROID_PPM; maxFilt = TransitionFullScan.MAX_CENTROID_PPM; } else { minFilt = TransitionFullScan.MIN_HI_RES; maxFilt = TransitionFullScan.MAX_HI_RES; } }
public static void SetAnalyzerType(FullScanMassAnalyzerType analyzerTypeNew, FullScanMassAnalyzerType analyzerTypeCurrent, double?resCurrent, double?resMzCurrent, Label label, TextBox textRes, Label labelAt, TextBox textAt, Label labelTh, Label labelPPM) { string labelText = Resources.TransitionSettingsUI_SetAnalyzerType_Resolution; labelPPM.Visible = false; if (analyzerTypeNew == FullScanMassAnalyzerType.none) { textRes.Enabled = false; textRes.Text = string.Empty; labelAt.Visible = false; textAt.Visible = false; labelTh.Left = textRes.Right; } else if (analyzerTypeNew == FullScanMassAnalyzerType.centroided) { labelAt.Visible = false; labelTh.Visible = false; textAt.Visible = false; textRes.Enabled = true; textRes.Text = resCurrent.HasValue && (analyzerTypeCurrent == analyzerTypeNew) ? resCurrent.Value.ToString(LocalizationHelper.CurrentCulture) : TransitionFullScan.DEFAULT_CENTROIDED_PPM.ToString(LocalizationHelper.CurrentCulture); labelText = Resources.FullScanSettingsControl_SetAnalyzerType_Mass__Accuracy_; labelPPM.Visible = true; labelPPM.Left = textRes.Right; labelPPM.Top = textRes.Top; } else { textRes.Enabled = true; bool variableRes = false; TextBox textMz = null; if (analyzerTypeNew == FullScanMassAnalyzerType.qit) { textMz = textRes; } else { labelText = Resources.TransitionSettingsUI_SetAnalyzerType_Resolving_power; if (analyzerTypeNew != FullScanMassAnalyzerType.tof) { variableRes = true; textMz = textAt; } } const string resolvingPowerFormat = "#,0.####"; // Not L10N if (analyzerTypeNew == analyzerTypeCurrent && resCurrent.HasValue) { textRes.Text = resCurrent.Value.ToString(resolvingPowerFormat); } else { textRes.Text = TransitionFullScan.DEFAULT_RES_VALUES[(int)analyzerTypeNew].ToString(resolvingPowerFormat); } labelAt.Visible = variableRes; textAt.Visible = variableRes; textAt.Text = resMzCurrent.HasValue ? resMzCurrent.Value.ToString(LocalizationHelper.CurrentCulture) : TransitionFullScan.DEFAULT_RES_MZ.ToString(LocalizationHelper.CurrentCulture); labelTh.Visible = (textMz != null); if (textMz != null) { labelTh.Left = textMz.Right; } } label.Text = labelText; }
private static bool IsResMzAnalyzer(FullScanMassAnalyzerType precursorAnalyzerType) { return(precursorAnalyzerType == FullScanMassAnalyzerType.orbitrap || precursorAnalyzerType == FullScanMassAnalyzerType.ft_icr); }
public void OkDialog() { var helper = new MessageBoxHelper(this); // Validate and store prediction settings string massType = comboPrecursorMass.SelectedItem.ToString(); MassType precursorMassType = MassTypeExtension.GetEnum(massType); massType = comboIonMass.SelectedItem.ToString(); MassType fragmentMassType = MassTypeExtension.GetEnum(massType); string nameCE = comboCollisionEnergy.SelectedItem.ToString(); CollisionEnergyRegression collisionEnergy = Settings.Default.GetCollisionEnergyByName(nameCE); string nameDP = comboDeclusterPotential.SelectedItem.ToString(); DeclusteringPotentialRegression declusteringPotential = Settings.Default.GetDeclusterPotentialByName(nameDP); string nameCoV = comboCompensationVoltage.SelectedItem.ToString(); CompensationVoltageParameters compensationVoltage = Settings.Default.GetCompensationVoltageByName(nameCoV); string nameOptLib = comboOptimizationLibrary.SelectedItem.ToString(); OptimizationLibrary optimizationLibrary = Settings.Default.GetOptimizationLibraryByName(nameOptLib); OptimizedMethodType optimizedMethodType = OptimizedMethodType.None; if (cbUseOptimized.Checked) { optimizedMethodType = OptimizedMethodTypeExtension.GetEnum(comboOptimizeType.SelectedItem.ToString()); } TransitionPrediction prediction = new TransitionPrediction(precursorMassType, fragmentMassType, collisionEnergy, declusteringPotential, compensationVoltage, optimizationLibrary, optimizedMethodType); Helpers.AssignIfEquals(ref prediction, Prediction); // Validate and store filter settings int[] precursorCharges; int min = TransitionGroup.MIN_PRECURSOR_CHARGE; int max = TransitionGroup.MAX_PRECURSOR_CHARGE; if (!helper.ValidateNumberListTextBox(tabControl1, (int)TABS.Filter, textPrecursorCharges, min, max, out precursorCharges)) { return; } precursorCharges = precursorCharges.Distinct().ToArray(); int[] productCharges; min = Transition.MIN_PRODUCT_CHARGE; max = Transition.MAX_PRODUCT_CHARGE; if (!helper.ValidateNumberListTextBox(tabControl1, (int)TABS.Filter, textIonCharges, min, max, out productCharges)) { return; } productCharges = productCharges.Distinct().ToArray(); IonType[] types = TransitionFilter.ParseTypes(textIonTypes.Text, new IonType[0]); if (types.Length == 0) { helper.ShowTextBoxError(tabControl1, (int)TABS.Filter, textIonTypes, Resources.TransitionSettingsUI_OkDialog_Ion_types_must_contain_a_comma_separated_list_of_ion_types_a_b_c_x_y_z_and_p_for_precursor); return; } types = types.Distinct().ToArray(); double exclusionWindow = 0; if (!string.IsNullOrEmpty(textExclusionWindow.Text) && !Equals(textExclusionWindow.Text, exclusionWindow.ToString(LocalizationHelper.CurrentCulture))) { if (!helper.ValidateDecimalTextBox(tabControl1, (int)TABS.Filter, textExclusionWindow, TransitionFilter.MIN_EXCLUSION_WINDOW, TransitionFilter.MAX_EXCLUSION_WINDOW, out exclusionWindow)) { return; } } string fragmentRangeFirst = TransitionFilter.GetStartFragmentNameFromLabel(comboRangeFrom.SelectedItem.ToString()); string fragmentRangeLast = TransitionFilter.GetEndFragmentNameFromLabel(comboRangeTo.SelectedItem.ToString()); var measuredIons = _driverIons.Chosen; bool autoSelect = cbAutoSelect.Checked; bool exclusionUseDIAWindow = FullScanSettingsControl.IsDIA() && cbExclusionUseDIAWindow.Checked; var filter = new TransitionFilter(precursorCharges, productCharges, types, fragmentRangeFirst, fragmentRangeLast, measuredIons, exclusionWindow, exclusionUseDIAWindow, autoSelect); Helpers.AssignIfEquals(ref filter, Filter); // Validate and store library settings TransitionLibraryPick pick = TransitionLibraryPick.none; if (cbLibraryPick.Checked) { if (radioAll.Checked) { pick = TransitionLibraryPick.all; } else if (radioAllAndFiltered.Checked) { pick = TransitionLibraryPick.all_plus; } else { pick = TransitionLibraryPick.filter; } } double ionMatchTolerance; double minTol = TransitionLibraries.MIN_MATCH_TOLERANCE; double maxTol = TransitionLibraries.MAX_MATCH_TOLERANCE; if (!helper.ValidateDecimalTextBox(tabControl1, (int)TABS.Library, textTolerance, minTol, maxTol, out ionMatchTolerance)) { return; } int ionCount = Libraries.IonCount; if (pick != TransitionLibraryPick.none) { min = TransitionLibraries.MIN_ION_COUNT; max = TransitionLibraries.MAX_ION_COUNT; if (!helper.ValidateNumberTextBox(tabControl1, (int)TABS.Library, textIonCount, min, max, out ionCount)) { return; } } TransitionLibraries libraries = new TransitionLibraries(ionMatchTolerance, ionCount, pick); Helpers.AssignIfEquals(ref libraries, Libraries); // This dialog does not yet change integration settings TransitionIntegration integration = _transitionSettings.Integration; // Validate and store instrument settings int minMz; min = TransitionInstrument.MIN_MEASUREABLE_MZ; max = TransitionInstrument.MAX_MEASURABLE_MZ - TransitionInstrument.MIN_MZ_RANGE; if (!helper.ValidateNumberTextBox(tabControl1, (int)TABS.Instrument, textMinMz, min, max, out minMz)) { return; } int maxMz; min = minMz + TransitionInstrument.MIN_MZ_RANGE; max = TransitionInstrument.MAX_MEASURABLE_MZ; if (!helper.ValidateNumberTextBox(tabControl1, (int)TABS.Instrument, textMaxMz, min, max, out maxMz)) { return; } bool isDynamicMin = cbDynamicMinimum.Checked; double mzMatchTolerance; minTol = TransitionInstrument.MIN_MZ_MATCH_TOLERANCE; maxTol = TransitionInstrument.MAX_MZ_MATCH_TOLERANCE; if (!helper.ValidateDecimalTextBox(tabControl1, (int)TABS.Instrument, textMzMatchTolerance, minTol, maxTol, out mzMatchTolerance)) { return; } int?maxTrans = null; if (!string.IsNullOrEmpty(textMaxTrans.Text)) { int maxTransTemp; min = TransitionInstrument.MIN_TRANSITION_MAX; max = TransitionInstrument.MAX_TRANSITION_MAX; if (!helper.ValidateNumberTextBox(tabControl1, (int)TABS.Instrument, textMaxTrans, min, max, out maxTransTemp)) { return; } maxTrans = maxTransTemp; } int?maxInclusions = null; if (!string.IsNullOrEmpty(textMaxInclusions.Text)) { int maxInclusionsTemp; min = TransitionInstrument.MIN_INCLUSION_MAX; max = TransitionInstrument.MAX_INCLUSION_MAX; if (!helper.ValidateNumberTextBox(tabControl1, (int)TABS.Instrument, textMaxInclusions, min, max, out maxInclusionsTemp)) { return; } maxInclusions = maxInclusionsTemp; } int?minTime = null, maxTime = null; min = TransitionInstrument.MIN_TIME; max = TransitionInstrument.MAX_TIME; if (!string.IsNullOrEmpty(textMinTime.Text)) { int minTimeTemp; if (!helper.ValidateNumberTextBox(tabControl1, (int)TABS.Instrument, textMinTime, min, max, out minTimeTemp)) { return; } minTime = minTimeTemp; } if (!string.IsNullOrEmpty(textMaxTime.Text)) { int maxTimeTemp; if (!helper.ValidateNumberTextBox(tabControl1, (int)TABS.Instrument, textMaxTime, min, max, out maxTimeTemp)) { return; } maxTime = maxTimeTemp; } if (minTime.HasValue && maxTime.HasValue && maxTime.Value - minTime.Value < TransitionInstrument.MIN_TIME_RANGE) { helper.ShowTextBoxError(tabControl1, (int)TABS.Instrument, textMaxTime, string.Format(Resources.TransitionSettingsUI_OkDialog_The_allowable_retention_time_range__0__to__1__must_be_at_least__2__minutes_apart, minTime, maxTime, TransitionInstrument.MIN_TIME_RANGE)); return; } TransitionInstrument instrument = new TransitionInstrument(minMz, maxMz, isDynamicMin, mzMatchTolerance, maxTrans, maxInclusions, minTime, maxTime); Helpers.AssignIfEquals(ref instrument, Instrument); // Validate and store full-scan settings // If high resolution MS1 filtering is enabled, make sure precursor m/z type // is monoisotopic and isotope enrichments are set FullScanPrecursorIsotopes precursorIsotopes = PrecursorIsotopesCurrent; FullScanMassAnalyzerType precursorAnalyzerType = PrecursorMassAnalyzer; if (precursorIsotopes != FullScanPrecursorIsotopes.None && precursorAnalyzerType != FullScanMassAnalyzerType.qit) { if (precursorMassType != MassType.Monoisotopic) { MessageDlg.Show(this, Resources.TransitionSettingsUI_OkDialog_High_resolution_MS1_filtering_requires_use_of_monoisotopic_precursor_masses); tabControl1.SelectedIndex = (int)TABS.Prediction; comboPrecursorMass.Focus(); return; } if (FullScanSettingsControl.Enrichments == null) { tabControl1.SelectedIndex = (int)TABS.FullScan; MessageDlg.Show(GetParentForm(this), Resources.TransitionSettingsUI_OkDialog_Isotope_enrichment_settings_are_required_for_MS1_filtering_on_high_resolution_mass_spectrometers); FullScanSettingsControl.ComboEnrichmentsSetFocus(); return; } } IsolationScheme isolationScheme = FullScanSettingsControl.IsolationScheme; FullScanAcquisitionMethod acquisitionMethod = AcquisitionMethod; if (isolationScheme == null && acquisitionMethod == FullScanAcquisitionMethod.DIA) { tabControl1.SelectedIndex = (int)TABS.FullScan; MessageDlg.Show(this, Resources.TransitionSettingsUI_OkDialog_An_isolation_scheme_is_required_to_match_multiple_precursors); FullScanSettingsControl.ComboIsolationSchemeSetFocus(); return; } if (isolationScheme != null && isolationScheme.WindowsPerScan.HasValue && !maxInclusions.HasValue) { MessageDlg.Show(this, Resources.TransitionSettingsUI_OkDialog_Before_performing_a_multiplexed_DIA_scan_the_instrument_s_firmware_inclusion_limit_must_be_specified); tabControl1.SelectedIndex = (int)TABS.Instrument; textMaxInclusions.Focus(); return; } if (FullScanSettingsControl.IsDIA() && cbExclusionUseDIAWindow.Checked) { if (FullScanSettingsControl.IsolationScheme.IsAllIons) { MessageDlg.Show(this, Resources.TransitionSettingsUI_OkDialog_Cannot_use_DIA_window_for_precusor_exclusion_when__All_Ions__is_selected_as_the_isolation_scheme___To_use_the_DIA_window_for_precusor_exclusion__change_the_isolation_scheme_in_the_Full_Scan_settings_); tabControl1.SelectedIndex = (int)TABS.Filter; cbExclusionUseDIAWindow.Focus(); return; } if (FullScanSettingsControl.IsolationScheme.FromResults) { MessageDlg.Show(this, Resources.TransitionSettingsUI_OkDialog_Cannot_use_DIA_window_for_precursor_exclusion_when_isolation_scheme_does_not_contain_prespecified_windows___Please_select_an_isolation_scheme_with_prespecified_windows_); tabControl1.SelectedIndex = (int)TABS.Filter; cbExclusionUseDIAWindow.Focus(); return; } } TransitionFullScan fullScan; if (!FullScanSettingsControl.ValidateFullScanSettings(helper, out fullScan, tabControl1, (int)TABS.FullScan)) { return; } Helpers.AssignIfEquals(ref fullScan, FullScan); TransitionSettings settings = new TransitionSettings(prediction, filter, libraries, integration, instrument, fullScan); // Only update, if anything changed if (!Equals(settings, _transitionSettings)) { if (!_parent.ChangeSettingsMonitored(this, Resources.TransitionSettingsUI_OkDialog_Changing_transition_settings, s => s.ChangeTransitionSettings(settings))) { return; } _transitionSettings = settings; } DialogResult = DialogResult.OK; }
private static void CheckMassAnalyzer(string instrumentType, FullScanMassAnalyzerType massAnalyzer) { // NOTE: Change to a DIFFERENT mass analyzer than we expect. if (!Equals(instrumentType, ExportInstrumentType.AGILENT_TOF)) { RunUI(() => SkylineWindow.ModifyDocument("Change full-scan settings", doc => doc.ChangeSettings(doc.Settings.ChangeTransitionFullScan(fs => fs .ChangePrecursorResolution(FullScanMassAnalyzerType.tof, 10000, null) .ChangeProductResolution(FullScanMassAnalyzerType.tof, 10000, null) .ChangeAcquisitionMethod(FullScanAcquisitionMethod.Targeted, null))))); } else { RunUI(() => SkylineWindow.ModifyDocument("Change full-scan settings", doc => doc.ChangeSettings(doc.Settings.ChangeTransitionFullScan(fs => fs .ChangePrecursorResolution(FullScanMassAnalyzerType.orbitrap, 60000, 400) .ChangeProductResolution(FullScanMassAnalyzerType.orbitrap, 60000, 400) .ChangeAcquisitionMethod(FullScanAcquisitionMethod.Targeted, null))))); } var exportMethodDlg = ShowDialog<ExportMethodDlg>(() => SkylineWindow.ShowExportMethodDialog(ExportFileType.IsolationList)); RunUI(() => { exportMethodDlg.InstrumentType = instrumentType; }); RunDlg<MessageDlg>( exportMethodDlg.OkDialog, messageDlg => { AssertEx.AreComparableStrings(Resources.ExportMethodDlg_OkDialog_The_precursor_mass_analyzer_type_is_not_set_to__0__in_Transition_Settings_under_the_Full_Scan_tab, messageDlg.Message, 1); messageDlg.OkDialog(); }); OkDialog(exportMethodDlg, exportMethodDlg.CancelDialog); }
private void GetFilterMinMax(FullScanMassAnalyzerType analyzerType, out double minFilt, out double maxFilt) { if (analyzerType == FullScanMassAnalyzerType.qit) { minFilt = TransitionFullScan.MIN_LO_RES; maxFilt = TransitionFullScan.MAX_LO_RES; } else if (analyzerType == FullScanMassAnalyzerType.centroided) { minFilt = TransitionFullScan.MIN_CENTROID_PPM; maxFilt = TransitionFullScan.MAX_CENTROID_PPM; } else { minFilt = TransitionFullScan.MIN_HI_RES; maxFilt = TransitionFullScan.MAX_HI_RES; } }
private static bool IsResMzAnalyzer(FullScanMassAnalyzerType precursorAnalyzerType) { return precursorAnalyzerType == FullScanMassAnalyzerType.orbitrap || precursorAnalyzerType == FullScanMassAnalyzerType.ft_icr; }
public static void SetAnalyzerType(FullScanMassAnalyzerType analyzerTypeNew, FullScanMassAnalyzerType analyzerTypeCurrent, double? resCurrent, double? resMzCurrent, Label label, TextBox textRes, Label labelAt, TextBox textAt, Label labelTh, Label labelPPM) { string labelText = Resources.TransitionSettingsUI_SetAnalyzerType_Resolution; labelPPM.Visible = false; if (analyzerTypeNew == FullScanMassAnalyzerType.none) { textRes.Enabled = false; textRes.Text = string.Empty; labelAt.Visible = false; textAt.Visible = false; labelTh.Left = textRes.Right; } else if (analyzerTypeNew == FullScanMassAnalyzerType.centroided) { labelAt.Visible = false; labelTh.Visible = false; textAt.Visible = false; textRes.Enabled = true; textRes.Text = resCurrent.HasValue && (analyzerTypeCurrent == analyzerTypeNew) ? resCurrent.Value.ToString(LocalizationHelper.CurrentCulture) : TransitionFullScan.DEFAULT_CENTROIDED_PPM.ToString(LocalizationHelper.CurrentCulture); labelText = Resources.FullScanSettingsControl_SetAnalyzerType_Mass__Accuracy_; labelPPM.Visible = true; labelPPM.Left = textRes.Right; labelPPM.Top = textRes.Top; } else { textRes.Enabled = true; bool variableRes = false; TextBox textMz = null; if (analyzerTypeNew == FullScanMassAnalyzerType.qit) { textMz = textRes; } else { labelText = Resources.TransitionSettingsUI_SetAnalyzerType_Resolving_power; if (analyzerTypeNew != FullScanMassAnalyzerType.tof) { variableRes = true; textMz = textAt; } } const string resolvingPowerFormat = "#,0.####"; // Not L10N if (analyzerTypeNew == analyzerTypeCurrent && resCurrent.HasValue) textRes.Text = resCurrent.Value.ToString(resolvingPowerFormat); else textRes.Text = TransitionFullScan.DEFAULT_RES_VALUES[(int)analyzerTypeNew].ToString(resolvingPowerFormat); labelAt.Visible = variableRes; textAt.Visible = variableRes; textAt.Text = resMzCurrent.HasValue ? resMzCurrent.Value.ToString(LocalizationHelper.CurrentCulture) : TransitionFullScan.DEFAULT_RES_MZ.ToString(LocalizationHelper.CurrentCulture); labelTh.Visible = (textMz != null); if (textMz != null) labelTh.Left = textMz.Right; } label.Text = labelText; }