package jalview.analysis;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import jalview.analysis.AlignmentUtils.MappingResult;
import jalview.datamodel.AlignedCodonFrame;
checkAlignSequenceAs("GG-G-AA-A-C-CC-T-TT", "AL",
false, true, map, "GG-G-AA-ACCCTTT");
}
+
+ /**
+ * Test for the method that generates an aligned translated sequence from one
+ * mapping.
+ */
+ @Test
+ public void testGetAlignedTranslation_dnaLikeProtein()
+ {
+ // dna alignment will be replaced
+ SequenceI dna = new Sequence("Seq1", "T-G-CC-A--T-TAC-CAG-");
+ dna.createDatasetSequence();
+ // protein alignment will be 'applied' to dna
+ SequenceI protein = new Sequence("Seq1", "-CH-Y--Q-");
+ protein.createDatasetSequence();
+ MapList map = new MapList(new int[]
+ { 1, 12 }, new int[]
+ { 1, 4 }, 3, 1);
+ AlignedCodonFrame acf = new AlignedCodonFrame();
+ acf.addMap(dna.getDatasetSequence(), protein.getDatasetSequence(), map);
+
+ final SequenceI aligned = AlignmentUtils
+ .getAlignedTranslation(protein, '-', acf);
+ assertEquals("---TGCCAT---TAC------CAG---", aligned.getSequenceAsString());
+ assertSame(aligned.getDatasetSequence(), dna.getDatasetSequence());
+ }
}