Last change
on this file since 1573 was
1572,
checked in by rkrimmel, 10 years ago
|
Added parts of the PAL library, implemented UPGMA Algoritm for Feng Doolittle guide tree
|
File size:
1.2 KB
|
Rev | Line | |
---|
[1314] | 1 | /** |
---|
| 2 | * |
---|
| 3 | */ |
---|
[1572] | 4 | package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; |
---|
[1314] | 5 | |
---|
[1324] | 6 | import java.util.Collection; |
---|
| 7 | import java.util.List; |
---|
| 8 | |
---|
| 9 | import de.ugoe.cs.autoquest.eventcore.Event; |
---|
[1553] | 10 | import de.ugoe.cs.autoquest.tasktrees.treeifc.IUserSession; |
---|
[1324] | 11 | |
---|
[1314] | 12 | /** |
---|
| 13 | * @author Ralph Krimmel |
---|
| 14 | * |
---|
| 15 | */ |
---|
| 16 | public class DifferenceSubstitutionMatrix implements SubstitutionMatrix { |
---|
| 17 | |
---|
| 18 | private int[] input1; |
---|
| 19 | private int[] input2; |
---|
| 20 | private int maxValue; |
---|
| 21 | |
---|
| 22 | public DifferenceSubstitutionMatrix(int[] input1,int[] input2) { |
---|
| 23 | this.input1 = input1; |
---|
| 24 | this.input2 = input2; |
---|
| 25 | this.maxValue = getMaxValue(); |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | /* (non-Javadoc) |
---|
| 29 | * @see de.ugoe.cs.autoquest.plugin.alignment.SubstitutionMatrix#getDistance(int, int) |
---|
| 30 | */ |
---|
[1568] | 31 | public double getDistance(int pos1, int pos2) { |
---|
[1314] | 32 | return maxValue - (input1[pos1] - input2[pos2]); |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | private int getMaxValue() { |
---|
| 36 | int max = input1[0]; |
---|
| 37 | for (int i=0; i < input1.length; i++) { |
---|
| 38 | if(input1[i] > max) { |
---|
| 39 | max = input1[i]; |
---|
| 40 | } |
---|
| 41 | } |
---|
| 42 | for (int j=0; j < input2.length; j++) { |
---|
| 43 | if(input2[j] > max) { |
---|
| 44 | max = input2[j]; |
---|
| 45 | } |
---|
| 46 | } |
---|
| 47 | return max; |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | @Override |
---|
[1568] | 51 | public double getGapPenalty() { |
---|
[1314] | 52 | return -maxValue; |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | |
---|
[1324] | 56 | @Override |
---|
[1554] | 57 | public void generate() { |
---|
[1324] | 58 | // TODO Auto-generated method stub |
---|
| 59 | |
---|
| 60 | } |
---|
| 61 | |
---|
[1314] | 62 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.