当前位置: 首页>>代码示例>>C#>>正文


C# IMatrixData.GetCategoryRowAt方法代码示例

本文整理汇总了C#中IMatrixData.GetCategoryRowAt方法的典型用法代码示例。如果您正苦于以下问题:C# IMatrixData.GetCategoryRowAt方法的具体用法?C# IMatrixData.GetCategoryRowAt怎么用?C# IMatrixData.GetCategoryRowAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IMatrixData的用法示例。


在下文中一共展示了IMatrixData.GetCategoryRowAt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessData


//.........这里部分代码省略.........
                        double mwWeightedNormalizedSummedHistoneIntensities = 0;
                        foreach (int row in histoneRows){
                            if (!double.IsNaN(column[row]) && !double.IsNaN(mw[row])){
                                mwWeightedNormalizedSummedHistoneIntensities += (column[row]/detectabilityNormFactor[row])*mw[row];
                            }
                        }
                        double ploidy =
                            param.GetSingleChoiceWithSubParams("Scaling mode").GetSubParameters().GetDoubleParam("Ploidy").Value;
                        factor = (cValue*ploidy*avogadro)/mwWeightedNormalizedSummedHistoneIntensities;
                        break;
                    default:
                        factor = 1;
                        break;
                }
                normalizationFactors[col] = factor;
            }
            // check averaging mode
            if (param.GetSingleChoiceWithSubParams("Averaging mode").Value == 1) // same factor for all
            {
                double factor = ArrayUtils.Mean(normalizationFactors);
                for (int i = 0; i < normalizationFactors.Length; i++){
                    normalizationFactors[i] = factor;
                }
            }
            if (param.GetSingleChoiceWithSubParams("Averaging mode").Value == 2) // same factor in each group
            {
                if (
                    param.GetSingleChoiceWithSubParams("Averaging mode").GetSubParameters().GetSingleChoiceParam("Grouping").Value ==
                        -1){
                    processInfo.ErrString = "No grouping selected.";
                    return;
                }
                string[][] groupNames =
                    mdata.GetCategoryRowAt(
                        param.GetSingleChoiceWithSubParams("Averaging mode").GetSubParameters().GetSingleChoiceParam("Grouping").Value);
                string[] uniqueGroupNames = Unique(groupNames);
                int[] grouping = new int[columns.Count];
                for (int i = 0; i < columns.Count; i++){
                    if (intensityCols[i] >= mdata.ExpressionColumnCount){ // Numeric annotation columns cannot be grouped
                        grouping[i] = i;
                        continue;
                    }
                    if (ArrayUtils.Contains(uniqueGroupNames, groupNames[i][0])){
                        grouping[i] = ArrayUtils.IndexOf(uniqueGroupNames, groupNames[i][0]);
                        continue;
                    }
                    grouping[i] = i;
                }
                Dictionary<int, List<double>> factors = new Dictionary<int, List<double>>();
                for (int i = 0; i < columns.Count; i++){
                    if (factors.ContainsKey(grouping[i])){
                        factors[grouping[i]].Add(normalizationFactors[i]);
                    } else{
                        factors.Add(grouping[i], new List<double>{normalizationFactors[i]});
                    }
                }
                double[] averagedNormalizationFactors = new double[columns.Count];
                for (int i = 0; i < columns.Count; i++){
                    List<double> factor;
                    factors.TryGetValue(grouping[i], out factor);
                    averagedNormalizationFactors[i] = ArrayUtils.Mean(factor);
                }
                normalizationFactors = averagedNormalizationFactors;
            }
            // loop over all selected columns and calculate copy numbers
            for (int col = 0; col < columns.Count; col++){
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:67,代码来源:CopyNumbers.cs

示例2: GetEditParameters

 public Parameters GetEditParameters(IMatrixData mdata, int ind)
 {
     List<Parameter> par = new List<Parameter>();
     for (int i = 0; i < mdata.ExpressionColumnCount; i++){
         string t = mdata.ExpressionColumnNames[i];
         string help = "Specify a category value for the column '" + t + "'.";
         par.Add(new StringParam(t, StringUtils.Concat(";", mdata.GetCategoryRowAt(ind)[i])){Help = help});
     }
     return new Parameters(par);
 }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:10,代码来源:CreateCategoricalAnnotRow.cs

示例3: ProcessData

        public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
			ref IDocumentData[] documents, ProcessInfo processInfo)
        {
            const bool rows = true;
            bool percentage;
            int minValids = PerseusPluginUtils.GetMinValids(param, out percentage);
            ParameterWithSubParams<int> modeParam = param.GetParamWithSubParams<int>("Mode");
            int modeInd = modeParam.Value;
            if (modeInd != 0 && mdata.CategoryRowNames.Count == 0){
                processInfo.ErrString = "No grouping is defined.";
                return;
            }
            FilteringMode filterMode;
            double threshold;
            double threshold2;
            PerseusPluginUtils.ReadValuesShouldBeParams(param, out filterMode, out threshold, out threshold2);
            if (modeInd != 0){
                int gind = modeParam.GetSubParameters().GetParam<int>("Grouping").Value;
                string[][] groupCol = mdata.GetCategoryRowAt(gind);
                NonzeroFilterGroup(minValids, percentage, mdata, param, modeInd == 2, threshold, threshold2, filterMode, groupCol);
            } else{
                PerseusPluginUtils.NonzeroFilter1(rows, minValids, percentage, mdata, param, threshold, threshold2, filterMode);
            }
        }
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:24,代码来源:FilterValidValuesRows.cs

示例4: DivideByColumn

 public static void DivideByColumn(IMatrixData data, int index)
 {
     int p = data.RowCount;
     int n = data.ExpressionColumnCount;
     float[,] newEx = new float[p,n - 1];
     for (int i = 0; i < p; i++){
         for (int j = 0; j < index; j++){
             newEx[i, j] = data[i, j]/data[i, index];
             if (float.IsInfinity(newEx[i, j])){
                 newEx[i, j] = float.NaN;
             }
         }
         for (int j = index + 1; j < n; j++){
             newEx[i, j - 1] = data[i, j]/data[i, index];
             if (float.IsInfinity(newEx[i, j - 1])){
                 newEx[i, j - 1] = float.NaN;
             }
         }
     }
     bool[,] newImp = new bool[p,n - 1];
     for (int i = 0; i < p; i++){
         for (int j = 0; j < index; j++){
             newImp[i, j] = data.IsImputed[i, j] || data.IsImputed[i, index];
         }
         for (int j = index + 1; j < n; j++){
             newImp[i, j - 1] = data.IsImputed[i, j] || data.IsImputed[i, index];
         }
     }
     data.ExpressionValues = newEx;
     data.IsImputed = newImp;
     data.ExpressionColumnNames.RemoveAt(index);
     data.ExpressionColumnDescriptions.RemoveAt(index);
     for (int i = 0; i < data.CategoryRowCount; i++){
         data.SetCategoryRowAt(ArrayUtils.RemoveAtIndex(data.GetCategoryRowAt(i), index), i);
     }
     for (int i = 0; i < data.NumericRowCount; i++){
         data.NumericRows[i] = ArrayUtils.RemoveAtIndex(data.NumericRows[i], index);
     }
 }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:39,代码来源:DivisionByColumn.cs

示例5: ProcessData

        public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
			ref IDocumentData[] documents, ProcessInfo processInfo)
        {
            const bool rows = false;
            int minValids = param.GetIntParam("Min. number of values").Value;
            SingleChoiceWithSubParams modeParam = param.GetSingleChoiceWithSubParams("Mode");
            int modeInd = modeParam.Value;
            if (modeInd != 0 && mdata.CategoryRowNames.Count == 0){
                processInfo.ErrString = "No grouping is defined.";
                return;
            }
            if (modeInd != 0){
                processInfo.ErrString = "Group-wise filtering can only be appled to rows.";
                return;
            }
            SingleChoiceWithSubParams x = param.GetSingleChoiceWithSubParams("Values should be");
            Parameters subParams = x.GetSubParameters();
            int shouldBeIndex = x.Value;
            FilteringMode filterMode;
            double threshold = double.NaN;
            double threshold2 = double.NaN;
            switch (shouldBeIndex){
                case 0:
                    filterMode = FilteringMode.Valid;
                    break;
                case 1:
                    filterMode = FilteringMode.GreaterThan;
                    threshold = subParams.GetDoubleParam("Minimum").Value;
                    break;
                case 2:
                    filterMode = FilteringMode.GreaterEqualThan;
                    threshold = subParams.GetDoubleParam("Minimum").Value;
                    break;
                case 3:
                    filterMode = FilteringMode.LessThan;
                    threshold = subParams.GetDoubleParam("Maximum").Value;
                    break;
                case 4:
                    filterMode = FilteringMode.LessEqualThan;
                    threshold = subParams.GetDoubleParam("Maximum").Value;
                    break;
                case 5:
                    filterMode = FilteringMode.Between;
                    threshold = subParams.GetDoubleParam("Minimum").Value;
                    threshold2 = subParams.GetDoubleParam("Maximum").Value;
                    break;
                case 6:
                    filterMode = FilteringMode.Outside;
                    threshold = subParams.GetDoubleParam("Minimum").Value;
                    threshold2 = subParams.GetDoubleParam("Maximum").Value;
                    break;
                default:
                    throw new Exception("Should not happen.");
            }
            if (modeInd != 0){
                int gind = modeParam.GetSubParameters().GetSingleChoiceParam("Grouping").Value;
                string[][] groupCol = mdata.GetCategoryRowAt(gind);
                NonzeroFilterGroup(minValids, mdata, param, modeInd == 2, threshold, threshold2, filterMode, groupCol);
            } else{
                NonzeroFilter1(rows, minValids, mdata, param, threshold, threshold2, filterMode);
            }
        }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:62,代码来源:FilterValidValuesColumns.cs

示例6: WriteMatrixToFile


//.........这里部分代码省略.........
         }
         for (int i = 0; i < data.NumericColumnCount; i++)
         {
             words.Add("N");
         }
         for (int i = 0; i < data.StringColumnCount; i++)
         {
             words.Add("T");
         }
         for (int i = 0; i < data.MultiNumericColumnCount; i++)
         {
             words.Add("M");
         }
         writer.WriteLine("#!{Type}" + StringUtils.Concat("\t", words));
         for (int i = 0; i < data.NumericRowCount; i++)
         {
             words = new List<string>();
             for (int j = 0; j < data.ColumnCount; j++)
             {
                 words.Add("" + data.NumericRows[i][j]);
             }
             for (int j = 0; j < data.CategoryColumnCount; j++)
             {
                 words.Add("");
             }
             for (int j = 0; j < data.NumericColumnCount; j++)
             {
                 words.Add("");
             }
             for (int j = 0; j < data.StringColumnCount; j++)
             {
                 words.Add("");
             }
             for (int j = 0; j < data.MultiNumericColumnCount; j++)
             {
                 words.Add("");
             }
             writer.WriteLine("#!{N:" + data.NumericRowNames[i] + "}" + StringUtils.Concat("\t", words));
         }
         for (int i = 0; i < data.CategoryRowCount; i++)
         {
             words = new List<string>();
             for (int j = 0; j < data.ColumnCount; j++)
             {
                 string[] s = data.GetCategoryRowAt(i)[j];
                 words.Add(s.Length == 0 ? "" : StringUtils.Concat(";", s));
             }
             for (int j = 0; j < data.CategoryColumnCount; j++)
             {
                 words.Add("");
             }
             for (int j = 0; j < data.NumericColumnCount; j++)
             {
                 words.Add("");
             }
             for (int j = 0; j < data.StringColumnCount; j++)
             {
                 words.Add("");
             }
             for (int j = 0; j < data.MultiNumericColumnCount; j++)
             {
                 words.Add("");
             }
             writer.WriteLine("#!{C:" + data.CategoryRowNames[i] + "}" + StringUtils.Concat("\t", words));
         }
         for (int j = 0; j < data.RowCount; j++)
         {
             words = new List<string>();
             for (int i = 0; i < data.ColumnCount; i++)
             {
                 string s1 = "" + data.Values.Get(j, i);
                 if (addtlMatrices)
                 {
                     s1 += ";" + data.IsImputed[j, i] + ";" + data.Quality.Get(j, i);
                 }
                 words.Add(s1);
             }
             for (int i = 0; i < data.CategoryColumnCount; i++)
             {
                 string[] q = data.GetCategoryColumnEntryAt(i, j) ?? new string[0];
                 words.Add((q.Length > 0 ? StringUtils.Concat(";", q) : ""));
             }
             for (int i = 0; i < data.NumericColumnCount; i++)
             {
                 words.Add("" + data.NumericColumns[i][j]);
             }
             for (int i = 0; i < data.StringColumnCount; i++)
             {
                 words.Add(data.StringColumns[i][j]);
             }
             for (int i = 0; i < data.MultiNumericColumnCount; i++)
             {
                 double[] q = data.MultiNumericColumns[i][j];
                 words.Add((q.Length > 0 ? StringUtils.Concat(";", q) : ""));
             }
             string s = StringUtils.Concat("\t", words);
             writer.WriteLine(s);
         }
     }
 }
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:101,代码来源:PerseusUtils.cs

示例7: ProcessData

        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());
        }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:37,代码来源:FilterCategoricalRow.cs

示例8: FillMatrixKeep

 private static void FillMatrixKeep(int groupColInd, int validVals, IMatrixData mdata, Func<IList<double>, double> func)
 {
     string[][] groupCol = mdata.GetCategoryRowAt(groupColInd);
     string[] groupNames = ArrayUtils.UniqueValuesPreserveOrder(groupCol);
     int[][] colInds = PerseusPluginUtils.GetExpressionColIndices(groupCol, groupNames);
     double[][] newNumCols = new double[groupNames.Length][];
     for (int i = 0; i < newNumCols.Length; i++){
         newNumCols[i] = new double[mdata.RowCount];
     }
     for (int i = 0; i < mdata.RowCount; i++){
         for (int j = 0; j < groupNames.Length; j++){
             List<double> vals = new List<double>();
             foreach (int ind in colInds[j]){
                 double val = mdata[i, ind];
                 if (!double.IsNaN(val) && !double.IsInfinity(val)){
                     vals.Add(val);
                 }
             }
             float xy = float.NaN;
             if (vals.Count >= validVals){
                 xy = (float) func(vals);
             }
             newNumCols[j][i] = xy;
         }
     }
     for (int i = 0; i < groupNames.Length; i++){
         mdata.AddNumericColumn(groupNames[i], groupNames[i], newNumCols[i]);
     }
 }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:29,代码来源:AverageGroups.cs

示例9: SetAnnotationRows

 private static void SetAnnotationRows(IMatrixData result, IMatrixData mdata1, IMatrixData mdata2)
 {
     result.CategoryRowNames.Clear();
     result.CategoryRowDescriptions.Clear();
     result.ClearCategoryRows();
     result.NumericRowNames.Clear();
     result.NumericRowDescriptions.Clear();
     result.NumericRows.Clear();
     string[] allCatNames = ArrayUtils.Concat(mdata1.CategoryRowNames, mdata2.CategoryRowNames);
     allCatNames = ArrayUtils.UniqueValues(allCatNames);
     result.CategoryRowNames = new List<string>();
     string[] allCatDescriptions = new string[allCatNames.Length];
     for (int i = 0; i < allCatNames.Length; i++){
         allCatDescriptions[i] = GetDescription(allCatNames[i], mdata1.CategoryRowNames, mdata2.CategoryRowNames,
             mdata1.CategoryRowDescriptions, mdata2.CategoryRowDescriptions);
     }
     result.CategoryRowDescriptions = new List<string>();
     for (int index = 0; index < allCatNames.Length; index++){
         string t = allCatNames[index];
         string[][] categoryRow = new string[mdata1.ExpressionColumnCount + mdata2.ExpressionColumnCount][];
         for (int j = 0; j < categoryRow.Length; j++){
             categoryRow[j] = new string[0];
         }
         int ind1 = mdata1.CategoryRowNames.IndexOf(t);
         if (ind1 >= 0){
             string[][] c1 = mdata1.GetCategoryRowAt(ind1);
             for (int j = 0; j < c1.Length; j++){
                 categoryRow[j] = c1[j];
             }
         }
         int ind2 = mdata2.CategoryRowNames.IndexOf(t);
         if (ind2 >= 0){
             string[][] c2 = mdata2.GetCategoryRowAt(ind2);
             for (int j = 0; j < c2.Length; j++){
                 categoryRow[mdata1.ExpressionColumnCount + j] = c2[j];
             }
         }
         result.AddCategoryRow(allCatNames[index], allCatDescriptions[index], categoryRow);
     }
     string[] allNumNames = ArrayUtils.Concat(mdata1.NumericRowNames, mdata2.NumericRowNames);
     allNumNames = ArrayUtils.UniqueValues(allNumNames);
     result.NumericRowNames = new List<string>(allNumNames);
     string[] allNumDescriptions = new string[allNumNames.Length];
     for (int i = 0; i < allNumNames.Length; i++){
         allNumDescriptions[i] = GetDescription(allNumNames[i], mdata1.NumericRowNames, mdata2.NumericRowNames,
             mdata1.NumericRowDescriptions, mdata2.NumericRowDescriptions);
     }
     result.NumericRowDescriptions = new List<string>(allNumDescriptions);
     foreach (string t in allNumNames){
         double[] numericRow = new double[mdata1.ExpressionColumnCount + mdata2.ExpressionColumnCount];
         for (int j = 0; j < numericRow.Length; j++){
             numericRow[j] = double.NaN;
         }
         int ind1 = mdata1.NumericRowNames.IndexOf(t);
         if (ind1 >= 0){
             double[] c1 = mdata1.NumericRows[ind1];
             for (int j = 0; j < c1.Length; j++){
                 numericRow[j] = c1[j];
             }
         }
         int ind2 = mdata2.NumericRowNames.IndexOf(t);
         if (ind2 >= 0){
             double[] c2 = mdata2.NumericRows[ind2];
             for (int j = 0; j < c2.Length; j++){
                 numericRow[mdata1.ExpressionColumnCount + j] = c2[j];
             }
         }
         result.NumericRows.Add(numericRow);
     }
 }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:70,代码来源:MatchingRowsByName.cs

示例10: GetCategoryRows

 public static List<string[][]> GetCategoryRows(IMatrixData mdata)
 {
     List<string[][]> result = new List<string[][]>();
     for (int index = 0; index < mdata.CategoryRowCount; index++){
         result.Add(mdata.GetCategoryRowAt(index));
     }
     return result;
 }
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:8,代码来源:PerseusPluginUtils.cs

示例11: FillMatrixDontKeep

        private static void FillMatrixDontKeep(int groupColInd, int validVals, IMatrixData mdata,
			Func<IList<double>, double> func)
        {
            string[][] groupCol = mdata.GetCategoryRowAt(groupColInd);
            string[] groupNames = ArrayUtils.UniqueValuesPreserveOrder(groupCol);
            int[][] colInds = PerseusPluginUtils.GetExpressionColIndices(groupCol, groupNames);
            float[,] newExCols = new float[mdata.RowCount,groupNames.Length];
            float[,] newQuality = new float[mdata.RowCount,groupNames.Length];
            bool[,] newImputed = new bool[mdata.RowCount,groupNames.Length];
            for (int i = 0; i < newExCols.GetLength(0); i++){
                for (int j = 0; j < newExCols.GetLength(1); j++){
                    List<double> vals = new List<double>();
                    List<bool> imps = new List<bool>();
                    foreach (int ind in colInds[j]){
                        double val = mdata[i, ind];
                        if (!double.IsNaN(val) && !double.IsInfinity(val)){
                            vals.Add(val);
                            imps.Add(mdata.IsImputed[i, ind]);
                        }
                    }
                    bool imp = false;
                    float xy = float.NaN;
                    if (vals.Count >= validVals){
                        xy = (float) func(vals);
                        imp = ArrayUtils.Or(imps);
                    }
                    newExCols[i, j] = xy;
                    newQuality[i, j] = float.NaN;
                    newImputed[i, j] = imp;
                }
            }
            mdata.ExpressionColumnNames = new List<string>(groupNames);
            mdata.ExpressionColumnDescriptions = GetEmpty(groupNames);
            mdata.ExpressionValues = newExCols;
            mdata.QualityValues = newQuality;
            mdata.IsImputed = newImputed;
            mdata.RemoveCategoryRowAt(groupColInd);
            for (int i = 0; i < mdata.CategoryRowCount; i++){
                mdata.SetCategoryRowAt(AverageCategoryRow(mdata.GetCategoryRowAt(i), colInds), i);
            }
            for (int i = 0; i < mdata.NumericRows.Count; i++){
                mdata.NumericRows[i] = AverageNumericRow(mdata.NumericRows[i], colInds);
            }
        }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:44,代码来源:AverageGroups.cs

示例12: StringToExpression

 private static void StringToExpression(IList<int> colInds, IMatrixData mdata)
 {
     int[] inds = ArrayUtils.Complement(colInds, mdata.StringColumnCount);
     string[] names = ArrayUtils.SubArray(mdata.StringColumnNames, colInds);
     string[] descriptions = ArrayUtils.SubArray(mdata.StringColumnDescriptions, colInds);
     string[][] str = ArrayUtils.SubArray(mdata.StringColumns, colInds);
     float[][] newEx = new float[str.Length][];
     for (int j = 0; j < str.Length; j++){
         newEx[j] = new float[str[j].Length];
         for (int i = 0; i < newEx[j].Length; i++){
             float f;
             bool success = float.TryParse(str[j][i], out f);
             newEx[j][i] = success ? f : float.NaN;
         }
     }
     float[,] newExp = new float[mdata.RowCount,mdata.ExpressionColumnCount + str.Length];
     float[,] newQual = new float[mdata.RowCount,mdata.ExpressionColumnCount + str.Length];
     bool[,] newIsImputed = new bool[mdata.RowCount,mdata.ExpressionColumnCount + str.Length];
     for (int i = 0; i < mdata.RowCount; i++){
         for (int j = 0; j < mdata.ExpressionColumnCount; j++){
             newExp[i, j] = mdata[i, j];
             newQual[i, j] = mdata.QualityValues[i, j];
             newIsImputed[i, j] = mdata.IsImputed[i, j];
         }
         for (int j = 0; j < newEx.Length; j++){
             newExp[i, j + mdata.ExpressionColumnCount] = newEx[j][i];
             newQual[i, j + mdata.ExpressionColumnCount] = float.NaN;
             newIsImputed[i, j + mdata.ExpressionColumnCount] = false;
         }
     }
     mdata.ExpressionValues = newExp;
     mdata.QualityValues = newQual;
     mdata.IsImputed = newIsImputed;
     mdata.ExpressionColumnNames.AddRange(names);
     mdata.ExpressionColumnDescriptions.AddRange(descriptions);
     mdata.StringColumns = ArrayUtils.SubList(mdata.StringColumns, inds);
     mdata.StringColumnNames = ArrayUtils.SubList(mdata.StringColumnNames, inds);
     mdata.StringColumnDescriptions = ArrayUtils.SubList(mdata.StringColumnDescriptions, inds);
     for (int i = 0; i < mdata.CategoryRowCount; i++){
         mdata.SetCategoryRowAt(ExtendCategoryRow(mdata.GetCategoryRowAt(i), str.Length),i);
     }
     for (int i = 0; i < mdata.NumericRows.Count; i++){
         mdata.NumericRows[i] = ExtendNumericRow(mdata.NumericRows[i], str.Length);
     }
 }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:45,代码来源:ChangeColumnType.cs

示例13: GetIndicesOfCol

 public static int[] GetIndicesOfCol(IMatrixData data, string categoryName, HashSet<string> values)
 {
     int index = GetIndexOfCol(data, categoryName);
     List<int> result = new List<int>();
     for (int i = 0; i < data.ExpressionColumnCount; i++){
         string[] s = data.GetCategoryRowAt(index)[i];
         foreach (string s1 in s){
             if (values.Contains(s1)){
                 result.Add(i);
                 break;
             }
         }
     }
     return result.ToArray();
 }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:15,代码来源:PerseusPluginUtils.cs

示例14: ProcessData

        public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
			ref IDocumentData[] documents, ProcessInfo processInfo)
        {
            SingleChoiceWithSubParams xp = param.GetSingleChoiceWithSubParams("Expression column selection");
            bool groups = xp.Value == 2;
            string[] groupNames = null;
            int[][] colIndsGroups = null;
            if (groups){
                int groupRowInd = xp.GetSubParameters().GetSingleChoiceParam("Group").Value;
                string[][] groupCol = mdata.GetCategoryRowAt(groupRowInd);
                groupNames = ArrayUtils.UniqueValuesPreserveOrder(groupCol);
                colIndsGroups = PerseusPluginUtils.GetExpressionColIndices(groupCol, groupNames);
            }
            int[] useCols = xp.Value == 1
                ? xp.GetSubParameters().GetMultiChoiceParam("Columns").Value
                : ArrayUtils.ConsecutiveInts(mdata.ExpressionColumnCount);
            HashSet<int> w = ArrayUtils.ToHashSet(param.GetMultiChoiceParam("Calculate").Value);
            bool[] include = new bool[procs.Length];
            double[][] columns = new double[procs.Length][];
            double[][][] columnsG = null;
            if (groups){
                columnsG = new double[procs.Length][][];
                for (int i = 0; i < columnsG.Length; i++){
                    columnsG[i] = new double[groupNames.Length][];
                }
            }
            for (int i = 0; i < include.Length; i++){
                include[i] = w.Contains(i);
                if (include[i]){
                    columns[i] = new double[mdata.RowCount];
                    if (groups){
                        for (int j = 0; j < groupNames.Length; j++){
                            columnsG[i][j] = new double[mdata.RowCount];
                        }
                    }
                }
            }
            for (int i = 0; i < mdata.RowCount; i++){
                List<double> v = new List<double>();
                foreach (int j in useCols){
                    double x = mdata[i, j];
                    if (!double.IsNaN(x) && !double.IsInfinity(x)){
                        v.Add(x);
                    }
                }
                for (int j = 0; j < include.Length; j++){
                    if (include[j]){
                        columns[j][i] = procs[j].Item2(v);
                    }
                }
                if (groups){
                    List<double>[] vg = new List<double>[groupNames.Length];
                    for (int j = 0; j < colIndsGroups.Length; j++){
                        vg[j] = new List<double>();
                        for (int k = 0; k < colIndsGroups[j].Length; k++){
                            double x = mdata[i, colIndsGroups[j][k]];
                            if (!double.IsNaN(x) && !double.IsInfinity(x)){
                                vg[j].Add(x);
                            }
                        }
                    }
                    for (int j = 0; j < include.Length; j++){
                        if (include[j]){
                            for (int k = 0; k < groupNames.Length; k++){
                                columnsG[j][k][i] = procs[j].Item2(vg[k]);
                            }
                        }
                    }
                }
            }
            for (int i = 0; i < include.Length; i++){
                if (include[i]){
                    mdata.AddNumericColumn(procs[i].Item1, procs[i].Item3, columns[i]);
                    if (groups){
                        for (int k = 0; k < groupNames.Length; k++){
                            mdata.AddNumericColumn(procs[i].Item1 + " " + groupNames[k], procs[i].Item3, columnsG[i][k]);
                        }
                    }
                }
            }
        }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:81,代码来源:SummaryStatisticsRows.cs

示例15: GetCategoryRows

 private static List<string[][]> GetCategoryRows(IMatrixData mdata)
 {
     List<string[][]> result = new List<string[][]>();
     for (int i = 0; i < mdata.CategoryRowCount; i++){
         result.Add(mdata.GetCategoryRowAt(i));
     }
     return result;
 }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:8,代码来源:Transpose.cs


注:本文中的IMatrixData.GetCategoryRowAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。