public IC50TableModel( // net.bioclipse.brunn.pojos.Plate plate, // KTable table, // IC50 editor, Replicates replicates) { columnNames = new ArrayList<String>(); Collections.addAll(columnNames, new String[] {"Compound Names", "IC50"}); /* * set up the matrix if there are any results for the plate */ if (replicates .getPlate() .getWell(1, 'a') .getSampleContainer() .getWorkList() .getAbstractOperations() .size() > 0) { fillContent(replicates); extractEntries(); } List<String[]> rows = new ArrayList<String[]>(); for (String compound : entries.keySet()) { rows.add(entries.get(compound)); } Collections.sort( rows, new Comparator<String[]>() { public int compare(String[] o1, String[] o2) { int c = o1[0].compareTo(o2[0]); if (c != 0) return c; c = Double.compare( Double.parseDouble( o1[1].contains(" ") ? o1[1].substring(0, o1[1].indexOf(' ')) : o1[1]), Double.parseDouble( o2[1].contains(" ") ? o2[1].substring(0, o2[1].indexOf(' ')) : o2[1])); if (c != 0) return c; return 0; } }); matrix = rows.toArray(new String[0][0]); this.rows = matrix.length; this.cols = columnNames.size(); initialize(); }
// reads dataset from replicate table private void fillContent(Replicates replicates) { replicatesContent.clear(); String[][] matrix = replicates.getReplicatesContent(); String[] headers = matrix[0]; for (int i = 0; i < headers.length; i++) { if (headers[i].equals("si%") || headers.equals("si") || headers.equals("SI") || headers.equals("Si")) { headers[i] = "SI%"; } replicatesContent.put(headers[i], null); } for (int i = 1; i < matrix.length; i++) { if (Character.isDigit(matrix[i][3].charAt(0))) { for (int j = 0; j < headers.length; j++) { replicatesContent.put( headers[j], addToStringArray(replicatesContent.get(headers[j]), matrix[i][j])); } } } splitConcAndUnit(); storeIC50(); }