|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.unibi.techfak.jpredictor.motifs.MotifSearchAdapter
de.unibi.techfak.jpredictor.motifs.Motif
de.unibi.techfak.jpredictor.motifs.RegularExpressionMotif
public class RegularExpressionMotif
Contains a regular expression sequence as motif, that is given as a string e.g. "YGAGYG" with 'Y' standing for C,T. The IUB-code, that is the degenerated DNA-code, can be used for the characters.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class de.unibi.techfak.jpredictor.motifs.MotifSearchAdapter |
|---|
MotifSearchAdapter.SearchFields |
| Field Summary | |
|---|---|
private int |
errorNumberAllowedForMatch
The number of mismatch errors allowed in sequence alignment. |
protected java.lang.String |
motif
The motif stored as String. |
| Fields inherited from class de.unibi.techfak.jpredictor.motifs.Motif |
|---|
DNA_DEGENERATED_CODE, DNA_DEGENERATED_CODE_JOINING, MARK_USABLE |
| Fields inherited from class de.unibi.techfak.jpredictor.motifs.MotifSearchAdapter |
|---|
searchFields |
| Fields inherited from interface de.unibi.techfak.jpredictor.motifs.MotifSearcher |
|---|
SEARCH_ALL_ORIENTATIONS, SEARCH_DIRECTION_MAX, SEARCH_DIRECTION_MINUS, SEARCH_DIRECTION_PLUS |
| Fields inherited from interface de.unibi.techfak.misc.Markable |
|---|
MARK_BASIC, MARK_DELETED, MARK_EXP, MARK_MOVED, MARK_REPLACED, MARK_SELECTED, MARK_TOBEDELETED, MARK_TOBEMOVED, MARK_TOBEREPLACED |
| Constructor Summary | |
|---|---|
RegularExpressionMotif()
Standard constructor, inits all values to zero or null. |
|
RegularExpressionMotif(java.lang.String name,
java.lang.String description,
java.lang.String motif,
int nErrorNumberAllowedForMatch)
Sets all the motif's characteristics. |
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Clones the motif by creating the same motif again and copying all importent fields. |
int |
compareTo(java.lang.Object o)
Compares this motif with the specified object. |
static java.lang.String |
createConsensusFromMotifBlock(java.lang.String[] lines,
int start,
int end,
java.lang.String filter)
Reads a motif block, where every line in the String array represents a short sequence and all sequences are combined to a regular expression sequence. |
Motif |
createReversedComplement()
Creates the reversed complementary motif. |
java.lang.String |
getConsensusSequence()
Calculates the consensus sequence from the motif, replaces the degenerated letter-representations of DNA with the base letters in the order A,C,G,T. |
int |
getErrorNumberAllowedForMatch()
|
java.lang.String |
getRegularExpression()
Represents the motif as a regular expression. |
static char |
getRegularExpressionChar(char r,
char b)
Joins two chars into one Regular Expression, e.g. |
int |
length()
The length of the motif is to return. |
protected boolean |
match(char sequ,
char reg)
Matches two chars. |
protected boolean |
matchComplement(char sequ,
char reg)
Matches two chars, the first is treated complementary and then the normal match method is called. |
void |
print(java.io.PrintStream out)
Prints the motif to the given stream, e.g. |
static RegularExpressionMotif |
readMotifBlockFromFile(java.lang.String filename,
int bnr,
java.lang.String filter)
Reads a motif block from a file. |
FoundMotifStruct |
search(int seqStart,
int seqLength)
Runs through the sequence already given in the initialization method initSearch and matches the motif on this
CharSequence with respect to the search mode and the
search window determined by the two parameters seqStart
and seqWidth. |
void |
setErrorNumberAllowedForMatch(int errorNumber)
Sets the number of mismatch errors allowed in one single alignment of motif against another sequence |
void |
setMotif(java.lang.String motif)
Sets the motif from a given String. |
| Methods inherited from class de.unibi.techfak.jpredictor.motifs.Motif |
|---|
clearMark, clearMark, equals, getDescription, getMark, getName, getWeight, isMarked, isMarked, print, scoreSequenceWindow, setDescription, setMark, setName, setWeight, toString |
| Methods inherited from class de.unibi.techfak.jpredictor.motifs.MotifSearchAdapter |
|---|
getSearchMode, initSearch, searchAll, setSearchMode |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface de.unibi.techfak.jpredictor.motifs.MotifSearcher |
|---|
getSearchMode, initSearch, searchAll, setSearchMode |
| Field Detail |
|---|
protected java.lang.String motif
private int errorNumberAllowedForMatch
| Constructor Detail |
|---|
public RegularExpressionMotif(java.lang.String name,
java.lang.String description,
java.lang.String motif,
int nErrorNumberAllowedForMatch)
name - The name of the motif.description - A short description of the motif.motif - The motif itself as a short sequence.nErrorNumberAllowedForMatch - The number of mismatch errors
allowed for a perfect match.public RegularExpressionMotif()
null.
| Method Detail |
|---|
public void setMotif(java.lang.String motif)
MotifFilter.DNA_RNA_FILTER_DEGENERATED.
motif - The new motif as a short sequence.MotifFilter.DNA_RNA_FILTER_DEGENERATEDpublic java.lang.String getConsensusSequence()
getConsensusSequence in class MotifString or
null if no motif is present.public java.lang.String getRegularExpression()
MotifgetConsensusSequence().
getRegularExpression in class Motifpublic int length()
MotifSearchAdapter
length in class MotifSearchAdapterpublic void print(java.io.PrintStream out)
MotifMotif.print(
new PrintStream( new FileOutputStream ( name )))
print in class Motifout - The stream to print the motif to.
public FoundMotifStruct search(int seqStart,
int seqLength)
throws MissingCharSequenceException,
MissingMotifException
MotifSearcherinitSearch and matches the motif on this
CharSequence with respect to the search mode and the
search window determined by the two parameters seqStart
and seqWidth.
FoundMotifStruct with positions absolute to the
sequence window. Note, that this method verifies no previous
searches, instead it searches always new. If the motif was not
found, null is returned.
id of the returned struct is misused as a flag
determining the search direction (search mode) the found motif was
(any combination of SEARCH_DIRECTION_PLUS and
SEARCH_DIRECTION_MINUS). Note, that it is possible,
that a motif can occur more than once at the same position, e.g. the
regular expression motif CNGCCATNDNND and its reversed complemented
part HNNHNATGGCTG can both be matched on the sequence CGGCCATGGCTG.
In case both search direction occur, the motif start and end position
is always for plus direction. For a reversed complemented motif
end is less than start.
null is returned.
search in interface MotifSearcherseqStart - Search starts with this index.seqLength - The width of the subsequence to search on.
null if the motif could not be found on the sequence.
MissingCharSequenceException - If no sequence to search on was
set.
MissingMotifException - If no motif to search for was set.MotifSearcher.initSearch(CharSequence),
MotifSearcher.SEARCH_DIRECTION_PLUS,
MotifSearcher.SEARCH_DIRECTION_MINUSpublic Motif createReversedComplement()
Motif
createReversedComplement in class Motif
protected boolean match(char sequ,
char reg)
true, because both chars contain at least 'C'. The
match of 'Y' and 'G' returns false, because 'C'|'T'
does not contain a 'G'.
sequ - The first regular expression charreg - The second regular expression char
true iff both regular expression have at least one
base in common, false otherwise
protected boolean matchComplement(char sequ,
char reg)
sequ - The char from the sequence.reg - The char from the motif.
true iff the chars are equal after complementing
the first one, false otherwiseSequenceMotif.match(char, char)
public static RegularExpressionMotif readMotifBlockFromFile(java.lang.String filename,
int bnr,
java.lang.String filter)
RegularExpressionMotif, which is returned.
MotifFilter) to filter all found sequences to only
valid characters.
>MotifBlockName CGAGTG TGAACG TGACCG TGATTGThe function returns the regular expression 'YGANYG'.
filename - The name of the file to read from.bnr - The block number within the file.filter - The filter used when lines are evaluated.
RegularExpressionMotif,
null in case of error.MotifFilter.filterString(String, String)
public static java.lang.String createConsensusFromMotifBlock(java.lang.String[] lines,
int start,
int end,
java.lang.String filter)
PSPMotif.createPSPMFromMotifBlockPSPMotif.
Example: the following block of motif sequences CGAGTG TGAACG TGACCG TGATTGis represented by the regular expression 'YGANYG' and thus 'CGAACG' is returned..
lines - The lines containing a file or the motif block.start - The start of the block within the array.end - The end of the block within the array.filter - Every sequence in the block is filtered by calling
MotifFilter.filterString( lines[i], filter ).
String,
null in case of error.PSPMotif.createPSPMFromMotifBlock(String[], int, int, String),
MotifFilter.filterString(String, String)
public static char getRegularExpressionChar(char r,
char b)
r - The first of two chars.b - The second character.
public java.lang.Object clone()
Motif
Clones the motif by creating the same motif again and copying all
importent fields. The result is at least of class Motif.
When cloning a MultiMotif the referred single motifs
are not cloned.
The fields that are copied are: Name, Description, the Motif itself,
errorNumberAllowedForMatch or Threshold, respectively, Weight and
searchMode (altogether 6 fields by now). What is not copied are the
fields of the MotifSearchAdapter.
Note, that any matrices are not cloned. Thus, if cloning a
PSPMotif or a PSSMotif the cloned motif does
contain a reference to the matrix of the old motif. This was done
to preserve memory.
clone in class MotifObject.clone()public int getErrorNumberAllowedForMatch()
getErrorNumberAllowedForMatch in interface MotifSearchWithErrorMotifSearcher.search(int, int)public void setErrorNumberAllowedForMatch(int errorNumber)
MotifSearchWithError
setErrorNumberAllowedForMatch in interface MotifSearchWithErrorerrorNumber - The number of mismatches allowed.MotifSearcher.search(int, int)public int compareTo(java.lang.Object o)
Motif
Compares this motif with the specified object. The Object
given must be a Motif and must not be null,
otherwise a ClassCastException is thrown. If for this
motif or the given one, the motif representation was not set, a
ClassCastException is thrown as well.
Two motifs are compared for their representations, both plus and
minus depending on the search direction. Both motifs must be of the
same type, otherwise the following relation is considered:
SequenceMotif < PSPMotif < MultiMotif and returned
without further investigations. Note, that RegularExpressionMotif
s count as SequenceMotifs and that PSSMotif
s count as PSPMotifs. In case of comparing two
MultiMotifs, after comparing the comprised single motifs
the distance informations are taken into account: first minimum vs.
first minimum, then first maximum, second minimum, and so on. In the
last instance two sequence motifs are compared for their error number
allowed for match, whereas two position specific matrix motifs are
compared for their threshold.
More formaly, this motif is less than the specified one if this reg-exp string is less than the one from the specified motif.
compareTo in interface java.lang.ComparablecompareTo in class Motifo - The motif this method is compared to.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||