public class AlignmentModelUtils extends Object
AlignmentModel
.Modifier and Type | Field and Description |
---|---|
static String |
THYMINE |
static String |
URACILE |
Constructor and Description |
---|
AlignmentModelUtils() |
Modifier and Type | Method and Description |
---|---|
static <T> List<T> |
charSequenceToTokenList(CharSequence sequence,
TokenSet<T> tokenSet)
Converts a character sequence to a sequence of tokens.
|
static <T> List<T> |
charSequenceToTokenList(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,
String sequenceID)
Reverse complements a whole nucleotide sequence.
|
static <T> void |
reverseComplement(AlignmentModel<T> model,
String sequenceID,
int start,
int end)
Reverse complements a part of a nucleotide sequence.
|
static String |
selectionAsString(AlignmentArea area,
boolean separateBySpace)
Converts the current selection to a
String . |
public static final String THYMINE
public static final String URACILE
public AlignmentModelUtils()
public static <T> List<T> charSequenceToTokenList(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
IllegalArgumentException
- if a character in sequence
is not a valid token representation
in tokenSet
CharSequenceTokenScanner
,
charSequenceToTokenList(CharSequence, TokenSet, boolean, Object)
public static <T> List<T> charSequenceToTokenList(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.)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, 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, String sequenceID)
model
- the alignment model containing the sequencesequenceID
- the ID of the sequence to be reverse complementedpublic static 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.)