From 10083e0731425dedd9c2e4f3677dbdee2db8bc33 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Fri, 1 Jul 2016 10:07:31 +0100 Subject: [PATCH] JAL-2110 code/comment tidy --- src/jalview/datamodel/xdb/embl/EmblEntry.java | 43 +++++++++++-------------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/src/jalview/datamodel/xdb/embl/EmblEntry.java b/src/jalview/datamodel/xdb/embl/EmblEntry.java index a2354ed..67d7059 100644 --- a/src/jalview/datamodel/xdb/embl/EmblEntry.java +++ b/src/jalview/datamodel/xdb/embl/EmblEntry.java @@ -388,24 +388,21 @@ public class EmblEntry if (product != null) { /* - * make xrefs from protein to EMBLCDS and EMBLCDSPROTEIN + * make xref from protein to EMBLCDS; we assume here that the + * CDS sequence version is same as dna sequence (?!) */ - DBRefEntry proteinToEmblCdsRef = new DBRefEntry(); - proteinToEmblCdsRef.setAccessionId(proteinId); - proteinToEmblCdsRef.setSource(DBRefSource.EMBLCDS); - proteinToEmblCdsRef.setVersion(getSequenceVersion()); // same as - // parent EMBL - // version. - MapList mp = new MapList(new int[] { 1, translation.length() }, - new int[] { 1 + (codonStart - 1), - (codonStart - 1) + 3 * translation.length() }, 1, 3); - proteinToEmblCdsRef.setMap(new Mapping(mp)); + MapList proteinToCdsMapList = new MapList(new int[] { 1, + translation.length() }, new int[] { 1 + (codonStart - 1), + (codonStart - 1) + 3 * translation.length() }, 1, 3); + DBRefEntry proteinToEmblCdsRef = new DBRefEntry( + DBRefSource.EMBLCDS, getSequenceVersion(), proteinId, + new Mapping(proteinToCdsMapList)); product.addDBRef(proteinToEmblCdsRef); + + /* + * make xref from protein to EMBLCDSPROTEIN + */ proteinToEmblProteinRef = new DBRefEntry(proteinToEmblCdsRef); - MapList mp2 = new MapList( - new int[] { 1, translation.length() }, new int[] { 1, - translation.length() }, 1, 1); - proteinToEmblProteinRef.setMap(new Mapping(mp2)); proteinToEmblProteinRef.setSource(DBRefSource.EMBLCDSProduct); product.addDBRef(proteinToEmblProteinRef); } @@ -502,21 +499,19 @@ public class EmblEntry dna.addDBRef(ref); } } + /* * if we have a product (translation) but no explicit Uniprot dbref - * (example: EMBL AAFI02000057 protein_id EAL65544.1 - * construct mappings to an assumed EMBLCDSPROTEIN accession + * (example: EMBL AAFI02000057 protein_id EAL65544.1) + * then construct mappings to an assumed EMBLCDSPROTEIN accession */ if (!hasUniprotDbref && product != null) { if (proteinToEmblProteinRef == null) { - proteinToEmblProteinRef = new DBRefEntry(); - proteinToEmblProteinRef.setAccessionId(proteinId); - proteinToEmblProteinRef.setSource(DBRefSource.EMBLCDSProduct); - proteinToEmblProteinRef.setVersion(getSequenceVersion()); - proteinToEmblProteinRef.setMap(new Mapping(product, - dnaToProteinMapping.getMap().getInverse())); + // assuming CDSPROTEIN sequence version = dna version (?!) + proteinToEmblProteinRef = new DBRefEntry( + DBRefSource.EMBLCDSProduct, getSequenceVersion(), proteinId); } product.addDBRef(proteinToEmblProteinRef); @@ -524,7 +519,7 @@ public class EmblEntry && dnaToProteinMapping.getTo() != null) { DBRefEntry dnaToEmblProteinRef = new DBRefEntry( - proteinToEmblProteinRef); + DBRefSource.EMBLCDSProduct, getSequenceVersion(), proteinId); dnaToEmblProteinRef.setMap(dnaToProteinMapping); dna.addDBRef(dnaToEmblProteinRef); } -- 1.7.10.2