X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fanalysis%2FAlignmentUtilsTests.java;h=62253978ac0ed141a575e64a02bbaba427de0f24;hb=1e085f14ae2f19adfac0153c437ee891f0ad07bc;hp=75cc18b40c086c314e902eb93323358124b4122e;hpb=9876fdccf311378e690c1f9e18db52675d427b89;p=jalview.git diff --git a/test/jalview/analysis/AlignmentUtilsTests.java b/test/jalview/analysis/AlignmentUtilsTests.java index 75cc18b..6225397 100644 --- a/test/jalview/analysis/AlignmentUtilsTests.java +++ b/test/jalview/analysis/AlignmentUtilsTests.java @@ -281,7 +281,7 @@ public class AlignmentUtilsTests * @throws IOException */ @Test(groups = { "Functional" }) - public void testMapProteinToCdna_noXrefs() throws IOException + public void testMapProteinAlignmentToCdna_noXrefs() throws IOException { List protseqs = new ArrayList(); protseqs.add(new Sequence("UNIPROT|V12345", "EIQ")); @@ -298,7 +298,7 @@ public class AlignmentUtilsTests AlignmentI cdna = new Alignment(dnaseqs.toArray(new SequenceI[4])); cdna.setDataset(null); - assertTrue(AlignmentUtils.mapProteinToCdna(protein, cdna)); + assertTrue(AlignmentUtils.mapProteinAlignmentToCdna(protein, cdna)); // 3 mappings made, each from 1 to 1 sequence assertEquals(3, protein.getCodonFrames().size()); @@ -617,7 +617,7 @@ public class AlignmentUtilsTests * @throws IOException */ @Test(groups = { "Functional" }) - public void testMapProteinToCdna_withStartAndStopCodons() + public void testMapProteinAlignmentToCdna_withStartAndStopCodons() throws IOException { List protseqs = new ArrayList(); @@ -638,7 +638,7 @@ public class AlignmentUtilsTests AlignmentI cdna = new Alignment(dnaseqs.toArray(new SequenceI[4])); cdna.setDataset(null); - assertTrue(AlignmentUtils.mapProteinToCdna(protein, cdna)); + assertTrue(AlignmentUtils.mapProteinAlignmentToCdna(protein, cdna)); // 3 mappings made, each from 1 to 1 sequence assertEquals(3, protein.getCodonFrames().size()); @@ -710,7 +710,7 @@ public class AlignmentUtilsTests * @throws IOException */ @Test(groups = { "Functional" }) - public void testMapProteinToCdna_withXrefs() throws IOException + public void testMapProteinAlignmentToCdna_withXrefs() throws IOException { List protseqs = new ArrayList(); protseqs.add(new Sequence("UNIPROT|V12345", "EIQ")); @@ -739,7 +739,7 @@ public class AlignmentUtilsTests // A11111 should be mapped to V12347 // A55555 is spare and has no xref so is not mapped - assertTrue(AlignmentUtils.mapProteinToCdna(protein, cdna)); + assertTrue(AlignmentUtils.mapProteinAlignmentToCdna(protein, cdna)); // 4 protein mappings made for 3 proteins, 2 to V12345, 1 each to V12346/7 assertEquals(3, protein.getCodonFrames().size()); @@ -786,7 +786,8 @@ public class AlignmentUtilsTests * @throws IOException */ @Test(groups = { "Functional" }) - public void testMapProteinToCdna_prioritiseXrefs() throws IOException + public void testMapProteinAlignmentToCdna_prioritiseXrefs() + throws IOException { List protseqs = new ArrayList(); protseqs.add(new Sequence("UNIPROT|V12345", "EIQ")); @@ -806,7 +807,7 @@ public class AlignmentUtilsTests // A11111 should then be mapped to the unmapped V12346 dnaseqs.get(1).addDBRef(new DBRefEntry("UNIPROT", "1", "V12345")); - assertTrue(AlignmentUtils.mapProteinToCdna(protein, cdna)); + assertTrue(AlignmentUtils.mapProteinAlignmentToCdna(protein, cdna)); // 2 protein mappings made assertEquals(2, protein.getCodonFrames().size()); @@ -1279,4 +1280,27 @@ public class AlignmentUtilsTests assertTrue(AlignmentUtils.isMappable(al1, al2)); assertTrue(AlignmentUtils.isMappable(al2, al1)); } + + /** + * Test creating a mapping when the sequences involved do not start at residue + * 1 + * + * @throws IOException + */ + @Test(groups = { "Functional" }) + public void testMapProteinSequenceToCdna_forSubsequence() + throws IOException + { + SequenceI prot = new Sequence("UNIPROT|V12345", "E-I--Q", 10, 12); + prot.createDatasetSequence(); + + SequenceI dna = new Sequence("EMBL|A33333", "GAA--AT-C-CAG", 40, 48); + dna.createDatasetSequence(); + + MapList map = AlignmentUtils.mapProteinSequenceToCdna(prot, dna); + assertEquals(10, map.getToLowest()); + assertEquals(12, map.getToHighest()); + assertEquals(40, map.getFromLowest()); + assertEquals(48, map.getFromHighest()); + } }