X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FSequence.java;h=ebdff92bb896cd11255b7c8dd8959fa0d2b48339;hb=cd1ded4a9a6f3478f3b704c9c97fd323ac5dbdd7;hp=cc5d760532264f639847d70ff24264e640683f83;hpb=28c732f6b0a3a43029bcc529fef8ac1174befa69;p=jalview.git diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index cc5d760..ebdff92 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -2,7 +2,7 @@ package jalview.datamodel; import jalview.analysis.*; import java.awt.*; -import java.util.StringTokenizer; +import java.util.*; import MCview.*; @@ -10,19 +10,38 @@ public class Sequence implements SequenceI { protected String name; protected String sequence; + protected String description; protected int start; protected int end; - protected String description; - protected int charHeight; protected String displayId; protected Color color = Color.white; + String pdbId; PDBfile pdb; - public int maxchain = -1; + public int maxchain = -1; public int pdbstart; public int pdbend; public int seqstart; public int seqend; + + public Vector sequenceFeatures = new Vector(); + public void setSequenceFeatures(Vector v) + { + sequenceFeatures = v; + } + + public Vector getSequenceFeatures() + {return sequenceFeatures; } + + public void setPDBId(String id) + { + pdbId = id; + } + public String getPDBId() + { + return pdbId; + } + public void setPDBfile(PDBfile pdb) { this.pdb = pdb; @@ -120,6 +139,8 @@ public class Sequence implements SequenceI return this.sequence; } public String getSequence(int start,int end) { + if(end>=sequence.length()) + end = sequence.length()-1; return this.sequence.substring(start,end); } @@ -144,19 +165,18 @@ public class Sequence implements SequenceI while (i< sequence.length() && j <= end && j <= pos) { - String s = sequence.substring(i,i+1); + char c = sequence.charAt(i); - if (!(s.equals(".") || s.equals("-") || s.equals(" "))) { + if (!jalview.util.Comparison.isGap((c))) j++; - } + i++; } - if (j == end && j < pos) { + if (j == end && j < pos) return end+1; - } else { - + else return i; - } + } public int findPosition(int i) { @@ -164,12 +184,12 @@ public class Sequence implements SequenceI int j = 0; int pos = start; - while (j < i) { - String s = sequence.substring(j,j+1); - - if (!(s.equals(".") || s.equals("-") || s.equals(" "))) { + while (j < i && j