/*
* need a sourceDbRef if we are to construct dbrefs to the CDS
- * sequence
+ * sequence from the dna contig sequences
*/
DBRefEntry dbref = new DBRefEntry("ENSEMBL", "0", "dna1");
dna1.getDatasetSequence().setSourceDBRef(dbref);
* CDS sequences are 'discovered' from dna-to-protein mappings on the alignment
* dataset (e.g. added from dbrefs by CrossRef.findXrefSequences)
*/
- MapList map = new MapList(new int[] { 4, 6, 10, 12 },
+ MapList mapfordna1 = new MapList(new int[] { 4, 6, 10, 12 },
new int[] { 1, 2 }, 3, 1);
AlignedCodonFrame acf = new AlignedCodonFrame();
- acf.addMap(dna1.getDatasetSequence(), pep1.getDatasetSequence(), map);
+ acf.addMap(dna1.getDatasetSequence(), pep1.getDatasetSequence(),
+ mapfordna1);
dna.addCodonFrame(acf);
- map = new MapList(new int[] { 1, 3, 7, 9, 13, 15 }, new int[] { 1, 3 },
+ MapList mapfordna2 = new MapList(new int[] { 1, 3, 7, 9, 13, 15 },
+ new int[] { 1, 3 },
3, 1);
acf = new AlignedCodonFrame();
- acf.addMap(dna2.getDatasetSequence(), pep2.getDatasetSequence(), map);
+ acf.addMap(dna2.getDatasetSequence(), pep2.getDatasetSequence(),
+ mapfordna2);
dna.addCodonFrame(acf);
/*
+ * In this case, mappings originally came from matching Uniprot accessions - so need an xref on dna involving those regions. These are normally constructed from CDS annotation
+ */
+ DBRefEntry dna1xref = new DBRefEntry("UNIPROT", "ENSEMBL", "pep1",
+ new Mapping(mapfordna1));
+ dna1.getDatasetSequence().addDBRef(dna1xref);
+ DBRefEntry dna2xref = new DBRefEntry("UNIPROT", "ENSEMBL", "pep2",
+ new Mapping(mapfordna2));
+ dna2.getDatasetSequence().addDBRef(dna2xref);
+
+ /*
* execute method under test:
*/
AlignmentI cds = AlignmentUtils.makeCdsAlignment(new SequenceI[] {
assertNotNull(cds1Dss.getDBRefs());
assertEquals(1, cds1Dss.getDBRefs().length);
dbref = cds1Dss.getDBRefs()[0];
- assertEquals("UNIPROT", dbref.getSource());
- assertEquals("0", dbref.getVersion());
- assertEquals("pep1", dbref.getAccessionId());
+ assertEquals(dna1xref.getSource(), dbref.getSource());
+ // version is via ensembl's primary ref
+ assertEquals(dna1xref.getVersion(), dbref.getVersion());
+ assertEquals(dna1xref.getAccessionId(), dbref.getAccessionId());
assertNotNull(dbref.getMap());
assertSame(pep1.getDatasetSequence(), dbref.getMap().getTo());
MapList cdsMapping = new MapList(new int[] { 1, 6 },