JAL-1705 derive transcript sequences from gene sequence/GFF; handle CDS
[jalview.git] / src / jalview / datamodel / SequenceFeature.java
index 6f514f7..252f46c 100755 (executable)
@@ -36,6 +36,9 @@ public class SequenceFeature
 
   private static final String STRAND = "STRAND";
 
+  // private key for Phase designed not to conflict with real GFF data
+  private static final String PHASE = "!Phase";
+
   private static final String ATTRIBUTES = "ATTRIBUTES";
 
   public int begin;
@@ -237,7 +240,7 @@ public class SequenceFeature
   }
 
   /**
-   * Used for getting values which are not in the basic set. eg STRAND, FRAME
+   * Used for getting values which are not in the basic set. eg STRAND, PHASE
    * for GFF file
    * 
    * @param key
@@ -355,4 +358,24 @@ public class SequenceFeature
     setValue(STRAND, strand);
   }
 
+  public void setPhase(String phase)
+  {
+    setValue(PHASE, phase);
+  }
+
+  public String getPhase()
+  {
+    return (String) getValue(PHASE);
+  }
+
+  /**
+   * Readable representation, for debug only, not guaranteed not to change
+   * between versions
+   */
+  @Override
+  public String toString()
+  {
+    return String.format("%d %d %s %s", getBegin(), getEnd(), getType(),
+            getDescription());
+  }
 }