本文整理汇总了C#中BasicLib.Param.Parameters.GetSingleChoiceParam方法的典型用法代码示例。如果您正苦于以下问题:C# Parameters.GetSingleChoiceParam方法的具体用法?C# Parameters.GetSingleChoiceParam怎么用?C# Parameters.GetSingleChoiceParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BasicLib.Param.Parameters
的用法示例。
在下文中一共展示了Parameters.GetSingleChoiceParam方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessData
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
ref IDocumentData[] documents, ProcessInfo processInfo)
{
SingleChoiceParam access = param.GetSingleChoiceParam("Matrix access");
bool rows = access.Value == 0;
Rank1(rows, mdata);
}
示例2: ProcessData
public void ProcessData(IMatrixData data, Parameters param, ref IMatrixData[] supplTables,
ref IDocumentData[] documents, ProcessInfo processInfo)
{
bool falseAreIndicated = param.GetSingleChoiceParam("Indicated are").Value == 0;
int catCol = param.GetSingleChoiceParam("In column").Value;
string word = param.GetStringParam("Indicator").Value;
int[] scoreColumns = param.GetMultiChoiceParam("Scores").Value;
if (scoreColumns.Length == 0){
processInfo.ErrString = "Please specify at least one column with scores.";
return;
}
bool largeIsGood = param.GetBoolParam("Large values are good").Value;
int[] showColumns = param.GetMultiChoiceParam("Display quantity").Value;
if (showColumns.Length == 0){
processInfo.ErrString = "Please select at least one quantity to display";
return;
}
bool[] indCol = GetIndicatorColumn(falseAreIndicated, catCol, word, data);
List<string> expColNames = new List<string>();
List<float[]> expCols = new List<float[]>();
foreach (int scoreColumn in scoreColumns){
double[] vals = scoreColumn < data.NumericColumnCount
? data.NumericColumns[scoreColumn]
: ArrayUtils.ToDoubles(data.GetExpressionColumn(scoreColumn - data.NumericColumnCount));
string name = scoreColumn < data.NumericColumnCount
? data.NumericColumnNames[scoreColumn] : data.ExpressionColumnNames[scoreColumn - data.NumericColumnCount];
int[] order = GetOrder(vals, largeIsGood);
CalcCurve(ArrayUtils.SubArray(indCol, order), showColumns, name, expCols, expColNames);
}
float[,] expData = ToMatrix(expCols);
data.SetData(data.Name, expColNames, expData, new List<string>(), new List<string[]>(), new List<string>(),
new List<string[][]>(), new List<string>(), new List<double[]>(), new List<string>(), new List<double[][]>());
}
示例3: GetReduceMatrix
private static bool GetReduceMatrix(Parameters parameters)
{
return parameters.GetSingleChoiceParam("Filter mode").Value == 0;
}
示例4: ProcessData
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables, ProcessInfo processInfo)
{
int colIndex = param.GetSingleChoiceParam("Control column").Value;
if (colIndex < mdata.ExpressionColumnCount){
DivideByColumn(mdata, colIndex);
} else{
DivideByColumnNum(mdata, colIndex - mdata.ExpressionColumnCount);
}
}
示例5: ProcessDataRename
private static void ProcessDataRename(IMatrixData mdata, Parameters param)
{
int groupColInd = param.GetSingleChoiceParam("Numerical row").Value;
string newName = param.GetStringParam("New name").Value;
string newDescription = param.GetStringParam("New description").Value;
mdata.NumericRowNames[groupColInd] = newName;
mdata.NumericRowDescriptions[groupColInd] = newDescription;
}
示例6: ProcessData
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables, ProcessInfo processInfo)
{
string[][] col = mdata.CategoryColumns[param.GetSingleChoiceParam("Indicator column").Value];
string term = param.GetStringParam("Value").Value;
List<int> inds = new List<int>();
for (int i = 0; i < col.Length; i++){
if (Contains(col[i], term)){
inds.Add(i);
}
}
float[][] profiles = new float[inds.Count][];
for (int i = 0; i < profiles.Length; i++){
profiles[i] = mdata.GetExpressionRow(inds[i]);
float mean = (float) ArrayUtils.Mean(profiles[i]);
for (int j = 0; j < profiles[i].Length; j++){
profiles[i][j] -= mean;
}
}
float[] totalProfile = new float[mdata.ExpressionColumnCount];
for (int i = 0; i < totalProfile.Length; i++){
List<float> vals = new List<float>();
foreach (float[] t in profiles){
float val = t[i];
if (float.IsNaN(val) || float.IsInfinity(val)){
continue;
}
vals.Add(val);
}
totalProfile[i] = vals.Count > 0 ? ArrayUtils.Median(vals) : float.NaN;
}
for (int i = 0; i < mdata.RowCount; i++){
for (int j = 0; j < mdata.ExpressionColumnCount; j++){
mdata[i, j] -= totalProfile[j];
}
}
}
示例7: ProcessData
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables, ProcessInfo processInfo)
{
double width = param.GetDoubleParam("Width").Value;
double shift = param.GetDoubleParam("Down shift").Value;
bool separateColumns = param.GetSingleChoiceParam("Mode").Value == 0;
if (separateColumns){
ReplaceMissingsByGaussianByColumn(width, shift, mdata);
} else{
ReplaceMissingsByGaussianWholeMatrix(width, shift, mdata);
}
}
示例8: ProcessData
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
ref IDocumentData[] documents, ProcessInfo processInfo)
{
int nameCol = param.GetSingleChoiceParam("New column names").Value;
List<string> colNames;
if (nameCol >= 0){
HashSet<string> taken = new HashSet<string>();
colNames = new List<string>();
foreach (string n in mdata.StringColumns[nameCol]){
string n1 = GetNextAvailableName(n, taken);
taken.Add(n1);
colNames.Add(n1);
}
} else{
colNames = new List<string>();
for (int i = 0; i < mdata.RowCount; i++){
colNames.Add("Column" + (i + 1));
}
}
List<string> rowNames = mdata.ExpressionColumnNames;
mdata.SetData(mdata.Name, mdata.Description, colNames, colNames, ArrayUtils.Transpose(mdata.ExpressionValues),
ArrayUtils.Transpose(mdata.IsImputed), ArrayUtils.Transpose(mdata.QualityValues), mdata.QualityName,
mdata.QualityBiggerIsBetter, new List<string>(new[]{"Name"}), new List<string>(new[]{"Name"}),
new List<string[]>(new[]{rowNames.ToArray()}), mdata.CategoryRowNames, mdata.CategoryRowDescriptions,
GetCategoryRows(mdata), mdata.NumericRowNames, mdata.NumericRowDescriptions, mdata.NumericRows, new List<string>(),
new List<string>(), new List<double[][]>(), mdata.CategoryColumnNames, mdata.CategoryColumnDescriptions,
GetCategoryColumns(mdata), mdata.NumericColumnNames, mdata.NumericColumnDescriptions, mdata.NumericColumns);
}
示例9: ProcessData
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables, ProcessInfo processInfo)
{
bool rows = param.GetSingleChoiceParam("Matrix access").Value == 0;
bool atLeast = param.GetSingleChoiceParam("Side").Value == 0;
int numValids = param.GetIntParam("Number of valid values").Value;
SingleChoiceWithSubParams modeParam = param.GetSingleChoiceWithSubParams("Mode");
int modeInd = modeParam.Value;
if (modeInd != 0 && mdata.CategoryRowNames.Count == 0){
processInfo.ErrString = "No grouping is defined.";
return;
}
if (modeInd != 0 && !rows){
processInfo.ErrString = "Group-wise filtering can only be appled to rows.";
return;
}
if (modeInd != 0){
int gind = modeParam.GetSubParameters().GetSingleChoiceParam("Grouping").Value;
string[][] groupCol = mdata.CategoryRows[gind];
ValidValueFilterGroup(numValids, mdata, param, modeInd == 2, groupCol, atLeast);
} else{
ValidValueFilter1(rows, numValids, mdata, param, atLeast);
}
}
示例10: ProcessData
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables, ProcessInfo processInfo)
{
int colInd = param.GetSingleChoiceParam("Column").Value;
string value = param.GetStringParam("Find").Value;
bool remove = param.GetSingleChoiceParam("Mode").Value == 0;
string[][] cats = mdata.CategoryColumns[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 (w.Equals(value)){
valid = false;
break;
}
}
if ((valid && remove) || (!valid && !remove)){
valids.Add(i);
}
}
mdata.ExtractExpressionRows(valids.ToArray());
}
示例11: ProcessData
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
ref IDocumentData[] documents, ProcessInfo processInfo)
{
float[,] q = new float[mdata.RowCount,mdata.ExpressionColumnCount];
for (int j = 0; j < mdata.ExpressionColumnCount; j++){
int ind = param.GetSingleChoiceParam(mdata.ExpressionColumnNames[j]).Value;
double[] w = mdata.NumericColumns[ind];
for (int i = 0; i < mdata.RowCount; i++){
q[i, j] = (float) w[i];
}
}
mdata.QualityValues = q;
mdata.QualityBiggerIsBetter = false;
}
示例12: ProcessData
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
ref IDocumentData[] documents, ProcessInfo processInfo)
{
int ind = param.GetSingleChoiceParam("Column").Value;
bool descending = param.GetBoolParam("Descending").Value;
if (ind < mdata.ExpressionColumnCount){
float[] v = mdata.GetExpressionColumn(ind);
int[] o = ArrayUtils.Order(v);
if (descending){
ArrayUtils.Revert(o);
}
mdata.ExtractExpressionRows(o);
} else{
double[] v = mdata.NumericColumns[ind - mdata.ExpressionColumnCount];
int[] o = ArrayUtils.Order(v);
if (descending){
ArrayUtils.Revert(o);
}
mdata.ExtractExpressionRows(o);
}
}
示例13: ProcessData
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables, ProcessInfo processInfo)
{
SingleChoiceParam access = param.GetSingleChoiceParam("Matrix access");
bool rows = access.Value == 0;
int what = param.GetSingleChoiceParam("Divide by what").Value;
DivideImpl(rows, ArrayUtils.Mean, mdata);
switch (what){
case 0:
DivideImpl(rows, ArrayUtils.Mean, mdata);
break;
case 1:
DivideImpl(rows, ArrayUtils.Median, mdata);
break;
case 2:
DivideImpl(rows, ArrayUtils.MostFrequentValue, mdata);
break;
default:
throw new Exception("Never get here.");
}
}
示例14: 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());
}
示例15: 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;
}
}