Changeset 1588
- Timestamp:
- 07/08/14 21:38:11 (10 years ago)
- Location:
- branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/AlignmentAlgorithmFactory.java
r1587 r1588 8 8 public static AlignmentAlgorithm create(int[] input1, int[] input2, SubstitutionMatrix submat,float threshold) { 9 9 10 //return new NeedlemanWunsch(input1,input2,submat,threshold);10 //return new SmithWaterman(input1,input2,submat,threshold); 11 11 return new NeedlemanWunsch(input1,input2,submat,threshold); 12 12 //return new SmithWatermanRepeated(input1,input2,submat,threshold); -
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/NeedlemanWunsch.java
r1587 r1588 2 2 3 3 import java.util.ArrayList; 4 import java.util.logging.Level; 4 import java.util.Iterator; 5 import java.util.LinkedList; 5 6 6 7 import de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix; 7 8 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.Constants; 8 import de.ugoe.cs.util.console.Console; 9 9 10 10 11 public class NeedlemanWunsch implements AlignmentAlgorithm { … … 116 117 117 118 matrix[i][j].setScore(Math.max(diagScore, 118 Math.max(upScore, Math.max(leftScore, 0))));119 Math.max(upScore, leftScore))); 119 120 120 121 // find the directions that give the maximum scores. … … 175 176 public void traceback() { 176 177 MatrixEntry tmp = matrix[length1][length2]; 177 int aligned1[] = new int[length1 + length2 + 2]; 178 int aligned2[] = new int[length1 + length2 + 2]; 178 LinkedList<Integer> aligned1 = new LinkedList<Integer>(); 179 LinkedList<Integer> aligned2 = new LinkedList<Integer>(); 180 do { 181 182 aligned1.add(new Integer(tmp.getXvalue())); 183 aligned2.add(new Integer(tmp.getYvalue())); 184 185 tmp = tmp.getPrevious(); 186 187 } while (tmp != null); 188 189 // reverse order of the alignment 190 int reversed1[] = new int[aligned1.size()]; 191 int reversed2[] = new int[aligned2.size()]; 192 179 193 int count = 0; 180 do { 181 if (length1 + length2 + 2 == count) { 182 Console.traceln(Level.WARNING, 183 "Traceback longer than both sequences summed up!"); 184 break; 185 } 186 aligned1[count] = tmp.getXvalue(); 187 aligned2[count] = tmp.getYvalue(); 188 189 tmp = tmp.getPrevious(); 194 for (Iterator<Integer> it = aligned1.descendingIterator(); it.hasNext();) { 190 195 count++; 191 192 } while (tmp != null); 193 count--; 194 // reverse order of the alignment 195 int reversed1[] = new int[count]; 196 int reversed2[] = new int[count]; 197 198 for (int i = count; i > 0; i--) { 199 reversed1[reversed1.length - i] = aligned1[i]; 200 reversed2[reversed2.length - i] = aligned2[i]; 196 reversed1[reversed1.length - count] = it.next(); 197 198 } 199 count = 0; 200 for (Iterator<Integer> it = aligned2.descendingIterator(); it.hasNext();) { 201 count++; 202 reversed2[reversed2.length - count] = it.next(); 201 203 } 202 204 … … 216 218 int count = 0; 217 219 do { 220 System.out.println(tmp); 218 221 String append1 = ""; 219 222 String append2 = ""; -
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/pal/tree/UPGMAAligningTree.java
r1587 r1588 217 217 int seqCount2 = node2.getSequences().size(); 218 218 219 /* 219 220 for(int i = 0; i < seqCount1; i++) { 220 221 for(int j = 0; j < seqCount2; j++) { … … 223 224 } 224 225 } 226 */ 225 227 226 228 Console.traceln(Level.INFO,"Merging node " + node1.getIdentifier() + " with " + node2.getIdentifier()); -
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRuleAlignment.java
r1587 r1588 29 29 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithmFactory; 30 30 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.NumberSequence; 31 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.SmithWatermanRepeated;32 31 import de.ugoe.cs.autoquest.tasktrees.alignment.matrix.BinaryAlignmentStorage; 33 32 import de.ugoe.cs.autoquest.tasktrees.alignment.matrix.ObjectDistanceSubstitionMatrix; 34 import de.ugoe.cs.autoquest.tasktrees.alignment.matrix.UPGMAMatrix;35 33 import de.ugoe.cs.autoquest.tasktrees.alignment.pal.tree.UPGMAAligningTree; 36 34 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; … … 211 209 //alignments.get(20, 47).printAlignment(); 212 210 213 System.out.println(alignments.getDistanceMatrix() .toString());211 System.out.println(alignments.getDistanceMatrix()); 214 212 UPGMAAligningTree guidetree = new UPGMAAligningTree(numberseqs, alignments,submat); 215 //System.out.println("Number of sequences in root node: " + guidetree.getRoot().getSequences().size());213 System.out.println("Number of sequences in root node: " + guidetree.getRoot().getSequences().size()); 216 214 for (Iterator<NumberSequence> it = guidetree.getRoot().getSequences().iterator(); it.hasNext();) { 217 215 NumberSequence tmp = it.next();
Note: See TracChangeset
for help on using the changeset viewer.