本文整理汇总了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;
}
示例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();
}
示例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("");
}
//.........这里部分代码省略.........