1 package jalview.datamodel;
\r
3 import jalview.schemes.*;
\r
4 import jalview.analysis.*;
\r
5 import jalview.datamodel.*;
\r
6 import java.util.Vector;
\r
8 public class SequenceGroup
\r
12 boolean displayBoxes;
\r
13 boolean displayText;
\r
16 Conservation conserve;
\r
18 boolean aaFrequencyValid = false;
\r
19 public Vector sequences = new Vector();
\r
21 public ColourSchemeI cs;
\r
25 public SequenceGroup()
\r
27 groupName = "Group";
\r
28 this.isSelected = false;
\r
29 this.displayBoxes = true;
\r
30 this.displayText = true;
\r
31 this.colourText = false;
\r
32 this.display = true;
\r
36 public SequenceGroup(String groupName, ColourSchemeI scheme,
\r
38 boolean displayBoxes, boolean displayText,
\r
45 this.groupName = groupName;
\r
46 this.isSelected = isSelected;
\r
47 this.displayBoxes = displayBoxes;
\r
48 this.displayText = displayText;
\r
49 this.colourText = colourText;
\r
50 this.display = display;
\r
56 public String getName()
\r
61 public void setName(String name)
\r
66 public Conservation getConservation()
\r
71 public void setConservation(Conservation c)
\r
76 public void addSequence(SequenceI s)
\r
78 if(!sequences.contains(s))
\r
79 sequences.addElement(s);
\r
82 public void addOrRemove(SequenceI s)
\r
84 if(sequences.contains(s))
\r
90 public void deleteSequence(SequenceI s)
\r
92 sequences.removeElement(s);
\r
95 public void setColourText(boolean state)
\r
100 public boolean getColourText()
\r
105 public void setDisplayText(boolean state)
\r
107 displayText = state;
\r
110 public boolean getDisplayText()
\r
112 return displayText;
\r
115 public void setDisplayBoxes(boolean state)
\r
117 displayBoxes = state;
\r
120 public boolean getDisplayBoxes()
\r
122 return displayBoxes;
\r
125 public int getStartRes()
\r
130 public int getEndRes()
\r
135 public void setStartRes(int i)
\r
140 public void setEndRes(int i)
\r
145 public int getSize()
\r
147 return sequences.size();
\r
150 public SequenceI getSequenceAt(int i)
\r
152 return (SequenceI) sequences.elementAt(i);
\r
155 public Vector getAAFrequency()
\r
157 if (aaFrequency == null || aaFrequencyValid == false)
\r
159 aaFrequency = AAFrequency.calculate(sequences, 0, getWidth());
\r
160 aaFrequencyValid = true;
\r
162 return aaFrequency;
\r
165 public int getWidth()
\r
167 System.out.println("it is called");
\r
168 // MC This needs to get reset when characters are inserted and deleted
\r
169 for (int i = 0; i < sequences.size(); i++)
\r
171 SequenceI seq = (SequenceI) sequences.elementAt(i);
\r
172 if (seq.getLength() > width)
\r
173 width = seq.getLength();
\r