Changeset 1572 for branches/ralph/src/main/java/de
- Timestamp:
- 06/23/14 00:05:33 (10 years ago)
- Location:
- branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees
- Files:
-
- 2 deleted
- 9 edited
- 1 copied
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/FengDoolittle.java
r1557 r1572 1 1 package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 2 2 3 import de.ugoe.cs.autoquest.tasktrees.alignment. substitution.TriangleMatrix;3 import de.ugoe.cs.autoquest.tasktrees.alignment.matrix.TriangleMatrix; 4 4 5 5 public class FengDoolittle { -
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/SmithWaterman.java
r1558 r1572 4 4 import java.util.List; 5 5 6 import de.ugoe.cs.autoquest.tasktrees.alignment. substitution.SubstitutionMatrix;7 8 public class SmithWaterman implements Alignment{6 import de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix; 7 8 public class SmithWaterman { 9 9 10 10 /** -
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/SmithWatermanRepeated.java
r1568 r1572 2 2 3 3 import java.util.ArrayList; 4 import java.util.Iterator; 5 import java.util.LinkedList; 4 6 import java.util.List; 5 7 6 import de.ugoe.cs.autoquest.tasktrees.alignment. substitution.SubstitutionMatrix;7 8 public class SmithWatermanRepeated implements Alignment{8 import de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix; 9 10 public class SmithWatermanRepeated { 9 11 10 12 /** … … 29 31 private MatrixEntry[][] matrix; 30 32 31 33 34 private List<NumberSequence> alignment; 32 35 33 36 private float scoreThreshold; … … 50 53 51 54 matrix = new MatrixEntry[length1+2][length2+1]; 55 alignment = new ArrayList<NumberSequence>(); 52 56 53 57 for (int i = 0; i <= length1+1; i++) { … … 218 222 } 219 223 220 public List<Match> traceback() { 224 225 public void traceback() { 226 MatrixEntry tmp = matrix[length1+1][0]; 227 228 int aligned1[] = new int[length1+length2]; 229 int aligned2[] = new int[length1+length2]; 230 int count = 0; 231 do 232 { 233 if(count != 0) 234 { 235 aligned1[count] = tmp.getXvalue(); 236 aligned2[count] = tmp.getYvalue(); 237 } 238 239 tmp = tmp.getPrevious(); 240 count++; 241 242 } while(tmp != null); 243 244 //reverse order 245 int reversed1[] = new int[count]; 246 int reversed2[] = new int[count]; 247 248 for(int i = count; count > 0; count ++) { 249 250 } 251 252 NumberSequence ns1 = new NumberSequence(reversed1.length); 253 NumberSequence ns2 = new NumberSequence(reversed2.length); 254 ns1.setSequence(reversed1); 255 ns2.setSequence(reversed2); 256 257 alignment.add(ns1); 258 alignment.add(ns2); 259 } 260 261 public void printAlignment() { 221 262 MatrixEntry tmp = matrix[length1+1][0]; 222 263 String aligned1 = ""; … … 259 300 System.out.println(aligned1); 260 301 System.out.println(aligned2); 261 return null;262 302 } 263 303 … … 321 361 return matchList; 322 362 } 363 364 365 public List<NumberSequence> getAlignment() { 366 return alignment; 367 } 368 369 public void setAlignment(List<NumberSequence> alignment) { 370 this.alignment = alignment; 371 } 323 372 324 373 } -
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/DifferenceSubstitutionMatrix.java
r1568 r1572 2 2 * 3 3 */ 4 package de.ugoe.cs.autoquest.tasktrees.alignment. substitution;4 package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; 5 5 6 6 import java.util.Collection; -
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/NearbySubstitutionMatrix.java
r1568 r1572 2 2 * 3 3 */ 4 package de.ugoe.cs.autoquest.tasktrees.alignment. substitution;4 package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; 5 5 6 6 import java.util.Collection; -
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/ObjectDistanceSubstitionMatrix.java
r1570 r1572 1 package de.ugoe.cs.autoquest.tasktrees.alignment. substitution;1 package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; 2 2 3 3 -
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/SubstitutionMatrix.java
r1570 r1572 1 package de.ugoe.cs.autoquest.tasktrees.alignment. substitution;1 package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; 2 2 3 3 -
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/TriangleMatrix.java
r1570 r1572 1 package de.ugoe.cs.autoquest.tasktrees.alignment. substitution;1 package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; 2 2 3 3 public class TriangleMatrix { 4 4 5 5 private double[] matrix; 6 pr ivateint size;6 protected int size; 7 7 8 8 -
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/UPGMAMatrix.java
r1571 r1572 1 package de.ugoe.cs.autoquest.tasktrees.alignment. substitution;1 package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; 2 2 3 public class FitchMargoliashMatrix extends TriangleMatrix { 3 import de.ugoe.cs.autoquest.tasktrees.alignment.pal.misc.Identifier; 4 4 5 public FitchMargoliashMatrix(int size) { 5 6 public class UPGMAMatrix extends TriangleMatrix { 7 8 public UPGMAMatrix(int size) { 6 9 super(size); 7 10 } 8 9 11 12 public int size() { 13 return size; 14 } 15 16 public String toString() { 17 String result = ""; 18 for (int i = 0; i < size; i++) { 19 result = result + String.format("%8d", i); 20 } 21 result += "\n"; 22 23 for (int i = 0; i < size; i++) { 24 for(int j = 0; j< size; j++) { 25 if(i<j) { 26 if(Double.isInfinite(this.get(i,j))) { 27 result = result + " -------"; 28 } 29 else { 30 result = result + String.format("%+8.2f",this.get(i,j)); 31 } 32 } 33 else { 34 result = result + (" "); 35 } 36 } 37 result = result + " " + i + "\n"; 38 } 39 return result; 40 } 41 10 42 11 43 -
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRuleAlignment.java
r1570 r1572 15 15 package de.ugoe.cs.autoquest.tasktrees.temporalrelation; 16 16 17 import java.io.File; 18 import java.io.FileNotFoundException; 19 import java.io.PrintWriter; 17 20 import java.util.ArrayList; 18 21 import java.util.HashMap; … … 28 31 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.NumberSequence; 29 32 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.SmithWatermanRepeated; 30 import de.ugoe.cs.autoquest.tasktrees.alignment.substitution.ObjectDistanceSubstitionMatrix; 31 import de.ugoe.cs.autoquest.tasktrees.alignment.substitution.TriangleMatrix; 33 import de.ugoe.cs.autoquest.tasktrees.alignment.matrix.ObjectDistanceSubstitionMatrix; 34 import de.ugoe.cs.autoquest.tasktrees.alignment.matrix.TriangleMatrix; 35 import de.ugoe.cs.autoquest.tasktrees.alignment.matrix.UPGMAMatrix; 36 import de.ugoe.cs.autoquest.tasktrees.alignment.pal.tree.UPGMATree; 32 37 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 33 38 import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; … … 161 166 submat.generate(); 162 167 163 TriangleMatrix sequenceDistances = new TriangleMatrix(numberseqs.size());168 UPGMAMatrix sequenceDistances = new UPGMAMatrix(numberseqs.size()); 164 169 sequenceDistances.initialize(Double.POSITIVE_INFINITY); 165 170 … … 186 191 SmithWatermanRepeated randomSequence = new SmithWatermanRepeated( 187 192 ns1.shuffle().getSequence(),ns2.shuffle().getSequence(),submat,smithWatermanThreshold); 188 //randomSequence.printDPMatrix();189 //randomSequence.traceback();190 193 191 194 double score = twoSequences.getAlignmentScore(); … … 235 238 } 236 239 System.out.println(sequenceDistances.toString()); 240 UPGMATree guidetree = new UPGMATree(numberseqs, sequenceDistances); 241 System.out.println(guidetree.toString()); 237 242 238 243 do {
Note: See TracChangeset
for help on using the changeset viewer.