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