public class SequenceIDManager extends java.lang.Object
IDs are unique, while multiple sequences may have the same name.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_ID_PREFIX |
Constructor and Description |
---|
SequenceIDManager() |
SequenceIDManager(java.lang.String idPrefix) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
addSequenceName(java.lang.String sequenceName)
Adds a new empty sequence to the underlying data source and generates an ID for it.
|
java.lang.String |
renameSequence(java.lang.String sequenceID,
java.lang.String newSequenceName,
AlignmentModel<?> model)
Renames a sequence in the underlying data source.
|
java.util.Set<java.lang.String> |
sequenceIDsByName(java.lang.String sequenceName)
Returns a set of unique sequence IDs associated with the specified name.
|
java.lang.String |
sequenceNameByID(java.lang.String sequenceID)
Returns the sequence name (that would be visible to the application user) associated with the
specified unique ID.
|
public static final java.lang.String DEFAULT_ID_PREFIX
public SequenceIDManager()
public SequenceIDManager(java.lang.String idPrefix)
public java.lang.String addSequenceName(java.lang.String sequenceName)
If a shared ID manager is used, a previously defined ID is used, if one exists.
sequenceName
- the name of the new sequenceAlignmentSourceNotWritableException
- if the underlying data source is not writable for sequencespublic java.lang.String renameSequence(java.lang.String sequenceID, java.lang.String newSequenceName, AlignmentModel<?> model) throws SequenceNotFoundException
sequenceID
- the ID of the sequence to be renamednewSequenceName
- the new name the sequence shall havemodel
- the alignment model calling this method (This reference is only needed to set the source
of a possible exceptions.)SequenceNotFoundException
- if a sequence with the specified ID is not present the underlying
data sourcepublic java.util.Set<java.lang.String> sequenceIDsByName(java.lang.String sequenceName)
sequenceName
- the name of the sequence that would be visible to the application userpublic java.lang.String sequenceNameByID(java.lang.String sequenceID)
sequenceID
- the unique unmodifiable ID the sequence is identified bynull
if no sequence with this ID is contained in this model