/** Find a character in the first string, s, that can be aligned * with the i-th character in the second string, t. */ public int getAlignedChar(int iMinusOne,boolean preferHigherIndices) { // internally to this package, strings are indexed 1...N, so // we need to convert from the usual 0...N-1 Java convention int i = iMinusOne+1; int bestJ = -1; double bestScore = -Double.MAX_VALUE; for (int j=mat.getFirstStoredEntryInRow(i); j<=mat.getLastStoredEntryInRow(i); j++) { if (mat.outOfRange(i,j)) log.error("out of range: "+i+","+j); double score = mat.get(i,j); if ((score>bestScore) || (score==bestScore && preferHigherIndices)) { bestScore = score; bestJ = j; } } // convert back to the usual 0...N-1 Java convention return bestJ-1; }
/** Find a character in the first string, s, that can be aligned * with the i-th character in the second string, t. */ public int getAlignedChar(int iMinusOne,boolean preferHigherIndices) { // internally to this package, strings are indexed 1...N, so // we need to convert from the usual 0...N-1 Java convention int i = iMinusOne+1; int bestJ = -1; double bestScore = -Double.MAX_VALUE; for (int j=mat.getFirstStoredEntryInRow(i); j<=mat.getLastStoredEntryInRow(i); j++) { if (mat.outOfRange(i,j)) log.error("out of range: "+i+","+j); double score = mat.get(i,j); if ((score>bestScore) || (score==bestScore && preferHigherIndices)) { bestScore = score; bestJ = j; } } // convert back to the usual 0...N-1 Java convention return bestJ-1; }
/** Find a character in the first string, s, that can be aligned * with the i-th character in the second string, t. */ public int getAlignedChar(int iMinusOne,boolean preferHigherIndices) { // internally to this package, strings are indexed 1...N, so // we need to convert from the usual 0...N-1 Java convention int i = iMinusOne+1; int bestJ = -1; double bestScore = -Double.MAX_VALUE; //System.out.print("align to: "+i); for (int j=mat.getFirstStoredEntryInRow(i); j<=mat.getLastStoredEntryInRow(i); j++) { if (mat.outOfRange(i,j)) System.out.println("out of range: "+i+","+j); double score = mat.get(i,j); //System.out.print(" at"+j+"="+(-score)); if ((score>bestScore) || (score==bestScore && preferHigherIndices)) { bestScore = score; bestJ = j; //System.out.print("!"); } } //System.out.println("i="+i+" bestJ="+bestJ+ " score="+bestScore+" alignment("+iMinusOne+")="+(bestJ-1)); // convert back to the usual 0...N-1 Java convention return bestJ-1; }
public String explainScore(StringWrapper s,StringWrapper t) { mat = new MyMatrix( s, t ); double d = mat.get(s.length(), t.length() ); mat.setPrintNegativeValues(true); return mat.toString() + "\nScore = "+d; }
public double score(StringWrapper s,StringWrapper t) { mat = new MyMatrix( s, t ); // fill matrix forward to prevent deep recursion for (int i=1; i<=s.length(); i++) { int j = (int)Math.round(i * mat.getScale()); if (j>=1 && j<=t.length()) { double forceComputatationHere = mat.get( i, j); } } return mat.get(s.length(), t.length() ); }
public String explainScore(StringWrapper s,StringWrapper t) { mat = new MyMatrix( s, t ); double d = mat.get(s.length(), t.length() ); mat.setPrintNegativeValues(true); return mat.toString() + "\nScore = "+d; }
public String explainScore(StringWrapper s,StringWrapper t) { mat = new MyMatrix( s, t ); double d = mat.get(s.length(), t.length() ); mat.setPrintNegativeValues(true); return mat.toString() + "\nScore = "+d; }
public double score(StringWrapper s,StringWrapper t) { mat = new MyMatrix( s, t ); // fill matrix forward to prevent deep recursion for (int i=1; i<=s.length(); i++) { int j = (int)Math.round(i * mat.getScale()); if (j>=1 && j<=t.length()) { double forceComputatationHere = mat.get( i, j); } } return mat.get(s.length(), t.length() ); }
public double score(StringWrapper s,StringWrapper t) { mat = new MyMatrix( s, t ); // fill matrix forward to prevent deep recursion for (int i=1; i<=s.length(); i++) { int j = (int)Math.round(i * mat.getScale()); if (j>=1 && j<=t.length()) { double forceComputatationHere = mat.get( i, j); } } return mat.get(s.length(), t.length() ); }