X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignment.java;h=22d23bc299735b1c469e7f4559ed4ae021099c0d;hb=08b87509ada06ac8614424247346daef4054b41a;hp=02c423910c1bc010459c8812e563f3af91bca7dc;hpb=3da878124135ff033f42d19d8733891b09e953cd;p=jalview.git diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 02c4239..22d23bc 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -59,6 +59,15 @@ public class Alignment implements AlignmentI private boolean nucleotide = true; + private List codonFrameList; + + private static final SequenceGroup[] noGroups = new SequenceGroup[0]; + + /* + * persistent object to hold result of findAllGroups(SequenceI) + */ + private List groupsForSequence = new ArrayList<>(); + public boolean hasRNAStructure = false; public AlignmentAnnotation[] annotations; @@ -69,8 +78,6 @@ public class Alignment implements AlignmentI public Hashtable alignmentProperties; - private List codonFrameList; - private void initAlignment(SequenceI[] seqs) { groups = Collections.synchronizedList(new ArrayList()); @@ -125,8 +132,7 @@ public class Alignment implements AlignmentI /** * Make a new alignment from an array of SeqCigars * - * @param seqs - * SeqCigar[] + * @param alseqs */ public Alignment(SeqCigar[] alseqs) { @@ -408,11 +414,14 @@ public class Alignment implements AlignmentI @Override public SequenceGroup[] findAllGroups(SequenceI s) { - ArrayList temp = new ArrayList<>(); - synchronized (groups) { int gSize = groups.size(); + if (gSize == 0) + { + return noGroups; + } + groupsForSequence.clear(); for (int i = 0; i < gSize; i++) { SequenceGroup sg = groups.get(i); @@ -425,12 +434,12 @@ public class Alignment implements AlignmentI if (sg.getSequences().contains(s)) { - temp.add(sg); + groupsForSequence.add(sg); } } } - SequenceGroup[] ret = new SequenceGroup[temp.size()]; - return temp.toArray(ret); + SequenceGroup[] ret = new SequenceGroup[groupsForSequence.size()]; + return groupsForSequence.toArray(ret); } /** */ @@ -1190,7 +1199,8 @@ public class Alignment implements AlignmentI int maxLength = -1; SequenceI current; - for (int i = 0; i < sequences.size(); i++) + int nseq = sequences.size(); + for (int i = 0; i < nseq; i++) { current = getSequenceAt(i); for (int j = current.getLength(); j > maxLength; j--) @@ -1207,7 +1217,7 @@ public class Alignment implements AlignmentI maxLength++; int cLength; - for (int i = 0; i < sequences.size(); i++) + for (int i = 0; i < nseq; i++) { current = getSequenceAt(i); cLength = current.getLength(); @@ -2026,4 +2036,17 @@ public class Alignment implements AlignmentI } } + @Override + public void resetColors() + { + for (int i = getHeight(); --i >= 0;) + { + sequences.get(i).resetColors(); + } + // if (dataset != null) + // { + // dataset.resetColors(); + // } + } + }