Merge branch 'feature/JAL-3187linkedFeatures' into feature/JAL-3251biotypedMappings
[jalview.git] / src / jalview / analysis / GeneticCodeI.java
diff --git a/src/jalview/analysis/GeneticCodeI.java b/src/jalview/analysis/GeneticCodeI.java
new file mode 100644 (file)
index 0000000..daed0ac
--- /dev/null
@@ -0,0 +1,46 @@
+package jalview.analysis;
+
+public interface GeneticCodeI
+{
+  /**
+   * Answers the single letter amino acid code (e.g. "D") for the given codon
+   * (e.g. "GAC"), or "*" for a stop codon, or null for an unknown input. The
+   * codon is not case-sensitive, the return value is upper case.
+   * <p>
+   * If the codon includes any of the standard ambiguity codes
+   * <ul>
+   * <li>if all possible translations are the same, returns that value</li>
+   * <li>else returns null</li>
+   * </ul>
+   * 
+   * @param codon
+   * @return
+   */
+  String translate(String codon);
+
+  /**
+   * Answers the single letter amino acid code (e.g. "D") for the given codon
+   * (e.g. "GAC"), or "*" for a stop codon, or null for an unknown input. The
+   * codon is not case-sensitive, the return value is upper case. If the codon
+   * includes any of the standard ambiguity codes, this method returns null.
+   * 
+   * @param codon
+   * @return
+   */
+  String translateCanonical(String codon);
+
+  /**
+   * Answers a unique identifier for the genetic code (using the numbering
+   * system as on NCBI)
+   * 
+   * @return
+   */
+  String getId();
+
+  /**
+   * Answers a display name suitable for use in menus, reports etc
+   * 
+   * @return
+   */
+  String getName();
+}