* @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.haveCrossRef(seq2, seq1));
// now the other way round
- seq1.setDBRef(null);
+ seq1.setDBRefs(null);
seq2.addDBRef(new DBRefEntry("EMBL", "1", "A12345"));
assertTrue(AlignmentUtils.haveCrossRef(seq1, seq2));
assertTrue(AlignmentUtils.haveCrossRef(seq2, seq1));
assertEquals("GGGTTT", exon.getSequenceAsString());
assertEquals("dna1|A12345", exon.getName());
- assertEquals(1, exon.getDBRef().length);
- DBRefEntry cdsRef = exon.getDBRef()[0];
+ assertEquals(1, exon.getDBRefs().length);
+ DBRefEntry cdsRef = exon.getDBRefs()[0];
assertEquals("EMBLCDS", cdsRef.getSource());
assertEquals("2", cdsRef.getVersion());
assertEquals("A12345", cdsRef.getAccessionId());
SequenceI exon = exons.get(0);
assertEquals("GGGTTT", exon.getSequenceAsString());
assertEquals("dna1|A12345", exon.getName());
- assertEquals(1, exon.getDBRef().length);
- DBRefEntry cdsRef = exon.getDBRef()[0];
+ assertEquals(1, exon.getDBRefs().length);
+ DBRefEntry cdsRef = exon.getDBRefs()[0];
assertEquals("EMBLCDS", cdsRef.getSource());
assertEquals("2", cdsRef.getVersion());
assertEquals("A12345", cdsRef.getAccessionId());
exon = exons.get(1);
assertEquals("aaaccc", exon.getSequenceAsString());
assertEquals("dna1|A12346", exon.getName());
- assertEquals(1, exon.getDBRef().length);
- cdsRef = exon.getDBRef()[0];
+ assertEquals(1, exon.getDBRefs().length);
+ cdsRef = exon.getDBRefs()[0];
assertEquals("EMBLCDS", cdsRef.getSource());
assertEquals("3", cdsRef.getVersion());
assertEquals("A12346", cdsRef.getAccessionId());
exon = exons.get(2);
assertEquals("aaaTTT", exon.getSequenceAsString());
assertEquals("dna1|A12347", exon.getName());
- assertEquals(1, exon.getDBRef().length);
- cdsRef = exon.getDBRef()[0];
+ assertEquals(1, exon.getDBRefs().length);
+ cdsRef = exon.getDBRefs()[0];
assertEquals("EMBLCDS", cdsRef.getSource());
assertEquals("4", cdsRef.getVersion());
assertEquals("A12347", cdsRef.getAccessionId());
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());
+ }
}