X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2Fxdb%2Fembl%2FEmblEntry.java;fp=src%2Fjalview%2Fdatamodel%2Fxdb%2Fembl%2FEmblEntry.java;h=fc57b27662a70995eab5a18a3b0966b278007e93;hb=cf491d18e6affbfacfc67eda7c6bceedd457982f;hp=3c88083b7e190445e7ba54925c8583eca4c86a00;hpb=5dc62d509b6d0f90f3545bf40b272390410eda45;p=jalview.git diff --git a/src/jalview/datamodel/xdb/embl/EmblEntry.java b/src/jalview/datamodel/xdb/embl/EmblEntry.java index 3c88083..fc57b27 100644 --- a/src/jalview/datamodel/xdb/embl/EmblEntry.java +++ b/src/jalview/datamodel/xdb/embl/EmblEntry.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2) - * Copyright (C) 2014 The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * @@ -425,9 +425,13 @@ public class EmblEntry { 1, dna.getLength() }, 1, 1)); // TODO: transform EMBL Database refs to canonical form if (dbRefs != null) + { for (Iterator i = dbRefs.iterator(); i.hasNext(); dna .addDBRef((DBRefEntry) i.next())) + { ; + } + } } try { @@ -440,7 +444,9 @@ public class EmblEntry { for (Iterator dbr = feature.dbRefs.iterator(); dbr.hasNext(); dna .addDBRef((DBRefEntry) dbr.next())) + { ; + } } } if (FeatureProperties.isCodingFeature(sourceDb, feature.getName())) @@ -456,7 +462,9 @@ public class EmblEntry { for (Iterator dbr = feature.dbRefs.iterator(); dbr.hasNext(); dna .addDBRef((DBRefEntry) dbr.next())) + { ; + } } } } @@ -582,8 +590,10 @@ public class EmblEntry } } Sequence product = null; + DBRefEntry protEMBLCDS = null; exon = adjustForPrStart(prstart, exon); - + boolean noProteinDbref=true; + if (prseq != null && prname != null && prid != null) { // extract proteins. @@ -659,8 +669,14 @@ public class EmblEntry // { 1prstart, prstart + prseq.length() - 1 }, 3, 1); pcdnaref.setMap(new Mapping(mp)); if (product != null) + { product.addDBRef(pcdnaref); - + protEMBLCDS = new DBRefEntry(pcdnaref); + protEMBLCDS.setSource(DBRefSource.EMBLCDSProduct); + product.addDBRef(protEMBLCDS); + + } + } } // add cds feature to dna seq - this may include the stop codon @@ -671,18 +687,20 @@ public class EmblEntry sf.setEnd(exon[xint + 1]); sf.setType(feature.getName()); sf.setFeatureGroup(sourceDb); - sf.setDescription("Exon " + (1 + (int) (xint / 2)) + sf.setDescription("Exon " + (1 + xint / 2) + " for protein '" + prname + "' EMBLCDS:" + prid); sf.setValue(FeatureProperties.EXONPOS, new Integer(1 + xint)); sf.setValue(FeatureProperties.EXONPRODUCT, prname); if (vals != null && vals.size() > 0) { - Enumeration kv = vals.elements(); + Enumeration kv = vals.keys(); while (kv.hasMoreElements()) { Object key = kv.nextElement(); if (key != null) + { sf.setValue(key.toString(), vals.get(key)); + } } } dna.addSequenceFeature(sf); @@ -712,6 +730,7 @@ public class EmblEntry + ref.getAccessionId()); } } + noProteinDbref = false; } if (product != null) { @@ -734,6 +753,33 @@ public class EmblEntry } dna.addDBRef(ref); } + if (noProteinDbref && product != null) + { + // add protein coding reference to dna sequence so xref matches + if (protEMBLCDS == null) + { + protEMBLCDS = new DBRefEntry(); + protEMBLCDS.setAccessionId(prid); + protEMBLCDS.setSource(DBRefSource.EMBLCDSProduct); + protEMBLCDS.setVersion(getVersion()); + protEMBLCDS + .setMap(new Mapping(product, map.getMap().getInverse())); + } + product.addDBRef(protEMBLCDS); + + // Add converse mapping reference + if (map != null) + { + Mapping pmap = new Mapping(product, protEMBLCDS.getMap().getMap() + .getInverse()); + DBRefEntry ncMap = new DBRefEntry(protEMBLCDS); + ncMap.setMap(pmap); + if (map.getTo() != null) + { + dna.addDBRef(ncMap); + } + } + } } }