JAL-2110 throw implementation error if not given a dataset for CDS alignment synthesis
authorJim Procter <jprocter@issues.jalview.org>
Thu, 16 Jun 2016 12:38:33 +0000 (13:38 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Thu, 16 Jun 2016 12:46:17 +0000 (13:46 +0100)
src/jalview/analysis/AlignmentUtils.java
test/jalview/analysis/AlignmentUtilsTests.java

index ead4ef8..6a9dc7b 100644 (file)
@@ -1402,15 +1402,22 @@ public class AlignmentUtils
    * @param dna
    *          aligned dna sequences
    * @param dataset
+   *          - throws error if not given a dataset
    * @return an alignment whose sequences are the cds-only parts of the dna
    *         sequences (or null if no mappings are found)
    */
   public static AlignmentI makeCdsAlignment(SequenceI[] dna,
           AlignmentI dataset)
   {
+    if (dataset.getDataset() != null)
+    {
+      throw new Error(
+              "IMPLEMENTATION ERROR: dataset.getDataset() must be null!");
+    }
     List<SequenceI> cdsSeqs = new ArrayList<SequenceI>();
     List<AlignedCodonFrame> mappings = dataset.getCodonFrames();
     
+
     /*
      * construct CDS sequences from the (cds-to-protein) mappings made earlier;
      * this makes it possible to model multiple products from dna (e.g. EMBL); 
index 9600fdc..2d1f6ff 100644 (file)
@@ -1010,7 +1010,7 @@ public class AlignmentUtilsTests
      * execute method under test:
      */
     AlignmentI cds = AlignmentUtils.makeCdsAlignment(new SequenceI[] {
-        dna1, dna2 }, dna);
+        dna1, dna2 }, dna.getDataset());
 
     assertEquals(2, cds.getSequences().size());
     assertEquals("GGGTTT", cds.getSequenceAt(0)