/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel.xdb.embl;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Vector;
+
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.DBRefSource;
import jalview.datamodel.FeatureProperties;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Vector;
-
+/**
+ * Data model for one entry returned from an EMBL query, as marshalled by a
+ * Castor binding file
+ *
+ * For example: http://www.ebi.ac.uk/Tools/dbfetch/dbfetch/embl/x53828/emblxml
+ *
+ * @see embl_mapping.xml
+ */
public class EmblEntry
{
String accession;
String lastUpdated;
- Vector keywords;
+ Vector<String> keywords;
- Vector refs;
+ Vector<DBRefEntry> dbRefs;
- Vector dbRefs;
-
- Vector features;
+ Vector<EmblFeature> features;
EmblSequence sequence;
/**
* @return the dbRefs
*/
- public Vector getDbRefs()
+ public Vector<DBRefEntry> getDbRefs()
{
return dbRefs;
}
* @param dbRefs
* the dbRefs to set
*/
- public void setDbRefs(Vector dbRefs)
+ public void setDbRefs(Vector<DBRefEntry> dbRefs)
{
this.dbRefs = dbRefs;
}
/**
* @return the features
*/
- public Vector getFeatures()
+ public Vector<EmblFeature> getFeatures()
{
return features;
}
* @param features
* the features to set
*/
- public void setFeatures(Vector features)
+ public void setFeatures(Vector<EmblFeature> features)
{
this.features = features;
}
/**
* @return the keywords
*/
- public Vector getKeywords()
+ public Vector<String> getKeywords()
{
return keywords;
}
* @param keywords
* the keywords to set
*/
- public void setKeywords(Vector keywords)
+ public void setKeywords(Vector<String> keywords)
{
this.keywords = keywords;
}
}
/**
- * @return the refs
- */
- public Vector getRefs()
- {
- return refs;
- }
-
- /**
- * @param refs
- * the refs to set
- */
- public void setRefs(Vector refs)
- {
- this.refs = refs;
- }
-
- /**
* @return the releaseCreated
*/
public String getRCreated()
* @param releaseCreated
* the releaseCreated to set
*/
- public void setRcreated(String releaseCreated)
+ public void setRCreated(String releaseCreated)
{
this.rCreated = releaseCreated;
}
{ 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
{
{
for (Iterator dbr = feature.dbRefs.iterator(); dbr.hasNext(); dna
.addDBRef((DBRefEntry) dbr.next()))
+ {
;
+ }
}
}
if (FeatureProperties.isCodingFeature(sourceDb, feature.getName()))
{
for (Iterator dbr = feature.dbRefs.iterator(); dbr.hasNext(); dna
.addDBRef((DBRefEntry) dbr.next()))
+ {
;
+ }
}
}
}
}
}
Sequence product = null;
+ DBRefEntry protEMBLCDS = null;
exon = adjustForPrStart(prstart, exon);
-
+ boolean noProteinDbref=true;
+
if (prseq != null && prname != null && prid != null)
{
// extract proteins.
// { 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
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);
+ ref.getAccessionId());
}
}
+ noProteinDbref = false;
}
if (product != null)
{
}
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);
+ }
+ }
+ }
}
}