1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
package pp2.prediction.knn;
import java.util.LinkedList;
/**
* for each GO term, stores by which sequences it is supported
* @author Thomas Hopf
*
*/
public class GoNode implements Comparable<GoNode> {
private String goTerm;
private LinkedList<Double> reliabilities;
private LinkedList<Integer> hitIndex;
private double score;
public GoNode(String goTerm, int index, double reliability)
{
this.goTerm = goTerm;
hitIndex = new LinkedList<Integer>();
reliabilities = new LinkedList<Double>();
hitIndex.add(index);
reliabilities.add(reliability);
}
public void addHit(int index, double reliability)
{
hitIndex.add(index);
reliabilities.add(reliability);
}
public LinkedList<Integer> getHitIndex()
{
return hitIndex;
}
public LinkedList<Double> getReliabilities()
{
return reliabilities;
}
public void setScore(double score)
{
this.score = score;
}
public double getScore()
{
return score;
}
public String getGoTerm()
{
return goTerm;
}
@Override
public int compareTo(GoNode o) {
// highest scores are "smallest" so they end up as the first list elements
if(this.score < o.score)
return 1;
else {
if (this.score > o.score)
return -1;
else
return 0;
}
}
}
|