X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignmentI.java;h=752235bd55eee214e3a6ef96cda7654e492a9639;hb=9debcac658224e1a84ddff4c4fd9f696e812913f;hp=67e574347e6e2355678ad8bf38a71ce2199fd7e6;hpb=be32c14cd8e48fe0a207cd7030cb9cd46f894678;p=jalview.git diff --git a/src/jalview/datamodel/AlignmentI.java b/src/jalview/datamodel/AlignmentI.java index 67e5743..752235b 100755 --- a/src/jalview/datamodel/AlignmentI.java +++ b/src/jalview/datamodel/AlignmentI.java @@ -41,7 +41,8 @@ public interface AlignmentI extends AnnotatedCollectionI * * Calculates the maximum width of the alignment, including gaps. * - * @return Greatest sequence length within alignment. + * @return Greatest sequence length within alignment, or -1 if no sequences + * present */ @Override int getWidth(); @@ -107,11 +108,14 @@ public interface AlignmentI extends AnnotatedCollectionI * Used to set a particular index of the alignment with the given sequence. * * @param i - * Index of sequence to be updated. + * Index of sequence to be updated. if i>length, sequence will be + * added to end, with no intervening positions. * @param seq - * New sequence to be inserted. + * New sequence to be inserted. The existing sequence at position i + * will be replaced. + * @return existing sequence (or null if i>current length) */ - void setSequenceAt(int i, SequenceI seq); + SequenceI replaceSequenceAt(int i, SequenceI seq); /** * Deletes a sequence from the alignment @@ -152,15 +156,16 @@ public interface AlignmentI extends AnnotatedCollectionI int findIndex(SequenceI s); /** - * Finds group that given sequence is part of. + * Returns the first group (in the order in which groups were added) that + * includes the given sequence and aligned position (base 0), or null if none + * found * - * @param s - * Sequence in alignment. + * @param seq + * @param position * - * @return First group found for sequence. WARNING : Sequences may be members - * of several groups. This method is incomplete. + * @return */ - SequenceGroup findGroup(SequenceI s); + SequenceGroup findGroup(SequenceI seq, int position); /** * Finds all groups that a given sequence is part of. @@ -280,13 +285,6 @@ public interface AlignmentI extends AnnotatedCollectionI char getGapCharacter(); /** - * Test for all nucleotide alignment - * - * @return true if alignment is nucleotide sequence - */ - boolean isNucleotide(); - - /** * Test if alignment contains RNA structure * * @return true if RNA structure AligmnentAnnotation was added to alignment @@ -294,18 +292,12 @@ public interface AlignmentI extends AnnotatedCollectionI boolean hasRNAStructure(); /** - * Set alignment to be a nucleotide sequence - * - */ - void setNucleotide(boolean b); - - /** * Get the associated dataset for the alignment. * * @return Alignment containing dataset sequences or null of this is a * dataset. */ - Alignment getDataset(); + AlignmentI getDataset(); /** * Set the associated dataset for the alignment, or create one. @@ -313,7 +305,7 @@ public interface AlignmentI extends AnnotatedCollectionI * @param dataset * The dataset alignment or null to construct one. */ - void setDataset(Alignment dataset); + void setDataset(AlignmentI dataset); /** * pads sequences with gaps (to ensure the set looks like an alignment) @@ -375,12 +367,12 @@ public interface AlignmentI extends AnnotatedCollectionI * * @return */ - Set getCodonFrames(); + List getCodonFrames(); /** - * Set the codon frame mappings (replacing any existing set). + * Set the codon frame mappings (replacing any existing list). */ - void setCodonFrames(Set acfs); + void setCodonFrames(List acfs); /** * get codon frames involving sequenceI @@ -422,7 +414,7 @@ public interface AlignmentI extends AnnotatedCollectionI * @param results * @return -1 or index of sequence in alignment */ - int findIndex(SearchResults results); + int findIndex(SearchResultsI results); /** * append sequences and annotation from another alignment object to this one. @@ -473,9 +465,8 @@ public interface AlignmentI extends AnnotatedCollectionI * * @return existing annotation matching the given attributes */ - AlignmentAnnotation findOrCreateAnnotation(String name, - String calcId, boolean autoCalc, SequenceI seqRef, - SequenceGroup groupRef); + AlignmentAnnotation findOrCreateAnnotation(String name, String calcId, + boolean autoCalc, SequenceI seqRef, SequenceGroup groupRef); /** * move the given group up or down in the alignment by the given number of @@ -517,4 +508,40 @@ public interface AlignmentI extends AnnotatedCollectionI * @return */ Set getSequenceNames(); + + /** + * Checks if the alignment has at least one sequence with one non-gaped + * residue + * + * @return + */ + public boolean hasValidSequence(); + + /** + * Update any mappings to 'virtual' sequences to compatible real ones, if + * present in the added sequences. Returns a count of mappings updated. + * + * @param seqs + * @return + */ + int realiseMappings(List seqs); + + /** + * Returns the first AlignedCodonFrame that has a mapping between the given + * dataset sequences + * + * @param mapFrom + * @param mapTo + * @return + */ + AlignedCodonFrame getMapping(SequenceI mapFrom, SequenceI mapTo); + + /** + * Calculate the visible start and end index of an alignment. The result is + * returned an int array where: int[0] = startIndex, and int[1] = endIndex. + * + * @param hiddenCols + * @return + */ + public int[] getVisibleStartAndEndIndex(List hiddenCols); }