Ignore:
Timestamp:
07/09/14 12:13:13 (10 years ago)
Author:
rkrimmel
Message:

Refactoring and code cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/pal/tree/UPGMAAligningTree.java

    r1588 r1589  
    1515 
    1616import java.util.ArrayList; 
     17import java.util.Iterator; 
    1718import java.util.logging.Level; 
    1819 
    19 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithm; 
    2020import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithmFactory; 
    2121import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.NumberSequence; 
    22 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.SmithWatermanRepeated; 
    23 import de.ugoe.cs.autoquest.tasktrees.alignment.matrix.BinaryAlignmentStorage; 
     22import de.ugoe.cs.autoquest.tasktrees.alignment.matrix.PairwiseAlignmentStorage; 
    2423import de.ugoe.cs.autoquest.tasktrees.alignment.matrix.ObjectDistanceSubstitionMatrix; 
    2524import de.ugoe.cs.autoquest.tasktrees.alignment.matrix.UPGMAMatrix; 
     
    4847         * @param m distance matrix 
    4948         */ 
    50         public UPGMAAligningTree(ArrayList<NumberSequence> numberseqs, BinaryAlignmentStorage alignments, ObjectDistanceSubstitionMatrix submat) 
     49        public UPGMAAligningTree(ArrayList<NumberSequence> numberseqs, PairwiseAlignmentStorage alignments, ObjectDistanceSubstitionMatrix submat) 
    5150        { 
    5251                if (alignments.getDistanceMatrix().size() < 2) 
     
    8281        // 
    8382        private ArrayList<NumberSequence> numberseqs; 
    84         private BinaryAlignmentStorage alignments; 
     83        private PairwiseAlignmentStorage alignments; 
    8584        private ObjectDistanceSubstitionMatrix submat; 
    8685        private int numClusters; 
     
    216215                        int seqCount1 = node1.getSequences().size(); 
    217216                        int seqCount2 = node2.getSequences().size(); 
    218                          
    219                         /* 
    220                         for(int i = 0; i < seqCount1; i++) { 
    221                                 for(int j = 0; j < seqCount2; j++) { 
    222                                         node1.getSequence(i).printSequence(); 
    223                                         node2.getSequence(j).printSequence(); 
    224                                 } 
    225                         } 
    226                         */ 
     217 
    227218                         
    228219                        Console.traceln(Level.INFO,"Merging node " + node1.getIdentifier() + " with " + node2.getIdentifier()); 
     
    237228                                alignment.addAll(node1.getSequences()); 
    238229                                 
    239                                 BinaryAlignmentStorage tempStorage = new BinaryAlignmentStorage(seqCount1,seqCount2); 
     230                                PairwiseAlignmentStorage tempStorage = new PairwiseAlignmentStorage(seqCount1,seqCount2); 
    240231                                double maxScore = 0.0; 
    241232                                int maxIndex = 0; 
     
    254245                        else if(seqCount1 == 1 && seqCount2 > 1) { 
    255246                                alignment.addAll(node2.getSequences()); 
    256                                 BinaryAlignmentStorage tempStorage = new BinaryAlignmentStorage(seqCount1,seqCount2); 
     247                                PairwiseAlignmentStorage tempStorage = new PairwiseAlignmentStorage(seqCount1,seqCount2); 
    257248                                double maxScore = 0.0; 
    258249                                int maxIndex = 0; 
     
    270261                        //Align 2 groups 
    271262                        else if((seqCount1 > 1) && (seqCount2 > 1)){ 
    272                                         BinaryAlignmentStorage tempStorage1 = new BinaryAlignmentStorage(seqCount2,1); 
    273                                         BinaryAlignmentStorage tempStorage2 = new BinaryAlignmentStorage(seqCount1,1); 
     263                                        PairwiseAlignmentStorage tempStorage1 = new PairwiseAlignmentStorage(seqCount2,1); 
     264                                        PairwiseAlignmentStorage tempStorage2 = new PairwiseAlignmentStorage(seqCount1,1); 
    274265                                        double maxScore1 = 0.0; 
    275266                                        double maxScore2 = 0.0; 
     
    334325                        (oc[aj]/ocsum)*jdist; 
    335326        } 
     327 
     328 
     329        public void printMultipleAlignment() { 
     330                for (Iterator<NumberSequence> it =  getRoot().getSequences().iterator(); it.hasNext();) { 
     331                        NumberSequence tmp  = it.next(); 
     332                        tmp.printSequence(); 
     333                } 
     334        } 
    336335} 
    337336 
Note: See TracChangeset for help on using the changeset viewer.