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


C# Parameters.GetFileParam方法代码示例

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


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

示例1: ProcessDataReadFromFile

 private static string ProcessDataReadFromFile(IMatrixData mdata, Parameters param)
 {
     FileParam fp = param.GetFileParam("Input file");
     string filename = fp.Value;
     string[] colNames = TabSep.GetColumnNames(filename, '\t');
     int nameIndex = GetNameIndex(colNames);
     if (nameIndex < 0){
         return "Error: the file has to contain a column called 'Name'.";
     }
     if (colNames.Length < 2){
         return "Error: the file does not contain a grouping column.";
     }
     string[] nameCol = TabSep.GetColumn(colNames[nameIndex], filename, '\t');
     Dictionary<string, int> map = ArrayUtils.InverseMap(nameCol);
     for (int i = 0; i < colNames.Length; i++){
         if (i == nameIndex){
             continue;
         }
         string groupName = colNames[i];
         string[] groupCol = TabSep.GetColumn(groupName, filename, '\t');
         string[][] newCol = new string[mdata.ExpressionColumnCount][];
         for (int j = 0; j < newCol.Length; j++){
             string colName = mdata.ExpressionColumnNames[j];
             if (!map.ContainsKey(colName)){
                 newCol[j] = new string[0];
                 continue;
             }
             int ind = map[colName];
             string group = groupCol[ind];
             newCol[j] = new[]{group};
         }
         mdata.AddCategoryRow(groupName, groupName, newCol);
     }
     return null;
 }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:35,代码来源:CreateCategoricalAnnotRow.cs

示例2: ProcessDataWriteTemplateFile

 private static void ProcessDataWriteTemplateFile(IMatrixData mdata, Parameters param)
 {
     FileParam fp = param.GetFileParam("Output file");
     StreamWriter writer = new StreamWriter(fp.Value);
     writer.WriteLine("Name\tNew grouping");
     for (int i = 0; i < mdata.ExpressionColumnCount; i++){
         string colName = mdata.ExpressionColumnNames[i];
         writer.WriteLine(colName + "\t" + colName);
     }
     writer.Close();
 }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:11,代码来源:CreateCategoricalAnnotRow.cs

示例3: Export

 public void Export(Parameters parameters, IMatrixData data, ProcessInfo processInfo)
 {
     string filename = parameters.GetFileParam("File name").Value;
     StreamWriter writer;
     try{
         writer = new StreamWriter(filename);
     } catch (Exception e){
         processInfo.ErrString = e.Message;
         return;
     }
     List<string> words = new List<string>();
     for (int i = 0; i < data.ExpressionColumnCount; i++){
         words.Add(Trunc(data.ExpressionColumnNames[i]));
     }
     for (int i = 0; i < data.CategoryColumnCount; i++){
         words.Add(Trunc(data.CategoryColumnNames[i]));
     }
     for (int i = 0; i < data.NumericColumnCount; i++){
         words.Add(Trunc(data.NumericColumnNames[i]));
     }
     for (int i = 0; i < data.StringColumnCount; i++){
         words.Add(Trunc(data.StringColumnNames[i]));
     }
     for (int i = 0; i < data.MultiNumericColumnCount; i++){
         words.Add(Trunc(data.MultiNumericColumnNames[i]));
     }
     writer.WriteLine(StringUtils.Concat("\t", words));
     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.CategoryRows[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("");
         }
//.........这里部分代码省略.........
开发者ID:BAngermann,项目名称:perseus-plugins,代码行数:101,代码来源:TabSeparatedExport.cs


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