X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FSequence.java;h=21b877d4083609affa599393782ab5f92ad741a6;hb=e33b171845992fd21094ba754498f9ab3d29f110;hp=22929f59bc6f97bda4da4bb9750e2a8976184674;hpb=8a92c2fed93b2adfac07a8bc29d3556ee7b1be62;p=jalview.git diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index 22929f5..21b877d 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6) - * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) + * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle * * This file is part of Jalview. * @@ -17,9 +17,10 @@ */ package jalview.datamodel; -import java.util.*; +import jalview.analysis.AlignSeq; -import jalview.analysis.*; +import java.util.Enumeration; +import java.util.Vector; /** * @@ -53,6 +54,11 @@ public class Sequence implements SequenceI * to the residues of this sequence */ Vector annotation; + + /** + * The index of the sequence in a MSA + */ + int index = -1; /** array of seuqence features - may not be null for a valid sequence object */ public SequenceFeature[] sequenceFeatures; @@ -571,13 +577,9 @@ public class Sequence implements SequenceI return this.description; } - /** - * Return the alignment position for a sequence position - * - * @param pos - * lying from start to end - * - * @return aligned position of residue pos + + /* (non-Javadoc) + * @see jalview.datamodel.SequenceI#findIndex(int) */ public int findIndex(int pos) { @@ -895,8 +897,10 @@ public class Sequence implements SequenceI { this.annotation = new Vector(); } - - this.annotation.addElement(annotation); + if (!this.annotation.contains(annotation)) + { + this.annotation.addElement(annotation); + } annotation.setSequenceRef(this); } @@ -1172,4 +1176,17 @@ public class Sequence implements SequenceI } } + /** + * @return The index (zero-based) on this sequence in the MSA. + * It returns {@code -1} if this information is not available. + */ + public int getIndex() { return index; } + + /** + * Defines the position of this sequence in the MSA. + * Use the value {@code -1} if this information is undefined. + * + * @param The position for this sequence. This value is zero-based (zero for this first sequence) + */ + public void setIndex(int value) { index = value; } }