From 3410919969a9a70e54738d65489ab732abb9010c Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Thu, 25 Aug 2016 20:52:43 +0100 Subject: [PATCH] JAL-2154 JAL-2106 transfer primary refs to CDS for makeCDS --- src/jalview/analysis/AlignmentUtils.java | 43 +++++++++++++++++++----------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/src/jalview/analysis/AlignmentUtils.java b/src/jalview/analysis/AlignmentUtils.java index bed685a..cc80384 100644 --- a/src/jalview/analysis/AlignmentUtils.java +++ b/src/jalview/analysis/AlignmentUtils.java @@ -1734,28 +1734,41 @@ public class AlignmentUtils * 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 -- 1.7.10.2