*
* 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();
* 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
* @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.
* @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)
*
* @return
*/
- Set<AlignedCodonFrame> getCodonFrames();
+ List<AlignedCodonFrame> getCodonFrames();
/**
- * Set the codon frame mappings (replacing any existing set).
+ * Set the codon frame mappings (replacing any existing list).
*/
- void setCodonFrames(Set<AlignedCodonFrame> acfs);
+ void setCodonFrames(List<AlignedCodonFrame> acfs);
/**
* get codon frames involving sequenceI
* @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.
*
* @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
* @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<SequenceI> 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<int[]> hiddenCols);
}