private static Parameter GetColumnSelectionParameter(string[] selection) { const int maxCols = 5; string[] values = new string[maxCols]; Parameters[] subParams = new Parameters[maxCols]; for (int i = 1; i <= maxCols; i++) { values[i - 1] = "" + i; Parameter[] px = new Parameter[i]; for (int j = 0; j < i; j++) { px[j] = new SingleChoiceParam(GetVariableName(j), j) { Values = selection }; } Parameters p = new Parameters(px); subParams[i - 1] = p; } return(new SingleChoiceWithSubParams("Number of columns", 0) { Values = values, SubParams = subParams, ParamNameWidth = 120, TotalWidth = 800 }); }
public void TestSingleChoiceParam() { SingleChoiceParam param = new SingleChoiceParam("choice", 1) { Values = new List <string> { "c1", "b2" } }; SingleChoiceParam param2 = (SingleChoiceParam)param.ToXmlAndBack(); Assert.AreEqual(param.Name, param2.Name); Assert.AreEqual(param.Value, param2.Value); Assert.IsTrue(param.Values.SequenceEqual(param2.Values)); }
public Parameters GetParameters(IMatrixData mdata, ref string errorString) { string[] reducedExpColNames = ReduceNames(mdata.ColumnNames); List <Parameter> p = new List <Parameter>(); for (int i = 0; i < mdata.ColumnCount; i++) { SingleChoiceParam scp = new SingleChoiceParam(mdata.ColumnNames[i]) { Values = mdata.NumericColumnNames, Value = GetSelectedValue(mdata.NumericColumnNames, reducedExpColNames[i]) }; p.Add(scp); } return(new Parameters(p)); }
public void TestSmallExample() { SingleChoiceParam matchColParam1 = (SingleChoiceParam)parameters.GetParam <int>("Matching column in table 1"); CollectionAssert.AreEqual(new [] { "pep_id", "pep_Protein group IDs", "pep_Intensity" }, matchColParam1.Values.ToArray()); matchColParam1.Value = 1; Assert.AreEqual("pep_Protein group IDs", matchColParam1.StringValue); IMatrixData[] supplTables = null; IDocumentData[] documents = null; IMatrixData matched = matching.ProcessData(new[] { expand, proteinMain }, parameters, ref supplTables, ref documents, BaseTest.CreateProcessInfo()); CollectionAssert.AreEqual(new [] { "pep_MS/MS Count", "pep_id", "pep_Protein group IDs", "pep_Intensity" }, matched.ColumnNames.Concat(matched.StringColumnNames).Concat(matched.NumericColumnNames).ToArray()); Assert.AreEqual(2, matched.RowCount); Assert.AreEqual(1, matched.ColumnCount); Assert.AreEqual(1, matched.NumericColumnCount); }
protected override Parameter[] SpecificParameters(IMatrixData data, ref string errString) { if (data.StringColumnCount == 0) { errString = "Please add at least one string column"; return(null); } var ConditionColumn1Param = new SingleChoiceParam("Condition column, eg R.FileName") { Values = data.StringColumnNames, Value = Math.Max(0, data.StringColumnNames.FindIndex(col => col.ToLower().Equals("r.filename"))), Help = "Chose experimental condition column, such as R.FileName, which will be used to create wide-format intensity columns. Has to be a text column." }; var PerlParam = new SingleChoiceWithSubParams("Condition grouping") { Values = new[] { "Group by condition column", "Skip" }, Value = 0, Help = "Chose if input should be grouped from long-format (e.g. Spectronaut report or MaxQuant LFQ evidence) or mixed-format " + "(e.g. MaxQuant TMT evidence with conditions) into wide-format required for this plugin. Chose skip if data is already in wide-format " + "(e.g. MaxQuant TMT evidence without conditions).", SubParams = new Parameters[] { // Define the different sub-parameter groups new Parameters(ConditionColumn1Param), // condition grouping new Parameters() // Skip } }; var Cutoff1aParam = new DoubleParam("Localization cutoff", 0.75) { Help = "Localization cutoff to be used to filter PTM localization. Can be between 0 and 1. Setting to 0 will not filter anything." }; var Cutoff1bParam = new DoubleParam("Localization cutoff", 0.75) { Help = "Localization cutoff to be used to filter PTM localization. Can be between 0 and 1. Setting to 0 will not filter anything." }; var Cutoff2aParam = new DoubleParam("Localization cutoff", 0.75) { Help = "Localization cutoff to be used to filter PTM localization. Can be between 0 and 1. Setting to 0 will not filter anything." }; var Cutoff2bParam = new DoubleParam("Localization cutoff", 0.75) { Help = "Localization cutoff to be used to filter PTM localization. Can be between 0 and 1. Setting to 0 will not filter anything." }; var Cutoff2cParam = new DoubleParam("Localization cutoff", 0.75) { Help = "Localization cutoff to be used to filter PTM localization. Can be between 0 and 1. Setting to 0 will not filter anything." }; var Cutoff3aParam = new DoubleParam("Localization cutoff", 0.75) { Help = "Localization cutoff to be used to filter PTM localization. Can be between 0 and 1. Setting to 0 will not filter anything." }; var Cutoff3bParam = new DoubleParam("Localization cutoff", 0.75) { Help = "Localization cutoff to be used to filter PTM localization. Can be between 0 and 1. Setting to 0 will not filter anything." }; var PTMPosCol1Param = new SingleChoiceParam("PTM position column type") { Values = new[] { "EG.PTMLocalizationProbabilities (SN)", "EG.PrecursorId (SN)" }, Help = "Chose which column PTM positions should be extracted from. Requires respective columns." }; var PTMPosCol2Param = new SingleChoiceParam("PTM position column type") { Values = new[] { "EG.PTMLocalizationProbabilities (SN)", "EG.PrecursorId (SN)", "Modified sequence (MQ)" }, Help = "Chose which column PTM positions should be extracted from. Requires respective columns." }; var PTMPosCol3Param = new SingleChoiceParam("PTM position column type") { Values = new[] { "EG.PTMLocalizationProbabilities (SN)", "EG.PrecursorId (SN)" }, Help = "Chose which column PTM positions should be extracted from. Requires respective columns." }; var PTMPosCol2cParam = new SingleChoiceParam("Target PTM Probabilities column") { Values = data.StringColumnNames, Value = Math.Max(0, data.StringColumnNames.FindIndex(col => col.ToLower().Equals("phospho (sty) probabilities"))), Help = "Chose which column PTM target probabilities should be extracted from. Requires respective columns." }; var ProbType1Param = new SingleChoiceWithSubParams("Probability column type") { Values = new[] { "EG.PTMLocalizationProbabilities (SN)", "EG.PTMAssayProbability (SN)", "No probability column" }, Help = "Chose which column probabilities and PTM positions should be extracted from. Requires resepctive columns. " + "EG.PTMAssayProbability will extract PTM positions from EG.PrecursorId.", SubParams = new Parameters[] { // Define the different sub-parameter groups new Parameters(Cutoff1aParam), // EG.PTMLocalizationProbabilities new Parameters(Cutoff1bParam), // EG.PTMAssayProbability new Parameters(PTMPosCol1Param) // Ignored } }; var ProbType2Param = new SingleChoiceWithSubParams("Probability column type") { Values = new[] { "EG.PTMLocalizationProbabilities (SN)", "EG.PTMAssayProbability (SN)", "No probability column", "Modified sequence (MQ)" }, Help = "Chose which column probabilities and PTM positions should be extracted from. Requires resepctive columns. " + "EG.PTMAssayProbability will extract PTM positions from EG.PrecursorId. Modified sequence will extract probabilities from provided PTM Probabilities columns.", SubParams = new Parameters[] { // Define the different sub-parameter groups new Parameters(Cutoff2aParam), // EG.PTMLocalizationProbabilities new Parameters(Cutoff2bParam), // EG.PTMAssayProbability new Parameters(PTMPosCol2Param), // Ignored new Parameters(Cutoff2cParam, PTMPosCol2cParam) // Modified sequence } }; var ProbType3Param = new SingleChoiceWithSubParams("Probability column type") { Values = new[] { "EG.PTMLocalizationProbabilities (SN)", "EG.PTMAssayProbability (SN)", "No probability column" }, Help = "Chose which column probabilities and PTM positions should be extracted from. Requires resepctive columns. " + "EG.PTMAssayProbability will extract PTM positions from EG.PrecursorId.", SubParams = new Parameters[] { // Define the different sub-parameter groups new Parameters(Cutoff3aParam), // EG.PTMLocalizationProbabilities new Parameters(Cutoff3bParam), // EG.PTMAssayProbability new Parameters(PTMPosCol3Param) // Ignored } }; var GenesParam = new SingleChoiceParam("Genes or protein groups") { Values = new[] { "PG.Genes", "PG.ProteinGroups" }, Help = "Chose if sites should be collapsed on gene or protein level." }; var FastaFileParam = new FileParam("FASTA file (optional)") { Help = "Define file location of FASTA file for PTM motif sequence annotation. Leaving blank will skip annotation." }; var FastaStringParam = new StringParam("FASTA identifier rule", ".*GN=([^ ]*) .*") { Help = "If FASTA file is provided, define identifier parsing rule. This is crucial to allow gene or protein name matching as defined above. Set e.g." + ".*GN=([^ ]*) .* for gene readout, or .*\\|(.*)\\|.* for protein readout" }; var StoichParam = new SingleChoiceParam("Stoichiometry calculation") { Values = new[] { "Calculate stoichiometries", "Skip" }, Help = "Chose if target PTM stoichiometries should be calculated." }; var CollapseParam = new SingleChoiceWithSubParams("Collapse level") { Values = new[] { "Target PTM site-level, e.g. ABC1_S15_M1", "Target PTM peptide-level, e.g. FS[ph]EAMST[ph]R (stoichiometry possible)", "ModSpec peptide-level, e.g. FSEAMSTR_2[ph];1[ox]" }, Value = 0, Help = "Chose if precursors should be collapsed on peptide- or site-level. Site-level requires PEP.PeptidePosition column.", SubParams = new Parameters[] { // Define the different sub-parameter groups new Parameters(ProbType1Param, GenesParam, FastaFileParam, FastaStringParam), // Localized Site new Parameters(ProbType2Param, StoichParam), // Localized Peptide new Parameters(ProbType3Param) // ModSpec Peptide } }; var PTMTypesParam = new StringParam("Variable PTMs, target PTM first", "[Phospho (STY)];[Deamidation (NQ)];[Oxidation (M)];[Carbamidomethyl (C)]") { Help = "List PTMs as listed in EG.PrecursorId, separated by semicolon. If target site- or target peptide-level collapse is performed, " + "target PTM needs to be listed first." }; var AggParam = new SingleChoiceParam("Aggregation type") { Values = new[] { "Linear modeling based", "Summing" }, Help = "Chose if peptide intensities should be aggregated based on a linear model or simply summed." }; var NumberOfCoresParam = new IntParam("CPUcores", 8) { Help = "Number of CPU threads to be created by the plugin where possible. Set to 1 for lowest CPU usage. Do not set higher than actual number of available CPU threads." }; return(new Parameter[] { PerlParam, CollapseParam, PTMTypesParam, AggParam, NumberOfCoresParam, }); }
/// <summary> /// Convert <see cref="BaseLib.Param"/> to <see cref="BaseLibS.Param"/> /// </summary> /// <param name="p"></param> /// <returns></returns> public static Parameter Convert(Parameter p) { if (p.Type == ParamType.Server) { return(p); } if (p is RegexReplaceParamWf) { RegexReplaceParamWf q = (RegexReplaceParamWf)p; RegexReplaceParam b = new RegexReplaceParam(q.Name, q.Value.Item1, q.Value.Item2, q.Previews) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is RegexMatchParamWf) { RegexMatchParamWf q = (RegexMatchParamWf)p; RegexMatchParam b = new RegexMatchParam(q.Name, q.Value, q.Previews) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is BoolParamWf) { BoolParamWf q = (BoolParamWf)p; BoolParam b = new BoolParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is BoolWithSubParamsWf) { BoolWithSubParamsWf q = (BoolWithSubParamsWf)p; q.SubParamsFalse?.Convert(Convert); q.SubParamsTrue?.Convert(Convert); BoolWithSubParams b = new BoolWithSubParams(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, SubParamsFalse = q.SubParamsFalse, SubParamsTrue = q.SubParamsTrue, Default = q.Default, ParamNameWidth = q.ParamNameWidth, TotalWidth = q.TotalWidth, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is DictionaryIntValueParamWf) { DictionaryIntValueParamWf q = (DictionaryIntValueParamWf)p; DictionaryIntValueParam b = new DictionaryIntValueParam(q.Name, q.Value, q.Keys) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is DoubleParamWf) { DoubleParamWf q = (DoubleParamWf)p; DoubleParam b = new DoubleParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is FileParamWf) { FileParamWf q = (FileParamWf)p; FileParam b = new FileParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Default = q.Default, Filter = q.Filter, ProcessFileName = q.ProcessFileName, Save = q.Save, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is FolderParamWf) { FolderParamWf q = (FolderParamWf)p; FolderParam b = new FolderParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is IntParamWf) { IntParamWf q = (IntParamWf)p; IntParam b = new IntParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is LabelParamWf) { LabelParamWf q = (LabelParamWf)p; LabelParam b = new LabelParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is MultiChoiceMultiBinParamWf) { MultiChoiceMultiBinParamWf q = (MultiChoiceMultiBinParamWf)p; MultiChoiceMultiBinParam b = new MultiChoiceMultiBinParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Values = q.Values, Bins = q.Bins, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is MultiChoiceParamWf) { MultiChoiceParamWf q = (MultiChoiceParamWf)p; MultiChoiceParam b = new MultiChoiceParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Repeats = q.Repeats, Values = q.Values, Default = q.Default, DefaultSelections = q.DefaultSelections, DefaultSelectionNames = q.DefaultSelectionNames, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is MultiFileParamWf) { MultiFileParamWf q = (MultiFileParamWf)p; MultiFileParam b = new MultiFileParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Filter = q.Filter, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is MultiStringParamWf) { MultiStringParamWf q = (MultiStringParamWf)p; MultiStringParam b = new MultiStringParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is SingleChoiceParamWf) { SingleChoiceParamWf q = (SingleChoiceParamWf)p; SingleChoiceParam b = new SingleChoiceParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Values = q.Values, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is SingleChoiceWithSubParamsWf) { SingleChoiceWithSubParamsWf q = (SingleChoiceWithSubParamsWf)p; foreach (Parameters param in q.SubParams) { param?.Convert(Convert); } SingleChoiceWithSubParams b = new SingleChoiceWithSubParams(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Values = q.Values, Default = q.Default, SubParams = new Parameters[q.SubParams.Count], ParamNameWidth = q.ParamNameWidth, TotalWidth = q.TotalWidth, Url = q.Url }; for (int i = 0; i < q.SubParams.Count; i++) { b.SubParams[i] = q.SubParams[i]; } foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is StringParamWf) { StringParamWf q = (StringParamWf)p; StringParam b = new StringParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is Ms1LabelParamWf) { Ms1LabelParamWf q = (Ms1LabelParamWf)p; Ms1LabelParam b = new Ms1LabelParam(q.Name, q.Value) { Values = q.Values, Multiplicity = q.Multiplicity, Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } throw new Exception("Could not convert ParamWfeter"); }
public void TestSingleChoiceParam() { var param = new SingleChoiceParam("choice", 1) { Values = new List<string> {"c1", "b2"} }; var param2 = (SingleChoiceParam) param.ToXmlAndBack(); Assert.AreEqual(param.Name, param2.Name); Assert.AreEqual(param.Value, param2.Value); Assert.IsTrue(param.Values.SequenceEqual(param2.Values)); }
private static Parameter GetColumnSelectionParameter(string[] selection) { const int maxCols = 5; string[] values = new string[maxCols]; Parameters[] subParams = new Parameters[maxCols]; for (int i = 1; i <= maxCols; i++){ values[i - 1] = "" + i; Parameter[] px = new Parameter[i]; for (int j = 0; j < i; j++){ px[j] = new SingleChoiceParam(GetVariableName(j), j){Values = selection}; } Parameters p = new Parameters(px); subParams[i - 1] = p; } return new SingleChoiceWithSubParams("Number of columns", 0){ Values = values, SubParams = subParams, ParamNameWidth = 120, TotalWidth = 800 }; }
private void AddQuantificationParameters(IList<Parameter> list, Lib.Model.Param quantificationMethod, Lib.Model.Param protUnit, Lib.Model.Param pepUnit, IList<ParameterDescription> help) { string name = MetadataElement.QUANTIFICATION_METHOD.Name; string desc = null; name = CheckIfDescriptionExists(help, name, ref desc, null); IList<string> values = cv.GetOnlyChildNamesOfTerm("MS:1001833", "MS"); values.Add(""); int index = -1; if (quantificationMethod != null){ index = MzTabMatrixUtils.GetSelectedIndex(quantificationMethod.Name, values); } SingleChoiceParam method = new SingleChoiceParam(name, index){ Help = desc, Values = values }; list.Add(method); values = cv.GetOnlyChildNamesOfTerm("PRIDE:0000392", "PRIDE"); name = string.Format("{0}{1}{2}", MetadataElement.PROTEIN, MZTabConstants.MINUS, MetadataProperty.PROTEIN_QUANTIFICATION_UNIT); desc = null; name = CheckIfDescriptionExists(help, name, ref desc, null); index = MzTabMatrixUtils.GetSelectedIndex( protUnit == null ? cv.GetParam("Ratio", "PRIDE").Name : protUnit.Name, values); SingleChoiceParam protein_unit = new SingleChoiceParam(name, index){Help = desc, Values = values}; list.Add(protein_unit); name = string.Format("{0}{1}{2}", MetadataElement.PEPTIDE, MZTabConstants.MINUS, MetadataProperty.PEPTIDE_QUANTIFICATION_UNIT); desc = null; name = CheckIfDescriptionExists(help, name, ref desc, null); index = MzTabMatrixUtils.GetSelectedIndex(pepUnit == null ? cv.GetParam("Ratio", "PRIDE").Name : pepUnit.Name, values); SingleChoiceParam peptide_unit = new SingleChoiceParam(name, index){Help = desc, Values = values}; list.Add(peptide_unit); }
private void AddMzParameters(IList<Parameter> list, IList<ParameterDescription> help, Metadata mtd) { string name = string.Format("{0}{1}{2}", MetadataElement.MZTAB, MZTabConstants.MINUS, MetadataProperty.MZTAB_VERSION); string desc = null; name = CheckIfDescriptionExists(help, name, ref desc, mtd); StringParam version = new StringParam(name, Constants.versions.Last()){ Help = desc }; list.Add(version); IList<string> values = Enum.GetNames(typeof (MzTabMode)); name = string.Format("{0}{1}{2}", MetadataElement.MZTAB, MZTabConstants.MINUS, MetadataProperty.MZTAB_MODE); desc = null; name = CheckIfDescriptionExists(help, name, ref desc, mtd); SingleChoiceParam mode = new SingleChoiceParam(name){ Values = values, Value = values.IndexOf(mtd.TabDescription.MzTabMode.ToString()), Help = desc }; list.Add(mode); values = Enum.GetNames(typeof (MzTabType)); name = string.Format("{0}{1}{2}", MetadataElement.MZTAB, MZTabConstants.MINUS, MetadataProperty.MZTAB_TYPE); desc = null; name = CheckIfDescriptionExists(help, name, ref desc, mtd); SingleChoiceParam type = new SingleChoiceParam(name){ Values = values, Value = values.IndexOf(mtd.TabDescription.MzTabType.ToString()), Help = desc }; list.Add(type); name = string.Format("{0}{1}{2}", MetadataElement.MZTAB, MZTabConstants.MINUS, MetadataProperty.MZTAB_ID); desc = null; name = CheckIfDescriptionExists(help, name, ref desc, mtd); StringParam id = new StringParam(name){Value = mtd.TabDescription.Id, Help = desc}; list.Add(id); }
protected override Parameter[] SpecificParameters(IMatrixData data, ref string errString) { if (data.StringColumnCount == 0) { errString = "Please add at least one string column"; return(null); } if (data.CategoryColumnCount == 0) { errString = "Please add at least one categorical column"; return(null); } var NumberOfCoresParam = new StringParam("CPUcores", "8") { Help = "Number of CPU cores to be used by the plugin in certain steps, set to 1 for lowest CPU usage." }; var ConditionColumnParam = new SingleChoiceParam("Condition column, eg R.FileName") { Values = data.CategoryColumnNames, Value = Math.Max(0, data.CategoryColumnNames.FindIndex(col => col.ToLower().Equals("r.filename"))), Help = "Chose experimental condition column, such as R.FileName. Has to be a categorical column." }; var ConditionOldParam = new StringParam("Rename condition old", "20171125_QE7_nLC14_DBJ_SA_DIAphos_RPE1_pilot2_") { Help = "Write parsing rule of condition column to be changed from. Leave blank if no change wanted." }; var ConditionNewParam = new StringParam("Rename condition new", "DIA_") { Help = "Write parsing rule of condition column to be changed into. Leave blank if no change wanted." }; var PerlParam = new SingleChoiceParam("Parsing type") { Values = new[] { "fixed", "perl" }, Help = "Chose if perl compatibility should be enabled for parsing." }; var ProbParam = new SingleChoiceWithSubParams("Prob param") // Hierarchical parameter with sub parameters { Values = new [] { "Local", "Global" }, // Name the different sub-parameter groups SubParams = new Parameters[] { // Define the different sub-parameter groups new Parameters(ConditionColumnParam, ConditionOldParam, ConditionNewParam, PerlParam), // Local new Parameters(PTMProbParam) // Global } }; var PTMProbParam = new SingleChoiceParam("EG.PTMLocalizationProbabilities") { Values = data.StringColumnNames, Value = Math.Max(0, data.StringColumnNames.FindIndex(col => col.ToLower().Equals("eg.ptmlocalizationprobabilities"))), Help = "Chose localization probability column, such as EG.PTMLocalizationProbabilities. Has to be a string column." }; var PTMSeqParam = new SingleChoiceParam("EG.PrecursorId") { Values = data.StringColumnNames, Value = Math.Max(0, data.StringColumnNames.FindIndex(col => col.ToLower().Equals("eg.precursorid"))), Help = "Chose sequence column, such as EG.PrecursorId. Has to be a string column." }; var GenesParam = new SingleChoiceParam("PG.Genes or PG.ProteinGroups") { Values = data.StringColumnNames, Value = Math.Max(0, data.StringColumnNames.FindIndex(col => col.ToLower().Equals("pg.genes"))), Help = "Chose gene or protein group column. Has to be a string column." }; var PeptidePosParam = new SingleChoiceParam("PEP.PeptidePosition") { Values = data.StringColumnNames, Value = Math.Max(0, data.StringColumnNames.FindIndex(col => col.ToLower().Equals("pep.peptideposition"))), Help = "Chose peptide position column, such as PEP.PeptidePosition. Has to be a string column." }; var AggParam = new SingleChoiceParam("Aggregation type") { Values = new[] { "Linear modeling based", "Summing" }, Help = "Chose if peptide intensities should be aggregated based on a linear model or simply summed." }; var CutoffParam = new StringParam("Localization cutoff", "0") { Help = "Localization cutoff to be used to filter PTM localization. Can be between 0 and 1. Setting to 0 will not filter anything." }; return(new Parameter[] { NumberOfCoresParam, ProbParam, // Use ProbParam instead of other parameters. PTMSeqParam, GenesParam, PeptidePosParam, AggParam, CutoffParam, }); }
/// <summary> /// Convert <see cref="BaseLib.Param"/> to <see cref="BaseLibS.Param"/> /// </summary> /// <param name="p"></param> /// <returns></returns> public static Parameter Convert(Parameter p) { if (p.Type == ParamType.Server){ return p; } if (p is RegexReplaceParamWf){ RegexReplaceParamWf q = (RegexReplaceParamWf) p; RegexReplaceParam b = new RegexReplaceParam(q.Name, q.Value.Item1, q.Value.Item2, q.Previews){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is RegexMatchParamWf){ RegexMatchParamWf q = (RegexMatchParamWf) p; RegexMatchParam b = new RegexMatchParam(q.Name, q.Value, q.Previews){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is BoolParamWf){ BoolParamWf q = (BoolParamWf) p; BoolParam b = new BoolParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is BoolWithSubParamsWf){ BoolWithSubParamsWf q = (BoolWithSubParamsWf) p; q.SubParamsFalse?.Convert(Convert); q.SubParamsTrue?.Convert(Convert); BoolWithSubParams b = new BoolWithSubParams(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, SubParamsFalse = q.SubParamsFalse, SubParamsTrue = q.SubParamsTrue, Default = q.Default, ParamNameWidth = q.ParamNameWidth, TotalWidth = q.TotalWidth, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is DictionaryIntValueParamWf){ DictionaryIntValueParamWf q = (DictionaryIntValueParamWf) p; DictionaryIntValueParam b = new DictionaryIntValueParam(q.Name, q.Value, q.Keys){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is DoubleParamWf){ DoubleParamWf q = (DoubleParamWf) p; DoubleParam b = new DoubleParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is FileParamWf){ FileParamWf q = (FileParamWf) p; FileParam b = new FileParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Default = q.Default, Filter = q.Filter, ProcessFileName = q.ProcessFileName, Save = q.Save, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is FolderParamWf){ FolderParamWf q = (FolderParamWf) p; FolderParam b = new FolderParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is IntParamWf){ IntParamWf q = (IntParamWf) p; IntParam b = new IntParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is LabelParamWf){ LabelParamWf q = (LabelParamWf) p; LabelParam b = new LabelParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is MultiChoiceMultiBinParamWf){ MultiChoiceMultiBinParamWf q = (MultiChoiceMultiBinParamWf) p; MultiChoiceMultiBinParam b = new MultiChoiceMultiBinParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Values = q.Values, Bins = q.Bins, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is MultiChoiceParamWf){ MultiChoiceParamWf q = (MultiChoiceParamWf) p; MultiChoiceParam b = new MultiChoiceParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Repeats = q.Repeats, Values = q.Values, Default = q.Default, DefaultSelections = q.DefaultSelections, DefaultSelectionNames = q.DefaultSelectionNames, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is MultiFileParamWf){ MultiFileParamWf q = (MultiFileParamWf) p; MultiFileParam b = new MultiFileParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Filter = q.Filter, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is MultiStringParamWf){ MultiStringParamWf q = (MultiStringParamWf) p; MultiStringParam b = new MultiStringParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is SingleChoiceParamWf){ SingleChoiceParamWf q = (SingleChoiceParamWf) p; SingleChoiceParam b = new SingleChoiceParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Values = q.Values, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is SingleChoiceWithSubParamsWf){ SingleChoiceWithSubParamsWf q = (SingleChoiceWithSubParamsWf) p; foreach (Parameters param in q.SubParams){ param?.Convert(Convert); } SingleChoiceWithSubParams b = new SingleChoiceWithSubParams(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Values = q.Values, Default = q.Default, SubParams = new Parameters[q.SubParams.Count], ParamNameWidth = q.ParamNameWidth, TotalWidth = q.TotalWidth, Url = q.Url }; for (int i = 0; i < q.SubParams.Count; i++){ b.SubParams[i] = q.SubParams[i]; } foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is StringParamWf){ StringParamWf q = (StringParamWf) p; StringParam b = new StringParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is Ms1LabelParamWf){ Ms1LabelParamWf q = (Ms1LabelParamWf) p; Ms1LabelParam b = new Ms1LabelParam(q.Name, q.Value){ Values = q.Values, Multiplicity = q.Multiplicity, Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } throw new Exception("Could not convert ParamWfeter"); }