X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FSequenceGroup.java;h=5e33229f6c87dc19bd2ab5db8fd8b08bed84d587;hb=d1e20f6a5654ea6baf378afa3277b4e751c69a96;hp=62f9fd8fe2a5eb5d3d9c884f6b87bccd18e5470f;hpb=beff7ac7ab7be2c24ccb179be16b8816d2c18610;p=jalview.git diff --git a/src/jalview/datamodel/SequenceGroup.java b/src/jalview/datamodel/SequenceGroup.java index 62f9fd8..5e33229 100755 --- a/src/jalview/datamodel/SequenceGroup.java +++ b/src/jalview/datamodel/SequenceGroup.java @@ -88,7 +88,7 @@ public class SequenceGroup implements AnnotatedCollectionI /** * group members */ - private List sequences = new ArrayList<>(); + private List sequences; /** * representative sequence for this group (if any) @@ -108,7 +108,7 @@ public class SequenceGroup implements AnnotatedCollectionI private int startRes = 0; /** - * end column (base 0) + * end column (base 0) */ private int endRes = 0; @@ -162,6 +162,7 @@ public class SequenceGroup implements AnnotatedCollectionI { groupName = "JGroup:" + this.hashCode(); cs = new ResidueShader(); + sequences = new ArrayList<>(); } /** @@ -213,7 +214,7 @@ public class SequenceGroup implements AnnotatedCollectionI displayBoxes = seqsel.displayBoxes; displayText = seqsel.displayText; colourText = seqsel.colourText; - + startRes = seqsel.startRes; endRes = seqsel.endRes; cs = new ResidueShader((ResidueShader) seqsel.cs); @@ -243,6 +244,17 @@ public class SequenceGroup implements AnnotatedCollectionI } } + /** + * Constructor that copies the given list of sequences + * + * @param seqs + */ + public SequenceGroup(List seqs) + { + this(); + this.sequences.addAll(seqs); + } + public boolean isShowSequenceLogo() { return showSequenceLogo; @@ -257,7 +269,8 @@ public class SequenceGroup implements AnnotatedCollectionI for (int i = 0, ipos = 0; i < inorder.length; i++) { SequenceI seq = inorder[i]; - SequenceI seqipos = seqs[ipos] = seq.getSubSequence(startRes, endRes + 1); + SequenceI seqipos = seqs[ipos] = seq.getSubSequence(startRes, + endRes + 1); if (seqipos != null) { seqipos.setDescription(seq.getDescription()); @@ -761,10 +774,9 @@ public class SequenceGroup implements AnnotatedCollectionI public void setStartRes(int newStart) { int before = startRes; - startRes= Math.max(0,newStart); // sanity check for negative start column positions - changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before, startRes); - - + startRes = Math.max(0, newStart); // sanity check for negative start column + // positions + changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before, startRes); }