本文整理汇总了C#中IMatrixData.AddNumericColumn方法的典型用法代码示例。如果您正苦于以下问题:C# IMatrixData.AddNumericColumn方法的具体用法?C# IMatrixData.AddNumericColumn怎么用?C# IMatrixData.AddNumericColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMatrixData
的用法示例。
在下文中一共展示了IMatrixData.AddNumericColumn方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessData
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
ref IDocumentData[] documents, ProcessInfo processInfo)
{
SingleChoiceWithSubParams xp = param.GetSingleChoiceWithSubParams("Expression column selection");
bool groups = xp.Value == 2;
string[] groupNames = null;
int[][] colIndsGroups = null;
if (groups){
int groupRowInd = xp.GetSubParameters().GetSingleChoiceParam("Group").Value;
string[][] groupCol = mdata.GetCategoryRowAt(groupRowInd);
groupNames = ArrayUtils.UniqueValuesPreserveOrder(groupCol);
colIndsGroups = PerseusPluginUtils.GetExpressionColIndices(groupCol, groupNames);
}
int[] useCols = xp.Value == 1
? xp.GetSubParameters().GetMultiChoiceParam("Columns").Value
: ArrayUtils.ConsecutiveInts(mdata.ExpressionColumnCount);
HashSet<int> w = ArrayUtils.ToHashSet(param.GetMultiChoiceParam("Calculate").Value);
bool[] include = new bool[procs.Length];
double[][] columns = new double[procs.Length][];
double[][][] columnsG = null;
if (groups){
columnsG = new double[procs.Length][][];
for (int i = 0; i < columnsG.Length; i++){
columnsG[i] = new double[groupNames.Length][];
}
}
for (int i = 0; i < include.Length; i++){
include[i] = w.Contains(i);
if (include[i]){
columns[i] = new double[mdata.RowCount];
if (groups){
for (int j = 0; j < groupNames.Length; j++){
columnsG[i][j] = new double[mdata.RowCount];
}
}
}
}
for (int i = 0; i < mdata.RowCount; i++){
List<double> v = new List<double>();
foreach (int j in useCols){
double x = mdata[i, j];
if (!double.IsNaN(x) && !double.IsInfinity(x)){
v.Add(x);
}
}
for (int j = 0; j < include.Length; j++){
if (include[j]){
columns[j][i] = procs[j].Item2(v);
}
}
if (groups){
List<double>[] vg = new List<double>[groupNames.Length];
for (int j = 0; j < colIndsGroups.Length; j++){
vg[j] = new List<double>();
for (int k = 0; k < colIndsGroups[j].Length; k++){
double x = mdata[i, colIndsGroups[j][k]];
if (!double.IsNaN(x) && !double.IsInfinity(x)){
vg[j].Add(x);
}
}
}
for (int j = 0; j < include.Length; j++){
if (include[j]){
for (int k = 0; k < groupNames.Length; k++){
columnsG[j][k][i] = procs[j].Item2(vg[k]);
}
}
}
}
}
for (int i = 0; i < include.Length; i++){
if (include[i]){
mdata.AddNumericColumn(procs[i].Item1, procs[i].Item3, columns[i]);
if (groups){
for (int k = 0; k < groupNames.Length; k++){
mdata.AddNumericColumn(procs[i].Item1 + " " + groupNames[k], procs[i].Item3, columnsG[i][k]);
}
}
}
}
}
示例2: ProcessData
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
ref IDocumentData[] documents, ProcessInfo processInfo)
{
int[] cols = param.GetMultiChoiceParam("Columns").Value;
int truncIndex = param.GetSingleChoiceParam("Use for truncation").Value;
TestTruncation truncation = truncIndex == 0
? TestTruncation.Pvalue : (truncIndex == 1 ? TestTruncation.BenjaminiHochberg : TestTruncation.PermutationBased);
double threshold = param.GetDoubleParam("Threshold value").Value;
int sideInd = param.GetSingleChoiceParam("Side").Value;
TestSide side;
switch (sideInd){
case 0:
side = TestSide.Both;
break;
case 1:
side = TestSide.Left;
break;
case 2:
side = TestSide.Right;
break;
default:
throw new Exception("Never get here.");
}
foreach (int col in cols){
float[] r = mdata.GetExpressionColumn(col);
double[] pvals = CalcSignificanceA(r, side);
string[][] fdr;
switch (truncation){
case TestTruncation.Pvalue:
fdr = PerseusPluginUtils.CalcPvalueSignificance(pvals, threshold);
break;
case TestTruncation.BenjaminiHochberg:
fdr = PerseusPluginUtils.CalcBenjaminiHochbergFdr(pvals, threshold);
break;
default:
throw new Exception("Never get here.");
}
mdata.AddNumericColumn(mdata.ExpressionColumnNames[col] + " Significance A", "", pvals);
mdata.AddCategoryColumn(mdata.ExpressionColumnNames[col] + " A significant", "", fdr);
}
}
示例3: ProcessData
//.........这里部分代码省略.........
Dictionary<int, List<double>> factors = new Dictionary<int, List<double>>();
for (int i = 0; i < columns.Count; i++){
if (factors.ContainsKey(grouping[i])){
factors[grouping[i]].Add(normalizationFactors[i]);
} else{
factors.Add(grouping[i], new List<double>{normalizationFactors[i]});
}
}
double[] averagedNormalizationFactors = new double[columns.Count];
for (int i = 0; i < columns.Count; i++){
List<double> factor;
factors.TryGetValue(grouping[i], out factor);
averagedNormalizationFactors[i] = ArrayUtils.Mean(factor);
}
normalizationFactors = averagedNormalizationFactors;
}
// loop over all selected columns and calculate copy numbers
for (int col = 0; col < columns.Count; col++){
string sampleName = sampleNames[col];
double[] column = columns[col];
double factor = normalizationFactors[col];
double[] copyNumbers = new double[mdata.RowCount];
double[] concentrations = new double[mdata.RowCount]; // femtoliters
double[] massFraction = new double[mdata.RowCount];
double[] moleFraction = new double[mdata.RowCount];
double totalProtein = 0; // picograms
double histoneMass = 0; // picograms
double totalMolecules = 0;
for (int row = 0; row < mdata.RowCount; row++){
if (!double.IsNaN(column[row]) && !double.IsNaN(mw[row])){
copyNumbers[row] = (column[row]/detectabilityNormFactor[row])*factor;
totalMolecules += copyNumbers[row];
totalProtein += (copyNumbers[row]*mw[row]*1e12)/avogadro; // picograms
if (ArrayUtils.Contains(histoneRows, row)){
histoneMass += (copyNumbers[row]*mw[row]*1e12)/avogadro; // picograms
}
}
}
double totalVolume = (totalProtein/(param.GetDoubleParam("Total cellular protein concentration [g/l]").Value))*1000;
// femtoliters
for (int row = 0; row < mdata.RowCount; row++){
if (!double.IsNaN(column[row]) && !double.IsNaN(mw[row])){
concentrations[row] = ((copyNumbers[row]/(totalVolume*1e-15))/avogadro)*1e9; // nanomolar
massFraction[row] = (((copyNumbers[row]*mw[row]*1e12)/avogadro)/totalProtein)*1e6; // ppm
moleFraction[row] = (copyNumbers[row]/totalMolecules)*1e6; // ppm
}
}
string suffix = (sampleName == "") ? "" : " " + sampleName;
if (ArrayUtils.Contains(outputColumns, 0)){
mdata.AddNumericColumn("Copy number" + suffix, "", copyNumbers);
}
if (ArrayUtils.Contains(outputColumns, 1)){
mdata.AddNumericColumn("Concentration [nM]" + suffix, "", concentrations);
}
if (ArrayUtils.Contains(outputColumns, 2)){
mdata.AddNumericColumn("Abundance (mass/total mass) [*10^-6]" + suffix, "", massFraction);
}
if (ArrayUtils.Contains(outputColumns, 3)){
mdata.AddNumericColumn("Abundance (molecules/total molecules) [*10^-6]" + suffix, "", moleFraction);
}
double[] rank = ArrayUtils.Rank(copyNumbers);
double[] relativeRank = new double[mdata.RowCount];
double validRanks = mdata.RowCount;
for (int row = 0; row < mdata.RowCount; row++){
// remove rank for protein with no copy number information
if (double.IsNaN((copyNumbers[row])) || copyNumbers[row] == 0){
rank[row] = double.NaN;
validRanks--; // do not consider as valid
}
// invert ranking, so that rank 0 is the most abundant protein
rank[row] = mdata.RowCount - rank[row];
}
for (int row = 0; row < mdata.RowCount; row++){
relativeRank[row] = rank[row]/validRanks;
}
if (ArrayUtils.Contains(outputColumns, 4)){
mdata.AddNumericColumn("Copy number rank" + suffix, "", rank);
}
if (ArrayUtils.Contains(outputColumns, 5)){
mdata.AddNumericColumn("Relative copy number rank" + suffix, "", relativeRank);
}
if (intensityCols[col] < mdata.ExpressionColumnCount &&
param.GetSingleChoiceWithSubParams("Averaging mode").Value != 3){
totalProteinRow[intensityCols[col]] = Math.Round(totalProtein, 2);
totalMoleculesRow[intensityCols[col]] = Math.Round(totalMolecules, 0);
organismRow[intensityCols[col]] = new string[]{organism.name};
histoneMassRow[intensityCols[col]] = Math.Round(histoneMass, 4);
ploidyRow[intensityCols[col]] = Math.Round((histoneMass*1e-12)/cValue, 2);
cellVolumeRow[intensityCols[col]] = Math.Round(totalVolume, 2); // femtoliters
}
}
if (param.GetSingleChoiceWithSubParams("Averaging mode").Value != 3 && ArrayUtils.Contains(outputColumns, 6)){
mdata.AddNumericRow("Total protein [pg/cell]", "", totalProteinRow);
mdata.AddNumericRow("Total molecules per cell", "", totalMoleculesRow);
mdata.AddCategoryRow("Organism", "", organismRow);
mdata.AddNumericRow("Histone mass [pg/cell]", "", histoneMassRow);
mdata.AddNumericRow("Ploidy", "", ploidyRow);
mdata.AddNumericRow("Cell volume [fl]", "", cellVolumeRow);
}
}
示例4: ProcessData
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
ref IDocumentData[] documents, ProcessInfo processInfo)
{
int[] colIndx = param.GetParam<int[]>("x").Value;
int[] colIndy = param.GetParam<int[]>("y").Value;
if (colIndx.Length == 0){
processInfo.ErrString = "Please select some columns";
return;
}
if (colIndx.Length != colIndy.Length){
processInfo.ErrString = "Please select the same number of columns in the boxes for the first and second columns.";
return;
}
int typeInd = param.GetParam<int>("Distribution type").Value;
int points = param.GetParam<int>("Number of points").Value;
for (int k = 0; k < colIndx.Length; k++){
float[] xvals = GetColumn(mdata, colIndx[k]);
float[] yvals = GetColumn(mdata, colIndy[k]);
float[] xvals1;
float[] yvals1;
GetValidPairs(xvals, yvals, out xvals1, out yvals1);
double xmin;
double xmax;
double ymin;
double ymax;
DensityEstimation.CalcRanges(xvals1, yvals1, out xmin, out xmax, out ymin, out ymax);
float[,] values = DensityEstimation.GetValuesOnGrid(xvals1, xmin, (xmax - xmin)/points, points, yvals1, ymin,
(ymax - ymin)/points, points);
if (typeInd == 1){
MakeConditional1(values);
}
if (typeInd == 2){
MakeConditional2(values);
}
if (typeInd == 3){
MakeConditional3(values);
}
DensityEstimation.DivideByMaximum(values);
double[] xmat = new double[points];
for (int i = 0; i < points; i++){
xmat[i] = xmin + i*(xmax - xmin)/points;
}
double[] ymat = new double[points];
for (int i = 0; i < points; i++){
ymat[i] = ymin + i*(ymax - ymin)/points;
}
float[,] percvalues = CalcExcludedPercentage(values);
double[] dvals = new double[xvals.Length];
double[] pvals = new double[xvals.Length];
for (int i = 0; i < dvals.Length; i++){
double xx = xvals[i];
double yy = yvals[i];
if (!double.IsNaN(xx) && !double.IsNaN(yy)){
int xind = ArrayUtils.ClosestIndex(xmat, xx);
int yind = ArrayUtils.ClosestIndex(ymat, yy);
dvals[i] = values[xind, yind];
pvals[i] = percvalues[xind, yind];
} else{
dvals[i] = double.NaN;
pvals[i] = double.NaN;
}
}
string xname = GetColumnName(mdata, colIndx[k]);
string yname = GetColumnName(mdata, colIndy[k]);
mdata.AddNumericColumn("Density_" + xname + "_" + yname,
"Density of data points in the plane spanned by the columns " + xname + " and " + yname + ".", dvals);
mdata.AddNumericColumn("Excluded fraction_" + xname + "_" + yname,
"Percentage of points with a point density smaller than at this point in the plane spanned by the columns " + xname +
" and " + yname + ".", pvals);
}
}
示例5: ProcessData
public void ProcessData(IMatrixData mdata, Parameters param1, ref IMatrixData[] supplTables,
ref IDocumentData[] documents, ProcessInfo processInfo)
{
int[] cols = param1.GetMultiChoiceParam("Columns").Value;
int[] ops = param1.GetMultiChoiceParam("Operation").Value;
foreach (int t in ops){
double[][] vals = new double[cols.Length][];
for (int i = 0; i < cols.Length; i++){
double[][] x = mdata.MultiNumericColumns[cols[i]];
vals[i] = new double[x.Length];
for (int j = 0; j < vals[i].Length; j++){
vals[i][j] = operations[t](x[j]);
}
}
for (int i = 0; i < cols.Length; i++){
mdata.AddNumericColumn(mdata.MultiNumericColumnNames[cols[i]] + "_" + names[t], "", vals[i]);
}
}
}
示例6: ProcessData
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
ref IDocumentData[] documents, ProcessInfo processInfo)
{
int[] rcols = param.GetMultiChoiceParam("Ratio columns").Value;
int[] icols = param.GetMultiChoiceParam("Intensity columns").Value;
if (rcols.Length == 0){
processInfo.ErrString = "Please specify some ratio columns.";
return;
}
if (rcols.Length != icols.Length){
processInfo.ErrString = "The number of ratio and intensity columns have to be equal.";
return;
}
int truncIndex = param.GetSingleChoiceParam("Use for truncation").Value;
TestTruncation truncation = truncIndex == 0
? TestTruncation.Pvalue : (truncIndex == 1 ? TestTruncation.BenjaminiHochberg : TestTruncation.PermutationBased);
double threshold = param.GetDoubleParam("Threshold value").Value;
int sideInd = param.GetSingleChoiceParam("Side").Value;
TestSide side;
switch (sideInd){
case 0:
side = TestSide.Both;
break;
case 1:
side = TestSide.Left;
break;
case 2:
side = TestSide.Right;
break;
default:
throw new Exception("Never get here.");
}
for (int i = 0; i < rcols.Length; i++){
float[] r = mdata.GetExpressionColumn(rcols[i]);
float[] intens = icols[i] < mdata.ExpressionColumnCount
? mdata.GetExpressionColumn(icols[i])
: ArrayUtils.ToFloats(mdata.NumericColumns[icols[i] - mdata.ExpressionColumnCount]);
double[] pvals = CalcSignificanceB(r, intens, side);
string[][] fdr;
switch (truncation){
case TestTruncation.Pvalue:
fdr = PerseusPluginUtils.CalcPvalueSignificance(pvals, threshold);
break;
case TestTruncation.BenjaminiHochberg:
fdr = PerseusPluginUtils.CalcBenjaminiHochbergFdr(pvals, threshold);
break;
default:
throw new Exception("Never get here.");
}
mdata.AddNumericColumn(mdata.ExpressionColumnNames[rcols[i]] + " Significance B", "", pvals);
mdata.AddCategoryColumn(mdata.ExpressionColumnNames[rcols[i]] + " B significant", "", fdr);
}
}
示例7: ProcessData
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables, ProcessInfo processInfo)
{
int[] colIndx = param.GetMultiChoiceParam("Column 1").Value;
int[] colIndy = param.GetMultiChoiceParam("Column 2").Value;
if (colIndx.Length == 0){
processInfo.ErrString = "Please select some columns";
return;
}
if (colIndx.Length != colIndy.Length){
processInfo.ErrString = "Please select the same number of columns in the boxes for the first and second columns.";
return;
}
int points = param.GetIntParam("Number of points").Value;
for (int k = 0; k < colIndx.Length; k++){
float[] xvals = GetColumn(mdata, colIndx[k]);
float[] yvals = GetColumn(mdata, colIndy[k]);
float[] xvals1;
float[] yvals1;
NumUtils.GetValidPairs(xvals, yvals, out xvals1, out yvals1);
double xmin;
double xmax;
double ymin;
double ymax;
DensityEstimation.CalcRanges(xvals1, yvals1, out xmin, out xmax, out ymin, out ymax);
float[,] values = DensityEstimation.GetValuesOnGrid(xvals1, xmin, (xmax - xmin) / points, points, yvals1, ymin,
(ymax - ymin)/points, points);
DensityEstimation.DivideByMaximum(values);
//if (modeInd == 1){
// values = InvertRows(values);
// List<string> colNames = new List<string>();
// for (int i = 0; i < values.GetLength(1); i++){
// colNames.Add("" + i);
// }
// mdata.SetData(mdata.Name, colNames, values, new List<string>(), new List<string[]>(), new List<string>(),
// new List<string[][]>(), new List<string>(), new List<double[]>(), new List<string>(), new List<double[][]>());
// return;
//}
double[] xmat = new double[points];
for (int i = 0; i < points; i++){
xmat[i] = xmin + i*(xmax - xmin)/points;
}
double[] ymat = new double[points];
for (int i = 0; i < points; i++){
ymat[i] = ymin + i*(ymax - ymin)/points;
}
float[,] percvalues = CalcExcludedPercentage(values);
double[] dvals = new double[xvals.Length];
double[] pvals = new double[xvals.Length];
for (int i = 0; i < dvals.Length; i++){
double xx = xvals[i];
double yy = yvals[i];
if (!double.IsNaN(xx) && !double.IsNaN(yy)){
int xind = ArrayUtils.ClosestIndex(xmat, xx);
int yind = ArrayUtils.ClosestIndex(ymat, yy);
dvals[i] = values[xind, yind];
pvals[i] = percvalues[xind, yind];
} else{
dvals[i] = double.NaN;
pvals[i] = double.NaN;
}
}
string xname = GetColumnName(mdata, colIndx[k]);
string yname = GetColumnName(mdata, colIndy[k]);
mdata.AddNumericColumn("Density_" + xname + "_" + yname,
"Density of data points in the plane spanned by the columns " + xname + " and " + yname + ".", dvals);
mdata.AddNumericColumn("Excluded fraction_" + xname + "_" + yname,
"Percentage of points with a point density smaller than at this point in the plane spanned by the columns " + xname +
" and " + yname + ".", pvals);
}
}
示例8: ExpressionToNumeric
private static void ExpressionToNumeric(IList<int> colInds, IMatrixData mdata)
{
int[] remainingInds = ArrayUtils.Complement(colInds, mdata.NumericColumnCount);
foreach (int colInd in colInds){
double[] d = ArrayUtils.ToDoubles(mdata.GetExpressionColumn(colInd));
mdata.AddNumericColumn(mdata.ExpressionColumnNames[colInd], mdata.ExpressionColumnDescriptions[colInd], d);
}
mdata.ExtractExpressionColumns(remainingInds);
}
示例9: FillMatrixKeep
private static void FillMatrixKeep(int groupColInd, int validVals, IMatrixData mdata, Func<IList<double>, double> func)
{
string[][] groupCol = mdata.GetCategoryRowAt(groupColInd);
string[] groupNames = ArrayUtils.UniqueValuesPreserveOrder(groupCol);
int[][] colInds = PerseusPluginUtils.GetExpressionColIndices(groupCol, groupNames);
double[][] newNumCols = new double[groupNames.Length][];
for (int i = 0; i < newNumCols.Length; i++){
newNumCols[i] = new double[mdata.RowCount];
}
for (int i = 0; i < mdata.RowCount; i++){
for (int j = 0; j < groupNames.Length; j++){
List<double> vals = new List<double>();
foreach (int ind in colInds[j]){
double val = mdata[i, ind];
if (!double.IsNaN(val) && !double.IsInfinity(val)){
vals.Add(val);
}
}
float xy = float.NaN;
if (vals.Count >= validVals){
xy = (float) func(vals);
}
newNumCols[j][i] = xy;
}
}
for (int i = 0; i < groupNames.Length; i++){
mdata.AddNumericColumn(groupNames[i], groupNames[i], newNumCols[i]);
}
}
示例10: ProcessData
//.........这里部分代码省略.........
}
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);
}
}
annotationColumn[row] = String.Join(";", rowAnnotations.ToArray());
}
mdata.AddStringColumn("Species", "", annotationColumn);
}
// Numeric annotations
processInfo.Status("Adding numeric annotations.");
selection =
param.GetParamWithSubParams<int>("Numeric annotations").GetSubParameters().GetParam<int[]>("Annotations").Value;
bool annotateLeadingId = (param.GetParamWithSubParams<int>("Numeric annotations").Value == 1);
if (ArrayUtils.Contains(selection, 0)){ // Sequence length
double[] annotationColumn = new double[mdata.RowCount];
for (int row = 0; row < mdata.RowCount; row++){
List<double> rowAnnotations = new List<double>();
foreach (ProteinSequence entry in fastaEntries[row]){
double sequenceLength = entry.GetSequence().Length;
rowAnnotations.Add(sequenceLength);
if (annotateLeadingId && rowAnnotations.Count > 0){
break;
}
}
annotationColumn[row] = ArrayUtils.Median(rowAnnotations.ToArray());
}
mdata.AddNumericColumn("Sequence length", "", annotationColumn);
}
if (ArrayUtils.Contains(selection, 1)){ // Monoisotopic molecular mass
double[] annotationColumn = new double[mdata.RowCount];
for (int row = 0; row < mdata.RowCount; row++){
List<double> rowAnnotations = new List<double>();
foreach (ProteinSequence entry in fastaEntries[row]){
double monoisotopicMass = entry.GetMonoisotopicMolecularMass();
rowAnnotations.Add(monoisotopicMass);
if (annotateLeadingId && rowAnnotations.Count > 0){
break;
}
}
annotationColumn[row] = ArrayUtils.Median(rowAnnotations.ToArray());
}
mdata.AddNumericColumn("Monoisotopic molecular mass", "", annotationColumn);
}
if (ArrayUtils.Contains(selection, 2)){ // Average molecular mass
double[] annotationColumn = new double[mdata.RowCount];
for (int row = 0; row < mdata.RowCount; row++){
List<double> rowAnnotations = new List<double>();
foreach (ProteinSequence entry in fastaEntries[row]){
double averageMass = entry.GetAverageMolecularMass();
rowAnnotations.Add(averageMass);
if (annotateLeadingId && rowAnnotations.Count > 0){
break;
}
}
annotationColumn[row] = ArrayUtils.Median(rowAnnotations.ToArray());
}
mdata.AddNumericColumn("Average molecular mass", "", annotationColumn);
}
// Theoretical peptides
示例11: ProcessData
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
ref IDocumentData[] documents, ProcessInfo processInfo)
{
string[] mods = param.GetParam<int[]>("Modifications").StringValue.Split(new[]{';'},
StringSplitOptions.RemoveEmptyEntries);
string[] up = mdata.StringColumns[param.GetParam<int>("Uniprot column").Value];
string[][] uprot = new string[up.Length][];
for (int i = 0; i < up.Length; i++){
uprot[i] = up[i].Length > 0 ? up[i].Split(';') : new string[0];
}
double[][] c = new double[mods.Length][];
for (int index = 0; index < mods.Length; index++){
string mod = mods[index];
string filename = PhosphoSitePlusParser.GetFilenameForMod(mod);
if (filename == null){
processInfo.ErrString = "File does not exist.";
return;
}
string[] seqWins;
string[] accs;
string[] pubmedLtp;
string[] pubmedMs2;
string[] cstMs2;
string[] species;
PhosphoSitePlusParser.ParseKnownMods(filename, out seqWins, out accs, out pubmedLtp, out pubmedMs2, out cstMs2, out species);
for (int i = 0; i < seqWins.Length; i++){
seqWins[i] = seqWins[i].ToUpper();
}
Dictionary<string, HashSet<string>> counts = new Dictionary<string, HashSet<string>>();
for (int i = 0; i < accs.Length; i++){
string acc = accs[i];
if (!counts.ContainsKey(acc)){
counts.Add(acc, new HashSet<string>());
}
counts[acc].Add(seqWins[i]);
}
c[index] = new double[up.Length];
for (int i = 0; i < up.Length; i++){
c[index][i] = CountSites(uprot[i], counts);
}
}
string[][] catCol = new string[up.Length][];
for (int i = 0; i < catCol.Length; i++){
List<string> x = new List<string>();
for (int j = 0; j < mods.Length; j++){
if (c[j][i] > 0){
x.Add(mods[j]);
}
}
x.Sort();
catCol[i] = x.ToArray();
}
mdata.AddCategoryColumn("Known modifications", "Known modifications", catCol);
for (int i = 0; i < mods.Length; i++){
mdata.AddNumericColumn(mods[i] + " count", mods[i] + " count", c[i]);
}
}