call annotate3d service and parse rnaml to alignment
authorjprocter <jprocter@compbio.dundee.ac.uk>
Sat, 17 Nov 2012 21:10:59 +0000 (21:10 +0000)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Sat, 17 Nov 2012 21:10:59 +0000 (21:10 +0000)
src/jalview/ws/jws1/Annotate3D.java

index 9f5ad19..a30a9a1 100644 (file)
@@ -59,6 +59,44 @@ public class Annotate3D
     // } catch (IOException e) {
     // }
   }
+
+  public AlignmentI getRNAMLFor(final FileParse source) throws IOException
+  {
+    try
+    {
+      StringBuffer sb = new StringBuffer();
+
+      Reader fpr = source.getReader();
+      int p = 0;
+      char[] cbuff = new char[2048];
+      while ((p = fpr.read(cbuff)) > 0)
+      {
+        for (int i = 0; i < p; i++)
+        {
+          sb.append(cbuff[i]);
+        }
+      }
+
+      FileParse fp = new InputStreamParser(
+              jalview.ext.paradise.Annotate3D.getRNAMLForPDBFileAsString(sb
+                      .toString()), source.getDataName());
+      AlignmentI nal = new FormatAdapter().readFromFile(fp, "RNAML");
+      return nal;
+    } catch (Throwable x)
+    {
+      if (x instanceof IOException)
+      {
+        throw ((IOException) x);
+      }
+      else
+      {
+        throw new IOException(
+                "Unexpected exception when handling RNAML translation of PDB data",
+                x);
+      }
+    }
+  }
+
   public Annotate3D(String path) throws InterruptedException
   {
     System.out.println("Annotate3D");