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


C# Parameters.GetParamWithSubParams方法代码示例

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


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

示例1: 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

示例2: Train

 public RegressionModel Train(BaseVector[] x, float[] y, Parameters param, int nthreads)
 {
     ParameterWithSubParams<int> kernelParam = param.GetParamWithSubParams<int>("Kernel");
     SvmParameter sp = new SvmParameter{
         kernelFunction = KernelFunctions.GetKernelFunction(kernelParam.Value, kernelParam.GetSubParameters()),
         svmType = SvmType.EpsilonSvr,
         c = param.GetParam<double>("C").Value
     };
     SvmModel model = SvmMain.SvmTrain(new SvmProblem(x, y), sp);
     return new SvmRegressionModel(model);
 }
开发者ID:JurgenCox,项目名称:compbio-base,代码行数:11,代码来源:SvmRegression.cs

示例3: Train

        public override ClassificationModel Train(BaseVector[] x, int[][] y, int ngroups, Parameters param, int nthreads,
			Action<double> reportProgress)
        {
            string err = CheckInput(x, y, ngroups);
            if (err != null){
                throw new Exception(err);
            }
            ParameterWithSubParams<int> kernelParam = param.GetParamWithSubParams<int>("Kernel");
            SvmParameter sp = new SvmParameter{
                kernelFunction = KernelFunctions.GetKernelFunction(kernelParam.Value, kernelParam.GetSubParameters()),
                svmType = SvmType.CSvc,
                c = param.GetParam<double>("C").Value
            };
            bool[] invert;
            SvmProblem[] problems = CreateProblems(x, y, ngroups, out invert);
            SvmModel[] models = new SvmModel[problems.Length];
            ThreadDistributor td = new ThreadDistributor(nthreads, models.Length,
                i => { models[i] = SvmMain.SvmTrain(problems[i], sp); }, fractionDone => { reportProgress?.Invoke(fractionDone); });
            td.Start();
            return new SvmClassificationModel(models, invert);
        }
开发者ID:JurgenCox,项目名称:compbio-base,代码行数:21,代码来源:SvmClassification.cs

示例4: ProcessData

        public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
			ref IDocumentData[] documents, ProcessInfo processInfo)
        {
            ParameterWithSubParams<int> p = param.GetParamWithSubParams<int>("Column");
            int colInd = p.Value;
            if (colInd < 0){
                processInfo.ErrString = "No categorical columns 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.GetCategoryColumnValuesAt(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;
            List<int> valids = new List<int>();
            for (int i = 0; i < mdata.RowCount; i++){
                bool valid = true;
                foreach (string w in mdata.GetCategoryColumnEntryAt(colInd, i)){
                    if (value.Contains(w)){
                        valid = false;
                        break;
                    }
                }
                if ((valid && remove) || (!valid && !remove)){
                    valids.Add(i);
                }
            }
            PerseusPluginUtils.FilterRows(mdata, param, valids.ToArray());
        }
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:37,代码来源:FilterCategoricalColumn.cs

示例5: 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

示例6: GetRelations

 private static Relation[] GetRelations(Parameters parameters, string[] realVariableNames)
 {
     ParameterWithSubParams<int> sp = parameters.GetParamWithSubParams<int>("Number of relations");
     int nrel = sp.Value + 1;
     List<Relation> result = new List<Relation>();
     Parameters param = sp.GetSubParameters();
     for (int j = 0; j < nrel; j++){
         string rel = param.GetParam<string>("Relation " + (j + 1)).Value;
         if (rel.StartsWith(">") || rel.StartsWith("<") || rel.StartsWith("=")){
             rel = "x" + rel;
         }
         string err1;
         Relation r = Relation.CreateFromString(rel, realVariableNames, new string[0], out err1);
         result.Add(r);
     }
     return result.ToArray();
 }
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:17,代码来源:PerseusUtils.cs

示例7: GetColIndsNumFilter

 private static int[] GetColIndsNumFilter(Parameters parameters, out string[] realVariableNames)
 {
     ParameterWithSubParams<int> sp = parameters.GetParamWithSubParams<int>("Number of columns");
     int ncols = sp.Value + 1;
     int[] result = new int[ncols];
     realVariableNames = new string[ncols];
     Parameters param = sp.GetSubParameters();
     for (int j = 0; j < ncols; j++){
         realVariableNames[j] = GetVariableName(j);
         result[j] = param.GetParam<int>(realVariableNames[j]).Value;
     }
     return result;
 }
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:13,代码来源:PerseusUtils.cs

示例8: ProcessData

        public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
			ref IDocumentData[] documents, ProcessInfo processInfo)
        {
            ParameterWithSubParams<int> access = param.GetParamWithSubParams<int>("Matrix access");
            bool rows = access.Value == 0;
            int meanInd = access.GetSubParameters().GetParam<int>("Mean").Value;
            int devInd = access.GetSubParameters().GetParam<int>("Std. dev.").Value;
            double[] means = rows ? mdata.NumericColumns[meanInd] : mdata.NumericRows[meanInd];
            double[] stddevs = rows ? mdata.NumericColumns[devInd] : mdata.NumericRows[devInd];
            UnZscore(rows, mdata, processInfo.NumThreads, means, stddevs);
        }
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:11,代码来源:UnZScore.cs

示例9: ProcessDataEdit

 private static void ProcessDataEdit(IDataWithAnnotationRows mdata, Parameters param)
 {
     ParameterWithSubParams<int> s = param.GetParamWithSubParams<int>("Numerical row");
     int groupColInd = s.Value;
     Parameters sp = s.GetSubParameters();
     for (int i = 0; i < mdata.ColumnCount; i++){
         string t = mdata.ColumnNames[i];
         double x = sp.GetParam<double>(t).Value;
         mdata.NumericRows[groupColInd][i] = x;
     }
 }
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:11,代码来源:CreateNumericalAnnotRow.cs

示例10: ProcessData

        public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
			ref IDocumentData[] documents, ProcessInfo processInfo)
        {
            ParameterWithSubParams<int> scwsp = param.GetParamWithSubParams<int>("Action");
            Parameters spar = scwsp.GetSubParameters();
            switch (scwsp.Value){
                case 0:
                    ProcessDataCreate(mdata, spar);
                    break;
                case 1:
                    ProcessDataEdit(mdata, spar);
                    break;
                case 2:
                    ProcessDataRename(mdata, spar);
                    break;
                case 3:
                    ProcessDataDelete(mdata, spar);
                    break;
            }
        }
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:20,代码来源:CreateNumericalAnnotRow.cs

示例11: ReadValuesShouldBeParams

        internal static void ReadValuesShouldBeParams(Parameters param, out FilteringMode filterMode, out double threshold,
			out double threshold2)
        {
            ParameterWithSubParams<int> x = param.GetParamWithSubParams<int>("Values should be");
            Parameters subParams = x.GetSubParameters();
            int shouldBeIndex = x.Value;
            threshold = double.NaN;
            threshold2 = double.NaN;
            switch (shouldBeIndex){
                case 0:
                    filterMode = FilteringMode.Valid;
                    break;
                case 1:
                    filterMode = FilteringMode.GreaterThan;
                    threshold = subParams.GetParam<double>("Minimum").Value;
                    break;
                case 2:
                    filterMode = FilteringMode.GreaterEqualThan;
                    threshold = subParams.GetParam<double>("Minimum").Value;
                    break;
                case 3:
                    filterMode = FilteringMode.LessThan;
                    threshold = subParams.GetParam<double>("Maximum").Value;
                    break;
                case 4:
                    filterMode = FilteringMode.LessEqualThan;
                    threshold = subParams.GetParam<double>("Maximum").Value;
                    break;
                case 5:
                    filterMode = FilteringMode.Between;
                    threshold = subParams.GetParam<double>("Minimum").Value;
                    threshold2 = subParams.GetParam<double>("Maximum").Value;
                    break;
                case 6:
                    filterMode = FilteringMode.Outside;
                    threshold = subParams.GetParam<double>("Minimum").Value;
                    threshold2 = subParams.GetParam<double>("Maximum").Value;
                    break;
                default:
                    throw new Exception("Should not happen.");
            }
        }
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:42,代码来源:PerseusPluginUtils.cs

示例12: GetMinValids

 public static int GetMinValids(Parameters param, out bool percentage)
 {
     ParameterWithSubParams<int> p = param.GetParamWithSubParams<int>("Min. valids");
     percentage = p.Value == 1;
     return p.GetSubParameters().GetParam<int>(percentage ? "Min. percentage of values" : "Min. number of values").Value;
 }
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:6,代码来源:PerseusPluginUtils.cs

示例13: ProcessData

        public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
			ref IDocumentData[] documents, ProcessInfo processInfo)
        {
            int proteinIdColumnInd = param.GetParam<int>("Protein IDs").Value;
            string[][] proteinIds = new string[mdata.RowCount][];
            string[][] leadingIds = new string[mdata.RowCount][];
            List<string> allIds = new List<string>();
            for (int row = 0; row < mdata.RowCount; row++){
                proteinIds[row] = mdata.StringColumns[proteinIdColumnInd][row].Split(';');
                leadingIds[row] = new[]{proteinIds[row][0]};
                allIds.AddRange(proteinIds[row]);
            }
            string fastaFilePath = param.GetParam<string>("Fasta file").Value;
            Fasta fasta = new Fasta();
            fasta.ParseFile(fastaFilePath, processInfo);
            // Text annotations
            processInfo.Status("Adding fasta header annotations.");
            int[] selection =
                param.GetParamWithSubParams<int>("Fasta header annotations").GetSubParameters().GetParam<int[]>("Annotations").Value;
            string[][] idsToBeAnnotated = (param.GetParamWithSubParams<int>("Fasta header annotations").Value == 0)
                ? proteinIds
                : leadingIds;
            ProteinSequence[][] fastaEntries = new ProteinSequence[mdata.RowCount][];
            for (int row = 0; row < mdata.RowCount; row++){
                List<ProteinSequence> rowEntries = new List<ProteinSequence>();
                foreach (string id in idsToBeAnnotated[row]){
                    ProteinSequence entry = fasta.GetEntry(id);
                    if (entry == null){
                        continue;
                    }
                    rowEntries.Add(entry);
                }
                fastaEntries[row] = rowEntries.ToArray();
            }
            if (ArrayUtils.Contains(selection, 0)){ // Entry name
                string[] annotationColumn = new string[mdata.RowCount];
                for (int row = 0; row < mdata.RowCount; row++){
                    List<string> rowAnnotations = new List<string>();
                    foreach (ProteinSequence entry in fastaEntries[row]){
                        string entryName = entry.EntryName;
                        if (entryName != null && !ArrayUtils.Contains(rowAnnotations, entryName)){
                            rowAnnotations.Add(entryName);
                        }
                    }
                    annotationColumn[row] = string.Join(";", rowAnnotations.ToArray());
                }
                mdata.AddStringColumn("Entry name", "", annotationColumn);
            }
            if (ArrayUtils.Contains(selection, 1)){ // Gene name
                string[] annotationColumn = new string[mdata.RowCount];
                for (int row = 0; row < mdata.RowCount; row++){
                    List<string> rowAnnotations = new List<string>();
                    foreach (ProteinSequence entry in fastaEntries[row]){
                        string geneName = entry.GeneName;
                        if (geneName != null && !ArrayUtils.Contains(rowAnnotations, geneName)){
                            rowAnnotations.Add(geneName);
                        }
                    }
                    annotationColumn[row] = string.Join(";", rowAnnotations.ToArray());
                }
                mdata.AddStringColumn("Gene name", "", annotationColumn);
            }
            if (ArrayUtils.Contains(selection, 2)){
                // Verbose protein name, i.e. all protein names annotated in all fasta headers, including the
                //'Isoform x of...' prefixes and '(Fragment)' suffixes
                string[] annotationColumn = new string[mdata.RowCount];
                for (int row = 0; row < mdata.RowCount; row++){
                    List<string> rowAnnotations = new List<string>();
                    foreach (ProteinSequence entry in fastaEntries[row]){
                        string proteinName = entry.ProteinName;
                        if (proteinName != null && !ArrayUtils.Contains(rowAnnotations, proteinName)){
                            rowAnnotations.Add(proteinName);
                        }
                    }
                    annotationColumn[row] = string.Join(";", rowAnnotations.ToArray());
                }
                mdata.AddStringColumn("Protein name (verbose)", "", annotationColumn);
            }
            if (ArrayUtils.Contains(selection, 3)){ // Consensus protein name
                string[] annotationColumn = new string[mdata.RowCount];
                for (int row = 0; row < mdata.RowCount; row++){
                    List<string> rowAnnotations = new List<string>();
                    foreach (ProteinSequence entry in fastaEntries[row]){
                        string proteinName = entry.ConsensusProteinName;
                        if (proteinName != null && !ArrayUtils.Contains(rowAnnotations, proteinName)){
                            rowAnnotations.Add(proteinName);
                        }
                    }
                    annotationColumn[row] = String.Join(";", rowAnnotations.ToArray());
                }
                mdata.AddStringColumn("Protein name", "", annotationColumn);
            }
            if (ArrayUtils.Contains(selection, 4)){ // Species
                string[] annotationColumn = new string[mdata.RowCount];
                for (int row = 0; row < mdata.RowCount; row++){
                    List<string> rowAnnotations = new List<string>();
                    foreach (ProteinSequence entry in fastaEntries[row]){
                        string speciesName = entry.Species;
                        if (speciesName != null && !ArrayUtils.Contains(rowAnnotations, speciesName)){
                            rowAnnotations.Add(speciesName);
//.........这里部分代码省略.........
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:101,代码来源:AnnotateSequences.cs

示例14: GetDistanceFunction

 public static IDistance GetDistanceFunction(Parameters param)
 {
     ParameterWithSubParams<int> distParam = param.GetParamWithSubParams<int>("Distance");
     return GetDistanceFunction(distParam.Value, distParam.GetSubParameters());
 }
开发者ID:JurgenCox,项目名称:compbio-base,代码行数:5,代码来源:Distances.cs


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