JAL-2110 code/comment tidy
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 1 Jul 2016 09:07:31 +0000 (10:07 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 1 Jul 2016 09:07:31 +0000 (10:07 +0100)
src/jalview/datamodel/xdb/embl/EmblEntry.java

index a2354ed..67d7059 100644 (file)
@@ -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);
       }