Changeset 1616


Ignore:
Timestamp:
07/15/14 20:54:58 (10 years ago)
Author:
rkrimmel
Message:

Small fixes

Location:
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/AlignmentAlgorithmFactory.java

    r1613 r1616  
    11package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 
    22 
    3 import java.lang.reflect.Constructor; 
    4 import java.lang.reflect.InvocationTargetException; 
    5  
    6 import de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix; 
    73 
    84public class AlignmentAlgorithmFactory { 
     
    2521                         
    2622                } catch (ClassNotFoundException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException e) { 
    27                         // TODO Auto-generated catch block 
    2823                        e.printStackTrace(); 
    2924                } 
  • branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/NeedlemanWunsch.java

    r1615 r1616  
    187187        } 
    188188 
    189         public void printAlignment() { 
    190                 MatrixEntry tmp = matrix[length1][length2]; 
    191                 String aligned1 = ""; 
    192                 String aligned2 = ""; 
    193                 int count = 0; 
    194                 do { 
    195                         System.out.println(tmp); 
    196                         String append1 = ""; 
    197                         String append2 = ""; 
    198  
    199                         if (tmp.getXvalue() == Constants.GAP_SYMBOL) { 
    200                                 append1 = "  ___"; 
    201                         } else { 
    202                                 append1 = String.format("%5d", tmp.getXvalue()); 
    203                         } 
    204  
    205                         if (tmp.getYvalue() == Constants.GAP_SYMBOL) { 
    206                                 append2 = "  ___"; 
    207                         } else { 
    208                                 append2 = String.format("%5d", tmp.getYvalue()); 
    209                         } 
    210                         if (count != 0) { 
    211                                 aligned1 = append1 + aligned1; 
    212                                 aligned2 = append2 + aligned2; 
    213                         } 
    214  
    215                         tmp = tmp.getPrevious(); 
    216                         count++; 
    217  
    218                 } while (tmp != null); 
    219                 System.out.println(aligned1); 
    220                 System.out.println(aligned2); 
    221         } 
    222  
     189         
    223190        /** 
    224191         * print the dynmaic programming matrix 
     
    241208                } 
    242209        } 
     210         
     211        public void printAlignment() { 
     212                int[] tmp1 = alignment.get(0).getSequence(); 
     213                int[] tmp2 = alignment.get(1).getSequence(); 
     214                for (int i=0; i< tmp1.length;i++) { 
     215                        if(tmp1[i] == Constants.GAP_SYMBOL) { 
     216                                System.out.print("  ___"); 
     217                        } 
     218                        else if(tmp1[i] == Constants.UNMATCHED_SYMBOL) { 
     219                                System.out.print("  ..."); 
     220                        } 
     221                        else { 
     222                                System.out.format("%5d", tmp1[i]); 
     223                        } 
     224                         
     225                } 
     226                System.out.println(); 
     227                for (int i=0; i< tmp2.length;i++) { 
     228                        if(tmp2[i] == Constants.GAP_SYMBOL) { 
     229                                System.out.print("  ___"); 
     230                        } 
     231                        else if(tmp2[i] == Constants.UNMATCHED_SYMBOL) { 
     232                                System.out.print("  ..."); 
     233                        } 
     234                        else { 
     235                                System.out.format("%5d", tmp2[i]); 
     236                        } 
     237                         
     238                } 
     239                System.out.println(); 
     240                 
     241                 
     242         
     243        } 
    243244 
    244245        /* 
Note: See TracChangeset for help on using the changeset viewer.