コード例 #1
0
ファイル: Transpose.cs プロジェクト: wengx006/perseus-plugins
        private static List <string[][]> GetCategoryRows(IDataWithAnnotationRows mdata)
        {
            List <string[][]> result = new List <string[][]>();

            for (int i = 0; i < mdata.CategoryRowCount; i++)
            {
                result.Add(mdata.GetCategoryRowAt(i));
            }
            return(result);
        }
コード例 #2
0
 private static Parameters[] GetFirstGroupParameters(IDataWithAnnotationRows mdata)
 {
     Parameters[] q = new Parameters[mdata.CategoryRowCount];
     for (int i = 0; i < q.Length; i++)
     {
         string[] vals = ArrayUtils.UniqueValuesPreserveOrder(ArrayUtils.Concat(mdata.GetCategoryRowAt(i)));
         q[i] = new Parameters(
             new MultiChoiceParam("First group (right)")
         {
             Values  = vals,
             Value   = new[] { 0 },
             Repeats = true,
             Help    = "All 'right' groups of the two sample tests are defined here. The number " +
                       "of groups selected here equals the number of different tests performed."
         }, GetSecondGroupParameter(vals));
     }
     return(q);
 }
コード例 #3
0
 private static List<string[][]> GetCategoryRows(IDataWithAnnotationRows mdata)
 {
     List<string[][]> result = new List<string[][]>();
     for (int i = 0; i < mdata.CategoryRowCount; i++){
         result.Add(mdata.GetCategoryRowAt(i));
     }
     return result;
 }
コード例 #4
0
 private static void SetAnnotationRows(IDataWithAnnotationRows result, IDataWithAnnotationRows mdata1,
                                       IDataWithAnnotationRows mdata2)
 {
     result.CategoryRowNames.Clear();
     result.CategoryRowDescriptions.Clear();
     result.ClearCategoryRows();
     result.NumericRowNames.Clear();
     result.NumericRowDescriptions.Clear();
     result.NumericRows.Clear();
     string[] allCatNames = ArrayUtils.Concat(mdata1.CategoryRowNames, mdata2.CategoryRowNames);
     allCatNames             = ArrayUtils.UniqueValues(allCatNames);
     result.CategoryRowNames = new List <string>();
     string[] allCatDescriptions = new string[allCatNames.Length];
     for (int i = 0; i < allCatNames.Length; i++)
     {
         allCatDescriptions[i] = GetDescription(allCatNames[i], mdata1.CategoryRowNames, mdata2.CategoryRowNames,
                                                mdata1.CategoryRowDescriptions, mdata2.CategoryRowDescriptions);
     }
     result.CategoryRowDescriptions = new List <string>();
     for (int index = 0; index < allCatNames.Length; index++)
     {
         string     t           = allCatNames[index];
         string[][] categoryRow = new string[mdata1.ColumnCount + mdata2.ColumnCount][];
         for (int j = 0; j < categoryRow.Length; j++)
         {
             categoryRow[j] = new string[0];
         }
         int ind1 = mdata1.CategoryRowNames.IndexOf(t);
         if (ind1 >= 0)
         {
             string[][] c1 = mdata1.GetCategoryRowAt(ind1);
             for (int j = 0; j < c1.Length; j++)
             {
                 categoryRow[j] = c1[j];
             }
         }
         int ind2 = mdata2.CategoryRowNames.IndexOf(t);
         if (ind2 >= 0)
         {
             string[][] c2 = mdata2.GetCategoryRowAt(ind2);
             for (int j = 0; j < c2.Length; j++)
             {
                 categoryRow[mdata1.ColumnCount + j] = c2[j];
             }
         }
         result.AddCategoryRow(allCatNames[index], allCatDescriptions[index], categoryRow);
     }
     string[] allNumNames = ArrayUtils.Concat(mdata1.NumericRowNames, mdata2.NumericRowNames);
     allNumNames            = ArrayUtils.UniqueValues(allNumNames);
     result.NumericRowNames = new List <string>(allNumNames);
     string[] allNumDescriptions = new string[allNumNames.Length];
     for (int i = 0; i < allNumNames.Length; i++)
     {
         allNumDescriptions[i] = GetDescription(allNumNames[i], mdata1.NumericRowNames, mdata2.NumericRowNames,
                                                mdata1.NumericRowDescriptions, mdata2.NumericRowDescriptions);
     }
     result.NumericRowDescriptions = new List <string>(allNumDescriptions);
     foreach (string t in allNumNames)
     {
         double[] numericRow = new double[mdata1.ColumnCount + mdata2.ColumnCount];
         for (int j = 0; j < numericRow.Length; j++)
         {
             numericRow[j] = double.NaN;
         }
         int ind1 = mdata1.NumericRowNames.IndexOf(t);
         if (ind1 >= 0)
         {
             double[] c1 = mdata1.NumericRows[ind1];
             for (int j = 0; j < c1.Length; j++)
             {
                 numericRow[j] = c1[j];
             }
         }
         int ind2 = mdata2.NumericRowNames.IndexOf(t);
         if (ind2 >= 0)
         {
             double[] c2 = mdata2.NumericRows[ind2];
             for (int j = 0; j < c2.Length; j++)
             {
                 numericRow[mdata1.ColumnCount + j] = c2[j];
             }
         }
         result.NumericRows.Add(numericRow);
     }
 }