Пример #1
0
        public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
                                ref IDocumentData[] documents, ProcessInfo processInfo)
        {
            int[]          cols       = param.GetParam <int[]>("Columns").Value;
            int            truncIndex = param.GetParam <int>("Use for truncation").Value;
            TestTruncation truncation = truncIndex == 0
                                ? TestTruncation.Pvalue
                                : (truncIndex == 1 ? TestTruncation.BenjaminiHochberg : TestTruncation.PermutationBased);
            double   threshold = param.GetParam <double>("Threshold value").Value;
            int      sideInd   = param.GetParam <int>("Side").Value;
            TestSide side;

            switch (sideInd)
            {
            case 0:
                side = TestSide.Both;
                break;

            case 1:
                side = TestSide.Left;
                break;

            case 2:
                side = TestSide.Right;
                break;

            default:
                throw new Exception("Never get here.");
            }
            foreach (int col in cols)
            {
                BaseVector r     = mdata.Values.GetColumn(col);
                double[]   pvals = CalcSignificanceA(r, side);
                string[][] fdr;
                switch (truncation)
                {
                case TestTruncation.Pvalue:
                    fdr = PerseusPluginUtils.CalcPvalueSignificance(pvals, threshold);
                    break;

                case TestTruncation.BenjaminiHochberg:
                    double[] fdrs;
                    fdr = PerseusPluginUtils.CalcBenjaminiHochbergFdr(pvals, threshold, pvals.Length, out fdrs);
                    break;

                default:
                    throw new Exception("Never get here.");
                }
                mdata.AddNumericColumn(mdata.ColumnNames[col] + " Significance A", "", pvals);
                mdata.AddCategoryColumn(mdata.ColumnNames[col] + " A significant", "", fdr);
            }
        }
Пример #2
0
        public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
                                ref IDocumentData[] documents, ProcessInfo processInfo)
        {
            int[] rcols = param.GetParam <int[]>("Ratio columns").Value;
            int[] icols = param.GetParam <int[]>("Intensity columns").Value;
            if (rcols.Length == 0)
            {
                processInfo.ErrString = "Please specify some ratio columns.";
                return;
            }
            if (rcols.Length != icols.Length)
            {
                processInfo.ErrString = "The number of ratio and intensity columns have to be equal.";
                return;
            }
            int            truncIndex = param.GetParam <int>("Use for truncation").Value;
            TestTruncation truncation = truncIndex == 0
                                ? TestTruncation.Pvalue
                                : (truncIndex == 1 ? TestTruncation.BenjaminiHochberg : TestTruncation.PermutationBased);
            double   threshold = param.GetParam <double>("Threshold value").Value;
            int      sideInd   = param.GetParam <int>("Side").Value;
            TestSide side;

            switch (sideInd)
            {
            case 0:
                side = TestSide.Both;
                break;

            case 1:
                side = TestSide.Left;
                break;

            case 2:
                side = TestSide.Right;
                break;

            default:
                throw new Exception("Never get here.");
            }
            for (int i = 0; i < rcols.Length; i++)
            {
                BaseVector r      = mdata.Values.GetColumn(rcols[i]);
                BaseVector intens = icols[i] < mdata.ColumnCount
                                        ? mdata.Values.GetColumn(icols[i])
                                        : new DoubleArrayVector(mdata.NumericColumns[icols[i] - mdata.ColumnCount]);
                double[]   pvals = CalcSignificanceB(r, intens, side);
                string[][] fdr;
                switch (truncation)
                {
                case TestTruncation.Pvalue:
                    fdr = PerseusPluginUtils.CalcPvalueSignificance(pvals, threshold);
                    break;

                case TestTruncation.BenjaminiHochberg:
                    fdr = PerseusPluginUtils.CalcBenjaminiHochbergFdr(pvals, threshold, out double[] fdrs);
                    break;

                default:
                    throw new Exception("Never get here.");
                }
                mdata.AddNumericColumn(mdata.ColumnNames[rcols[i]] + " Significance B", "", pvals);
                mdata.AddCategoryColumn(mdata.ColumnNames[rcols[i]] + " B significant", "", fdr);
            }
        }