Exemple #1
0
 private AbstractDataTable createTable() {
   DataTable data = DataTable.create();
   data.addColumn(ColumnType.STRING, "Dating Activity");
   data.addColumn(ColumnType.NUMBER, "Dating Time");
   data.addRows(2);
   data.setValue(0, 0, "Dinner");
   data.setValue(0, 1, 5);
   data.setValue(1, 0, "Movie");
   data.setValue(1, 1, "8");
   return data;
 }
  private AbstractDataTable createScatterTable() {
    int numRows = 20;

    DataTable data = DataTable.create();
    data.addColumn(AbstractDataTable.ColumnType.NUMBER, "X");
    data.addColumn(AbstractDataTable.ColumnType.NUMBER, "Widget 1");
    data.addColumn(AbstractDataTable.ColumnType.NUMBER, "Widget 2");
    data.addRows(numRows);

    Random randomGenerator = new Random();
    for (int i = 0; i < numRows; i++) {
      double sinResult = Math.sin(i / 5) * 0.25;
      double cosResult = Math.cos(i / 25);
      data.setValue(i, 0, randomGenerator.nextInt(100));
      data.setValue(i, 1, sinResult);
      data.setValue(i, 2, cosResult);
    }

    for (int i = 0; i < numRows; i++) {
      double sinResult = Math.sin(i / 25);
      double cosResult = Math.cos(i / 10) * 0.5;
      data.setValue(i, 0, randomGenerator.nextInt(100));
      data.setValue(i, 1, sinResult);
      data.setValue(i, 2, cosResult);
    }

    //        DataTable data = DataTable.create();
    //        data.addColumn(AbstractDataTable.ColumnType.NUMBER, "Sugar");
    //        data.addColumn(AbstractDataTable.ColumnType.NUMBER, "Calories");
    //        data.addColumn(AbstractDataTable.ColumnType.NUMBER, "Salt");
    //        data.addRows(4);
    //        data.setValue(0, 0, 20);
    //        data.setValue(0, 1, 11);
    //        data.setValue(0, 2, 30);
    //        data.setValue(1, 0, 30);
    //        data.setValue(1, 1, 10);
    //        data.setValue(1, 2, 20);
    //        data.setValue(2, 0, 27);
    //        data.setValue(2, 1, 2);
    //        data.setValue(2, 2, 34);
    //        data.setValue(3, 0, 22);
    //        data.setValue(3, 1, 2);
    //        data.setValue(3, 1, 9);

    return data;
  }
Exemple #3
0
 private AbstractDataTable createTable(String[][] qdata) {
   DataTable data = DataTable.create();
   data.addColumn(AbstractDataTable.ColumnType.STRING, qdata[0][0]);
   data.addColumn(AbstractDataTable.ColumnType.NUMBER, qdata[0][1]);
   data.addRows(qdata.length - 1);
   for (int i = 1; i < qdata.length; i++) {
     if (qdata[i][1] != null) {
       data.setValue(i - 1, 0, qdata[i][0]);
       data.setValue(i - 1, 1, Double.parseDouble(qdata[i][1]));
     }
   }
   return data;
 }
 private AbstractDataTable createTable(Collection<Course> courses) {
   data = DataTable.create();
   data.addColumn(ColumnType.STRING, "Course");
   data.addColumn(ColumnType.NUMBER, "Year");
   data.addColumn(ColumnType.NUMBER, "Semester");
   data.addColumn(ColumnType.STRING, "Activity");
   data.addColumn(ColumnType.NUMBER, "Documents");
   for (Course course : courses) {
     for (WritingActivity writingActivity : course.getWritingActivities()) {
       data.addRows(1);
       data.setValue(data.getNumberOfRows() - 1, 0, course.getName());
       data.setValue(data.getNumberOfRows() - 1, 1, course.getYear());
       data.setValue(data.getNumberOfRows() - 1, 2, course.getSemester());
       data.setValue(
           data.getNumberOfRows() - 1,
           3,
           writingActivity.getName() + " (" + writingActivity.getTutorial() + ")");
       data.setValue(data.getNumberOfRows() - 1, 4, writingActivity.getEntries().size());
     }
   }
   return data;
 }
 private DataTable getStatisticsData(List<Phenotype> phenotypes) {
   DataTable data = DataTable.create();
   data.addColumn(ColumnType.STRING, "Phenotype");
   data.addColumn(ColumnType.NUMBER, "Values");
   data.addColumn(ColumnType.NUMBER, "Datasets");
   data.addColumn(ColumnType.NUMBER, "Transformations");
   data.addColumn(ColumnType.NUMBER, "Results");
   data.addRows(phenotypes.size());
   for (int i = 0; i < phenotypes.size(); i++) {
     Phenotype phenotype = phenotypes.get(i);
     data.setValue(i, 0, phenotype.getName());
     data.setValue(i, 1, phenotype.getNumValues());
     data.setValue(i, 2, phenotype.getDatasets().size());
     data.setValue(i, 3, phenotype.getTransformationCount());
     data.setValue(i, 4, phenotype.getResultCount());
   }
   return data;
 }
 private DataTable getSingleHistogramDataTable(String env, Dataset.TYPE dataset) {
   DataTable dataTable = DataTable.create();
   dataTable.addColumn(ColumnType.STRING, "Phenotype Value", "x-axis");
   dataTable.addColumn(ColumnType.NUMBER, "Frequency", "y-axis");
   DataTable histogramDataTable = null;
   if (dataset == Dataset.TYPE.bisulfite) histogramDataTable = bsHistogramDataTable;
   else histogramDataTable = mRNAHistogramDataTable;
   dataTable.addRows(histogramDataTable.getNumberOfRows());
   for (int i = 0; i < histogramDataTable.getNumberOfRows(); i++) {
     dataTable.setValue(i, 0, histogramDataTable.getValueString(i, 0));
     dataTable.setValue(i, 1, histogramDataTable.getValueInt(i, (env.equals("T16C") ? 2 : 1)));
   }
   return dataTable;
 }