Changeset 1586
- Timestamp:
- 06/30/14 08:51:09 (10 years ago)
- Location:
- branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees
- Files:
-
- 3 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/SmithWatermanRepeated.java
r1585 r1586 8 8 import de.ugoe.cs.util.console.Console; 9 9 10 public class SmithWatermanRepeated {10 public class SmithWatermanRepeated implements AlignmentAlgorithm { 11 11 12 12 /** … … 208 208 } 209 209 210 /** 211 * Get the alignment score between the two input strings. 212 */ 210 /* (non-Javadoc) 211 * @see de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithm#getAlignmentScore() 212 */ 213 @Override 213 214 public double getAlignmentScore() { 214 215 return matrix[length1+1][0].getScore(); … … 328 329 329 330 331 /* (non-Javadoc) 332 * @see de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithm#getAlignment() 333 */ 334 @Override 330 335 public ArrayList<NumberSequence> getAlignment() { 331 336 return alignment; -
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/BinaryAlignmentStorage.java
r1585 r1586 2 2 3 3 4 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms. SmithWatermanRepeated;4 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithm; 5 5 6 6 public class BinaryAlignmentStorage { 7 7 8 private SmithWatermanRepeated[][] alignments;8 private AlignmentAlgorithm[][] alignments; 9 9 UPGMAMatrix sequenceDistances; 10 10 11 11 public BinaryAlignmentStorage(int sizex, int sizey) { 12 alignments = new SmithWatermanRepeated[sizex+1][sizey+1];12 alignments = new AlignmentAlgorithm[sizex+1][sizey+1]; 13 13 sequenceDistances = new UPGMAMatrix(Math.max(sizex,sizey)); 14 14 sequenceDistances.initialize(Double.POSITIVE_INFINITY); 15 15 } 16 16 17 public void set(int i,int j, SmithWatermanRepeatedsw) {17 public void set(int i,int j,AlignmentAlgorithm sw) { 18 18 alignments[i][j] = sw; 19 19 } 20 20 21 public SmithWatermanRepeatedget(int i,int j) {21 public AlignmentAlgorithm get(int i,int j) { 22 22 return alignments[i][j]; 23 23 } -
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/pal/tree/FengDoolittleNode.java
r1585 r1586 11 11 12 12 import java.util.ArrayList; 13 import java.util.logging.Level;14 15 13 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.NumberSequence; 16 14 import de.ugoe.cs.autoquest.tasktrees.alignment.pal.misc.Identifier; 17 import de.ugoe.cs.util.console.Console; 15 18 16 19 17 … … 374 372 newNode.addChild(child2); 375 373 newNode.setIdentifier(new Identifier(child1.getIdentifier().getName() + " " + child2.getIdentifier().getName())); 376 //System.out.println("Merging " + child1.getIdentifier() + " with " + child2.getIdentifier());377 374 378 375 return newNode; -
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/pal/tree/UPGMAAligningTree.java
r1585 r1586 15 15 16 16 import java.util.ArrayList; 17 import java.util.Iterator;18 17 import java.util.logging.Level; 19 18 19 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithm; 20 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithmFactory; 20 21 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.NumberSequence; 21 22 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.SmithWatermanRepeated; … … 228 229 int maxIndex = 0; 229 230 for(int i=0;i<seqCount1;i++) { 230 tempStorage.set(i, 1, new SmithWatermanRepeated(node1.getSequence(i).getSequence(), node2.getSequence(0).getSequence() , submat, 5));231 tempStorage.set(i, 1, AlignmentAlgorithmFactory.create(node1.getSequence(i).getSequence(), node2.getSequence(0).getSequence() , submat, 5)); 231 232 if(maxScore < tempStorage.get(i, 1).getAlignmentScore()) { 232 233 maxScore = tempStorage.get(i, 1).getAlignmentScore(); … … 234 235 } 235 236 } 237 //if(maxScore > 0) 236 238 alignment.add(tempStorage.get(maxIndex, 1).getAlignment().get(1)); 237 239 } … … 243 245 int maxIndex = 0; 244 246 for(int i=0;i<seqCount2;i++) { 245 tempStorage.set(1, i, new SmithWatermanRepeated(node2.getSequence(i).getSequence(), node1.getSequence(0).getSequence() , submat, 5));247 tempStorage.set(1, i, AlignmentAlgorithmFactory.create(node2.getSequence(i).getSequence(), node1.getSequence(0).getSequence() , submat, 5)); 246 248 if(maxScore < tempStorage.get(1, i).getAlignmentScore()) { 247 249 maxScore = tempStorage.get(1, i).getAlignmentScore(); … … 249 251 } 250 252 } 253 //if(maxScore > 0) 251 254 alignment.add(tempStorage.get(1,maxIndex).getAlignment().get(1)); 252 255 } … … 261 264 for(int i=0;i<seqCount1;i++) { 262 265 for(int j=0;j<seqCount2;j++) { 263 tempStorage1.set(j, 0, new SmithWatermanRepeated(node1.getSequence(i).getSequence(), node2.getSequence(j).getSequence() , submat, 5));266 tempStorage1.set(j, 0, AlignmentAlgorithmFactory.create(node1.getSequence(i).getSequence(), node2.getSequence(j).getSequence() , submat, 5)); 264 267 if(maxScore1 < tempStorage1.get(j, 0).getAlignmentScore()) { 265 268 maxScore1 = tempStorage1.get(j, 0).getAlignmentScore(); … … 267 270 } 268 271 } 272 //if(maxScore1 > 0) 269 273 alignment.add(tempStorage1.get(maxIndex1,0).getAlignment().get(0)); 270 274 } 271 275 for(int i=0; i<seqCount2;i++) { 272 276 for (int j=0;j<seqCount1;j++) { 273 tempStorage2.set(j, 0, new SmithWatermanRepeated(node2.getSequence(i).getSequence(),node1.getSequence(j).getSequence(),submat,5));277 tempStorage2.set(j, 0, AlignmentAlgorithmFactory.create(node2.getSequence(i).getSequence(),node1.getSequence(j).getSequence(),submat,5)); 274 278 if(maxScore2 < tempStorage2.get(j, 0).getAlignmentScore()) { 275 279 maxScore2 = tempStorage2.get(j, 0).getAlignmentScore(); … … 277 281 } 278 282 } 283 //if(maxScore2 > 0) 279 284 alignment.add(tempStorage2.get(maxIndex2,0).getAlignment().get(0)); 280 285 } -
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRuleAlignment.java
r1585 r1586 26 26 import java.util.logging.Level; 27 27 28 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithm; 29 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithmFactory; 28 30 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.NumberSequence; 29 31 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.SmithWatermanRepeated; … … 170 172 int smithWatermanThreshold = 10; 171 173 172 alignments.set(i, j, new SmithWatermanRepeated(174 alignments.set(i, j,AlignmentAlgorithmFactory.create( 173 175 ns1.getSequence(), ns2.getSequence(), submat, 174 176 smithWatermanThreshold)); 175 SmithWatermanRepeated sameSequence1 = new SmithWatermanRepeated(177 AlignmentAlgorithm sameSequence1 = AlignmentAlgorithmFactory.create( 176 178 ns1.getSequence(), ns1.getSequence(), submat, 177 179 smithWatermanThreshold); 178 SmithWatermanRepeated sameSequence2 = new SmithWatermanRepeated(180 AlignmentAlgorithm sameSequence2 = AlignmentAlgorithmFactory.create( 179 181 ns2.getSequence(), ns2.getSequence(), submat, 180 182 smithWatermanThreshold); 181 SmithWatermanRepeated randomSequence = new SmithWatermanRepeated(183 AlignmentAlgorithm randomSequence = AlignmentAlgorithmFactory.create( 182 184 ns1.shuffle().getSequence(),ns2.shuffle().getSequence(),submat,smithWatermanThreshold); 183 185
Note: See TracChangeset
for help on using the changeset viewer.