Changeset 1578
- Timestamp:
- 06/25/14 19:21:42 (10 years ago)
- Location:
- branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/SmithWaterman.java
r1572 r1578 97 97 // return (input1[i - 1] == input2[j - 1]) ? MATCH_SCORE : 98 98 // MISMATCH_SCORE; 99 return submat.get Distance(input1[i - 1], input2[j - 1]);99 return submat.getScore(input1[i - 1], input2[j - 1]); 100 100 } 101 101 -
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/SmithWatermanRepeated.java
r1575 r1578 2 2 3 3 import java.util.ArrayList; 4 import java.util.Iterator;5 import java.util.LinkedList;6 4 import java.util.List; 7 5 import java.util.logging.Level; 8 6 9 7 import de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix; 8 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.Constants; 10 9 import de.ugoe.cs.util.console.Console; 11 10 … … 79 78 */ 80 79 private double similarity(int i, int j) { 81 return submat.get Distance(input1[i - 1], input2[j - 1]);80 return submat.getScore(input1[i - 1], input2[j - 1]); 82 81 } 83 82 … … 129 128 130 129 } 131 132 130 133 131 tempMax -= scoreThreshold; … … 145 143 { 146 144 matrix[i][0].setXvalue(input1[i-1]); 147 matrix[i][0].setYvalue( -2);145 matrix[i][0].setYvalue(Constants.UNMATCHED_SYMBOL); 148 146 } 149 147 else { … … 161 159 162 160 // find the directions that give the maximum scores. 163 // Multiple directions are ignored TODO161 // TODO: Multiple directions are ignored, we choose the first maximum score 164 162 //True if we had a match 165 163 if (diagScore == matrix[i][j].getScore()) { … … 171 169 if (leftScore == matrix[i][j].getScore()) { 172 170 matrix[i][j].setXvalue(input1[i-1]); 173 matrix[i][j].setYvalue( -1);171 matrix[i][j].setYvalue(Constants.GAP_SYMBOL); 174 172 matrix[i][j].setPrevious(matrix[i-1][j]); 175 173 } 176 174 //true if we took an event from sequence y and not from x 177 175 if (upScore == matrix[i][j].getScore()) { 178 matrix[i][j].setXvalue( -1);176 matrix[i][j].setXvalue(Constants.GAP_SYMBOL); 179 177 matrix[i][j].setYvalue(input2[j-1]); 180 178 matrix[i][j].setPrevious(matrix[i][j-1]); … … 184 182 matrix[i][j].setPrevious(matrix[i][0]); 185 183 matrix[i][j].setXvalue(input1[i-1]); 186 matrix[i][j].setYvalue( -2);184 matrix[i][j].setYvalue(Constants.UNMATCHED_SYMBOL); 187 185 } 188 186 } … … 271 269 String append2=""; 272 270 273 if(tmp.getXvalue() == -1) {271 if(tmp.getXvalue() == Constants.GAP_SYMBOL) { 274 272 append1 = " ___"; 275 273 } 276 else if(tmp.getXvalue() == -2) {274 else if(tmp.getXvalue() == Constants.UNMATCHED_SYMBOL) { 277 275 append1 = " ..."; 278 276 } … … 281 279 } 282 280 283 if(tmp.getYvalue() == -1) {281 if(tmp.getYvalue() == Constants.GAP_SYMBOL) { 284 282 append2 = " ___"; 285 283 } 286 else if(tmp.getYvalue() == -2) {284 else if(tmp.getYvalue() == Constants.UNMATCHED_SYMBOL) { 287 285 append2 = " ..."; 288 286 } -
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/DifferenceSubstitutionMatrix.java
r1572 r1578 29 29 * @see de.ugoe.cs.autoquest.plugin.alignment.SubstitutionMatrix#getDistance(int, int) 30 30 */ 31 public double get Distance(int pos1, int pos2) {31 public double getScore(int pos1, int pos2) { 32 32 return maxValue - (input1[pos1] - input2[pos2]); 33 33 } -
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/NearbySubstitutionMatrix.java
r1572 r1578 29 29 * @see de.ugoe.cs.autoquest.plugin.alignment.SubstitutionMatrix#getDistance(int, int) 30 30 */ 31 public double get Distance(int pos1, int pos2) {31 public double getScore(int pos1, int pos2) { 32 32 int difference = Math.abs(input1[pos1]-input2[pos2]); 33 33 if(difference < range) { -
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/ObjectDistanceSubstitionMatrix.java
r1572 r1578 5 5 import java.util.Iterator; 6 6 7 8 7 import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement; 9 8 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentHelpers; 9 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.Constants; 10 10 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 11 11 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; … … 40 40 @Override 41 41 public void generate() { 42 42 43 int index = 0; 43 //TODO We need to determine this parameter before generating the matrix.. 44 //float meandistance = 18; 45 //TODO We need to determine this parameter before generating the matrix.. 44 46 45 float maxDistance =34; 47 46 for (Iterator<ITaskInstance> it = uniqueTasks.getSymbols().iterator(); it … … 52 51 eti1 = (IEventTaskInstance) obj1; 53 52 } 54 //System.out.println(eti1.getTask().toString());55 53 56 54 for (Iterator<ITaskInstance> jt = uniqueTasks.getSymbols() … … 97 95 98 96 matrix.set(tempindex1, tempindex2,distance); 99 97 100 98 } 101 99 } 102 //System.out.println("ObjectDistanceMatrix: MaxDistance: " + maxDistance);100 103 101 //System.out.println(meandistance/(uniqueTasks.size()*uniqueTasks.size())); 104 102 //System.out.println(idmapping.toString()); 105 103 //System.out.println(matrix.toString()); 104 //System.out.println("ObjectDistanceMatrix: MaxDistance: " + maxDistance); 106 105 //System.out.println(idmapping.keySet().toString()); 107 106 //System.out.println(idmapping.values().toString()); … … 113 112 } 114 113 115 @Override 116 public double getDistance(int taskId1, int taskId2) { 117 //System.out.println("Taskid1: " + taskId1 + " Taskid2: " + taskId2 + " Idmapping1: " + idmapping.get(taskId1) + " Idmapping2: " + idmapping.get(taskId2)); 118 return matrix.get(idmapping.get(taskId1),idmapping.get(taskId2)); 114 public double getScore(int taskId1, int taskId2) { 115 if(taskId1 == Constants.GAP_SYMBOL || taskId1 == Constants.UNMATCHED_SYMBOL || taskId2 == Constants.GAP_SYMBOL || taskId2 == Constants.UNMATCHED_SYMBOL ) { 116 return 0.0; 117 } 118 else { 119 return matrix.get(idmapping.get(taskId1),idmapping.get(taskId2)); 120 } 121 119 122 } 120 123 -
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/SubstitutionMatrix.java
r1572 r1578 6 6 7 7 8 public double get Distance(int pos1, int pos2);8 public double getScore(int pos1, int pos2); 9 9 10 10 public double getGapPenalty(); -
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRuleAlignment.java
r1576 r1578 63 63 * </p> 64 64 * <p> 65 * For determining the longest sequence occurring most often, the implementation 66 * uses a {@link Trie}. The depth of the tree is initially 3. If the algorithm 67 * has a longest sequence occurring most often whose length is equal to the 68 * depth of the trie, it recalculates the trie with an increased depth. 69 * </p> 65 70 66 * 71 67 * @author Patrick Harms … … 183 179 ns2.getSequence(), ns2.getSequence(), submat, 184 180 smithWatermanThreshold); 185 186 181 SmithWatermanRepeated randomSequence = new SmithWatermanRepeated( 187 182 ns1.shuffle().getSequence(),ns2.shuffle().getSequence(),submat,smithWatermanThreshold); 188 183 184 // Score of the aligmnment 189 185 double score = twoSequences.getAlignmentScore(); 190 // Scores of the sequence being aligned to itself 186 // Scores of the sequence being aligned to itself (maximum score) 191 187 double sSelf1 = sameSequence1.getAlignmentScore(); 192 188 double sSelf2 = sameSequence2.getAlignmentScore(); 193 189 // Score of sequences shuffled before aligned 194 190 double sRand = randomSequence.getAlignmentScore(); 195 191 … … 210 206 } 211 207 } 208 //System.out.println(sequenceDistances.toString()); 212 209 UPGMATree guidetree = new UPGMATree(numberseqs, sequenceDistances); 213 210 211 214 212 /* 215 213 do { 216 System.out.println();217 //FengDoolittle fd = new FengDoolittle();218 214 219 215 // appData.getStopWatch().start("whole loop");
Note: See TracChangeset
for help on using the changeset viewer.