public void calculatePssm() { pssm = new double[fragments.get(0).fragLength][25]; char c = 'a'; for (ProteinFragment f : fragments) { for (int i = 0; i < f.getSequence().length(); i++) { c = f.getSequence().charAt(i); pssm[i][c - 65] += (1.0 / fragments.size()); } } }
/** * returns a string representation of the fragment cluster in pdb format. Each fragment in the * cluster is wrapped as a pdb model. */ @Override public String toString() { int i = 0; StringBuilder result = new StringBuilder(); try { for (ProteinFragment f : fragments) { result.append("REMARK 500 " + f.getSequence() + "\n"); result.append("MODEL " + ++i + "\n"); result.append(f.toString()); result.append("ENDMDL" + "\n"); } return result.toString(); } catch (Exception e) { e.printStackTrace(); } return "problem printing"; // the try-catch block owes its existence to InvocationException calls // from phantom functions. We still don't know what was wrong there, but // apparently we fixed it. }