\r
protected Vector sequences;\r
protected Vector groups = new Vector();\r
- protected char gapCharacter = '-';\r
+ protected ArrayList superGroup = new ArrayList();\r
+ protected char gapCharacter = '-';\r
+ public AlignmentAnnotation [] annotations;\r
+ public Conservation conservation;\r
+\r
+ public boolean featuresAdded = false;\r
\r
/** Make an alignment from an array of Sequences.\r
*\r
}\r
\r
/** Adds a sequence to the alignment. Recalculates maxLength and size.\r
- * Should put the new sequence in a sequence group!!!\r
*\r
* @param snew\r
*/\r
public void addSequence(SequenceI snew) {\r
sequences.addElement(snew);\r
-\r
- ((SequenceGroup)groups.lastElement()).addSequence(snew);\r
}\r
\r
public void addSequence(SequenceI[] seq) {\r
}\r
\r
/** Adds a sequence to the alignment. Recalculates maxLength and size.\r
- * Should put the new sequence in a sequence group!!!\r
- *\r
+ *\r
* @param snew\r
*/\r
public void setSequenceAt(int i,SequenceI snew) {\r
deleteSequence(oldseq);\r
\r
sequences.setElementAt(snew,i);\r
-\r
- ((SequenceGroup)groups.lastElement()).addSequence(snew);\r
}\r
\r
public Vector getGroups() {\r
for (int i = 0; i < this.groups.size();i++)\r
{\r
SequenceGroup sg = (SequenceGroup)groups.elementAt(i);\r
+\r
if (sg.sequences.contains(s))\r
temp.add(sg);\r
}\r
}\r
}\r
\r
+ public void addSuperGroup(SuperGroup sg)\r
+ {\r
+ superGroup.add(sg);\r
+ }\r
+\r
+ public void removeSuperGroup(SuperGroup sg)\r
+ {\r
+ superGroup.remove(sg);\r
+ }\r
+\r
+ public SuperGroup getSuperGroup(SequenceGroup sg)\r
+ {\r
+ for (int i = 0; i < this.superGroup.size(); i++)\r
+ {\r
+ SuperGroup temp = (SuperGroup) superGroup.get(i);\r
+ if (temp.sequenceGroups.contains(sg))\r
+ return temp;\r
+ }\r
+ return null;\r
+ }\r
+\r
/** */\r
public void addGroup(SequenceGroup sg) {\r
if(!groups.contains(sg))\r
groups.addElement(sg);\r
}\r
\r
- /** */\r
- public SequenceGroup addGroup() {\r
- SequenceGroup sg = new SequenceGroup();\r
- groups.addElement(sg);\r
- return sg;\r
+ public void deleteAllGroups()\r
+ {\r
+ groups.clear();\r
+ superGroup.clear();\r
+ int i=0;\r
+ while (i < sequences.size()) {\r
+ SequenceI s = getSequenceAt(i);\r
+ s.setColor(java.awt.Color.white);\r
+ i++;\r
+ }\r
+\r
+\r
}\r
\r
/** */\r
{\r
return AAFrequency.calculate(sequences, 0, getWidth());\r
}\r
+\r
+ public boolean isAligned()\r
+ {\r
+ int width = getWidth();\r
+ for (int i = 0; i < sequences.size(); i++)\r
+ if (getSequenceAt(i).getLength() != width)\r
+ return false;\r
+\r
+ return true;\r
+ }\r
+\r
+ public void deleteAnnotation(AlignmentAnnotation aa)\r
+ {\r
+ int aSize = 1;\r
+ if(annotations!=null)\r
+ aSize = annotations.length;\r
+\r
+ AlignmentAnnotation [] temp = new AlignmentAnnotation [aSize-1];\r
+\r
+ int tIndex = 0;\r
+ for (int i = 0; i < aSize; i++)\r
+ {\r
+ if(annotations[i]==aa)\r
+ continue;\r
+\r
+\r
+ temp[tIndex] = annotations[i];\r
+ tIndex++;\r
+ }\r
+\r
+ annotations = temp;\r
+\r
+ }\r
+\r
+ public void addAnnotation(AlignmentAnnotation aa)\r
+ {\r
+ int aSize = 1;\r
+ if(annotations!=null)\r
+ aSize = annotations.length+1;\r
+\r
+ AlignmentAnnotation [] temp = new AlignmentAnnotation [aSize];\r
+ int i=0;\r
+ if (aSize > 1)\r
+ for (i = 0; i < aSize-1; i++)\r
+ temp[i] = annotations[i];\r
+\r
+ temp[i] = aa;\r
+\r
+ annotations = temp;\r
+ }\r
+ public AlignmentAnnotation[] getAlignmentAnnotation()\r
+ {\r
+ return annotations;\r
+ }\r
+\r
}\r
\r
\r