* same source and accession, so need a different accession for
* the CDS from the dna sequence
*/
+
// specific use case:
// Genomic contig ENSCHR:1, contains coding regions for ENSG01,
// ENSG02, ENSG03, with transcripts and products similarly named.
// cannot add distinct dbrefs mapping location on ENSCHR:1 to ENSG01
+
// JBPNote: ?? can't actually create an example that demonstrates we
// need to
// synthesize an xref.
- // TODO: merge conflicts from JAL-2154 branch and use PrimaryDBRefs()
- // for (DBRefEntry primRef:dnaDss.getPrimaryDBRefs())
- // {
- // creates a complementary cross-reference to the source sequence's
- // primary reference.
-
- // // problem here is that the cross-reference is synthesized -
- // cdsSeq.getName() may be like 'CDS|dnaaccession' or 'CDS|emblcdsacc'
- // // assuming cds version same as dna ?!?
- // DBRefEntry proteinToCdsRef = new DBRefEntry(dnaRef.getSource(),
- // dnaRef.getVersion(), cdsSeq.getName());
- // proteinToCdsRef.setMap(new Mapping(cdsSeqDss, cdsToProteinMap
- // .getInverse()));
- // proteinProduct.addDBRef(proteinToCdsRef);
- // }
+
+ for (DBRefEntry primRef : dnaDss.getPrimaryDBRefs())
+ {
+ // creates a complementary cross-reference to the source sequence's
+ // primary reference.
+
+ DBRefEntry cdsCrossRef = new DBRefEntry(primRef.getSource(),
+ primRef.getSource() + ":" + primRef.getVersion(),
+ primRef.getAccessionId());
+ cdsCrossRef
+ .setMap(new Mapping(dnaDss, new MapList(dnaToCdsMap)));
+ cdsSeqDss.addDBRef(cdsCrossRef);
+
+ // problem here is that the cross-reference is synthesized -
+ // cdsSeq.getName() may be like 'CDS|dnaaccession' or
+ // 'CDS|emblcdsacc'
+ // assuming cds version same as dna ?!?
+
+ DBRefEntry proteinToCdsRef = new DBRefEntry(
+ primRef.getSource(), primRef.getVersion(),
+ cdsSeq.getName());
+ //
+ proteinToCdsRef.setMap(new Mapping(cdsSeqDss, cdsToProteinMap
+ .getInverse()));
+ proteinProduct.addDBRef(proteinToCdsRef);
+ }
/*
* transfer any features on dna that overlap the CDS
{
AlignmentI copy = new Alignment(new Alignment(seqs));
copy.setDataset(dataset);
-
+ boolean isProtein = !copy.isNucleotide();
SequenceIdMatcher matcher = new SequenceIdMatcher(seqs);
if (xrefs != null)
{
{
for (DBRefEntry dbref : dbrefs)
{
- if (dbref.getMap() == null || dbref.getMap().getTo() == null)
+ if (dbref.getMap() == null || dbref.getMap().getTo() == null
+ || dbref.getMap().getTo().isProtein() != isProtein)
{
continue;
}