Class SeqContentPattern
- All Implemented Interfaces:
BioPattern
Regular expressions can be used to find sequence patterns. However, some things can't be easily expressed as a regular expression. For example, a region of length 10 that contains at least 8 Gs and up to two Ts and no other symbols. A SeqContentPattern can be built that does represent this.
SeqContentPattern scp = new SeqContentPattern(DNATools.getDNA());
scp.setLength(10);
scp.setMinCounts(DNATools.g(), 8);
scp.setMaxCounts(DNATools.t(), 2);
scp.setMaxCounts(DNATools.c(), 0);
scp.setMaxCounts(DNATools.a(), 0);
The minimum counts default to 0, and the maximum counts default to the length. If you have not manually set the maximum count for a symbol, it will continue to adjust while you change the length. Once you have set it, it will not vary, even if you do set the length. To re-set a maximum count to track the length, set it to -1.
All regions of the defined length for which all constraints are satisfied will potentialy be found. At the moment we have not defined what will happen for multiple regions that overlap all of which satisfy the constraints.
- Since:
- 1.4
- Author:
- Matthew Pocock
-
Constructor Summary
ConstructorsConstructorDescriptionSeqContentPattern
(FiniteAlphabet alpha) Create a new SeqContentPattern over an alphabet. -
Method Summary
Modifier and TypeMethodDescriptionint
Get the current length.int
Get the maximum counts required for a symbol.int
Get the minimum counts required for a symbol.matcher
(SymbolList symList) Get a matcher that will use these parameters to search a SymbolList.void
setLength
(int length) Set the pattern length.void
setMaxCounts
(AtomicSymbol as, int count) Set the maximum counts required for a symbol.void
setMinCounts
(AtomicSymbol as, int count) Set the minimum counts required for a symbol.
-
Constructor Details
-
SeqContentPattern
Create a new SeqContentPattern over an alphabet.- Parameters:
alpha
- the FiniteAlphabet for this pattern
-
-
Method Details
-
getLength
Get the current length.- Returns:
- the length
-
setLength
Set the pattern length.- Parameters:
length
- the new length
-
setMinCounts
Set the minimum counts required for a symbol.- Parameters:
as
- the AtomicSymbol to checkcount
- the minimum number of counts it must have- Throws:
IllegalSymbolException
- if as is not known in this alphabet
-
getMinCounts
Get the minimum counts required for a symbol.- Parameters:
as
- the AtomicSymbol to check- Returns:
- the minimum number of counts it must have
- Throws:
IllegalSymbolException
- if as is not known in this alphabet
-
setMaxCounts
Set the maximum counts required for a symbol. Use -1 to reset it to track the length.- Parameters:
as
- the AtomicSymbol to checkcount
- the maximum number of counts it must have- Throws:
IllegalSymbolException
- if as is not known in this alphabet
-
getMaxCounts
Get the maximum counts required for a symbol.- Parameters:
as
- the AtomicSymbol to check- Returns:
- the maximum number of counts it must have
- Throws:
IllegalSymbolException
- if as is not known in this alphabet
-
matcher
Description copied from interface:BioPattern
Get a matcher that will use these parameters to search a SymbolList.The resulting BioMatcher is independant of this BioPattern. In particular, calling any mutator methods on this pattern will not affect the matcher.
- Specified by:
matcher
in interfaceBioPattern
- Parameters:
symList
- the SymbolList to match against- Returns:
- a BioMatcher that will perform the search
- Throws:
IllegalAlphabetException
- if symList is not over the right alphabet
-