JAL-2110 change test for desired behaviour of getCodonFrame()
authorJim Procter <jprocter@issues.jalview.org>
Thu, 16 Jun 2016 12:50:16 +0000 (13:50 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Thu, 16 Jun 2016 12:50:16 +0000 (13:50 +0100)
test/jalview/analysis/AlignmentUtilsTests.java

index 2d1f6ff..afa6edb 100644 (file)
@@ -53,6 +53,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
 
+import org.testng.Assert;
 import org.testng.annotations.Test;
 
 public class AlignmentUtilsTests
@@ -1028,19 +1029,27 @@ public class AlignmentUtilsTests
             .contains(cds.getSequenceAt(1).getDatasetSequence()));
 
     /*
-     * Verify mappings from CDS to peptide and cDNA to CDS
+     * Verify mappings from CDS to peptide, cDNA to CDS, and cDNA to peptide
      * the mappings are on the shared alignment dataset
      */
-    assertSame(dna.getCodonFrames(), cds.getCodonFrames());
-    List<AlignedCodonFrame> cdsMappings = cds.getCodonFrames();
-    assertEquals(2, cdsMappings.size());
-    
+    List<AlignedCodonFrame> cdsMappings = cds.getDataset().getCodonFrames();
+    /*
+     * 6 mappings, 2*(DNA->CDS), 2*(DNA->Pep), 2*(CDS->Pep) 
+     */
+    assertEquals(6, cdsMappings.size());
+    /*
+     * verify that mapping sets for dna and cds alignments are different 
+     */
+    Assert.assertNotSame(dna.getCodonFrames(), cds.getCodonFrames());
+    assertEquals(4, dna.getCodonFrames());
+    assertEquals(4, cds.getCodonFrames());
     /*
      * Mapping from pep1 to GGGTTT in first new exon sequence
      */
     List<AlignedCodonFrame> pep1Mapping = MappingUtils
-            .findMappingsForSequence(pep1, cdsMappings);
-    assertEquals(1, pep1Mapping.size());
+            .findMappingsForSequence(pep1, cds.getCodonFrames());
+    assertEquals(1, pep1Mapping.size()); // CDS->Pep
+
     // map G to GGG
     SearchResults sr = MappingUtils
             .buildSearchResults(pep1, 1, cdsMappings);