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


C# IMatrixData类代码示例

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


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

示例1: GetParameters

 public Parameters GetParameters(IMatrixData mdata, ref string errorString)
 {
     List<Parameter> par = new List<Parameter>();
     foreach (string t in mdata.ColumnNames){
         string help = "Specify the new name for the column '" + t + "'.";
         par.Add(new StringParam(t){Value = t, Help = help});
     }
     foreach (string t in mdata.NumericColumnNames){
         string help = "Specify the new name for the column '" + t + "'.";
         par.Add(new StringParam(t){Value = t, Help = help});
     }
     foreach (string t in mdata.CategoryColumnNames){
         string help = "Specify the new name for the column '" + t + "'.";
         par.Add(new StringParam(t){Value = t, Help = help});
     }
     foreach (string t in mdata.StringColumnNames){
         string help = "Specify the new name for the column '" + t + "'.";
         par.Add(new StringParam(t){Value = t, Help = help});
     }
     foreach (string t in mdata.MultiNumericColumnNames){
         string help = "Specify the new name for the column '" + t + "'.";
         par.Add(new StringParam(t){Value = t, Help = help});
     }
     return new Parameters(par);
 }
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:25,代码来源:RenameColumns.cs

示例2: SubtractValues

 public static void SubtractValues(bool rows, Func<double[], double> summarize, IMatrixData data)
 {
     if (rows){
         for (int i = 0; i < data.RowCount; i++){
             List<double> vals = new List<double>();
             for (int j = 0; j < data.ExpressionColumnCount; j++){
                 double q = data[i, j];
                 if (!double.IsNaN(q) && !double.IsInfinity(q)){
                     vals.Add(q);
                 }
             }
             double med = summarize(vals.ToArray());
             for (int j = 0; j < data.ExpressionColumnCount; j++){
                 data[i, j] -= (float) med;
             }
         }
     } else{
         for (int j = 0; j < data.ExpressionColumnCount; j++){
             List<double> vals = new List<double>();
             for (int i = 0; i < data.RowCount; i++){
                 double q = data[i, j];
                 if (!double.IsNaN(q) && !double.IsInfinity(q)){
                     vals.Add(q);
                 }
             }
             double med = summarize(vals.ToArray());
             for (int i = 0; i < data.RowCount; i++){
                 data[i, j] -= (float) med;
             }
         }
     }
 }
开发者ID:BAngermann,项目名称:perseus-plugins,代码行数:32,代码来源:Subtract.cs

示例3: ReplaceMissingsByGaussianWholeMatrix

 public static string ReplaceMissingsByGaussianWholeMatrix(double width, double shift, IMatrixData data, int[] colInds)
 {
     List<float> allValues = new List<float>();
     for (int i = 0; i < data.RowCount; i++){
         foreach (int t in colInds){
             float x = GetValue(data, i, t);
             if (!float.IsNaN(x) && !float.IsInfinity(x)){
                 allValues.Add(x);
             }
         }
     }
     double stddev;
     double mean = ArrayUtils.MeanAndStddev(allValues.ToArray(), out stddev);
     if (double.IsNaN(mean) || double.IsInfinity(mean) || double.IsNaN(stddev) || double.IsInfinity(stddev)){
         return "Imputation failed since mean and standard deviation could not be calculated.";
     }
     double m = mean - shift*stddev;
     double s = stddev*width;
     Random2 r = new Random2();
     for (int i = 0; i < data.RowCount; i++){
         foreach (int colInd in colInds){
             float x = GetValue(data, i, colInd);
             if (float.IsNaN(x) || float.IsInfinity(x)){
                 if (colInd < data.ColumnCount){
                     data.Values.Set(i, colInd, (float) r.NextGaussian(m, s));
                     data.IsImputed[i, colInd] = true;
                 } else{
                     data.NumericColumns[colInd - data.ColumnCount][i] = r.NextGaussian(m, s);
                 }
             }
         }
     }
     return null;
 }
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:34,代码来源:ReplaceMissingFromGaussian.cs

示例4: UnitVectors

 public void UnitVectors(bool rows, IMatrixData data)
 {
     if (rows){
         for (int i = 0; i < data.RowCount; i++){
             double len = 0;
             for (int j = 0; j < data.ColumnCount; j++){
                 double q = data.Values.Get(i, j);
                 len += q*q;
             }
             len = Math.Sqrt(len);
             for (int j = 0; j < data.ColumnCount; j++){
                 data.Values.Set(i, j, data.Values.Get(i, j)/(float) len);
             }
         }
     } else{
         for (int j = 0; j < data.ColumnCount; j++){
             double len = 0;
             for (int i = 0; i < data.RowCount; i++){
                 double q = data.Values.Get(i, j);
                 len += q*q;
             }
             len = Math.Sqrt(len);
             for (int i = 0; i < data.RowCount; i++){
                 data.Values.Set(i, j, data.Values.Get(i, j) / (float) len);
             }
         }
     }
 }
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:28,代码来源:UnitVector.cs

示例5: ProcessData

        public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
			ref IDocumentData[] documents, ProcessInfo processInfo)
        {
            Parameter<int> access = param.GetParam<int>("Matrix access");
            bool rows = access.Value == 0;
            UnitVectors(rows, mdata);
        }
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:7,代码来源:UnitVector.cs

示例6: MatrixDataTable

 public MatrixDataTable(IMatrixData mdata)
     : base(mdata.Name, mdata.Description, mdata.RowCount)
 {
     this.mdata = mdata;
     CreateColumns();
     CreateAnnotationRows();
 }
开发者ID:BAngermann,项目名称:perseus-plugins,代码行数:7,代码来源:MatrixDataTable.cs

示例7: GetParameters

 public Parameters GetParameters(IMatrixData mdata, ref string errorString)
 {
     Parameters[] subParams = new Parameters[mdata.CategoryColumnCount];
     for (int i = 0; i < mdata.CategoryColumnCount; i++){
         string[] values = mdata.GetCategoryColumnValuesAt(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("Column"){
             Values = mdata.CategoryColumnNames,
             SubParams = subParams,
             Help = "The categorical column that the filtering should be based on.",
             ParamNameWidth = 50,
             TotalWidth = 731
         }, new SingleChoiceParam("Mode"){
             Values = new[]{"Remove matching rows", "Keep matching rows"},
             Help =
                 "If 'Remove matching rows' is selected, rows having the values specified above will be removed while " +
                 "all other rows will be kept. If 'Keep matching rows' is selected, the opposite will happen."
         }, PerseusPluginUtils.GetFilterModeParam(true));
 }
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:28,代码来源:FilterCategoricalColumn.cs

示例8: GetParameters

 public Parameters GetParameters(IMatrixData mdata, ref string errorString)
 {
     List<string> colChoice = mdata.StringColumnNames;
     int colInd = 0;
     for (int i = 0; i < colChoice.Count; i++){
         if (colChoice[i].ToUpper().Equals("UNIPROT")){
             colInd = i;
             break;
         }
     }
     int colSeqInd = 0;
     for (int i = 0; i < colChoice.Count; i++){
         if (colChoice[i].ToUpper().Equals("SEQUENCE WINDOW")){
             colSeqInd = i;
             break;
         }
     }
     return
         new Parameters(
             new SingleChoiceParam("Uniprot column"){
                 Value = colInd,
                 Help = "Specify here the column that contains Uniprot identifiers.",
                 Values = colChoice
             },
             new SingleChoiceParam("Sequence window"){
                 Value = colSeqInd,
                 Help = "Specify here the column that contains the sequence windows around the site.",
                 Values = colChoice
             });
 }
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:30,代码来源:AddRegulatorySites.cs

示例9: GetParameters

 public Parameters GetParameters(IMatrixData mdata, ref string errorString)
 {
     List<string> numRows = mdata.NumericRowNames;
     List<string> multiNumRows = mdata.MultiNumericRowNames;
     List<string> catRows = mdata.CategoryRowNames;
     List<string> textRows = mdata.StringRowNames;
     return
         new Parameters(new Parameter[]{
             new MultiChoiceParam("Numerical rows"){
                 Value = ArrayUtils.ConsecutiveInts(numRows.Count),
                 Values = numRows,
                 Help = "Specify here the new order in which the numerical rows should appear."
             },
             new MultiChoiceParam("Multi-numerical rows"){
                 Value = ArrayUtils.ConsecutiveInts(multiNumRows.Count),
                 Values = multiNumRows,
                 Help = "Specify here the new order in which the numerical rows should appear."
             },
             new MultiChoiceParam("Categorical rows"){
                 Value = ArrayUtils.ConsecutiveInts(catRows.Count),
                 Values = catRows,
                 Help = "Specify here the new order in which the categorical rows should appear."
             },
             new MultiChoiceParam("Text rows"){
                 Value = ArrayUtils.ConsecutiveInts(textRows.Count),
                 Values = textRows,
                 Help = "Specify here the new order in which the text rows should appear."
             }
         });
 }
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:30,代码来源:ReorderRemoveAnnotRows.cs

示例10: ProcessData

        public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
			ref IDocumentData[] documents, ProcessInfo processInfo)
        {
            const bool rows = false;
            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;
            }
            if (modeInd != 0){
                processInfo.ErrString = "Group-wise filtering can only be appled to rows.";
                return;
            }
            FilteringMode filterMode;
            double threshold;
            double threshold2;
            PerseusPluginUtils.ReadValuesShouldBeParams(param, out filterMode, out threshold, out threshold2);
            if (modeInd != 0){
                //TODO
            } else{
                PerseusPluginUtils.NonzeroFilter1(rows, minValids, percentage, mdata, param, threshold, threshold2, filterMode);
            }
        }
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:26,代码来源:FilterValidValuesColumns.cs

示例11: GetParameters

 public Parameters GetParameters(IMatrixData[] inputData, ref string errString)
 {
     IMatrixData matrixData1 = inputData[0];
     IMatrixData matrixData2 = inputData[1];
     return
         new Parameters(new Parameter[]{
             new SingleChoiceParam("Column in matrix 1 to be edited"){
                 Values = matrixData1.StringColumnNames,
                 Value = 0,
                 Help =
                     "The column in the first matrix in which strings will be replaced " +
                     "according to the key-value table specified in matrix 2."
             },
             new SingleChoiceParam("Keys in matrix 2"){
                 Values = matrixData2.StringColumnNames,
                 Value = 0,
                 Help = "The keys for the replacement table."
             },
             new SingleChoiceParam("Values in matrix 2"){
                 Values = matrixData2.StringColumnNames,
                 Value = 1,
                 Help = "The values for the replacement table."
             }
         });
 }
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:25,代码来源:ReplaceStrings.cs

示例12: ProcessData

        public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
			ref IDocumentData[] documents, ProcessInfo processInfo)
        {
            Random2 rand = new Random2();
            double std = param.GetParam<double>("Standard deviation").Value;
            int[] inds = param.GetParam<int[]>("Columns").Value;
            List<int> mainInds = new List<int>();
            List<int> numInds = new List<int>();
            foreach (int ind in inds){
                if (ind < mdata.ColumnCount){
                    mainInds.Add(ind);
                } else{
                    numInds.Add(ind - mdata.ColumnCount);
                }
            }
            foreach (int j in mainInds){
                for (int i = 0; i < mdata.RowCount; i++){
                    mdata.Values.Set(i, j, mdata.Values.Get(i, j) + (float) rand.NextGaussian(0, std));
                }
            }
            foreach (int j in numInds){
                for (int i = 0; i < mdata.RowCount; i++){
                    mdata.NumericColumns[j][i] += (float) rand.NextGaussian(0, std);
                }
            }
        }
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:26,代码来源:AddNoise.cs

示例13: 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];
         }
         for (int j = index + 1; j < n; j++){
             newEx[i, j - 1] = data[i, j] - data[i, index];
         }
     }
     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.CategoryColumns[i] = ArrayUtils.RemoveAtIndex(data.CategoryColumns[i], index);
     }
     for (int i = 0; i < data.NumericRowCount; i++){
         data.NumericColumns[i] = ArrayUtils.RemoveAtIndex(data.NumericColumns[i], index);
     }
 }
开发者ID:BAngermann,项目名称:perseus-plugins,代码行数:33,代码来源:SubtractColumn.cs

示例14: GetParameters

 public Parameters GetParameters(IMatrixData mdata, ref string errorString)
 {
     string[] vals = ArrayUtils.Concat(mdata.ColumnNames, mdata.NumericColumnNames);
     int[] sel1 = vals.Length > 0 ? new[]{0} : new int[0];
     int[] sel2 = vals.Length > 1 ? new[]{1} : (vals.Length > 0 ? new[]{0} : new int[0]);
     return
         new Parameters(new Parameter[]{
             new MultiChoiceParam("x", sel1){
                 Values = vals,
                 Repeats = true,
                 Help =
                     "Colums for the first dimension. Multiple choices can be made leading to the creation of multiple density maps."
             },
             new MultiChoiceParam("y", sel2){
                 Values = vals,
                 Repeats = true,
                 Help = "Colums for the second dimension. The number has to be the same as for the 'Column 1' parameter."
             },
             new IntParam("Number of points", 300){
                 Help =
                     "This parameter defines the resolution of the density map. It specifies the number of pixels per dimension. Large " +
                     "values may lead to increased computing times."
             },
             new SingleChoiceParam("Distribution type"){Values = new[]{"P(x,y)", "P(y|x)", "P(x|y)", "P(x,y)/(P(x)*P(y))"}}
         });
 }
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:26,代码来源:DensityEstimationProcessing.cs

示例15: GetParameters

 public Parameters GetParameters(IMatrixData mdata, ref string errorString)
 {
     return
         new Parameters(new Parameter[]{
             new StringParam("Find what"), new SingleChoiceParam("Look in"){Values = mdata.StringColumnNames},
             new BoolParam("Match case"){Value = true}, new BoolParam("Match whole word")
         });
 }
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:8,代码来源:SearchTextColumns.cs


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