public class BioPolymerCharAlignmentModelFactory extends AbstractAlignmentModelFactory<java.lang.Character> implements AlignmentModelFactory<java.lang.Character>
PackedAlignmentModel
using a CharacterTokenSet
for
nucleotide or amino acid data.
The token set of the created models (and the maximum number of different tokens supported by the packed model) depends on the character state type and predefined tokens specified in the parameter map. If no such data is provided an instance supporting all amino acid one letter (ambiguity) codes will be created. Such an instance can also take up all nucleotide (ambiguity) codes, since all such characters are also contained in the amino acid set.
In addition to the default molecular tokens, all tokens specified in
NewAlignmentModelParameterMap.getDefinedTokens()
will be added to the token set. Note
that only the first character of each string representation will be added the set. There will
be no warning, if representations get cut off.
In addition the number of supported different tokens by the packed model can be increased by
specifying a value for NewAlignmentModelParameterMap.KEY_CHARACTER_STATE_COUNT
which
is higher than the number of molecular tokens necessary for the specified character state set
type.
Constructor and Description |
---|
BioPolymerCharAlignmentModelFactory()
Creates a new instance of this class without an shared sequence ID manager.
|
BioPolymerCharAlignmentModelFactory(java.lang.Character defaultToken,
boolean distinguishCase)
Creates a new instance of this class without an shared sequence ID manager.
|
BioPolymerCharAlignmentModelFactory(SequenceIDManager sharedIDManager,
boolean reuseSequenceIDs,
java.lang.Character defaultToken,
boolean distinguishCase)
Creates a new instance of this class using a shared sequence ID manager.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Character |
createToken(AlignmentModel<java.lang.Character> alignmentModel,
java.lang.String tokenRepresentation)
Creates a token using
TokenSet.tokenByRepresentation(String) . |
AlignmentModel<java.lang.Character> |
doCreateNewModel(NewAlignmentModelParameterMap parameterMap) |
boolean |
isDistinguishCase()
Determines whether alignment models created by this instance should distinguish between upper and lower case
letters or not.
|
createNewModel, getDefaultToken, getSharedIDManager, hasSharedIDManager, isReuseSequenceIDs
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createNewModel
public BioPolymerCharAlignmentModelFactory()
public BioPolymerCharAlignmentModelFactory(java.lang.Character defaultToken, boolean distinguishCase)
defaultToken
- a default token to be used if invalid token representations are passed to
createToken(AlignmentModel, String)
(If null
is specified here, createToken(AlignmentModel, String)
will throw an exception
instead in such cases.)distinguishCase
- Specify true
here, if upper and lower case letters (representing nucleotides
or amino acids) should be supported as different tokens by created alignment models or false
if all token shall be converted to upper case letters in createToken(AlignmentModel, String)
.public BioPolymerCharAlignmentModelFactory(SequenceIDManager sharedIDManager, boolean reuseSequenceIDs, java.lang.Character defaultToken, boolean distinguishCase)
sharedIDManager
- the sequence ID manager that will be shared by all model instances
created by this factoryreuseSequenceIDs
- Specifies whether unused IDs present in their underlying ID managers should be reused
by alignment model instances created by this factory. (See the documentation of
AbstractUndecoratedAlignmentModel.isReuseSequenceIDs()
for details. Specify false
, if
you are unsure what this property does.)defaultToken
- a default token to be used if invalid token representations are passed to
createToken(AlignmentModel, String)
(If null
is specified here, createToken(AlignmentModel, String)
will throw an exception
instead in such cases.)distinguishCase
- Specify true
here, if upper and lower case letters (representing nucleotides
or amino acids) should be supported as different tokens by created alignment models or false
if all token shall be converted to upper case letters in createToken(AlignmentModel, String)
.public boolean isDistinguishCase()
This property can be set using the respective constructor parameter.
true
if upper and lower case letters are modeled as separate tokens or false
otherwisepublic AlignmentModel<java.lang.Character> doCreateNewModel(NewAlignmentModelParameterMap parameterMap)
doCreateNewModel
in class AbstractAlignmentModelFactory<java.lang.Character>
public java.lang.Character createToken(AlignmentModel<java.lang.Character> alignmentModel, java.lang.String tokenRepresentation)
AbstractAlignmentModelFactory
TokenSet.tokenByRepresentation(String)
.createToken
in interface AlignmentModelFactory<java.lang.Character>
createToken
in class AbstractAlignmentModelFactory<java.lang.Character>
alignmentModel
- the alignment model which will hold the returned tokentokenRepresentation
- the string representation of the token to be returned (e.g. read from
an alignment file)AbstractAlignmentModelFactory.getDefaultToken()
if no according representation was found in the setAlignmentModelFactory.createToken(info.bioinfweb.libralign.model.AlignmentModel, java.lang.String)