public Parameters GetParameters(IMatrixData mdata, ref string errorString) { Parameters[] subParams = new Parameters[mdata.CategoryRowCount]; for (int i = 0; i < mdata.CategoryRowCount; i++) { string[] values = mdata.GetCategoryRowValuesAt(i); int[] sel = values.Length == 1 ? new[] { 0 } : new int[0]; subParams[i] = new Parameters(new Parameter[] { new MultiChoiceParam("Values", sel) { Values = values, Help = "The value that should be present to discard/keep the corresponding row." } }); } return (new Parameters(new SingleChoiceWithSubParams("Row") { Values = mdata.CategoryRowNames, SubParams = subParams, Help = "The categorical row that the filtering should be based on.", ParamNameWidth = 50, TotalWidth = 731 }, new SingleChoiceParam("Mode") { Values = new[] { "Remove matching columns", "Keep matching columns" }, Help = "If 'Remove matching columns' is selected, rows having the values specified above will be removed while " + "all other rows will be kept. If 'Keep matching columns' is selected, the opposite will happen." }, PerseusPluginUtils.CreateFilterModeParam(false))); }
public Parameters GetParameters(IMatrixData mdata, ref string errorString) { Parameters[] subParams = new Parameters[mdata.CategoryRowCount]; for (int i = 0; i < mdata.CategoryRowCount; i++) { string[] values = mdata.GetCategoryRowValuesAt(i); int[] sel = values.Length == 1 ? new[] { 0 } : new int[0]; subParams[i] = new Parameters(new Parameter[] { new MultiChoiceParam("NGS samples", sel) { Values = values, Help = "The groups of NGS data that should be used as reference for normalization.", }, new MultiChoiceParam("MS samples", sel) { Values = values, Help = "The groups of MS data that should be normalized." } }); } return (new Parameters(new SingleChoiceWithSubParams("Group") { Values = mdata.CategoryRowNames, SubParams = subParams, Help = "The categorical row that the analysis should be based on.", ParamNameWidth = 70, TotalWidth = 731 })); }
public Parameters GetParameters(IMatrixData mdata, ref string errorString) { Parameters[] subParams = new Parameters[mdata.CategoryRowCount]; for (int i = 0; i < mdata.CategoryRowCount; i++) { string[] values = mdata.GetCategoryRowValuesAt(i); int[] sel = values.Length == 1 ? new[] { 0 } : new int[0]; subParams[i] = new Parameters(new Parameter[] { new MultiChoiceParam("Values", sel) { Values = values, Help = "The value that should be present to discard/keep the corresponding row." } }); } return (new Parameters(new Parameter[] { new SingleChoiceWithSubParams("Row") { Values = mdata.CategoryRowNames, SubParams = subParams, Help = "The categorical row that the filtering should be based on.", ParamNameWidth = 50, TotalWidth = 731 }, new StringParam("New term") })); }
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables, ref IDocumentData[] documents, ProcessInfo processInfo) { ParameterWithSubParams <int> p = param.GetParamWithSubParams <int>("Row"); int colInd = p.Value; if (colInd < 0) { processInfo.ErrString = "No categorical rows available."; return; } Parameter <int[]> mcp = p.GetSubParameters().GetParam <int[]>("Values"); int[] inds = mcp.Value; if (inds.Length == 0) { processInfo.ErrString = "Please select at least one term for filtering."; return; } string[] values = new string[inds.Length]; string[] v = mdata.GetCategoryRowValuesAt(colInd); for (int i = 0; i < values.Length; i++) { values[i] = v[inds[i]]; } HashSet <string> value = new HashSet <string>(values); bool remove = param.GetParam <int>("Mode").Value == 0; string[][] cats = mdata.GetCategoryRowAt(colInd); List <int> valids = new List <int>(); List <int> notvalids = new List <int>(); for (int i = 0; i < cats.Length; i++) { bool valid = true; foreach (string w in cats[i]) { if (value.Contains(w)) { valid = false; break; } } if (valid && remove || !valid && !remove) { valids.Add(i); } else if (!valid) { notvalids.Add(i); } } if (param.GetParam <int>("Filter mode").Value == 2) { supplTables = new[] { PerseusPluginUtils.CreateSupplTabSplitColumns(mdata, notvalids.ToArray()) }; } PerseusPluginUtils.FilterColumnsNew(mdata, param, valids.ToArray()); }
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables, ref IDocumentData[] documents, ProcessInfo processInfo) { ParameterWithSubParams <int> p = param.GetParamWithSubParams <int>("Row"); int colInd = p.Value; if (colInd < 0) { processInfo.ErrString = "No categorical rows available."; return; } Parameter <int[]> mcp = p.GetSubParameters().GetParam <int[]>("Values"); int[] inds = mcp.Value; if (inds.Length < 1) { processInfo.ErrString = "Please select at least two terms for merging."; return; } string newTerm = param.GetParam <string>("New term").Value; if (newTerm.Length == 0) { processInfo.ErrString = "Please specify a new term."; return; } string[] values = new string[inds.Length]; for (int i = 0; i < values.Length; i++) { values[i] = mdata.GetCategoryRowValuesAt(colInd)[inds[i]]; } HashSet <string> value = new HashSet <string>(values); string[][] cats = mdata.GetCategoryRowAt(colInd); string[][] newCat = new string[cats.Length][]; for (int i = 0; i < cats.Length; i++) { string[] w = cats[i]; bool changed = false; for (int j = 0; j < w.Length; j++) { if (value.Contains(w[j])) { w[j] = newTerm; changed = true; } } if (changed) { Array.Sort(w); } newCat[i] = w; } mdata.SetCategoryRowAt(newCat, colInd); }
public Parameters GetParameters(IMatrixData mdata, ref string errorString) { Parameters[] subParams = new Parameters[mdata.CategoryRowCount]; for (int i = 0; i < mdata.CategoryRowCount; i++) { string[] values = mdata.GetCategoryRowValuesAt(i); int[] sel = values.Length == 1 ? new[] { 0 } : new int[0]; subParams[i] = new Parameters(new Parameter[] { new MultiChoiceParam("Values1", sel) { Values = values, Help = "The groups that should be present to compute differential expression analysis.", }, new MultiChoiceParam("Values2", sel) { Values = values, Help = "The groups that should be present to compute differential expression analysis." } }); } return (new Parameters(new SingleChoiceWithSubParams("Group") { Values = mdata.CategoryRowNames, SubParams = subParams, Help = "The categorical row that the analysis should be based on.", ParamNameWidth = 70, TotalWidth = 731 }, new BoolWithSubParams("Log2 Fold Change") { Help = "The Log2 Fold Change threshold of the significant features.", Value = true, SubParamsTrue = new Parameters(new DoubleParam("Up-regluation", 1.5), new DoubleParam("Down-regluation", -1.5)), ParamNameWidth = 90, TotalWidth = 731 }, new BoolWithSubParams("FDR") { Help = "The FDR threshold of the significant features.", Value = true, SubParamsTrue = new Parameters(new DoubleParam("Max. FDR", 0.05)), ParamNameWidth = 90, TotalWidth = 731 }, new BoolWithSubParams("P-value") { Help = "The p-value threshold of the significant features.", Value = false, SubParamsTrue = new Parameters(new DoubleParam("Max. p-value", 0.05)), ParamNameWidth = 90, TotalWidth = 731 } )); }
public string[] ExtractGroup(IMatrixData mdata, ParameterWithSubParams <int> p, ProcessInfo processInfo, string value, int colInd) { string[] errors = new string[0]; Parameter <int[]> mcp = p.GetSubParameters().GetParam <int[]>(value); int[] inds = mcp.Value; if (inds.Length == 0) { return(errors); } string[] values = new string[inds.Length]; string[] groupids = new string[inds.Length]; string[] v = mdata.GetCategoryRowValuesAt(colInd); for (int i = 0; i < values.Length; i++) { groupids[i] = v[inds[i]]; } return(groupids); }
public Parameters GetParameters(IMatrixData mdata, ref string errorString) { Parameters[] subParams = new Parameters[mdata.CategoryRowCount]; for (int i = 0; i < mdata.CategoryRowCount; i++) { string[] values = mdata.GetCategoryRowValuesAt(i); int[] sel = values.Length == 1 ? new[] { 0 } : new int[0]; subParams[i] = new Parameters(new Parameter[] { new MultiChoiceParam("Values", sel) { Values = values, Help = "The group that should be performed the filtering of low expression values." } }); } return (new Parameters( new StringParam("Min. expression value") { Help = "The minimum expression value for filtering the rows of the table. " + "At least one entry of a row needs to be higher than this given value.", Value = "20", }, new SingleChoiceParam("Mode") { Values = new[] { "At least one group", "All groups" }, Help = "If 'At least one group' is selected, the row will be kept if at least one selected group can fit the 'Min. expression value.'" + "If 'All groups' is selected, the row will be kept if all selected groups can fit the 'Min. expression value.'.", Value = 0 }, new SingleChoiceWithSubParams("Group") { Values = mdata.CategoryRowNames, SubParams = subParams, Help = "The categorical row that the analysis should be based on.", ParamNameWidth = 50, TotalWidth = 731 } )); }
public Parameters GetParameters(IMatrixData mdata, ref string errorString) { Parameters[] subParams = new Parameters[mdata.CategoryRowCount]; for (int i = 0; i < mdata.CategoryRowCount; i++) { string[] values = mdata.GetCategoryRowValuesAt(i); int[] sel = values.Length == 1 ? new[] { 0 } : new int[0]; subParams[i] = new Parameters(new Parameter[] { new MultiChoiceParam("Values1", sel) { Values = values, Help = "The groups that should be present to compute differential expression analysis.", }, new MultiChoiceParam("Values2", sel) { Values = values, Help = "The groups that should be present to compute differential expression analysis." } }); } return (new Parameters(new SingleChoiceWithSubParams("Program") { Values = new[] { "DESeq2", "EdgeR" }, SubParams = new[] { new Parameters(new Parameter[] { new SingleChoiceParam("FitType") { Values = new[] { "parametric", "local", "mean" }, Help = "This fitType for running DESeq2. If your dataset without replicates, please use local or mean.", } }), new Parameters(new Parameter[] { new DoubleParam("Dispersion (without replicates)", 0.04) { Help = "This dispersion value of EdgeR for the dataset without replicates." }, new SingleChoiceParam("Test method") { Values = new[] { "Generalized linear model", "Exact Test" }, Help = "This test method for running EdgeR." } }) }, Help = "The program for doing differential expression analysis.", ParamNameWidth = 170, TotalWidth = 731 }, new SingleChoiceWithSubParams("Group") { Values = mdata.CategoryRowNames, SubParams = subParams, Help = "The categorical row that the analysis should be based on.", ParamNameWidth = 70, TotalWidth = 731 }, new SingleChoiceWithSubParams("Log2 Fold Change") { Help = "The Log2 Fold Change threshold of the significant features.", Values = new[] { "Number", "Percentile", "None" }, SubParams = new[] { new Parameters(new DoubleParam("Up-regluation", 2) { Help = "The minimum value of logFC for up-regulation. " + "If the expressed values are higher than this value, " + "it would be considered as up-regulated genes/proteins." }, new DoubleParam("Down-regluation", -2) { Help = "The maximum value of logFC for down-regulation. " + "If the expressed values are lower than this value, " + "it would be considered as down-regulated genes/proteins." }), new Parameters(new DoubleParam("Up-regluation", 95) { Help = "The cutoff of logFC for up-regulation. " + "If the expressed values are located at higher percentile of the assigned value, " + "it would be considered as up-regulated genes/proteins." }, new DoubleParam("Down-regluation", 5) { Help = "The cutoff of logFC for down-regulation. " + "If the expressed values are located at lower percentile of the assigned value, " + "it would be considered as down-regulated genes/proteins." }), new Parameters(), }, ParamNameWidth = 90, TotalWidth = 731 }, new BoolWithSubParams("Adjusted p-value (FDR)") { Help = "The Adjusted p-value (FDR) threshold of the significant features.", Value = true, SubParamsTrue = new Parameters(new DoubleParam("Max. Adjusted p-value (FDR)", 0.05)), ParamNameWidth = 90, TotalWidth = 731 }, new BoolWithSubParams("P-value") { Help = "The p-value threshold of the significant features.", Value = false, SubParamsTrue = new Parameters(new DoubleParam("Max. p-value", 0.05)), ParamNameWidth = 90, TotalWidth = 731 } )); }
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables, ref IDocumentData[] documents, ProcessInfo processInfo) { SingleChoiceWithSubParams p = param.GetSingleChoiceWithSubParams("Row"); int colInd = p.Value; if (colInd < 0) { processInfo.ErrString = "No categorical rows available."; return; } MultiChoiceParam mcp = p.GetSubParameters().GetMultiChoiceParam("Values"); int[] inds = mcp.Value; if (inds.Length < 1) { processInfo.ErrString = "Please select at least two terms for merging."; return; } string newTerm = param.GetStringParam("New term").Value; if (newTerm.Length == 0){ processInfo.ErrString = "Please specify a new term."; return; } string[] values = new string[inds.Length]; for (int i = 0; i < values.Length; i++) { values[i] = mdata.GetCategoryRowValuesAt(colInd)[inds[i]]; } HashSet<string> value = new HashSet<string>(values); string[][] cats = mdata.GetCategoryRowAt(colInd); string[][] newCat = new string[cats.Length][]; for (int i = 0; i < cats.Length; i++){ string[] w = cats[i]; bool changed = false; for (int j = 0; j < w.Length; j++){ if (value.Contains(w[j])){ w[j] = newTerm; changed = true; } } if (changed){ Array.Sort(w); } newCat[i] = w; } mdata.SetCategoryRowAt(newCat, colInd); }
public Parameters GetParameters(IMatrixData mdata, ref string errorString) { Parameters[] subParams = new Parameters[mdata.CategoryRowCount]; for (int i = 0; i < mdata.CategoryRowCount; i++) { string[] values = mdata.GetCategoryRowValuesAt(i); int[] sel = values.Length == 1 ? new[] { 0 } : new int[0]; subParams[i] = new Parameters(new Parameter[]{ new MultiChoiceParam("Values", sel) {Values = values, Help = "The value that should be present to discard/keep the corresponding row."} }); } return new Parameters(new Parameter[]{ new SingleChoiceWithSubParams("Row"){ Values = mdata.CategoryRowNames, SubParams = subParams, Help = "The categorical row that the filtering should be based on.", ParamNameWidth = 50, TotalWidth = 731 }, new StringParam("New term") }); }
public Parameters GetParameters(IMatrixData mdata, ref string errorString) { Parameters[] subParams = new Parameters[mdata.CategoryRowCount]; for (int i = 0; i < mdata.CategoryRowCount; i++) { string[] values = mdata.GetCategoryRowValuesAt(i); int[] sel = values.Length == 1 ? new[] { 0 } : new int[0]; subParams[i] = new Parameters(new Parameter[] { new MultiChoiceParam("Values", sel) { Values = values, Help = "The group that should be performed the filtering of low expression values." } }); } return (new Parameters( new SingleChoiceWithSubParams("Min. expression value") { Help = "The minimum expression value for filtering the rows of the table. ", Values = new[] { "Raw counts", "cpm" }, SubParams = new[] { new Parameters(new IntParam("Min. raw counts", Math.Min(mdata.RowCount, 20)) { Help = "The minimum value of raw count for filtering the low expressed genes/proteins.", }), new Parameters(new IntParam("Min. cpm", 1) { Help = "The minimum value of cpm for filtering the low expressed genes/proteins." }), }, ParamNameWidth = 50, TotalWidth = 731 }, new SingleChoiceParam("Mode") { Values = new[] { "At least one group", "All groups", "Total" }, Help = "If 'At least one group' is selected, the row will be kept if at least one selected group can fit the " + "'Min. expression value' with the number of 'Min.valid samples in a group'." + "If 'All groups' is selected, the row will be kept if all selected groups can fit the " + "'Min. expression value' with the number of 'Min.valid samples in a group'." + "If 'Total' is selected, the row will be kept if the samples (without considering group) can fit the " + "'Min. expression value' with the number of 'Min.valid samples in a group'.", Value = 0 }, new SingleChoiceWithSubParams("Min. valid samples in a group") { Help = "The minimum number of values in one row are higher than minimum expression value. ", Values = new[] { "Number", "Percentage" }, SubParams = new[] { new Parameters(new IntParam("Min. number of samples", Math.Min(mdata.RowCount, 1)) { Help = "If a row has less than the specified number of valid values it will be discarded in the output.", }), new Parameters(new IntParam("Min. percentage of samples", 25) { Help = "If a row has less than the specified percentage of valid values it will be discarded in the output." }), }, ParamNameWidth = 50, TotalWidth = 731 }, new SingleChoiceWithSubParams("Group") { Values = mdata.CategoryRowNames, SubParams = subParams, Help = "The categorical row that the analysis should be based on.", ParamNameWidth = 50, TotalWidth = 731 } )); }
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables, ref IDocumentData[] documents, ProcessInfo processInfo) { SingleChoiceWithSubParams p = param.GetSingleChoiceWithSubParams("Row"); int colInd = p.Value; if (colInd < 0){ processInfo.ErrString = "No categorical rows available."; return; } MultiChoiceParam mcp = p.GetSubParameters().GetMultiChoiceParam("Values"); int[] inds = mcp.Value; if (inds.Length == 0){ processInfo.ErrString = "Please select at least one term for filtering."; return; } string[] values = new string[inds.Length]; for (int i = 0; i < values.Length; i++){ values[i] = mdata.GetCategoryRowValuesAt(colInd)[inds[i]]; } HashSet<string> value = new HashSet<string>(values); bool remove = param.GetSingleChoiceParam("Mode").Value == 0; string[][] cats = mdata.GetCategoryRowAt(colInd); List<int> valids = new List<int>(); for (int i = 0; i < cats.Length; i++){ bool valid = true; foreach (string w in cats[i]){ if (value.Contains(w)){ valid = false; break; } } if ((valid && remove) || (!valid && !remove)){ valids.Add(i); } } PerseusPluginUtils.FilterColumns(mdata, param, valids.ToArray()); }
public Parameters GetParameters(IMatrixData mdata, ref string errorString) { Parameters[] subParams = new Parameters[mdata.CategoryRowCount]; for (int i = 0; i < mdata.CategoryRowCount; i++) { string[] values = mdata.GetCategoryRowValuesAt(i); int[] sel = values.Length == 1 ? new[]{0} : new int[0]; subParams[i] = new Parameters(new Parameter[]{ new MultiChoiceParam("Values", sel) {Values = values, Help = "The value that should be present to discard/keep the corresponding row."} }); } return new Parameters(new Parameter[]{ new SingleChoiceWithSubParams("Row"){ Values = mdata.CategoryRowNames, SubParams = subParams, Help = "The categorical row that the filtering should be based on.", ParamNameWidth = 50, TotalWidth = 731 }, new SingleChoiceParam("Mode"){ Values = new[]{"Remove matching columns", "Keep matching columns"}, Help = "If 'Remove matching columns' is selected, rows having the values specified above will be removed while " + "all other rows will be kept. If 'Keep matching columns' is selected, the opposite will happen." }, PerseusPluginUtils.GetFilterModeParam(false) }); }