From 4f42212c4d9a825aac6300ac9e3e3c5349040360 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Mon, 31 Oct 2005 15:52:04 +0000 Subject: [PATCH] DisplayId can be dbref and or jvsuffix --- src/jalview/datamodel/Sequence.java | 62 ++++++++++++++++++++++------------ src/jalview/datamodel/SequenceI.java | 8 ++++- 2 files changed, 47 insertions(+), 23 deletions(-) diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index 586280b..c24dc02 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -31,13 +31,14 @@ import java.util.*; */ public class Sequence implements SequenceI { - protected String name; - protected String sequence; - protected String description; - protected int start; - protected int end; - protected String displayId; - protected Color color = Color.white; + SequenceI datasetSequence; + String name; + String sequence; + String description; + int start; + int end; + String displayId; + Color color = Color.white; String pdbId; String vamsasId; Vector dbrefs; @@ -62,8 +63,6 @@ public class Sequence implements SequenceI this.end = end; checkValidRange(); - - setDisplayId(); } void checkValidRange() @@ -88,7 +87,6 @@ public class Sequence implements SequenceI this.end = endRes; } - setDisplayId(); } /** @@ -165,17 +163,26 @@ public class Sequence implements SequenceI * * @return DOCUMENT ME! */ - public String getDisplayId() + public String getDisplayId(boolean dbref, boolean jvsuffix) { - return displayId; - } + StringBuffer result = new StringBuffer(); + if (dbref && dbrefs != null) + { + for (int i = 0; i < dbrefs.size(); i++) + { + DBRefEntry entry = (DBRefEntry) dbrefs.elementAt(i); + result.append(entry.getSource() + "|" + entry.getAccessionId() + "|"); + } + } - /** - * DOCUMENT ME! - */ - public void setDisplayId() - { - displayId = name + "/" + start + "-" + end; + result.append(name); + + if (jvsuffix) + { + result.append("/" + start + "-" + end); + } + + return result.toString(); } /** @@ -186,7 +193,6 @@ public class Sequence implements SequenceI public void setName(String name) { this.name = name; - setDisplayId(); } /** @@ -207,7 +213,6 @@ public class Sequence implements SequenceI public void setStart(int start) { this.start = start; - setDisplayId(); } /** @@ -228,7 +233,6 @@ public class Sequence implements SequenceI public void setEnd(int end) { this.end = end; - setDisplayId(); } /** @@ -531,6 +535,10 @@ public class Sequence implements SequenceI vamsasId = id; } + public void setDBRef(Vector dbref) + { + dbrefs = dbref; + } public Vector getDBRef() { return dbrefs; @@ -544,4 +552,14 @@ public class Sequence implements SequenceI dbrefs.addElement(entry); } + public void setDatasetSequence(SequenceI seq) + { + datasetSequence = seq; + } + + public SequenceI getDatasetSequence() + { + return datasetSequence; + } + } diff --git a/src/jalview/datamodel/SequenceI.java b/src/jalview/datamodel/SequenceI.java index 186179b..fe2a859 100755 --- a/src/jalview/datamodel/SequenceI.java +++ b/src/jalview/datamodel/SequenceI.java @@ -64,7 +64,7 @@ public interface SequenceI * * @return DOCUMENT ME! */ - public String getDisplayId(); + public String getDisplayId(boolean dbref, boolean jvsuffix); /** * DOCUMENT ME! @@ -237,9 +237,15 @@ public interface SequenceI public void setVamsasId(String id); + public void setDBRef(Vector dbs); + public Vector getDBRef(); public void addDBRef(DBRefEntry entry); public void addSequenceFeature(SequenceFeature sf); + + public void setDatasetSequence(SequenceI seq); + + public SequenceI getDatasetSequence(); } -- 1.7.10.2