From dafd78a3307dd856d328139887036c156b44a203 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Thu, 16 Jun 2016 13:38:33 +0100 Subject: [PATCH] JAL-2110 throw implementation error if not given a dataset for CDS alignment synthesis --- src/jalview/analysis/AlignmentUtils.java | 7 +++++++ test/jalview/analysis/AlignmentUtilsTests.java | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) 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) -- 1.7.10.2