* @throws IOException
*/
@Test(groups = { "Functional" })
- public void testMapProteinToCdna_noXrefs() throws IOException
+ public void testMapProteinAlignmentToCdna_noXrefs() throws IOException
{
List<SequenceI> protseqs = new ArrayList<SequenceI>();
protseqs.add(new Sequence("UNIPROT|V12345", "EIQ"));
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());
* @throws IOException
*/
@Test(groups = { "Functional" })
- public void testMapProteinToCdna_withStartAndStopCodons()
+ public void testMapProteinAlignmentToCdna_withStartAndStopCodons()
throws IOException
{
List<SequenceI> protseqs = new ArrayList<SequenceI>();
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());
* @throws IOException
*/
@Test(groups = { "Functional" })
- public void testMapProteinToCdna_withXrefs() throws IOException
+ public void testMapProteinAlignmentToCdna_withXrefs() throws IOException
{
List<SequenceI> protseqs = new ArrayList<SequenceI>();
protseqs.add(new Sequence("UNIPROT|V12345", "EIQ"));
// 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());
* @throws IOException
*/
@Test(groups = { "Functional" })
- public void testMapProteinToCdna_prioritiseXrefs() throws IOException
+ public void testMapProteinAlignmentToCdna_prioritiseXrefs()
+ throws IOException
{
List<SequenceI> protseqs = new ArrayList<SequenceI>();
protseqs.add(new Sequence("UNIPROT|V12345", "EIQ"));
// 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());
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());
+ }
}