JAL-580 ensure WUSS annotation is reparsed if necessary and cope with parse errors
authorjprocter <jprocter@compbio.dundee.ac.uk>
Fri, 28 Oct 2011 14:06:02 +0000 (15:06 +0100)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Fri, 28 Oct 2011 14:06:02 +0000 (15:06 +0100)
src/jalview/analysis/Rna.java
src/jalview/analysis/WUSSParseException.java [new file with mode: 0644]

index 66bccb9..ca3c6d5 100644 (file)
@@ -44,6 +44,7 @@ public class Rna
    *         pair, end is close base pair
    */
   public static SequenceFeature[] GetBasePairs(String line)
+  public static SequenceFeature[] GetBasePairs(CharSequence line) throws WUSSParseException
   {
 
     Vector stack = new Vector();
diff --git a/src/jalview/analysis/WUSSParseException.java b/src/jalview/analysis/WUSSParseException.java
new file mode 100644 (file)
index 0000000..c8ade0c
--- /dev/null
@@ -0,0 +1,19 @@
+package jalview.analysis;
+
+public class WUSSParseException extends Exception {
+  private long problemPos;
+  public WUSSParseException(long problemPos)
+  {
+    this("Invalid WUSS Notation", problemPos);
+  }
+  public WUSSParseException(String message, long problemPos)
+  {
+    super(message+" at or near position "+problemPos);
+    this.problemPos=problemPos;
+  }
+  public long getProblemPos()
+  {
+    return problemPos;
+  }
+  
+}
\ No newline at end of file