-\r
- /**\r
- * Parse a file in Stockholm format into Jalview's data model using VARNA\r
- * \r
- * @throws IOException\r
- * If there is an error with the input file\r
- */\r
- public void parse_with_VARNA() throws IOException\r
- {\r
- FileReader fr = null;\r
- fr = new FileReader(inFile);\r
-\r
- BufferedReader r = new BufferedReader(fr);\r
- result = null;\r
- try\r
- {\r
- result = RNAFactory.loadSecStrStockholm(r);\r
- } catch (ExceptionUnmatchedClosingParentheses umcp)\r
- {\r
- errormessage = "Unmatched parentheses in annotation. Aborting ("\r
- + umcp.getMessage() + ")";\r
- throw new IOException(umcp);\r
- }\r
- // DEBUG System.out.println("this is the secondary scructure:"\r
- // +result.size());\r
- SequenceI[] seqs = new SequenceI[result.size()];\r
- String id=null;\r
- for (int i = 0; i < result.size(); i++)\r
- {\r
- // DEBUG System.err.println("Processing i'th sequence in Stockholm file")\r
- RNA current = result.get(i);\r
-\r
- String seq = current.getSeq();\r
- String rna = current.getStructDBN(true);\r
- // DEBUG System.out.println(seq);\r
- // DEBUG System.err.println(rna);\r
- int begin = 0;\r
- int end = seq.length() - 1;\r
- id = safeName(getDataName());\r
- seqs[i] = new Sequence(id, seq, begin, end);\r
- String[] annot = new String[rna.length()];\r
- Annotation[] ann = new Annotation[rna.length()];\r
- for (int j = 0; j < rna.length(); j++)\r
- {\r
- annot[j] = rna.substring(j, j + 1);\r
-\r
- }\r
-\r
- for (int k = 0; k < rna.length(); k++)\r
- {\r
- ann[k] = new Annotation(annot[k], "",\r
- jalview.schemes.ResidueProperties.getRNASecStrucState(\r
- annot[k]).charAt(0), 0f);\r
-\r
- }\r
- AlignmentAnnotation align = new AlignmentAnnotation("Sec. str.",\r
- current.getID(), ann);\r
-\r
- seqs[i].addAlignmentAnnotation(align);\r
- seqs[i].setRNA(result.get(i));\r
- this.annotations.addElement(align);\r
- }\r
- this.setSeqs(seqs);\r
-\r
- }\r
-\r