public class AlignmentModelUtils extends java.lang.Object
AlignmentModel
.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
THYMINE |
static java.lang.String |
URACILE |
Constructor and Description |
---|
AlignmentModelUtils() |
Modifier and Type | Method and Description |
---|---|
static <T> java.util.List<T> |
charSequenceToTokenList(java.lang.CharSequence sequence,
TokenSet<T> tokenSet)
Converts a character sequence to a sequence of tokens.
|
static <T> java.util.List<T> |
charSequenceToTokenList(java.lang.CharSequence sequence,
TokenSet<T> tokenSet,
boolean allowWhitespace,
T defaultToken)
Convenience method that uses
CharSequenceTokenScanner to parse all tokens contained in the specified
string and returns these as a list. |
static void |
reverseComplement(AlignmentModel<?> model,
java.lang.String sequenceID)
Reverse complements a whole nucleotide sequence.
|
static <T> void |
reverseComplement(AlignmentModel<T> model,
java.lang.String sequenceID,
int start,
int end)
Reverse complements a part of a nucleotide sequence.
|
static java.lang.String |
selectionAsString(AlignmentArea area,
boolean separateBySpace)
Converts the current selection to a
String . |
public static final java.lang.String THYMINE
public static final java.lang.String URACILE
public AlignmentModelUtils()
public static <T> java.util.List<T> charSequenceToTokenList(java.lang.CharSequence sequence, TokenSet<T> tokenSet)
sequence
is considered
to be a valid token representation in the specified set.
Note that CharSequenceTokenScanner
or charSequenceToTokenList(CharSequence, TokenSet, boolean, Object)
are more powerful alternatives to this method that allow longer token representations and handled invalid
representations.
sequence
- the character sequence to be convertedtokenSet
- the token set used to create token objectssequence
java.lang.IllegalArgumentException
- if a character in sequence
is not a valid token representation
in tokenSet
CharSequenceTokenScanner
,
charSequenceToTokenList(CharSequence, TokenSet, boolean, Object)
public static <T> java.util.List<T> charSequenceToTokenList(java.lang.CharSequence sequence, TokenSet<T> tokenSet, boolean allowWhitespace, T defaultToken)
CharSequenceTokenScanner
to parse all tokens contained in the specified
string and returns these as a list.sequence
- the sequence to parse tokens fromtokenSet
- the token set containing the tokens to be parsedallowWhitespace
- Specify true
here to allow whitespace between token representations or false
if not. Note that specifying false will lead to a IllegalArgumentException
if the specified token set
contains representations longer than one character.defaultToken
- a default token to be returned if invalid token representations are found (If null
is specified here, #next()
will throw an exception if an invalid representation is found.)java.lang.IllegalArgumentException
- if allowWhitespace
was set to false
although tokenSet
contains token representations that are longer than one characterInvalidTokenRepresentationException
- if no according token can be found for a string representation and
no default token was definedpublic static <T> void reverseComplement(AlignmentModel<T> model, java.lang.String sequenceID, int start, int end)
model
- the alignment model containing the sequencesequenceID
- the ID of the sequence to be reverse complementedstart
- the first position of the subsequence to be reverse complementedend
- the first position behind the subsequence to be reverse complementedPherogramArea#reverseComplement()
public static void reverseComplement(AlignmentModel<?> model, java.lang.String sequenceID)
model
- the alignment model containing the sequencesequenceID
- the ID of the sequence to be reverse complementedpublic static java.lang.String selectionAsString(AlignmentArea area, boolean separateBySpace)
String
.area
- the alignment area containing the according alignment and selection modelseparateBySpace
- Specify true
here, if single token representations shall be separated by a
space character, or false
otherwise. (true
should usually be specified, if token
representations can be longer than one character.)