From: amwaterhouse Date: Tue, 16 Nov 2004 15:13:05 +0000 (+0000) Subject: SequenceGroup may have name X-Git-Tag: Release_2_0~940 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=c19db28827bb0f5704354e4bfc049855fc3f220a;p=jalview.git SequenceGroup may have name --- diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 69b66e0..9b6d729 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -1,7 +1,5 @@ package jalview.datamodel; -import jalview.jbgui.*; -import jalview.schemes.*; import jalview.analysis.*; import jalview.util.*; import java.util.*; @@ -23,16 +21,17 @@ public class Alignment implements AlignmentI public Alignment(SequenceI[] seqs) { sequences = new Vector(); - for (int i=0; i < seqs.length; i++) { + for (int i=0; i < seqs.length; i++) sequences.addElement(seqs[i]); - } - groups.addElement(new SequenceGroup()); + SequenceGroup all = new SequenceGroup(); + all.setName("Group 1"); + groups.addElement(all); int i = 0; while (i < seqs.length) { - addToGroup((SequenceGroup)groups.elementAt(0),seqs[i]); + addToGroup(all,seqs[i]); i++; } @@ -324,11 +323,12 @@ public class Alignment implements AlignmentI /** */ public SequenceGroup findGroup(SequenceI s) { - for (int i = 0; i < this.groups.size();i++) { + for (int i = 0; i < this.groups.size();i++) + { SequenceGroup sg = (SequenceGroup)groups.elementAt(i); - if (sg.sequences.contains(s)) { + if (sg.sequences.contains(s)) return sg; - } + } return null; @@ -375,9 +375,22 @@ public class Alignment implements AlignmentI int i = 0; while (i < sequences.size()) { SequenceI s = getSequenceAt(i); - if (s.getName().equals(name)) { + if (s.getName().equals(name)) return s; - } + + i++; + } + return null; + } + + /** */ + public SequenceI findbyDisplayId(String name) { + int i = 0; + while (i < sequences.size()) { + SequenceI s = getSequenceAt(i); + if (s.getDisplayId().equals(name)) + return s; + i++; } return null; diff --git a/src/jalview/datamodel/AlignmentI.java b/src/jalview/datamodel/AlignmentI.java index 6a1e026..5a21a04 100755 --- a/src/jalview/datamodel/AlignmentI.java +++ b/src/jalview/datamodel/AlignmentI.java @@ -29,6 +29,8 @@ public interface AlignmentI { public void insertColumns(SequenceI[] seqs, int pos) ; public SequenceI findName(String name) ; + public SequenceI findbyDisplayId(String name); + public int findIndex(SequenceI s) ; // Modifying