- wsInfo.setProgressText(OutputHeader);\r
-\r
- try {\r
- // JPredFile prediction = new JPredFile("C:/JalviewX/files/jpred.txt", "File");\r
- jalview.io.JPredFile prediction = new jalview.io.JPredFile(result.getPredfile(),\r
- "Paste");\r
- SequenceI[] preds = prediction.getSeqsAsArray();\r
- Alignment al;\r
- int FirstSeq; // the position of the query sequence in Alignment al\r
- boolean noMsa = true; // set if no MSA has been returned by JPred\r
-\r
- if ((this.msa != null) && (result.getAligfile() != null)) {\r
- // we ignore the returned alignment if we only predicted on a single sequence\r
- String format = jalview.io.IdentifyFile.Identify(result.getAligfile(),\r
- "Paste");\r
-\r
- if (jalview.io.FormatAdapter.formats.contains(format)) {\r
- al = new Alignment(jalview.io.FormatAdapter.readFile(\r
- result.getAligfile(), "Paste", format));\r
- noMsa = false;\r
- FirstSeq = 0;\r
- } else {\r
- throw (new Exception(\r
- "Unknown format 'format' for file : \n" +\r
- result.getAligfile()));\r
- }\r
- } else {\r
- al = new Alignment(preds);\r
- FirstSeq = prediction.getQuerySeqPosition();\r
- }\r
-\r
- if (!jalview.analysis.SeqsetUtils.SeqCharacterUnhash(\r
- al.getSequenceAt(FirstSeq), SequenceInfo)) {\r
- throw (new Exception(\r
- "Couldn't recover sequence properties for JNet Query sequence!"));\r
- }\r
-\r
- AlignmentAnnotation annot;\r
- Annotation[] annotations = null;\r
- int i = 0;\r
- int width = preds[0].getSequence().length();\r
-\r
- int[] gapmap = al.getSequenceAt(FirstSeq).gapMap();\r
-\r
- if (gapmap.length != width) {\r
- throw (new Exception(\r
- "Jnet Client Error\nNumber of residues in supposed query sequence :\n" +\r
- al.getSequenceAt(FirstSeq).getName() + "\n" +\r
- al.getSequenceAt(FirstSeq).getSequence() +\r
- "\nDiffer from number of prediction sites in \n" +\r
- result.getPredfile() + "\n"));\r
- }\r
-\r
- // JBPNote Should also rename the query sequence sometime...\r
- i = 0;\r
-\r
- while (i < preds.length) {\r
- String id = preds[i].getName().toUpperCase();\r
-\r
- if (id.startsWith("LUPAS") || id.startsWith("JNET") ||\r
- id.startsWith("JPRED")) {\r
- annotations = new Annotation[al.getWidth()];\r
-\r
- if (id.equals("JNETPRED") || id.equals("JNETPSSM") ||\r
- id.equals("JNETFREQ") || id.equals("JNETHMM") ||\r
- id.equals("JNETALIGN") || id.equals("JPRED")) {\r
- for (int j = 0; j < width; j++) {\r
- annotations[gapmap[j]] = new Annotation("", "",\r
- preds[i].getCharAt(j), 0);\r
- }\r
- } else if (id.equals("JNETCONF")) {\r
- for (int j = 0; j < width; j++) {\r
- float value = Float.parseFloat(preds[i].getCharAt(\r
- j) + "");\r
- annotations[gapmap[j]] = new Annotation(preds[i].getCharAt(\r
- j) + "", "", preds[i].getCharAt(j),\r
- value);\r
- }\r
- } else {\r
- for (int j = 0; j < width; j++) {\r
- annotations[gapmap[j]] = new Annotation(preds[i].getCharAt(\r
- j) + "", "", ' ', 0);\r
- }\r
- }\r
-\r
- if (id.equals("JNETCONF")) {\r
- annot = new AlignmentAnnotation(preds[i].getName(),\r
- "JNet Output", annotations, 0f, 10f, 1);\r
- }\r
- else {\r
- annot = new AlignmentAnnotation(preds[i].getName(),\r
- "JNet Output", annotations);\r
- }\r
-\r
- al.addAnnotation(annot);\r
-\r
- if (noMsa) {\r
- al.deleteSequence(preds[i]);\r
- }\r
- }\r
-\r
- i++;\r
- }\r
-\r
- Hashtable scores = prediction.getScores();\r
-\r
- /* addFloatAnnotations(al, gapmap, (Vector)scores.get("JNETPROPH"),\r
- "JnetpropH", "Jnet Helix Propensity", 0f,1f,1);\r
-\r
- addFloatAnnotations(al, gapmap, (Vector)scores.get("JNETPROPB"),\r
- "JnetpropB", "Jnet Beta Sheet Propensity", 0f,1f,1);\r
-\r
- addFloatAnnotations(al, gapmap, (Vector)scores.get("JNETPROPC"),\r
- "JnetpropC", "Jnet Coil Propensity", 0f,1f,1);\r
- */\r
- AlignFrame af = new AlignFrame(al);\r
-\r
- Desktop.addInternalFrame(af, altitle,\r
- AlignFrame.NEW_WINDOW_WIDTH, AlignFrame.NEW_WINDOW_HEIGHT);\r
- } catch (Exception ex) {\r
- ex.printStackTrace();\r
- }\r
- }\r