3 import jalview.datamodel.*;
\r
5 import java.io.BufferedReader;
\r
6 import java.io.InputStreamReader;
\r
7 import java.io.FileReader;
\r
10 public class JnetAnnotationMaker
\r
13 * adds the annotation parsed by prediction to al.
\r
14 * @param prediction JPredFile
\r
15 * @param al AlignmentI
\r
16 * @param FirstSeq int -
\r
17 * @param noMsa boolean
\r
19 public static void add_annotation(JPredFile prediction, AlignmentI al,
\r
20 int FirstSeq, boolean noMsa)
\r
24 SequenceI[] preds = prediction.getSeqsAsArray();
\r
25 SequenceI seqRef = al.getSequenceAt(FirstSeq);
\r
26 int width = preds[0].getSequence().length();
\r
27 int[] gapmap = al.getSequenceAt(FirstSeq).gapMap();
\r
28 if (gapmap.length != width)
\r
30 throw (new Exception(
\r
31 "Number of residues in supposed query sequence ('" +
\r
32 al.getSequenceAt(FirstSeq).getName() + "'\n" +
\r
33 al.getSequenceAt(FirstSeq).getSequence() +
\r
34 ")\ndiffer from number of prediction sites in prediction (" + width +
\r
38 AlignmentAnnotation annot;
\r
39 Annotation[] annotations = null;
\r
41 while (i < preds.length)
\r
43 String id = preds[i].getName().toUpperCase();
\r
45 if (id.startsWith("LUPAS") || id.startsWith("JNET") ||
\r
46 id.startsWith("JPRED"))
\r
48 annotations = new Annotation[al.getWidth()];
\r
50 if (id.equals("JNETPRED") || id.equals("JNETPSSM") ||
\r
51 id.equals("JNETFREQ") || id.equals("JNETHMM") ||
\r
52 id.equals("JNETALIGN") || id.equals("JPRED"))
\r
54 for (int j = 0; j < width; j++)
\r
56 annotations[gapmap[j]] = new Annotation("", "",
\r
57 preds[i].getCharAt(j), 0);
\r
60 else if (id.equals("JNETCONF"))
\r
62 for (int j = 0; j < width; j++)
\r
64 float value = Float.parseFloat(preds[i].getCharAt(
\r
66 annotations[gapmap[j]] = new Annotation(preds[i].getCharAt(
\r
67 j) + "", "", preds[i].getCharAt(j),
\r
73 for (int j = 0; j < width; j++)
\r
75 annotations[gapmap[j]] = new Annotation(preds[i].getCharAt(
\r
76 j) + "", "", ' ', 0);
\r
80 if (id.equals("JNETCONF"))
\r
82 annot = new AlignmentAnnotation(preds[i].getName(),
\r
83 "JNet Output", annotations, 0f,
\r
85 AlignmentAnnotation.BAR_GRAPH);
\r
89 annot = new AlignmentAnnotation(preds[i].getName(),
\r
90 "JNet Output", annotations);
\r
95 annot.createSequenceMapping(seqRef, 0);
\r
96 seqRef.addAlignmentAnnotation(annot);
\r
99 al.addAnnotation(annot);
\r
103 al.deleteSequence(preds[i]);
\r
110 //Hashtable scores = prediction.getScores();
\r
112 /* addFloatAnnotations(al, gapmap, (Vector)scores.get("JNETPROPH"),
\r
113 "JnetpropH", "Jnet Helix Propensity", 0f,1f,1);
\r
115 addFloatAnnotations(al, gapmap, (Vector)scores.get("JNETPROPB"),
\r
116 "JnetpropB", "Jnet Beta Sheet Propensity", 0f,1f,1);
\r
118 addFloatAnnotations(al, gapmap, (Vector)scores.get("JNETPROPC"),
\r
119 "JnetpropC", "Jnet Coil Propensity", 0f,1f,1);
\r