S
- the type of BioJava sequence objects used by the underlying LightweightProfile
C
- the compound type used by the underlying BioJava sequence objectspublic class BioJava3SequenceAlignmentModel<S extends org.biojava3.core.sequence.template.Sequence<C>,C extends org.biojava3.core.sequence.template.Compound> extends AbstractUnmodifyableAlignmentModel<S,C> implements SequenceAccessAlignmentModel<S,C>
AlignmentModel
backed by a set of BioJava Sequence
implementations.
This class does not allow to write tokens (compounds) since this is not supported by the
Sequence
interface.
Although sequences may be added and removed from instances of this class, AbstractUndecoratedAlignmentModel.addSequence(String)
will
add null
as a new sequence. The technical reason is that this class cannot create instance of the
unknown type S
. It would anyway not make much sense to use this method, since the new sequence could
not be edited. If concrete new sequences shall be added, AbstractUnmodifyableAlignmentModel.addSequence(String, Object)
should be used
instead.
Constructor and Description |
---|
BioJava3SequenceAlignmentModel(org.biojava3.core.sequence.template.LightweightProfile<S,C> underlyingModel,
java.lang.String namePrefix,
CharacterStateSetType setType,
boolean spaceForGap)
Creates a new instance of this class and copies the sequences contained
underlyingModel to it. |
BioJava3SequenceAlignmentModel(org.biojava3.core.sequence.template.LightweightProfile<S,C> underlyingModel,
java.lang.String namePrefix,
CharacterStateSetType setType,
boolean spaceForGap,
SequenceIDManager idManager)
Creates a new instance of this class and copies the sequences contained
underlyingModel to it. |
BioJava3SequenceAlignmentModel(TokenSet<C> tokenSet)
Creates a new instance of this class using its own ID manager.
|
BioJava3SequenceAlignmentModel(TokenSet<C> tokenSet,
SequenceIDManager idManager,
boolean reuseSequenceIDs)
Creates a new instance of this class using a possibly shared ID manager.
|
Modifier and Type | Method and Description |
---|---|
protected S |
createNewSequence(java.lang.String sequenceID,
java.lang.String sequenceName)
Implementing classes must offer a way to create their custom instances of sequence objects
overwriting this method.
|
int |
getSequenceLength(java.lang.String sequenceID)
Returns the length of the specified sequence.
|
C |
getTokenAt(java.lang.String sequenceID,
int index)
Returns the token at the specified position.
|
static <C extends org.biojava3.core.sequence.template.Compound> |
newInstanceFromProfile(org.biojava3.alignment.template.Profile<org.biojava3.core.sequence.template.Sequence<C>,C> underlyingModel,
java.lang.String namePrefix,
CharacterStateSetType setType,
boolean spaceForGap)
Creates a new instance of this class and copies the sequences contained
underlyingModel to it. |
static <C extends org.biojava3.core.sequence.template.Compound> |
newInstanceFromProfile(org.biojava3.alignment.template.Profile<org.biojava3.core.sequence.template.Sequence<C>,C> underlyingModel,
java.lang.String namePrefix,
CharacterStateSetType setType,
boolean spaceForGap,
SequenceIDManager idManager,
boolean reuseSequenceIDs)
Creates a new instance of this class and copies the sequences contained
underlyingModel to it. |
addSequence, getSequence, getWriteType, insertTokenAt, insertTokensAt, removeTokenAt, removeTokensAt, replaceSequence, setTokenAt, setTokensAt
containsSequence, doAddSequence, doRemoveSequence, getSequenceCount, getSequenceMap, getSequenceOrder, sequenceIDIterator
addSequence, addSequence, appendToken, appendTokens, doRenameSequence, fireAfterSequenceChange, fireAfterTokenChange, getApproxMaxSequenceLength, getIDManager, getMaxSequenceLength, getTokenSet, isReuseSequenceIDs, isSequencesReadOnly, isTokensReadOnly, removeSequence, renameSequence, sequenceIDsByName, sequenceNameByID, setMaxSequeceLengthRecalculte, setReuseSequenceIDs, setTokenSet
fireAfterSequenceRenamed, getChangeListeners, getID, getLabel, setID, setLabel
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addSequence, replaceSequence
addSequence, addSequence, appendToken, appendTokens, containsSequence, getChangeListeners, getID, getLabel, getMaxSequenceLength, getSequenceCount, getTokenSet, getWriteType, insertTokenAt, insertTokensAt, isSequencesReadOnly, isTokensReadOnly, removeSequence, removeTokenAt, removeTokensAt, renameSequence, sequenceIDIterator, sequenceIDsByName, sequenceNameByID, setID, setLabel, setTokenAt, setTokensAt, setTokenSet
getSequence
public BioJava3SequenceAlignmentModel(TokenSet<C> tokenSet, SequenceIDManager idManager, boolean reuseSequenceIDs)
tokenSet
- the token set which is supported by the implementationidManager
- the ID manager to be used by the new instance (maybe shared among multiple instances)reuseSequenceIDs
- Specifies whether unused IDs of the underlying ID manager should be reused by this model.
(See the documentation of AbstractUndecoratedAlignmentModel.isReuseSequenceIDs()
for details. Specify false
, if you are unsure
what this property does.)public BioJava3SequenceAlignmentModel(TokenSet<C> tokenSet)
tokenSet
- the token set which is supported by the implementationpublic BioJava3SequenceAlignmentModel(org.biojava3.core.sequence.template.LightweightProfile<S,C> underlyingModel, java.lang.String namePrefix, CharacterStateSetType setType, boolean spaceForGap, SequenceIDManager idManager)
underlyingModel
to it. Later changes
in underlyingModel
will not be reflected by the new instance.namePrefix
- the prefix to be used for sequence names in the new instance (Sequence names will contain this prefix
followed by the index of the according sequence in the underlying model. Sequence names may be changes using
AbstractUndecoratedAlignmentModel.renameSequence(String, String)
later.)underlyingModel
- the BioJava class containing the sequences to be added to the new modeltype
- the token type of the new instance's token set (Only a discrete type would make sense for this class.)spaceForGap
- determines whether the space key shall be associated with gap symbol in the token setidManager
- the ID manager to be used by the new instance (maybe shared among multiple instances)java.lang.NullPointerException
- if underlyingModel
, type
or compoundSet
are null
public BioJava3SequenceAlignmentModel(org.biojava3.core.sequence.template.LightweightProfile<S,C> underlyingModel, java.lang.String namePrefix, CharacterStateSetType setType, boolean spaceForGap)
underlyingModel
to it. Later changes
in underlyingModel
will not be reflected by the new instance.underlyingModel
- the BioJava class containing the sequences to be added to the new modelnamePrefix
- the prefix to be used for sequence names in the new instance (Sequence names will contain this prefix
followed by the index of the according sequence in the underlying model. Sequence names may be changes using
AbstractUndecoratedAlignmentModel.renameSequence(String, String)
later.)type
- the token type of the new instance's token set (Only a discrete type would make sense for this class.)spaceForGap
- determines whether the space key shall be associated with gap symbol in the token setjava.lang.NullPointerException
- if underlyingModel
, type
or compoundSet
are null
public static <C extends org.biojava3.core.sequence.template.Compound> BioJava3SequenceAlignmentModel<org.biojava3.alignment.template.AlignedSequence<? extends org.biojava3.core.sequence.template.Sequence<C>,C>,C> newInstanceFromProfile(org.biojava3.alignment.template.Profile<org.biojava3.core.sequence.template.Sequence<C>,C> underlyingModel, java.lang.String namePrefix, CharacterStateSetType setType, boolean spaceForGap, SequenceIDManager idManager, boolean reuseSequenceIDs)
underlyingModel
to it. Later changes
in underlyingModel
will not be reflected by the new instance.underlyingModel
- the BioJava class containing the sequences to be added to the new modelnamePrefix
- the prefix to be used for sequence names in the new instance (Sequence names will contain this prefix
followed by the index of the according sequence in the underlying model. Sequence names may be changes using
AbstractUndecoratedAlignmentModel.renameSequence(String, String)
later.)type
- the token type of the new instance's token set (Only a discrete type would make sense for this class.)spaceForGap
- determines whether the space key shall be associated with gap symbol in the token setidManager
- the ID manager to be used by the new instance (maybe shared among multiple instances)java.lang.NullPointerException
- if underlyingModel
, type
or compoundSet
are null
public static <C extends org.biojava3.core.sequence.template.Compound> BioJava3SequenceAlignmentModel<org.biojava3.alignment.template.AlignedSequence<? extends org.biojava3.core.sequence.template.Sequence<C>,C>,C> newInstanceFromProfile(org.biojava3.alignment.template.Profile<org.biojava3.core.sequence.template.Sequence<C>,C> underlyingModel, java.lang.String namePrefix, CharacterStateSetType setType, boolean spaceForGap)
underlyingModel
to it. Later changes
in underlyingModel
will not be reflected by the new instance.underlyingModel
- the BioJava class containing the sequences to be added to the new modelnamePrefix
- the prefix to be used for sequence names in the new instance (Sequence names will contain this prefix
followed by the index of the according sequence in the underlying model. Sequence names may be changes using
AbstractUndecoratedAlignmentModel.renameSequence(String, String)
later.)type
- the token type of the new instance's token set (Only a discrete type would make sense for this class.)spaceForGap
- determines whether the space key shall be associated with gap symbol in the token setjava.lang.NullPointerException
- if underlyingModel
, type
or compoundSet
are null
protected S createNewSequence(java.lang.String sequenceID, java.lang.String sequenceName)
AbstractMapBasedAlignmentModel
#doAddSequence(int, String)
before
adding the new sequences to map and the oder list.createNewSequence
in class AbstractMapBasedAlignmentModel<S extends org.biojava3.core.sequence.template.Sequence<C>,C extends org.biojava3.core.sequence.template.Compound>
sequenceID
- the ID the new sequence must havesequenceName
- the name the new sequence will havepublic int getSequenceLength(java.lang.String sequenceID)
AlignmentModel
getSequenceLength
in interface AlignmentModel<C extends org.biojava3.core.sequence.template.Compound>
sequenceID
- the identifier the sequence in the alignment-1
if no sequence with the specified name existspublic C getTokenAt(java.lang.String sequenceID, int index)
AlignmentModel
getTokenAt
in interface AlignmentModel<C extends org.biojava3.core.sequence.template.Compound>
sequenceID
- the identifier the sequence where the token is containedindex
- the index of the element contained in the specified sequence (The first element has the index 0.)