protected void addToCentroid(Matrix m, PositionWeightMatrix pwm) { for (int i = 0; i < m.getColumnDimension(); i++) { PositionWeightColumn c = pwm.get(i); for (int j = 0; j < m.getRowDimension(); j++) { m.set(j, i, m.get(j, i) + c.getWeight(j)); } } }
public void write(BufferedWriter bw, NumberFormat formatter) throws IOException { bw.write(">" + name); bw.newLine(); if (size() > 0) { int rows = get(0).getAlphabetSize(); for (int i = 0; i < rows; i++) { Iterator<PositionWeightColumn> colIt = iterator(); while (colIt.hasNext()) { PositionWeightColumn col = colIt.next(); bw.write(formatter.format(col.getWeight(i))); if (colIt.hasNext()) { bw.write("\t"); } } bw.newLine(); } } }