public void setGOtcha(proteinSet train) { if (this.blastResult.size() == 0) { System.out.println(access + " have no blast result; We use Naive Score"); this.PredictionScore = train.getNaiveList(); } ArrayList<Integer> ann = new ArrayList<Integer>(); HashMap<Integer, Double> pred = new HashMap<Integer, Double>(); double SumBitScore = 0; double bitscore; for (Pair<String, Double> pair : blastResult) { bitscore = pair.getSecond(); SumBitScore = SumBitScore + bitscore; String access = pair.getFirst(); if (train.containProtein(access)) { ann = train.getAnnotation(access); for (int node : ann) { if (!pred.containsKey(node)) { pred.put(node, bitscore); } else { pred.put(node, pred.get(node) + bitscore); } } } } for (Map.Entry<Integer, Double> entry : pred.entrySet()) { this.PredictionScore.add( new Pair<Integer, Double>(entry.getKey(), (double) entry.getValue() / SumBitScore)); } }
public void knn(proteinSet train) { ArrayList<Integer> ann = new ArrayList<Integer>(); HashMap<Integer, Double> pred = new HashMap<Integer, Double>(); double SumBitScore = 0; double sim; for (Pair<String, Double> pair : this.Similiar) { sim = pair.getSecond(); SumBitScore = SumBitScore + sim; String access = pair.getFirst(); if (train.containProtein(access)) { ann = train.getAnnotation(access); for (int node : ann) { if (!pred.containsKey(node)) { pred.put(node, sim); } else { pred.put(node, pred.get(node) + sim); } } } } for (Map.Entry<Integer, Double> entry : pred.entrySet()) { double knnScore = 0.0; if (SumBitScore > Parameter.resolution) knnScore = (double) entry.getValue() / SumBitScore; this.PredictionScore.add(new Pair<Integer, Double>(entry.getKey(), knnScore)); } }
public double miniscore() { double miniscore = 1.0; for (Pair<Integer, Double> entry : PredictionScore) { if (miniscore > entry.getSecond()) miniscore = entry.getSecond(); } return miniscore; }
public void OutputPredScore(PrintWriter Fout) { Fout.println(this.access); Fout.print(this.PredictionScore.size()); for (Pair<Integer, Double> entry : this.PredictionScore) { Fout.printf(" %d:%.4f", entry.getFirst(), entry.getSecond()); } Fout.println(); }
public oneProtein getSubProtein(char space) { oneProtein aProtein = new oneProtein(this.access, getSubAnnotation(space)); for (Pair<Integer, Double> entry : PredictionScore) { int Annotation = entry.getFirst(); if (learning.aGoSet.getSpace(Annotation) == space) aProtein.addPred(entry); } return aProtein; }
public void setLiblinearFeatureFromSparseFeature() { List<Feature> x = new ArrayList<Feature>(); for (Pair<Integer, Double> pair : this.SparseFeature) { Feature node = new FeatureNode(pair.getFirst(), pair.getSecond()); x.add(node); } this.liblinearFeature = new Feature[x.size()]; this.liblinearFeature = x.toArray(this.liblinearFeature); this.SparseFeature.clear(); }
public void recordblastScore() { for (Pair<Integer, Double> pair : this.PredictionScore) { int label = pair.getFirst(); if ((this.MFOL2RCandidate.contains(label)) || (this.BPOL2RCandidate.contains(label)) || (this.CCOL2RCandidate.contains(label))) { this.blastScore.put(pair.getFirst(), pair.getSecond()); } } }
public void removeLowPred(int count) { ArrayList<Pair<Double, Integer>> ArrSort = new ArrayList<Pair<Double, Integer>>(); for (Pair<Integer, Double> pair : this.PredictionScore) { ArrSort.add(new Pair<Double, Integer>(pair.getSecond(), pair.getFirst())); } Collections.sort(ArrSort); this.PredictionScore.clear(); int index = Math.max(0, ArrSort.size() - count); for (int i = ArrSort.size() - 1; i >= index; i--) { this.PredictionScore.add( new Pair<Integer, Double>(ArrSort.get(i).getSecond(), ArrSort.get(i).getFirst())); } }
public void setBlastPred(proteinSet train) { ArrayList<Integer> ann = new ArrayList<Integer>(); HashMap<Integer, Double> pred = new HashMap<Integer, Double>(); for (Pair<String, Double> pair : blastResult) { double bitscore = pair.getSecond(); String access = pair.getFirst(); ann = train.getAnnotation(access); for (int node : ann) { if (!pred.containsKey(node)) { pred.put(node, bitscore); PredictionScore.add(new Pair<Integer, Double>(node, bitscore)); } } } }
public void OutputSparseFeature(PrintWriter Fout) { for (Pair<Integer, Double> e : this.SparseFeature) { Fout.print(" " + e.getFirst() + ":" + e.getSecond()); Fout.printf(" %d:%.4f", e.getFirst(), e.getSecond()); } }