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 // in the future we could search for the query
\r
26 // sequence in the alignment before calling this function.
\r
27 SequenceI seqRef = al.getSequenceAt(FirstSeq);
\r
28 int width = preds[0].getSequence().length();
\r
29 int[] gapmap = al.getSequenceAt(FirstSeq).gapMap();
\r
30 if (gapmap.length != width)
\r
32 throw (new Exception(
\r
33 "Number of residues in supposed query sequence ('" +
\r
34 al.getSequenceAt(FirstSeq).getName() + "'\n" +
\r
35 al.getSequenceAt(FirstSeq).getSequence() +
\r
36 ")\ndiffer from number of prediction sites in prediction (" + width +
\r
40 AlignmentAnnotation annot;
\r
41 Annotation[] annotations = null;
\r
43 while (i < preds.length)
\r
45 String id = preds[i].getName().toUpperCase();
\r
47 if (id.startsWith("LUPAS") || id.startsWith("JNET") ||
\r
48 id.startsWith("JPRED"))
\r
50 annotations = new Annotation[al.getWidth()];
\r
52 if (id.equals("JNETPRED") || id.equals("JNETPSSM") ||
\r
53 id.equals("JNETFREQ") || id.equals("JNETHMM") ||
\r
54 id.equals("JNETALIGN") || id.equals("JPRED"))
\r
56 for (int j = 0; j < width; j++)
\r
58 annotations[gapmap[j]] = new Annotation("", "",
\r
59 preds[i].getCharAt(j), 0);
\r
62 else if (id.equals("JNETCONF"))
\r
64 for (int j = 0; j < width; j++)
\r
66 float value = new Float(preds[i].getCharAt(
\r
67 j) + "").floatValue();
\r
68 annotations[gapmap[j]] = new Annotation(preds[i].getCharAt(
\r
69 j) + "", "", preds[i].getCharAt(j),
\r
75 for (int j = 0; j < width; j++)
\r
77 annotations[gapmap[j]] = new Annotation(preds[i].getCharAt(
\r
78 j) + "", "", ' ', 0);
\r
82 if (id.equals("JNETCONF"))
\r
84 annot = new AlignmentAnnotation(preds[i].getName(),
\r
85 "JNet Output", annotations, 0f,
\r
87 AlignmentAnnotation.BAR_GRAPH);
\r
91 annot = new AlignmentAnnotation(preds[i].getName(),
\r
92 "JNet Output", annotations);
\r
97 annot.createSequenceMapping(seqRef, 0);
\r
98 seqRef.addAlignmentAnnotation(annot);
\r
101 al.addAnnotation(annot);
\r
105 al.deleteSequence(preds[i]);
\r
112 //Hashtable scores = prediction.getScores();
\r
114 /* addFloatAnnotations(al, gapmap, (Vector)scores.get("JNETPROPH"),
\r
115 "JnetpropH", "Jnet Helix Propensity", 0f,1f,1);
\r
117 addFloatAnnotations(al, gapmap, (Vector)scores.get("JNETPROPB"),
\r
118 "JnetpropB", "Jnet Beta Sheet Propensity", 0f,1f,1);
\r
120 addFloatAnnotations(al, gapmap, (Vector)scores.get("JNETPROPC"),
\r
121 "JnetpropC", "Jnet Coil Propensity", 0f,1f,1);
\r