JAL-2137 STRUCTMODEL statement added, logic not yet implemented
authorJim Procter <jprocter@issues.jalview.org>
Wed, 29 Jun 2016 16:02:44 +0000 (17:02 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Wed, 29 Jun 2016 16:02:44 +0000 (17:02 +0100)
src/jalview/io/AnnotationFile.java

index d738882..54e96f3 100755 (executable)
@@ -734,7 +734,8 @@ public class AnnotationFile
 
   String lastread = "";
 
-  private static String GRAPHLINE = "GRAPHLINE", COMBINE = "COMBINE";
+  private static String GRAPHLINE = "GRAPHLINE", COMBINE = "COMBINE",
+          STRUCTMODEL = "STRUCTMODEL";
 
   public boolean parseAnnotationFrom(AlignmentI al, ColumnSelection colSel,
           BufferedReader in) throws Exception
@@ -980,7 +981,42 @@ public class AnnotationFile
           modified = true;
           continue;
         }
-
+        else if (token.equalsIgnoreCase(STRUCTMODEL))
+        {
+          boolean failedtoadd = true;
+          // expect
+          // STRUCTMODEL <QUERYID> <TemplateID> <URL to model> <URL to
+          // alignment>
+          if (st.hasMoreTokens()) {
+            refSeq = al.findName(refSeqId = st.nextToken());
+            if (refSeq == null)
+            {
+              System.err.println("Couldn't locate " + refSeqId
+                      + " in the alignment for STRUCTMODEL");
+              refSeqId = null;
+            }
+            else
+            {
+              String tempId = st.nextToken();
+              String urlToModel = st.nextToken();
+              String urlToPairwise = st.hasMoreTokens() ? st.nextToken()
+                      : "";
+              if (add_structmodel(refSeq, tempId, urlToModel, urlToPairwise))
+              {
+                failedtoadd = false;
+              }
+            }
+          }
+          if (failedtoadd)
+          {
+            System.err
+                    .println("Need <QueryId> <TemplateId> <URL to Model> [<URL to pairwise alignment>] as tab separated fields after "
+                            + STRUCTMODEL);
+          } else {
+            modified = true;
+          }
+          continue;
+        }
         // Parse out the annotation row
         graphStyle = AlignmentAnnotation.getGraphValueFromString(token);
         label = st.nextToken();
@@ -1180,6 +1216,30 @@ public class AnnotationFile
     return modified;
   }
 
+  /**
+   * resolve a structural model and generate and add an alignment sequence for
+   * it
+   * 
+   * @param refSeq2
+   * @param tempId
+   * @param urlToModel
+   * @param urlToPairwise
+   * @return true if model and sequence was added
+   */
+  private boolean add_structmodel(SequenceI refSeq2, String tempId,
+          String urlToModel, String urlToPairwise)
+  {
+
+    return false;
+  }
+
+  private void add_structmodel(StringTokenizer st)
+  {
+
+    // TODO Auto-generated method stub
+
+  }
+
   private void parseHideCols(ColumnSelection colSel, String nextToken)
   {
     StringTokenizer inval = new StringTokenizer(nextToken, ",");