Пример #1
0
 /**
  * Answer a perfect copy of <code>this</code> that points to another dataset
  *
  * @param dataSet the dataSet the copied gene will be part of.
  * @return a perfect copy of <code>this</code> that points to another dataset
  */
 public DefaultGene deepCopyFor(DataSet dataSet) {
   DefaultGene gene = new DefaultGene(dataSet, index);
   Iterator i = userAttributes.iterator();
   while (i.hasNext()) {
     String att = (String) i.next();
     gene.addAttribute(att);
   }
   return gene;
 }
Пример #2
0
  private JTable createTable(
      int samplesNum,
      int featuresNum,
      ArrayList sampleNames,
      ArrayList featureNames,
      ArrayList attributes,
      double[][] data,
      double[] SNR) {

    String[] columnNames = new String[attributes.size() + 1 + samplesNum];
    Object[][] rowData = new Object[featuresNum + 1][columnNames.length];
    int attributeSize = attributes.size();

    for (int i = 0; i < columnNames.length; i++) {
      if (i < attributeSize) {
        columnNames[i] = (String) attributes.get(i);
        rowData[0][i] = "";
      } else if (i == attributeSize) {
        columnNames[i] = "SNR performance";
        DefaultSample curSample = (DefaultSample) sampleNames.get(i - attributeSize);
        rowData[0][i] = curSample.getSampleKey();
      } else if (i >= attributeSize + 1) {
        DefaultSample curSample = (DefaultSample) sampleNames.get(i - attributeSize - 1);
        columnNames[i] = curSample.getId();
        rowData[0][i] = curSample.getSampleLabel();
      }
    }

    for (int i = 1; i < rowData.length; i++) {
      DefaultGene curGene = (DefaultGene) featureNames.get(i - 1);
      for (int j = 0; j < columnNames.length; j++) {
        if (j < attributeSize) {
          rowData[i][j] = curGene.getAttribute(j);
        } else if (j == attributeSize) {
          rowData[i][j] = SNR[i - 1];
        } else if (j >= attributeSize + 1) {
          rowData[i][j] = data[j - attributeSize - 1][i - 1];
        }
      }
    }

    JTable table = new JTable(rowData, columnNames);
    table.setGridColor(Color.DARK_GRAY);
    return table;
  }