X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FSequenceI.java;h=ee8c052e77d92a8dbc3f887f1dd847191cba451d;hb=e6fd15cb3a149fb6a8852448260b7b6e52dd2dcc;hp=e4be5ee3dd299f7f7e46844082f8e2f580e3f318;hpb=df2bf54c7050c42db156e96e73bbabce63e718d7;p=jalview.git diff --git a/src/jalview/datamodel/SequenceI.java b/src/jalview/datamodel/SequenceI.java index e4be5ee..ee8c052 100755 --- a/src/jalview/datamodel/SequenceI.java +++ b/src/jalview/datamodel/SequenceI.java @@ -21,7 +21,9 @@ package jalview.datamodel; import jalview.datamodel.features.SequenceFeaturesI; +import jalview.util.MapList; +import java.util.BitSet; import java.util.List; import java.util.Vector; @@ -43,6 +45,10 @@ public interface SequenceI extends ASequenceI */ public void setName(String name); + public HiddenMarkovModel getHMM(); + + public void setHMM(HiddenMarkovModel hmm); + /** * Get the display name */ @@ -118,9 +124,9 @@ public interface SequenceI extends ASequenceI public String getSequenceAsString(int start, int end); /** - * Get the sequence as a character array + * Answers a copy of the sequence as a character array * - * @return seqeunce and any gaps + * @return */ public char[] getSequence(); @@ -176,7 +182,7 @@ public interface SequenceI extends ASequenceI public String getDescription(); /** - * Return the alignment column for a sequence position + * Return the alignment column (from 1..) for a sequence position * * @param pos * lying from start to end @@ -191,16 +197,28 @@ public interface SequenceI extends ASequenceI public int findIndex(int pos); /** - * Returns the sequence position for an alignment position + * Returns the sequence position for an alignment (column) position. If at a + * gap, returns the position of the next residue to the right. If beyond the + * end of the sequence, returns 1 more than the last residue position. * * @param i * column index in alignment (from 0.. getSequenceFeatures(); @@ -437,17 +455,6 @@ public interface SequenceI extends ASequenceI public void transferAnnotation(SequenceI entry, Mapping mp); /** - * @param index - * The sequence index in the MSA - */ - public void setIndex(int index); - - /** - * @return The index of the sequence in the alignment - */ - public int getIndex(); - - /** * @return The RNA of the sequence in the alignment */ @@ -485,14 +492,77 @@ public interface SequenceI extends ASequenceI public List getPrimaryDBRefs(); /** - * Returns a (possibly empty) list of sequence features that overlap the range - * from-to (inclusive), optionally restricted to one or more specified feature - * types + * Updates mapping of Hidden Markov Model nodes to aligned sequence positions + * (e.g. after an alignment edit). The nodes of the HMM (excluding the first + * node, with model average values), are associated in turn with non-gapped + * sequence positions. + */ + public void updateHMMMapping(); + + boolean isHMMConsensusSequence(); + + void setIsHMMConsensusSequence(boolean isHMMConsensusSequence); + + boolean hasHMMAnnotation(); + + void setHasInfo(boolean status); + + /** + * Returns a (possibly empty) list of sequence features that overlap the given + * alignment column range, optionally restricted to one or more specified + * feature types. If the range is all gaps, then features which enclose it are + * included (but not contact features). * - * @param from - * @param to + * @param fromCol + * start column of range inclusive (1..) + * @param toCol + * end column of range inclusive (1..) * @param types + * optional feature types to restrict results to * @return */ - List findFeatures(int from, int to, String... types); + List findFeatures(int fromCol, int toCol, String... types); + + /** + * Method to call to indicate that the sequence (characters or alignment/gaps) + * has been modified. Provided to allow any cursors on residue/column + * positions to be invalidated. + */ + void sequenceChanged(); + + /** + * + * @return BitSet corresponding to index [0,length) where Comparison.isGap() + * returns true. + */ + BitSet getInsertionsAsBits(); + + void mapToReference(AlignmentAnnotation rf); + + /** + * Replaces every occurrence of c1 in the sequence with c2 and returns the + * number of characters changed + * + * @param c1 + * @param c2 + */ + int replace(char c1, char c2); + + /** + * Answers the GeneLociI, or null if not known + * + * @return + */ + GeneLociI getGeneLoci(); + + /** + * Sets the mapping to gene loci for the sequence + * + * @param speciesId + * @param assemblyId + * @param chromosomeId + * @param map + */ + void setGeneLoci(String speciesId, String assemblyId, + String chromosomeId, MapList map); }