private void SaveButton_Click(object sender, RoutedEventArgs e) { string fieldNotUsed = "1"; if (!GlobalGuiSettings.CheckTaskSettingsValidity(XLPrecusorMsTlTextBox.Text, productMassToleranceTextBox.Text, missedCleavagesTextBox.Text, maxModificationIsoformsTextBox.Text, MinPeptideLengthTextBox.Text, MaxPeptideLengthTextBox.Text, maxThreadsTextBox.Text, minScoreAllowed.Text, fieldNotUsed, fieldNotUsed, fieldNotUsed, TopNPeaksTextBox.Text, MinRatioTextBox.Text, null, null, numberOfDatabaseSearchesTextBox.Text, fieldNotUsed, fieldNotUsed, fieldNotUsed)) { return; } DissociationType dissociationType = GlobalVariables.AllSupportedDissociationTypes[DissociationTypeComboBox.SelectedItem.ToString()]; DissociationType childDissociationType = DissociationType.Unknown; if (ChildScanDissociationTypeComboBox.SelectedItem != null) { childDissociationType = GlobalVariables.AllSupportedDissociationTypes[ChildScanDissociationTypeComboBox.SelectedItem.ToString()]; } CustomFragmentationWindow.Close(); //TheTask.XlSearchParameters.SearchGlyco = RbSearchGlyco.IsChecked.Value; //TheTask.XlSearchParameters.SearchGlycoWithBgYgIndex = CkbSearchGlycoWithBgYgIndex.IsChecked.Value; TheTask.XlSearchParameters.RestrictToTopNHits = ckbXLTopNum.IsChecked.Value; TheTask.XlSearchParameters.CrosslinkSearchTopNum = int.Parse(txtXLTopNum.Text, CultureInfo.InvariantCulture); TheTask.XlSearchParameters.CrosslinkAtCleavageSite = ckbCrosslinkAtCleavageSite.IsChecked.Value; TheTask.XlSearchParameters.Crosslinker = (Crosslinker)cbCrosslinkers.SelectedItem; TheTask.XlSearchParameters.XlQuench_H2O = ckbQuenchH2O.IsChecked.Value; TheTask.XlSearchParameters.XlQuench_NH2 = ckbQuenchNH2.IsChecked.Value; TheTask.XlSearchParameters.XlQuench_Tris = ckbQuenchTris.IsChecked.Value; TheTask.XlSearchParameters.DecoyType = checkBoxDecoy.IsChecked.Value ? DecoyType.Reverse : DecoyType.None; Protease protease = (Protease)proteaseComboBox.SelectedItem; int MaxMissedCleavages = string.IsNullOrEmpty(missedCleavagesTextBox.Text) ? int.MaxValue : (int.Parse(missedCleavagesTextBox.Text, NumberStyles.Any, CultureInfo.InvariantCulture)); int MinPeptideLength = (int.Parse(MinPeptideLengthTextBox.Text, NumberStyles.Any, CultureInfo.InvariantCulture)); int MaxPeptideLength = string.IsNullOrEmpty(MaxPeptideLengthTextBox.Text) ? int.MaxValue : (int.Parse(MaxPeptideLengthTextBox.Text, NumberStyles.Any, CultureInfo.InvariantCulture)); int MaxModificationIsoforms = (int.Parse(maxModificationIsoformsTextBox.Text, CultureInfo.InvariantCulture)); InitiatorMethionineBehavior InitiatorMethionineBehavior = ((InitiatorMethionineBehavior)initiatorMethionineBehaviorComboBox.SelectedIndex); DigestionParams digestionParamsToSave = new DigestionParams( protease: protease.Name, maxMissedCleavages: MaxMissedCleavages, minPeptideLength: MinPeptideLength, maxPeptideLength: MaxPeptideLength, maxModificationIsoforms: MaxModificationIsoforms, initiatorMethionineBehavior: InitiatorMethionineBehavior); Tolerance ProductMassTolerance; if (productMassToleranceComboBox.SelectedIndex == 0) { ProductMassTolerance = new AbsoluteTolerance(double.Parse(productMassToleranceTextBox.Text, CultureInfo.InvariantCulture)); } else { ProductMassTolerance = new PpmTolerance(double.Parse(productMassToleranceTextBox.Text, CultureInfo.InvariantCulture)); } Tolerance PrecursorMassTolerance; if (cbbXLprecusorMsTl.SelectedIndex == 0) { PrecursorMassTolerance = new AbsoluteTolerance(double.Parse(XLPrecusorMsTlTextBox.Text, CultureInfo.InvariantCulture)); } else { PrecursorMassTolerance = new PpmTolerance(double.Parse(XLPrecusorMsTlTextBox.Text, CultureInfo.InvariantCulture)); } TheTask.XlSearchParameters.WriteOutputForPercolator = ckbPercolator.IsChecked.Value; TheTask.XlSearchParameters.WritePepXml = ckbPepXML.IsChecked.Value; var listOfModsVariable = new List <(string, string)>(); foreach (var heh in VariableModTypeForTreeViewObservableCollection) { listOfModsVariable.AddRange(heh.Children.Where(b => b.Use).Select(b => (b.Parent.DisplayName, b.ModName))); } var listOfModsFixed = new List <(string, string)>(); foreach (var heh in FixedModTypeForTreeViewObservableCollection) { listOfModsFixed.AddRange(heh.Children.Where(b => b.Use).Select(b => (b.Parent.DisplayName, b.ModName))); } CommonParameters commonParamsToSave = new CommonParameters( precursorMassTolerance: PrecursorMassTolerance, taskDescriptor: OutputFileNameTextBox.Text != "" ? OutputFileNameTextBox.Text : "XLSearchTask", productMassTolerance: ProductMassTolerance, doPrecursorDeconvolution: deconvolutePrecursors.IsChecked.Value, useProvidedPrecursorInfo: useProvidedPrecursor.IsChecked.Value, digestionParams: digestionParamsToSave, trimMs1Peaks: trimMs1.IsChecked.Value, trimMsMsPeaks: trimMsMs.IsChecked.Value, numberOfPeaksToKeepPerWindow: int.Parse(TopNPeaksTextBox.Text), minimumAllowedIntensityRatioToBasePeak: double.Parse(MinRatioTextBox.Text, CultureInfo.InvariantCulture), dissociationType: dissociationType, childScanDissociationType: childDissociationType, scoreCutoff: double.Parse(minScoreAllowed.Text, CultureInfo.InvariantCulture), totalPartitions: int.Parse(numberOfDatabaseSearchesTextBox.Text, CultureInfo.InvariantCulture), listOfModsVariable: listOfModsVariable, listOfModsFixed: listOfModsFixed, assumeOrphanPeaksAreZ1Fragments: protease.Name != "top-down"); TheTask.CommonParameters = commonParamsToSave; DialogResult = true; }
private void CancelButton_Click(object sender, RoutedEventArgs e) { DialogResult = false; CustomFragmentationWindow.Close(); }
private void SaveButton_Click(object sender, RoutedEventArgs e) { string fieldNotUsed = "1"; if (!GlobalGuiSettings.CheckTaskSettingsValidity(PrecusorMsTlTextBox.Text, productMassToleranceTextBox.Text, missedCleavagesTextBox.Text, maxModificationIsoformsTextBox.Text, MinPeptideLengthTextBox.Text, MaxPeptideLengthTextBox.Text, maxThreadsTextBox.Text, minScoreAllowed.Text, fieldNotUsed, fieldNotUsed, fieldNotUsed, TopNPeaksTextBox.Text, MinRatioTextBox.Text, null, null, numberOfDatabaseSearchesTextBox.Text, TxtBoxMaxModPerPep.Text, fieldNotUsed, fieldNotUsed)) { return; } DissociationType dissociationType = GlobalVariables.AllSupportedDissociationTypes[DissociationTypeComboBox.SelectedItem.ToString()]; DissociationType childDissociationType = DissociationType.Unknown; if (ChildScanDissociationTypeComboBox.SelectedItem.ToString() != "Null") { childDissociationType = GlobalVariables.AllSupportedDissociationTypes[ChildScanDissociationTypeComboBox.SelectedItem.ToString()]; } CustomFragmentationWindow.Close(); if (RbtOGlycoSearch.IsChecked.Value) { TheTask._glycoSearchParameters.GlycoSearchType = EngineLayer.GlycoSearch.GlycoSearchType.OGlycanSearch; } else if (RbtNGlycoSearch.IsChecked.Value) { TheTask._glycoSearchParameters.GlycoSearchType = EngineLayer.GlycoSearch.GlycoSearchType.NGlycanSearch; } else if (Rbt_N_O_GlycoSearch.IsChecked.Value) { TheTask._glycoSearchParameters.GlycoSearchType = EngineLayer.GlycoSearch.GlycoSearchType.N_O_GlycanSearch; } TheTask._glycoSearchParameters.OGlycanDatabasefile = CmbOGlycanDatabase.SelectedItem.ToString(); TheTask._glycoSearchParameters.NGlycanDatabasefile = CmbNGlycanDatabase.SelectedItem.ToString(); TheTask._glycoSearchParameters.GlycoSearchTopNum = int.Parse(txtTopNum.Text, CultureInfo.InvariantCulture); TheTask._glycoSearchParameters.MaximumOGlycanAllowed = int.Parse(TbMaxOGlycanNum.Text, CultureInfo.InvariantCulture); TheTask._glycoSearchParameters.OxoniumIonFilt = CkbOxoniumIonFilt.IsChecked.Value; if (CheckBoxDecoy.IsChecked.Value) { if (RadioButtonReverseDecoy.IsChecked.Value) { TheTask._glycoSearchParameters.DecoyType = DecoyType.Reverse; } else //if (radioButtonSlideDecoy.IsChecked.Value) { TheTask._glycoSearchParameters.DecoyType = DecoyType.Slide; } } else { TheTask._glycoSearchParameters.DecoyType = DecoyType.None; } Protease protease = (Protease)proteaseComboBox.SelectedItem; int MaxMissedCleavages = string.IsNullOrEmpty(missedCleavagesTextBox.Text) ? int.MaxValue : (int.Parse(missedCleavagesTextBox.Text, NumberStyles.Any, CultureInfo.InvariantCulture)); int MinPeptideLength = (int.Parse(MinPeptideLengthTextBox.Text, NumberStyles.Any, CultureInfo.InvariantCulture)); int MaxPeptideLength = string.IsNullOrEmpty(MaxPeptideLengthTextBox.Text) ? int.MaxValue : (int.Parse(MaxPeptideLengthTextBox.Text, NumberStyles.Any, CultureInfo.InvariantCulture)); int MaxModificationIsoforms = (int.Parse(maxModificationIsoformsTextBox.Text, CultureInfo.InvariantCulture)); int MaxModPerPep = (int.Parse(TxtBoxMaxModPerPep.Text, CultureInfo.InvariantCulture)); InitiatorMethionineBehavior InitiatorMethionineBehavior = ((InitiatorMethionineBehavior)initiatorMethionineBehaviorComboBox.SelectedIndex); DigestionParams digestionParamsToSave = new DigestionParams( protease: protease.Name, maxMissedCleavages: MaxMissedCleavages, minPeptideLength: MinPeptideLength, maxPeptideLength: MaxPeptideLength, maxModificationIsoforms: MaxModificationIsoforms, maxModsForPeptides: MaxModPerPep, initiatorMethionineBehavior: InitiatorMethionineBehavior); Tolerance ProductMassTolerance; if (productMassToleranceComboBox.SelectedIndex == 0) { ProductMassTolerance = new AbsoluteTolerance(double.Parse(productMassToleranceTextBox.Text, CultureInfo.InvariantCulture)); } else { ProductMassTolerance = new PpmTolerance(double.Parse(productMassToleranceTextBox.Text, CultureInfo.InvariantCulture)); } Tolerance PrecursorMassTolerance; if (cbbPrecusorMsTl.SelectedIndex == 0) { PrecursorMassTolerance = new AbsoluteTolerance(double.Parse(PrecusorMsTlTextBox.Text, CultureInfo.InvariantCulture)); } else { PrecursorMassTolerance = new PpmTolerance(double.Parse(PrecusorMsTlTextBox.Text, CultureInfo.InvariantCulture)); } var listOfModsVariable = new List <(string, string)>(); foreach (var heh in VariableModTypeForTreeViewObservableCollection) { listOfModsVariable.AddRange(heh.Children.Where(b => b.Use).Select(b => (b.Parent.DisplayName, b.ModName))); } var listOfModsFixed = new List <(string, string)>(); foreach (var heh in FixedModTypeForTreeViewObservableCollection) { listOfModsFixed.AddRange(heh.Children.Where(b => b.Use).Select(b => (b.Parent.DisplayName, b.ModName))); } CommonParameters commonParamsToSave = new CommonParameters( precursorMassTolerance: PrecursorMassTolerance, taskDescriptor: OutputFileNameTextBox.Text != "" ? OutputFileNameTextBox.Text : "GlycoSearchTask", productMassTolerance: ProductMassTolerance, doPrecursorDeconvolution: deconvolutePrecursors.IsChecked.Value, useProvidedPrecursorInfo: useProvidedPrecursor.IsChecked.Value, digestionParams: digestionParamsToSave, trimMs1Peaks: trimMs1.IsChecked.Value, trimMsMsPeaks: trimMsMs.IsChecked.Value, numberOfPeaksToKeepPerWindow: int.Parse(TopNPeaksTextBox.Text), minimumAllowedIntensityRatioToBasePeak: double.Parse(MinRatioTextBox.Text, CultureInfo.InvariantCulture), dissociationType: dissociationType, ms2childScanDissociationType: childDissociationType, scoreCutoff: double.Parse(minScoreAllowed.Text, CultureInfo.InvariantCulture), totalPartitions: int.Parse(numberOfDatabaseSearchesTextBox.Text, CultureInfo.InvariantCulture), maxThreadsToUsePerFile: int.Parse(maxThreadsTextBox.Text, CultureInfo.InvariantCulture), listOfModsVariable: listOfModsVariable, listOfModsFixed: listOfModsFixed, assumeOrphanPeaksAreZ1Fragments: protease.Name != "top-down"); TheTask.CommonParameters = commonParamsToSave; DialogResult = true; }