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


C# IMatrixData.GetCategoryColumnAt方法代码示例

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


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

示例1: GetIndicatorColumn

 public static bool[] GetIndicatorColumn(bool falseAreIndicated, int catColInd, string word, IMatrixData data)
 {
     string[][] catCol = data.GetCategoryColumnAt(catColInd);
     bool[] result = new bool[data.RowCount];
     for (int i = 0; i < result.Length; i++){
         string[] cats = catCol[i];
         Array.Sort(cats);
         bool contains = Array.BinarySearch(cats, word) >= 0;
         if (falseAreIndicated){
             result[i] = !contains;
         } else{
             result[i] = contains;
         }
     }
     return result;
 }
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:16,代码来源:PerformanceCurves.cs

示例2: ProcessData

        public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
			ref IDocumentData[] documents, ProcessInfo processInfo)
        {
            string[][] col = mdata.GetCategoryColumnAt(param.GetParam<int>("Indicator column").Value);
            string term = param.GetParam<string>("Value").Value;
            List<int> inds = new List<int>();
            for (int i = 0; i < col.Length; i++){
                if (Contains(col[i], term)){
                    inds.Add(i);
                }
            }
            double[][] profiles = new double[inds.Count][];
            for (int i = 0; i < profiles.Length; i++){
                profiles[i] = ArrayUtils.ToDoubles(mdata.Values.GetRow(inds[i]));
                float mean = (float) ArrayUtils.Mean(profiles[i]);
                for (int j = 0; j < profiles[i].Length; j++){
                    profiles[i][j] -= mean;
                }
            }
            double[] totalProfile = new double[mdata.ColumnCount];
            for (int i = 0; i < totalProfile.Length; i++){
                List<double> vals = new List<double>();
                foreach (double[] t in profiles){
                    double val = t[i];
                    if (double.IsNaN(val) || double.IsInfinity(val)){
                        continue;
                    }
                    vals.Add(val);
                }
                totalProfile[i] = vals.Count > 0 ? ArrayUtils.Median(vals) : double.NaN;
            }
            for (int i = 0; i < mdata.RowCount; i++){
                for (int j = 0; j < mdata.ColumnCount; j++){
                    mdata.Values.Set(i, j, mdata.Values.Get(i, j)-(float) totalProfile[j]);
                }
            }
        }
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:37,代码来源:SubtractRowCluster.cs

示例3: ProcessData

        public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
			ref IDocumentData[] documents, ProcessInfo processInfo)
        {
            if (mdata.CategoryColumnCount < 2){
                processInfo.ErrString = "There are less than two categorical columns available.";
                return;
            }
            int colInd1 = param.GetSingleChoiceParam("First column").Value;
            int colInd2 = param.GetSingleChoiceParam("Second column").Value;
            string[][] col1 = mdata.GetCategoryColumnAt(colInd1);
            string[][] col2 = mdata.GetCategoryColumnAt(colInd2);
            string[][] result = new string[col1.Length][];
            for (int i = 0; i < result.Length; i++){
                result[i] = CombineTerms(col1[i], col2[i]);
            }
            string colName = mdata.CategoryColumnNames[colInd1] + "_" + mdata.CategoryColumnNames[colInd2];
            mdata.AddCategoryColumn(colName, "", result);
        }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:18,代码来源:CombineCategoricalColumns.cs

示例4: GetExperminetValues


//.........这里部分代码省略.........
                    }

                    assay.MsRun = msrun;
                    assay.Sample = sample;
                }
            }

            #endregion

            Dictionary<int, IList<string>> dictionary = new Dictionary<int, IList<string>>();

            #region parse experimentalDesign

            if (experimentalDesignTemplate != null) {
                string[] rawfiles = null;

                int index = Constants.GetKeywordIndex(experimentalDesign.rawfile,
                                                     experimentalDesignTemplate.StringColumnNames);
                if (index != -1) {
                    rawfiles = experimentalDesignTemplate.StringColumns[index];
                }

                string[] experimentNames = null;
                if (
                    (index =
                     Constants.GetKeywordIndex(experimentalDesign.variable,
                                              experimentalDesignTemplate.StringColumnNames)) !=
                    -1) {
                    experimentNames = experimentalDesignTemplate.StringColumns[index];
                } else if (
                      (index =
                       Constants.GetKeywordIndex(experimentalDesign.variable,
                                                experimentalDesignTemplate.CategoryColumnNames)) != -1) {
                    experimentNames = MzTabMatrixUtils.ConvertToStringArray(experimentalDesignTemplate.GetCategoryColumnAt(index));
                }

                if (rawfiles != null && experimentNames != null) {
                    for (int i = 0; i < rawfiles.Length && i < experimentNames.Length; i++) {
                        string name = experimentNames[i];
                        StudyVariable variable = studyvariables.FirstOrDefault(x => x.Description.Equals(name));
                        if (variable == null) {
                            variable = new StudyVariable(studyvariables.Count + 1) { Description = name };
                            studyvariables.Add(variable);
                        }

                        string rawfile = rawfiles[i];
                        MsRunImpl runImpl = msruns.FirstOrDefault(x => x.Description.Equals(rawfile));
                        if (runImpl == null) {
                            runImpl = new MsRunImpl(msruns.Count + 1) {
                                Location = new Url(rawfile),
                                Format = cv.GetParam("MS:1000563", "MS"),
                                IdFormat = cv.GetParam("MS:1000768", "MS")
                            };
                            msruns.Add(runImpl);
                        }

                        if (rawfile != null) {
                            if (!dictionary.ContainsKey(variable.Id)) {
                                dictionary.Add(variable.Id, new List<string>());
                            }
                            dictionary[variable.Id].Add(rawfile);
                        }
                    }
                } else {
                    Console.Out.WriteLine("Rawfiles " + rawfiles);
                    Console.Out.WriteLine("experimentNames " + experimentNames);
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:67,代码来源:MzTabProcessing.cs

示例5: GetCategoryColumns

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

示例6: ProcessData

        public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
			ref IDocumentData[] documents, ProcessInfo processInfo)
        {
            int colIndex = param.GetSingleChoiceParam("Column with second last AA").Value;
            string aas = param.GetStringParam("Amino acids").Value;
            string[][] col = mdata.GetCategoryColumnAt(colIndex);
            List<int> validRows = new List<int>();
            for (int i = 0; i < mdata.RowCount; i++){
                string[] x = col[i];
                for (int j = 0; j < x.Length; j++){
                    if (x[j].Length != 1){
                        processInfo.ErrString = "Some of the entries in column " + mdata.CategoryColumnNames[colIndex] +
                            " do not contain amino acids";
                        return;
                    }
                }
                bool keep = JudgeIfKept(aas, x);
                if (keep){
                    validRows.Add(i);
                }
            }
            mdata.ExtractExpressionRows(validRows.ToArray());
        }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:23,代码来源:FilterDE.cs

示例7: ProcessData

        public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
			ref IDocumentData[] documents, ProcessInfo processInfo)
        {
            int minCount = param.GetIntParam("Min. count").Value;
            int selCol = param.GetSingleChoiceParam("Selection").Value;
            string value = param.GetStringParam("Value").Value;
            int[] catIndices = param.GetMultiChoiceParam("Categories").Value;
            bool[] selection = null;
            if (selCol < mdata.CategoryColumnCount){
                selection = new bool[mdata.RowCount];
                string[][] x = mdata.GetCategoryColumnAt(selCol);
                for (int i = 0; i < selection.Length; i++){
                    if (x[i] != null){
                        for (int j = 0; j < x[i].Length; j++){
                            if (x[i][j].Equals(value)){
                                selection[i] = true;
                                break;
                            }
                        }
                    }
                }
            }
            CountingResult result = CountCategories(mdata, selection, selCol, catIndices);
            CreateMatrixData(result, mdata, minCount, selection);
        }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:25,代码来源:CategoryCounting.cs

示例8: Export


//.........这里部分代码省略.........
     if (HasAnyDescription(data)){
         words = new List<string>();
         for (int i = 0; i < data.ExpressionColumnCount; i++){
             words.Add(Trunc(data.ExpressionColumnDescriptions[i] ?? ""));
         }
         for (int i = 0; i < data.CategoryColumnCount; i++){
             words.Add(Trunc(data.CategoryColumnDescriptions[i] ?? ""));
         }
         for (int i = 0; i < data.NumericColumnCount; i++){
             words.Add(Trunc(data.NumericColumnDescriptions[i] ?? ""));
         }
         for (int i = 0; i < data.StringColumnCount; i++){
             words.Add(Trunc(data.StringColumnDescriptions[i] ?? ""));
         }
         for (int i = 0; i < data.MultiNumericColumnCount; i++){
             words.Add(Trunc(data.MultiNumericColumnDescriptions[i] ?? ""));
         }
         writer.WriteLine("#!{Description}" + StringUtils.Concat("\t", words));
     }
     words = new List<string>();
     for (int i = 0; i < data.ExpressionColumnCount; i++){
         words.Add("E");
     }
     for (int i = 0; i < data.CategoryColumnCount; i++){
         words.Add("C");
     }
     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.ExpressionColumnCount; 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.ExpressionColumnCount; 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.ExpressionColumnCount; i++){
             words.Add(Trunc("" + data[j, i]));
         }
         for (int i = 0; i < data.CategoryColumnCount; i++){
             string[] q = data.GetCategoryColumnAt(i)[j] ?? new string[0];
             words.Add(Trunc((q.Length > 0 ? StringUtils.Concat(";", q) : "")));
         }
         for (int i = 0; i < data.NumericColumnCount; i++){
             words.Add(Trunc("" + data.NumericColumns[i][j]));
         }
         for (int i = 0; i < data.StringColumnCount; i++){
             words.Add(Trunc(data.StringColumns[i][j]));
         }
         for (int i = 0; i < data.MultiNumericColumnCount; i++){
             double[] q = data.MultiNumericColumns[i][j];
             words.Add(Trunc((q.Length > 0 ? StringUtils.Concat(";", q) : "")));
         }
         string s = StringUtils.Concat("\t", words);
         s = s.Replace("\"", "");
         writer.WriteLine(s);
     }
     writer.Close();
 }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:101,代码来源:TabSeparatedExport.cs

示例9: GetCategoryColumns

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

示例10: ProcessData

        public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
			ref IDocumentData[] documents, ProcessInfo processInfo)
        {
            string colName = param.GetStringParam("Name of new column").Value;
            int[] columns = param.GetMultiChoiceParam("Categories").Value;
            bool inverse = param.GetBoolParam("Inverse").Value;
            int[] catCols;
            int[] stringCols;
            Split(columns, out catCols, out stringCols, mdata.CategoryColumnCount);
            string[] word1 = param.GetMultiStringParam("Search terms").Value;
            if (word1.Length == 0){
                processInfo.ErrString = "Please specify one or more search terms.";
                return;
            }
            if (string.IsNullOrEmpty(colName)){
                colName = word1[0];
            }
            string[] word = new string[word1.Length];
            for (int i = 0; i < word.Length; i++){
                word[i] = word1[i].ToLower().Trim();
            }
            bool[] indicator = new bool[mdata.RowCount];
            foreach (int col in catCols){
                string[][] cat = mdata.GetCategoryColumnAt(col);
                for (int i = 0; i < cat.Length; i++){
                    foreach (string s in cat[i]){
                        foreach (string s1 in word){
                            if (s.ToLower().Contains(s1)){
                                indicator[i] = true;
                                break;
                            }
                        }
                    }
                }
            }
            foreach (string[] txt in stringCols.Select(col => mdata.StringColumns[col])){
                for (int i = 0; i < txt.Length; i++){
                    string s = txt[i];
                    foreach (string s1 in word){
                        if (s.ToLower().Contains(s1)){
                            indicator[i] = true;
                            break;
                        }
                    }
                }
            }
            string[][] newCol = new string[indicator.Length][];
            for (int i = 0; i < newCol.Length; i++){
                bool yes = inverse ? !indicator[i] : indicator[i];
                newCol[i] = yes ? new[]{"+"} : new string[0];
            }
            mdata.AddCategoryColumn(colName, "", newCol);
        }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:53,代码来源:CombineAnnotations.cs

示例11: ProcessData

        public void ProcessData(IMatrixData mdata, Parameters param1, ref IMatrixData[] supplTables,
			ref IDocumentData[] documents, ProcessInfo processInfo)
        {
            int[] multiNumCols = param1.GetMultiChoiceParam("Multi-numeric columns").Value;
            Array.Sort(multiNumCols);
            int[] stringCols = param1.GetMultiChoiceParam("String columns").Value;
            Array.Sort(stringCols);
            HashSet<int> multinumCols2 = new HashSet<int>(multiNumCols);
            HashSet<int> stringCols2 = new HashSet<int>(stringCols);
            if (multiNumCols.Length + stringCols.Length == 0){
                processInfo.ErrString = "Please select some columns.";
                return;
            }
            int rowCount = GetNewRowCount(mdata, multiNumCols, stringCols);
            float[,] expVals = new float[rowCount,mdata.ExpressionColumnCount];
            List<string[]> stringC = new List<string[]>();
            for (int i = 0; i < mdata.StringColumnCount; i++){
                stringC.Add(new string[rowCount]);
            }
            List<double[]> numC = new List<double[]>();
            for (int i = 0; i < mdata.NumericColumnCount; i++){
                numC.Add(new double[rowCount]);
            }
            List<string[][]> catC = new List<string[][]>();
            for (int i = 0; i < mdata.CategoryColumnCount; i++){
                catC.Add(new string[rowCount][]);
            }
            List<double[][]> multiNumC = new List<double[][]>();
            for (int i = 0; i < mdata.MultiNumericColumnCount; i++){
                multiNumC.Add(new double[rowCount][]);
            }
            int count = 0;
            for (int i = 0; i < mdata.RowCount; i++){
                string err;
                int entryCount = GetEntryCount(i, mdata, multiNumCols, stringCols, out err);
                if (err != null){
                    processInfo.ErrString = err;
                    return;
                }
                bool empty = entryCount == 0;
                entryCount = Math.Max(entryCount, 1);
                for (int j = 0; j < entryCount; j++){
                    for (int k = 0; k < mdata.ExpressionColumnCount; k++){
                        expVals[count + j, k] = mdata[i, k];
                    }
                    for (int k = 0; k < mdata.NumericColumnCount; k++){
                        numC[k][count + j] = mdata.NumericColumns[k][i];
                    }
                    for (int k = 0; k < mdata.CategoryColumnCount; k++){
                        catC[k][count + j] = mdata.GetCategoryColumnAt(k)[i];
                    }
                }
                for (int k = 0; k < mdata.MultiNumericColumnCount; k++){
                    if (multinumCols2.Contains(k)){
                        if (empty){
                            multiNumC[k][count] = new double[0];
                        } else{
                            double[] vals = mdata.MultiNumericColumns[k][i];
                            for (int j = 0; j < entryCount; j++){
                                multiNumC[k][count + j] = new[]{vals[j]};
                            }
                        }
                    } else{
                        for (int j = 0; j < entryCount; j++){
                            multiNumC[k][count + j] = mdata.MultiNumericColumns[k][i];
                        }
                    }
                }
                for (int k = 0; k < mdata.StringColumnCount; k++){
                    if (stringCols2.Contains(k)){
                        if (empty){
                            stringC[k][count] = "";
                        } else{
                            string[] vals = mdata.StringColumns[k][i].Split(';');
                            for (int j = 0; j < entryCount; j++){
                                stringC[k][count + j] = vals[j];
                            }
                        }
                    } else{
                        for (int j = 0; j < entryCount; j++){
                            stringC[k][count + j] = mdata.StringColumns[k][i];
                        }
                    }
                }
                count += entryCount;
            }
            int[] multiNumComplement = ArrayUtils.Complement(multiNumCols, mdata.MultiNumericColumnCount);
            List<double[][]> toBeTransformed = ArrayUtils.SubList(multiNumC, multiNumCols);
            multiNumC = ArrayUtils.SubList(multiNumC, multiNumComplement);
            foreach (double[][] d in toBeTransformed){
                numC.Add(Transform(d));
            }
            mdata.SetData(mdata.Name, mdata.ExpressionColumnNames, expVals, mdata.StringColumnNames, stringC,
                mdata.CategoryColumnNames, catC,
                new List<string>(ArrayUtils.Concat(mdata.NumericColumnNames,
                    ArrayUtils.SubList(mdata.MultiNumericColumnNames, multiNumCols))), numC,
                new List<string>(ArrayUtils.SubArray(mdata.MultiNumericColumnNames, multiNumComplement)), multiNumC);
        }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:98,代码来源:ExpandMultiNumeric.cs

示例12: GetIndicesOf

 public static int[] GetIndicesOf(IMatrixData data, string categoryName, HashSet<string> values)
 {
     int index = GetIndexOf(data, categoryName);
     List<int> result = new List<int>();
     for (int i = 0; i < data.RowCount; i++){
         string[] s = data.GetCategoryColumnAt(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

示例13: ProcessData

        public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
			ref IDocumentData[] documents, ProcessInfo processInfo)
        {
            SingleChoiceWithSubParams p = param.GetSingleChoiceWithSubParams("Column");
            int colInd = p.Value;
            if (colInd < 0){
                processInfo.ErrString = "No categorical columns 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.GetCategoryColumnValuesAt(colInd)[inds[i]];
            }
            HashSet<string> value = new HashSet<string>(values);
            bool remove = param.GetSingleChoiceParam("Mode").Value == 0;
            string[][] cats = mdata.GetCategoryColumnAt(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.FilterRows(mdata, param, valids.ToArray());
        }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:37,代码来源:FilterCategoricalColumn.cs

示例14: ProcessData

        public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
			ref IDocumentData[] documents, ProcessInfo processInfo)
        {
            bool keepEmpty = param.GetBoolParam("Keep rows without ID").Value;
            AverageType atype = GetAverageType(param.GetSingleChoiceParam("Average type for expression columns").Value);
            string[] ids2 = mdata.StringColumns[param.GetSingleChoiceParam("ID column").Value];
            string[][] ids = SplitIds(ids2);
            int[] present;
            int[] absent;
            GetPresentAbsentIndices(ids, out present, out absent);
            ids = ArrayUtils.SubArray(ids, present);
            int[][] rowInds = new int[present.Length][];
            for (int i = 0; i < rowInds.Length; i++){
                rowInds[i] = new[]{present[i]};
            }
            ClusterRows(ref rowInds, ref ids);
            if (keepEmpty){
                rowInds = ProlongRowInds(rowInds, absent);
            }
            int nrows = rowInds.Length;
            int ncols = mdata.ExpressionColumnCount;
            float[,] expVals = new float[nrows,ncols];
            for (int j = 0; j < ncols; j++){
                float[] c = mdata.GetExpressionColumn(j);
                for (int i = 0; i < nrows; i++){
                    float[] d = ArrayUtils.SubArray(c, rowInds[i]);
                    expVals[i, j] = Average(d, atype);
                }
            }
            mdata.ExpressionValues = expVals;
            for (int i = 0; i < mdata.NumericColumnCount; i++){
                string name = mdata.NumericColumnNames[i];
                AverageType atype1 = GetAverageType(param.GetSingleChoiceParam("Average type for " + name).Value);
                double[] c = mdata.NumericColumns[i];
                double[] newCol = new double[nrows];
                for (int k = 0; k < nrows; k++){
                    double[] d = ArrayUtils.SubArray(c, rowInds[k]);
                    newCol[k] = Average(d, atype1);
                }
                mdata.NumericColumns[i] = newCol;
            }
            for (int i = 0; i < mdata.CategoryColumnCount; i++){
                string[][] c = mdata.GetCategoryColumnAt(i);
                string[][] newCol = new string[nrows][];
                for (int k = 0; k < nrows; k++){
                    string[][] d = ArrayUtils.SubArray(c, rowInds[k]);
                    newCol[k] = Average(d);
                }
                mdata.SetCategoryColumnAt(newCol,i);
            }
            for (int i = 0; i < mdata.StringColumnCount; i++){
                string[] c = mdata.StringColumns[i];
                string[] newCol = new string[nrows];
                for (int k = 0; k < nrows; k++){
                    string[] d = ArrayUtils.SubArray(c, rowInds[k]);
                    newCol[k] = Average(d);
                }
                mdata.StringColumns[i] = newCol;
            }
            for (int i = 0; i < mdata.MultiNumericColumnCount; i++){
                double[][] c = mdata.MultiNumericColumns[i];
                double[][] newCol = new double[nrows][];
                for (int k = 0; k < nrows; k++){
                    double[][] d = ArrayUtils.SubArray(c, rowInds[k]);
                    newCol[k] = Average(d);
                }
                mdata.MultiNumericColumns[i] = newCol;
            }
        }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:69,代码来源:CombineByIdentifiersProcessing.cs

示例15: CountCategories

 public static CountingResult CountCategories(IMatrixData data, bool[] selection, int selCol, int[] catIndices)
 {
     CountingResult result = new CountingResult();
     foreach (int i in catIndices.Where(i => i != selCol)){
         CountTerms(data.CategoryColumnNames[i], data.GetCategoryColumnAt(i), result, selection);
     }
     result.Sort();
     return result;
 }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:9,代码来源:CategoryCounting.cs


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