From: Jim Procter Date: Thu, 16 Jun 2016 12:38:33 +0000 (+0100) Subject: JAL-2110 throw implementation error if not given a dataset for CDS alignment synthesis X-Git-Tag: Release_2_10_0~140^2~5^2~49^2~13 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=dafd78a3307dd856d328139887036c156b44a203;p=jalview.git JAL-2110 throw implementation error if not given a dataset for CDS alignment synthesis --- diff --git a/src/jalview/analysis/AlignmentUtils.java b/src/jalview/analysis/AlignmentUtils.java index ead4ef8..6a9dc7b 100644 --- a/src/jalview/analysis/AlignmentUtils.java +++ b/src/jalview/analysis/AlignmentUtils.java @@ -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 cdsSeqs = new ArrayList(); List 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); diff --git a/test/jalview/analysis/AlignmentUtilsTests.java b/test/jalview/analysis/AlignmentUtilsTests.java index 9600fdc..2d1f6ff 100644 --- a/test/jalview/analysis/AlignmentUtilsTests.java +++ b/test/jalview/analysis/AlignmentUtilsTests.java @@ -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)