JAL-3763 Javadoc, check for null, additional tests
[jalview.git] / src / jalview / datamodel / AlignedCodonFrame.java
index 0927dda..6faf7a6 100644 (file)
@@ -220,6 +220,10 @@ public class AlignedCodonFrame
       int[] codon = null;
       SequenceI mappedSeq = null;
       SequenceI ds = seq.getDatasetSequence();
+      if (ds == null)
+      {
+        ds = seq;
+      }
       
       if (this.fromSeq == seq || this.fromSeq == ds)
       {
@@ -429,7 +433,8 @@ public class AlignedCodonFrame
 
   /**
    * Add search results for regions in other sequences that translate or are
-   * translated from a particular position in seq
+   * translated from a particular position in seq (which may be an aligned or
+   * dataset sequence)
    * 
    * @param seq
    * @param index
@@ -441,6 +446,10 @@ public class AlignedCodonFrame
           SearchResultsI results)
   {
     SequenceI ds = seq.getDatasetSequence();
+    if (ds == null)
+    {
+      ds = seq;
+    }
     for (SequenceToSequenceMapping ssm : mappings)
     {
       ssm.markMappedRegion(ds, index, results);
@@ -945,9 +954,9 @@ public class AlignedCodonFrame
   }
 
   /**
-   * Returns the first mapping found which is between the given sequence and
-   * another, is a triplet mapping (3:1 or 1:3), and covers the full extent of
-   * both sequences involved.
+   * Returns the first mapping found which is between the given dataset sequence
+   * and another, is a triplet mapping (3:1 or 1:3), and covers the full extent
+   * of both sequences involved
    * 
    * @param seq
    * @return