|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.unibi.techfak.jpredictor.operator.Operator
public class Operator
Class for controlling the functionality of motifs on sequences, for using the communicator as parameter deliverer and as output receiver.
| Nested Class Summary | |
|---|---|
(package private) class |
Operator.SearchThread
Class which gets a MotifList and either a
CharSequence or a SequenceReader (from which
the CharSequences are obtained) and which searches the
motifs in the list in all sequences by calling for every motif the
searchAll-method. |
| Field Summary | |
|---|---|
(package private) ICommunicator |
comm
The communicator object this operator gets options from. |
private static int |
METHOD_CALC
|
private static int |
METHOD_COUNT
|
private static int |
METHOD_SCORE
|
private static int |
METHOD_SEARCH
|
private int[] |
mOcc
The motif's occurrences are stored here. |
private java.util.Vector[] |
occ
The occurrence vector, there is a vector for every motif with its occurrences. |
protected java.util.Vector |
seqLengths
For every sequence processed the length is stored here as Integer. |
protected java.util.Vector |
seqNames
For every sequence processed the name is stored here as Integer. |
| Constructor Summary | |
|---|---|
Operator(ICommunicator comm)
Inits the operator and sets the communicator, from which all options and parameters come. |
|
| Method Summary | |
|---|---|
private void |
calculateScoresResults(java.util.LinkedList[] l,
int seqLength)
Called by the search thread, when METHOD_CALC was set as methodToCall. |
long |
getSequenceLength(int seqNr)
While searching or scoring the length of every searched sequence can be obtained. |
java.lang.String |
getSequenceName(int seqNr)
While searching or scoring the name of every searched sequence can be obtained. |
int |
getSequenceNumber()
After searching or scoring the number of sequences that has gone through can be obtained with this method. |
java.lang.String |
scoreSequence()
A sequence is window-by-window scored by summing-up the motifs weigths. |
private void |
scoreSequenceResults(java.util.LinkedList[] l,
int windowStart,
int windowWidth,
MotifList ml)
Called by the search thread, when METHOD_SCORE was set as methodToCall. |
java.lang.String |
searchMotifs(boolean count)
Search for motifs on a sequence. |
private void |
searchMotifsCount(java.util.LinkedList[] l,
int windowStart,
int nextWindowStart)
Called by the search thread, when METHOD_COUNT was set as methodToCall. |
private void |
searchMotifsResults(java.util.LinkedList[] l,
int windowStart,
int nextWindowStart)
Called by the search thread, when METHOD_SEARCH was set as methodToCall. |
private java.lang.String |
setSequence(java.lang.Object o,
int type,
Operator.SearchThread p)
Checks the type of the sequence in comparison to the ones set in the communicator |
java.lang.String |
weightMotifs()
Weight motifs by searching them on two training sets. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
ICommunicator comm
protected java.util.Vector seqLengths
SearchThread and used by
getSequenceLength(int) and
getSequenceNumber().
protected java.util.Vector seqNames
SearchThread and used by
getSequenceName(int).
private static final int METHOD_SEARCH
private static final int METHOD_COUNT
private static final int METHOD_CALC
private static final int METHOD_SCORE
private int[] mOcc
searchMotifs and used by
searchMotifsCount.
private java.util.Vector[] occ
ScoreThread and used by
calculateScoresResults.
| Constructor Detail |
|---|
public Operator(ICommunicator comm)
comm - The ICommunicator needed for communication
with the user interfaces.| Method Detail |
|---|
public int getSequenceNumber()
IOperatorString, than 7 is
returned.
getSequenceNumber in interface IOperatorpublic long getSequenceLength(int seqNr)
IOperatorgetSequenceNumber() the total length over all sequences
is calculated and returned.
getSequenceLength in interface IOperatorseqNr - The sequence thats length is of interest.
public java.lang.String getSequenceName(int seqNr)
IOperatorgetSequenceNumber() null is returned.
getSequenceName in interface IOperatorseqNr - The sequence whos name is of interest.
null,
if seqNr is out of range.
private java.lang.String setSequence(java.lang.Object o,
int type,
Operator.SearchThread p)
o - The sequence (CharSequence, Reader or Sequence).type - The type of sequence.p - The SearchThread to set the sequence to.
null in case of no error, otherwise a String
with a short explaination about the error.public java.lang.String searchMotifs(boolean count)
IOperatorMotifList
and the information about the sequence are taken from the
Communicator this operater was initialized with. The
search is done using the sequence window that is shifted on the
sequence.
count=false
for every occurrence one FoundMotifStruct is output,
which id gives the motif's number in the list. Note,
that the findings are ordered first by position and than by id.
If count=true the occurrences are counted for the motifs.
After every searched sequence a FoundMotifStruct is output
with id=motifNumber and start[0]=occurrences.
Note, that the occurrences are output in order the motifs are arranged
in the motif list.
FoundMotifStruct
with id=-1 and start[0]=0 is
output. If the search is all done, a FoundMotifStruct
with id=-1 and start[0]=-1 is output.
searchMotifs in interface IOperatorcount - false if all occurrences should be sent to
the communicator, true if they are counted for every
motif.
null iff the search was initiated,
otherwise a String with the error number followed by a short
explaination, why the search could not be started.
private void searchMotifsResults(java.util.LinkedList[] l,
int windowStart,
int nextWindowStart)
methodToCall. Evaluates the search results and
sends them to the communicator.
[windowStart,nextWindowStart[, because that
results are discarded when a new search is preformed.
If windowStart==-1 all results that are greater
than nextWindowStart are send to the communicator due
to end of sequence. If l==null the search assumed to be
ready.
l - A LinkedList of the results as FoundMotifStructwindowStart - nextWindowStart -
private void searchMotifsCount(java.util.LinkedList[] l,
int windowStart,
int nextWindowStart)
methodToCall. Counts up for every motif the
occurrences and sends them to the communicatorwindowStart == -1. If l == null
the search assumed to be ready.
l - A LinkedList of the results as FoundMotifStructwindowStart - nextWindowStart - public java.lang.String weightMotifs()
IOperatorMotifList and the sequence informations are
taken from the Communicator this operater was
initialized with. The motifs are searched first on the sequences
of the positive training set and afterwards on the sequences of the
negative training sets. Both training sets are taken from the
Communicator. The sequences are searched as a whole,
thus windowWidth and windowShift are
not needed.MotifList.setScores(MotifList, Vector[], Vector[]) is
taken for calculation, after a required sequence normalization is done.
Communicator is the
following: first, for every motif the occurrences (as Integer
) on the sequences of the positive training set is sent,
followed by a -1.
Second, the same for the negative training set is done. The last
number sent is the return value of the method
Motif.setScores(MotifList, Vector[], Vector[]), which
shows whether calculation was successful or not. The motif's scores
are stored in the motifs and can be read using getScore().
weightMotifs in interface IOperatornull iff the calculation was initiated,
otherwise a String with the error number followed by a short
explaination, why the calculation could not be started.MotifList.setScores(Vector[], Vector[]),
Motif.getWeight()
private void calculateScoresResults(java.util.LinkedList[] l,
int seqLength)
methodToCall. Evaluates the search results. windowStart == -1 or l == null
this method returns without doing anything. This is because
scoring is done on the whole sequence, thus only once.
l - A LinkedList of the results as FoundMotifStructseqLength - - The length of the processed sequence.public java.lang.String scoreSequence()
IOperatorMotifList and the sequence information are
taken from the Communicator this operater was
initialized with. The sequence given can be either a file (e.g.
FASTA-format) or a CharSequence. Searching is done by
shifting a window of defined width on the sequence. These sequence
windows are scored by summing up the weights of found motifs within
the window.ScoredSequenceStruct-object is sent
to the communicator, which holds the sequence number, the start and
end of the sequence and the corresponding score. ScoredSequenceStruct-object with -1 as sequence number.
scoreSequence in interface IOperatornull iff scoring was initiated,
otherwise a String with the error number followed by a short
explaination, why the scoring could not be started.
private void scoreSequenceResults(java.util.LinkedList[] l,
int windowStart,
int windowWidth,
MotifList ml)
methodToCall. Evaluates the search results by
calculating the scores for the sequence window, that are
send to the communicator
If windowStart == -1 the function does nothing.
If l == null the search is assumed to be ready.
l - A array of linked lists (one for every motif),
containing the search results as FoundMotifStructwindowStart - windowWidth - ml -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||