From 3bf07ba3afb39cea37a1e3eb32da7d498a1fd901 Mon Sep 17 00:00:00 2001 From: jprocter Date: Mon, 28 May 2007 11:15:40 +0000 Subject: [PATCH] prototype DBRef and Feature Type semantics (for annotating coding regions and distinguishing between DNA and peptide sequence databases) --- src/jalview/datamodel/DBRefSource.java | 4 ++++ src/jalview/datamodel/FeatureProperties.java | 24 ++++++++++++++++++++++++ src/jalview/datamodel/xdb/embl/EmblEntry.java | 7 ++++++- 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 src/jalview/datamodel/FeatureProperties.java diff --git a/src/jalview/datamodel/DBRefSource.java b/src/jalview/datamodel/DBRefSource.java index aaf0ada..9e394bb 100755 --- a/src/jalview/datamodel/DBRefSource.java +++ b/src/jalview/datamodel/DBRefSource.java @@ -44,4 +44,8 @@ public class DBRefSource * PFAM ID */ public static String PFAM = "PFAM"; + /** + * List of databases whose sequences might have coding regions annotated + */ + public static final String[] DNACODINGDBS = { EMBL, EMBLCDS}; } diff --git a/src/jalview/datamodel/FeatureProperties.java b/src/jalview/datamodel/FeatureProperties.java new file mode 100644 index 0000000..7eadf7b --- /dev/null +++ b/src/jalview/datamodel/FeatureProperties.java @@ -0,0 +1,24 @@ +package jalview.datamodel; + +/** + * A set of feature property constants used by jalview + * @author JimP + * + */ +public class FeatureProperties +{ + + public static final String EXONPOS = "exon number"; + public static final String EXONPRODUCT = "product"; + /** + * lookup feature type for a particular database to see if its a coding region feature + * @param dbrefsource + * @param string + * @return + */ + public static boolean isCodingFeature(String dbrefsource, String type) + { + return ((dbrefsource==null || dbrefsource.equalsIgnoreCase(DBRefSource.EMBL)) + && type.equalsIgnoreCase("CDS")); + } +} diff --git a/src/jalview/datamodel/xdb/embl/EmblEntry.java b/src/jalview/datamodel/xdb/embl/EmblEntry.java index e6c7197..a22eff7 100644 --- a/src/jalview/datamodel/xdb/embl/EmblEntry.java +++ b/src/jalview/datamodel/xdb/embl/EmblEntry.java @@ -1,6 +1,8 @@ package jalview.datamodel.xdb.embl; import jalview.datamodel.DBRefEntry; +import jalview.datamodel.DBRefSource; +import jalview.datamodel.FeatureProperties; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; @@ -414,7 +416,7 @@ public class EmblEntry ; } } - if (feature.getName().equalsIgnoreCase("CDS")) + if (FeatureProperties.isCodingFeature(DBRefSource.EMBL, "CDS")) { // extract coding region(s) jalview.datamodel.Mapping map = null; @@ -502,6 +504,8 @@ public class EmblEntry sf.setFeatureGroup(jalview.datamodel.DBRefSource.EMBL); sf.setDescription("Exon " + (1 + xint) + " 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(); @@ -523,6 +527,7 @@ public class EmblEntry DBRefEntry ref = (DBRefEntry) dbr.next(); ref.setSource(jalview.util.DBRefUtils.getCanonicalName(ref .getSource())); + // Hard code the kind of protein product accessions that EMBL cite if (ref.getSource().equals( jalview.datamodel.DBRefSource.UNIPROT)) { -- 1.7.10.2