protected override void UpdateSettings() { var groupComparisonDef = GroupComparisonModel.GroupComparisonDef; ReplaceComboItems(comboControlAnnotation, ListReplicateAnnotations(), groupComparisonDef.ControlAnnotation); string[] controlValues = ListControlValues(); ReplaceComboItems(comboControlValue, controlValues, groupComparisonDef.ControlValue ?? string.Empty); var caseValues = new HashSet <string>(controlValues) { string.Empty }; if (null != groupComparisonDef.ControlValue) { caseValues.Remove(groupComparisonDef.ControlValue); } var sortedCaseValues = caseValues.ToArray(); Array.Sort(sortedCaseValues); ReplaceComboItems(comboCaseValue, sortedCaseValues, groupComparisonDef.CaseValue ?? string.Empty); ReplaceComboItems(comboIdentityAnnotation, new[] { string.Empty }.Concat(ListReplicateAnnotations()), groupComparisonDef.IdentityAnnotation); ReplaceComboItems(comboNormalizationMethod, NormalizationMethod.ListNormalizationMethods(GroupComparisonModel.Document, true), groupComparisonDef.NormalizationMethod); tbxConfidenceLevel.Text = groupComparisonDef.ConfidenceLevelTimes100.ToString(CultureInfo.CurrentCulture); radioScopeProtein.Checked = groupComparisonDef.PerProtein; radioScopePeptide.Checked = !groupComparisonDef.PerProtein; }
protected override object[] GetDropdownItems() { var document = SkylineDataSchema.Document; List <Tuple <string, NormalizationMethod> > normalizationMethods = new List <Tuple <string, NormalizationMethod> > { new Tuple <string, NormalizationMethod>(string.Empty, null) }; normalizationMethods.AddRange(NormalizationMethod.ListNormalizationMethods(document).Select(ToDropdownItem)); normalizationMethods.AddRange(NormalizationMethod.RatioToSurrogate.ListSurrogateNormalizationMethods(document).Select(ToDropdownItem)); // If there are any molecules that have a normalization method that is not in the list, add it to the end. var normalizationMethodValues = new HashSet <NormalizationMethod>(normalizationMethods.Select(tuple => tuple.Item2) .Where(normalizationMethod => null != normalizationMethod)); foreach (var molecule in document.Molecules) { if (molecule.NormalizationMethod != null && normalizationMethodValues.Add(molecule.NormalizationMethod)) { normalizationMethods.Add(ToDropdownItem(molecule.NormalizationMethod)); } } return(normalizationMethods.Cast <object>().ToArray()); }
private IList <Tuple <string, NormalizationMethod> > GetDropdownItems(SrmDocument document) { List <Tuple <string, NormalizationMethod> > normalizationMethods = new List <Tuple <string, NormalizationMethod> > { new Tuple <string, NormalizationMethod>(string.Empty, null) }; if (null != document) { normalizationMethods.AddRange(NormalizationMethod.ListNormalizationMethods(document).Select(ToDropdownItem)); normalizationMethods.AddRange(NormalizationMethod.RatioToSurrogate.ListSurrogateNormalizationMethods(document).Select(ToDropdownItem)); // If there are any molecules that have a normalization method that is not in the list, add it to the end. var normalizationMethodValues = new HashSet <NormalizationMethod>(normalizationMethods.Select(tuple => tuple.Item2) .Where(normalizationMethod => null != normalizationMethod)); foreach (var molecule in document.Molecules) { if (molecule.NormalizationMethod != null && normalizationMethodValues.Add(molecule.NormalizationMethod)) { normalizationMethods.Add(ToDropdownItem(molecule.NormalizationMethod)); } } } return(normalizationMethods); }
/// <summary> /// Returns the normalization options that are appropriate for the document. /// Note: never includes "Default", "None", "Total", or "Maximum". /// </summary> /// <param name="document"></param> /// <returns></returns> public static IEnumerable <NormalizeOption> AvailableNormalizeOptions(SrmDocument document) { foreach (var normalizationMethod in NormalizationMethod.ListNormalizationMethods(document) .OrderBy(method => method is NormalizationMethod.RatioToLabel ? 0 : 1)) { if (Equals(normalizationMethod, NormalizationMethod.NONE)) { continue; } yield return(FromNormalizationMethod(normalizationMethod)); } if (document.Settings.PeptideSettings.Quantification.RegressionFit != RegressionFit.NONE) { yield return(CALIBRATED); } }
protected void UpdateSettings() { var groupComparisonDef = GroupComparisonModel.GroupComparisonDef; ReplaceComboItems(comboControlAnnotation, ListReplicateAnnotations(), groupComparisonDef.ControlAnnotation); string[] controlValues = ListControlValues(); ReplaceComboItems(comboControlValue, controlValues, groupComparisonDef.ControlValue ?? string.Empty); var caseValues = new HashSet <string>(controlValues) { string.Empty }; if (null != groupComparisonDef.ControlValue) { caseValues.Remove(groupComparisonDef.ControlValue); } var sortedCaseValues = caseValues.ToArray(); Array.Sort(sortedCaseValues); ReplaceComboItems(comboCaseValue, sortedCaseValues, groupComparisonDef.CaseValue ?? string.Empty); ReplaceComboItems(comboIdentityAnnotation, new[] { string.Empty }.Concat(ListReplicateAnnotations()), groupComparisonDef.IdentityAnnotation); ReplaceComboItems(comboNormalizationMethod, NormalizationMethod.ListNormalizationMethods(GroupComparisonModel.Document), groupComparisonDef.NormalizationMethod); ReplaceComboItems(comboSummaryMethod, SummarizationMethod.ListSummarizationMethods(), groupComparisonDef.SummarizationMethod); tbxConfidenceLevel.Text = groupComparisonDef.ConfidenceLevelTimes100.ToString(CultureInfo.CurrentCulture); radioScopeProtein.Checked = groupComparisonDef.PerProtein; radioScopePeptide.Checked = !groupComparisonDef.PerProtein; cbxUseZeroForMissingPeaks.Checked = groupComparisonDef.UseZeroForMissingPeaks; cbxUseZeroForMissingPeaks.Visible = GroupComparisonModel.Document.Settings.PeptideSettings.Integration.PeakScoringModel != null; if (GroupComparisonDef.QValueCutoff.HasValue) { tbxQValueCutoff.Text = groupComparisonDef.QValueCutoff.Value.ToString(CultureInfo.CurrentCulture); groupBoxQValueCutoff.Visible = true; } else { tbxQValueCutoff.Text = string.Empty; } if (RequiresAdvanced(groupComparisonDef)) { ShowAdvanced(true); } }