|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface ICommunicator
List of getter and setter methods for all possible options, parameters and settings.
| Field Summary | |
|---|---|
static java.lang.String |
DISTANCE_ADJACENT
When creating a DoubleMotif the distance between two motifs is '147 - (length1 + length2)' for minimum and '220 + (length1 + length2)' for maximum. |
static java.lang.String |
DISTANCE_ADJACENT73
When creating a DoubleMotif the distance between two motifs is '73 - (length1 + length2)' for minimum and '220 + (length1 + length2)' for maximum. |
static java.lang.String |
DISTANCE_ANYSPACE
When creating a DoubleMotif the distance between two motifs is minimal 0 and maximal Integer.MAX_INT. |
static java.lang.String |
DISTANCE_BELOW220
When creating a DoubleMotif the distance between two motifs is minimal 0 and maximal 219, messured between the motifs startpoints. |
static java.lang.String |
DISTANCE_ONETURN
When creating a DoubleMotif the distance between two motifs is '74 +- (length1 + length2)', minus for minimum and plus for maximum. |
static java.lang.String |
DISTANCE_SINGLE
All motifs are searched and scored as single motifs and are not combined to double motifs. |
static java.lang.String |
DISTANCE_TWOTURNS
When creating a DoubleMotif the distance between two motifs is '147 +- (length1 + length2)', minus for minimum and plus for maximum. |
static int |
FLAG_B
Set when the background (negativ training set) was previously set correctly. |
static int |
FLAG_F
Set when the file to search on is set correctly. |
static int |
FLAG_M
Set when the model (positive training set) was previously set correctly. |
static int |
OBJECT_FASTA_MODIFIER
This constant is used to switch on or off for regular objects whether they are FASTA or not. |
static int |
OBJECT_FILENAME
The object given as Object parameter in some methods
is a String containing a filename. |
static int |
OBJECT_FILENAME_FASTA
The object given as Object parameter in some methods
is a String containing the name of a FASTA file. |
static int |
OBJECT_NOTYPE
The object is not yet given. |
static int |
OBJECT_READER
The object given as Object parameter in some methods
is an arbitrary Reader containing a readable stream. |
static int |
OBJECT_READER_FASTA
The object given as Object parameter in some methods
is an arbitrary Reader containing a readable stream
delivering data in FASTA format. |
static int |
OBJECT_SEQUENCE
The object given as Object parameter in some methods
is a Sequence or a MappedCharSequence. |
static int |
OBJECT_STRING
The object given as Object parameter in some methods
is a String containing the sequence. |
static int |
OBJECT_STRING_FASTA
The object given as Object parameter in some methods
is a String containing one or more sequences, which
are in FASTA-format. |
| Method Summary | |
|---|---|
void |
allowRunning()
Sets a flag that signals all running threads started by the operator that they are allowed to run. |
java.io.PrintStream |
err()
Returns the output stream to which error messages should be sent. |
boolean |
flag(int flags)
Using this method you can test various settings, whether they occured or not. |
double |
getCutoff()
Gets the cutoff. |
java.lang.String |
getDistanceMode()
Gets the previously set distance mode. |
double[] |
getGlobalBackground()
Gives the background distribution over a character set. |
boolean |
getGraphicalOutput()
|
MotifList |
getMotifList()
Gets the previoulsy set MotifList. |
java.util.Vector |
getMotifOccurrenceVector()
If the graphical output is activated, the operator stores information of found motifs in this vector. |
java.lang.Object |
getNegativeTrainingSequence()
Gets the sequence object meant as negative training set. |
int |
getNegativeTrainingSequenceType()
|
java.lang.Object |
getNextResult()
The user interface requests for the next results. |
java.lang.Object |
getPositiveTrainingSequence()
Gets the sequence object meant as positive training set. |
int |
getPositiveTrainingSequenceType()
|
java.util.Vector |
getScorePlotVector()
If the graphical output is activated, the operator stores information for the score plot in this vector. |
long |
getSeed()
The seed, the random number generator was initialized with is returned. |
java.lang.Object |
getSequence()
Gets the sequence object. |
SequenceEnumeration |
getSequenceEnumeration(java.lang.Object o,
int type)
Checks for the type and builds a SequenceEnumerator
from the object given. |
boolean |
getSequenceLengthNormalization()
|
int |
getSequenceType()
|
int |
getSequenceWindowShift()
|
int |
getSequenceWindowWidth()
|
boolean |
hasNextResult()
The user interface asks whether the result queue has elements to fetch. |
boolean |
isRunningAllowed()
Returns the flag for search and score threads of the operator whether they are allow to proceed or must stop on next occasion. |
java.io.PrintStream |
out()
Returns the output stream to which normal output should be sent. |
boolean |
outputForScoreSequence(IOperator op,
boolean best)
Scores sequences using weighted motifs and generates and prints the appropriate output. |
boolean |
outputForSearchMotifs(IOperator op,
boolean count)
Searches motifs on sequences and generates and prints the appropriate output. |
boolean |
outputForWeightMotifs(IOperator op)
Weights motifs and generates and prints the appropriate output. |
java.util.Random |
rand()
Returns the random number generator which is initialized when the communicator object was created. |
double |
random()
Returns a double random number generated with the intern random number generator. |
int |
receiveResults(java.lang.Object o)
The communicator receives the next result, which is to be stored in a queue-like structure until the user interface requests for the next result by calling getNextResult(). |
void |
setCutoff(double cutoff)
Sets a cutoff. |
boolean |
setDistanceMode(java.lang.String distance)
Sets the distance mode. |
void |
setErrorStream(java.io.PrintStream ps)
This method sets a PrintStream as new error message
output stream. |
void |
setGlobalBackground(double[] newBackground)
Sets the new character occurrence distribution. |
void |
setGraphicalOutput(boolean graphout)
The graphical output is activated or deactivated. |
void |
setMotifList(MotifList ml)
Sets a MotifList. |
void |
setNegativeTrainingSequence(java.lang.Object sequ,
int type)
Sets a sequence object (CharSequence, filename or stream) meant as negative training set. |
void |
setOutputStream(java.io.PrintStream ps)
This method sets a PrintStream as new output stream. |
void |
setPositiveTrainingSequence(java.lang.Object sequ,
int type)
Sets a sequence object (CharSequence, filename or stream) meant as positive training set. |
void |
setSeed(long seed)
Sets a new seed for the random number generator. |
void |
setSequence(java.lang.Object sequ,
int type)
Sets a sequence ( CharSequence, filename or stream) to
perform searching and scoring on. |
void |
setSequenceLengthNormalization(boolean norm)
Sets, whether the occurrences on the positive and negativ training set, respectively, are normalized by the sequence length of the set. |
void |
setSequenceWindowShift(int shift)
Sets the sequence window's shift. |
void |
setSequenceWindowWidth(int width)
Sets the sequence window width. |
void |
setVerboseStream(java.io.PrintStream ps)
This method sets a PrintStream as new verbose message
output stream. |
void |
stopRunning()
Sets a flag that signals all running threads started by the operator to stop as soon as possible. |
java.io.PrintStream |
ver()
Returns the output stream to which verbose messages should be sent. |
| Field Detail |
|---|
static final java.lang.String DISTANCE_BELOW220
static final java.lang.String DISTANCE_ONETURN
static final java.lang.String DISTANCE_TWOTURNS
static final java.lang.String DISTANCE_ADJACENT
static final java.lang.String DISTANCE_ADJACENT73
static final java.lang.String DISTANCE_ANYSPACE
static final java.lang.String DISTANCE_SINGLE
static final int OBJECT_NOTYPE
null.
static final int OBJECT_FASTA_MODIFIER
static final int OBJECT_FILENAME
Object parameter in some methods
is a String containing a filename. The file itself
contains only the sequence itself without status lines (raw).
static final int OBJECT_FILENAME_FASTA
Object parameter in some methods
is a String containing the name of a FASTA file. This
file might contain one or more fasta sequences.
static final int OBJECT_STRING
Object parameter in some methods
is a String containing the sequence. The sequence has
no formating lines or characters (raw).
static final int OBJECT_STRING_FASTA
Object parameter in some methods
is a String containing one or more sequences, which
are in FASTA-format.
static final int OBJECT_READER
Object parameter in some methods
is an arbitrary Reader containing a readable stream.
The reader's content has no predefined format and is meant to
consist of only sequence data (raw).
static final int OBJECT_READER_FASTA
Object parameter in some methods
is an arbitrary Reader containing a readable stream
delivering data in FASTA format.
static final int OBJECT_SEQUENCE
Object parameter in some methods
is a Sequence or a MappedCharSequence.
static final int FLAG_B
setNegativeTrainingSequence(Object, int),
flag(int),
Constant Field Valuesstatic final int FLAG_M
setPositiveTrainingSequence(Object, int),
flag(int),
Constant Field Valuesstatic final int FLAG_F
setSequence(Object, int),
flag(int),
Constant Field Values| Method Detail |
|---|
boolean setDistanceMode(java.lang.String distance)
distance - The distance mode as String.
true, if the distance mode could be recognized,
false otherwise. If the distance mode was not recognized,
it is not set.java.lang.String getDistanceMode()
String.setDistanceMode(String)
SequenceEnumeration getSequenceEnumeration(java.lang.Object o,
int type)
SequenceEnumerator
from the object given. Example call: getSequenceEnumeration(
ICommunicator.getSequence(), ICommunicator.getSequenceType()).
o - The sequence (CharSequence, Reader or Sequence).type - The type of sequence, get it from the ICommunicator.
null in case of any error, otherwise an
enumerator over all possible sequences.SequenceEnumerator,
SequenceEnumeration
void setSequence(java.lang.Object sequ,
int type)
throws java.lang.IllegalArgumentException
CharSequence, filename or stream) to
perform searching and scoring on. Valid values for type
are the OBJECT_-variables of this class. Recommended to
give are either a filename or a Sequence-Object.
FLAG_F is set. But if you give
null as the object's value, any previously set sequence
and the FLAG_F are cleared.
sequ - The sequence object, either a String, a
Reader or a Sequence from package
sequences.type - The type definition for the object.
java.lang.IllegalArgumentException - If the object's type is
inequal to what type suggests.FLAG_F,
OBJECT_FILENAME,
OBJECT_FILENAME_FASTA,
OBJECT_NOTYPE,
OBJECT_READER,
OBJECT_READER_FASTA,
OBJECT_SEQUENCE,
OBJECT_STRING,
OBJECT_STRING_FASTAjava.lang.Object getSequence()
null if it was not set.setSequence(Object, int),
getSequenceEnumeration(Object, int)int getSequenceType()
OBJECT_NOTYPE
if it was not set.setSequence(Object, int),
getSequenceEnumeration(Object, int)
void setPositiveTrainingSequence(java.lang.Object sequ,
int type)
throws java.lang.IllegalArgumentException
setSequence(Object, int) for the parameter's meaning.
FLAG_M is set. But if you give
null as the object's value, any previously set sequence
and the FLAG_M is cleared.
sequ - The sequence object.type - The type definition for the object.
java.lang.IllegalArgumentException - If the object's type is inequal to
what type suggests.FLAG_M,
setSequence(Object, int),
getSequenceEnumeration(Object, int)java.lang.Object getPositiveTrainingSequence()
null if it was not set.setPositiveTrainingSequence(Object, int),
getSequenceEnumeration(Object, int)int getPositiveTrainingSequenceType()
OBJECT_NOTYPE if it was not set.setPositiveTrainingSequence(Object, int),
getSequenceEnumeration(Object, int)
void setNegativeTrainingSequence(java.lang.Object sequ,
int type)
throws java.lang.IllegalArgumentException
setSequence(Object, int) for the parameter's meaning.
FLAG_B is set. But if you give
null as the object's value, any previously set sequence
and the FLAG_B is cleared.
sequ - The sequence object.type - The type definition for the object.
java.lang.IllegalArgumentException - If the object's type is inequal
to what type suggests.FLAG_B,
setSequence(Object, int),
getSequenceEnumeration(Object, int)java.lang.Object getNegativeTrainingSequence()
null if it was not set.setNegativeTrainingSequence(Object, int),
getSequenceEnumeration(Object, int)int getNegativeTrainingSequenceType()
OBJECT_NOTYPE if it was not set.setNegativeTrainingSequence(Object, int),
getSequenceEnumeration(Object, int)void setSequenceWindowWidth(int width)
width - The width of the sequence window.int getSequenceWindowWidth()
setSequenceWindowWidth(int)void setSequenceWindowShift(int shift)
shift - The number of characters the sequence window is shifted
by.int getSequenceWindowShift()
setSequenceWindowShift(int)void setMotifList(MotifList ml)
MotifList. The motifs in the list are searched
on a sequence and using the occurrences the motifs are weigthed or
the sequence is scored.
ml - A list of motifs as MotifList.MotifList getMotifList()
MotifList.
null, if no
MotifList was set before.setMotifList(MotifList)void setCutoff(double cutoff)
cutoff. This value is used when a sequence is
scored. If not Double.NaN is set as cutoff the scores
are comprised to bands, for which the score is higher than the
cutoff. Otherwise, for every sequence window the scores are output.
cutoff - The new cutoff or Double.NaN to
switch comprising off.States.fixedCutoffDefaultdouble getCutoff()
Double.isNaN(cutoff)==true)
or off.
setCutoff(double)
void setGlobalBackground(double[] newBackground)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException
Sets the new character occurrence distribution. For every assumed character a probability has to be given, which represents the occurrence frequency of that character in a sequence.
The given double array is cloned, and the cloned version is recalculated such that all values sum up to one (normalization). Thus, the given background is not changed in any way.
newBackground - The new background character distribution.
Note, that it must not be null nor empty.
java.lang.NullPointerException - If the given background is
null.
java.lang.IllegalArgumentException - If the given background is empty
or if at least one value is less than zero or if the sum over all
probabilities (or counts) is zero.double[] getGlobalBackground()
setGlobalBackground(double[])
int receiveResults(java.lang.Object o)
throws java.lang.IllegalStateException
getNextResult().
o - This object is to be stored as part of the result stream.
java.lang.IllegalStateException - If the communicator was unable
to store the object for any reason.getNextResult()
java.lang.Object getNextResult()
throws java.lang.IllegalStateException
IOperator for
a notion on what the Objects might be.
null if no
results are available in the queue.
java.lang.IllegalStateException - If the communicator was unable
to read an object for any reason.hasNextResult(),
IOperator.searchMotifs(boolean),
IOperator.weightMotifs(),
IOperator.scoreSequence()boolean hasNextResult()
false, a
consecutive call to getNextResult() might return
other than null because the task-performing thread may
have send a result in the meanwhile. What can be assured of is, that
in case of a returned true a call to
getNextResult() will not return null.
true if a result is in the queue and
can be fetched by calling getNextresult(),
false if actually no result is in the queue.getNextResult()void setSequenceLengthNormalization(boolean norm)
norm - true if normalization should be done,
false otherwise.boolean getSequenceLengthNormalization()
true, if normalization is wished,
false otherwise.setSequenceLengthNormalization(boolean)boolean flag(int flags)
ICommunicator.flag( FLAG_B | FLAG_M ) would return
true.
flags - The flag or flags to be tested.
true, if at least one flag is set,
false otherwise.void setGraphicalOutput(boolean graphout)
The graphical output is activated or deactivated. If it is activated,
the result data are stored in several vectors, e.g. the one to hold
score plot data can be obtained by calling
getScorePlotVector.
What is stored in the respective vector relies on the methods of the
operator filling it. Every call to this method sets back all vectors,
either to the empty state, if the graphical output is activated or to
null in case of deactivation.
graphout - If true, the graphical output will be
activated, otherwise deactivated.getScorePlotVector(),
getMotifOccurrenceVector()boolean getGraphicalOutput()
true if the graphical output is wished,
false otherwise.setGraphicalOutput(boolean)java.util.Vector getScorePlotVector()
If the graphical output is activated, the operator stores
information for the score plot in this vector. For every score
on the sequence a Integer for the index and a
Double for the score is stored. If the operator
ends the scoring a -1 is stored.
Vector containing score plot data. Ends
with a -1.setGraphicalOutput(boolean),
ScoredSequenceStructjava.util.Vector getMotifOccurrenceVector()
If the graphical output is activated, the operator stores
information of found motifs in this vector. For every motif
found an Integer for the index of the motif in the
motif list and an Integer for its position on the
sequence (negativ for rev/comp) is stored.
Vector containing data about found motifs.setGraphicalOutput(boolean),
FoundMotifStructvoid allowRunning()
void stopRunning()
boolean isRunningAllowed()
true, if the threads are allowed to run,
false if they must stop as soon as possible.void setOutputStream(java.io.PrintStream ps)
PrintStream as new output stream.
For common access to that stream use the method out().
If ps=null the NilOutputStream is set.
ps - The new stream for directing the output to it.out(),
NilOutputStreamvoid setErrorStream(java.io.PrintStream ps)
PrintStream as new error message
output stream.
For common access to that stream use the method err().
If ps=null the NilOutputStream is set.
ps - The new stream for directing the output to it.err(),
NilOutputStreamvoid setVerboseStream(java.io.PrintStream ps)
PrintStream as new verbose message
output stream.
For common access to that stream use the method ver().
If ps=null the NilOutputStream is set.
ps - The new stream for directing the output to it.ver(),
NilOutputStreamjava.io.PrintStream out()
System.out.
setOutputStream(PrintStream)java.io.PrintStream err()
System.err as default.
setErrorStream(PrintStream)java.io.PrintStream ver()
NilOutputStream as default.
setVerboseStream(PrintStream),
NilOutputStreamjava.util.Random rand()
java.util.Random.double random()
void setSeed(long seed)
Randomlong getSeed()
boolean outputForSearchMotifs(IOperator op,
boolean count)
Searches motifs on sequences and generates and prints the appropriate
output. This method uses the given IOperator to start
the searchMotifs(boolean)-method, which will get its
necessary informations from the ICommunicator the given
operator was created with and the parameter count.
The output created and send to comm.out() is the
following. First all motif names are printed, followed by a line
with '//'. Every next line holds one sequence name followed by
the number of occurrences of each motif on that sequence. if
count is true, then the sequence' name is printed
and then for any sequence section the motif's name with its
occurrences within this section.
At the beginning and at the end, some messages are created for
the verbose stream comm.ver(). This messages contains
the time this output method has waited for the thread to finish.
Also an error message is sent to comm.err() if the
thread could not be started.
op - The IOperator to start the method
searchMotifs(boolean) from.count - The method searchMotifs(boolean) get
this value as parameter and it is also used to slightly change the
output sent to comm.out().
false if an error occured and no motifs
were searched, true otherwise.IOperator.searchMotifs(boolean)boolean outputForWeightMotifs(IOperator op)
Weights motifs and generates and prints the appropriate output.
This method uses the given IOperator to call the
weightMotifs()-method, which will get its necessary
informations from the ICommunicator the given operator
was created with.
The output created and sent to comm.out() is the
following. First two matrices are output, one for the positive
training set named 'Raw model fingerprints' and one for the
negative training set named 'Raw background fingerprints'.
Every line (row) stands for a sequence from the corresponding
training set. Within the rows the values (column) correspond
with the motifs and give the occurrences. After both matrices a
block named 'Scores:' follows holding within every line the
motifs name and its calculated weight/score.
At the beginning and at the end, some messages are created for
the verbose stream comm.ver(). This messages contains
the time this output method has waited for the thread to finish.
Also an error message is sent to comm.err() if the
thread could not be started.
op - The IOperator to start the method
weightMotifs() from.
false if an error occured and no motif
was weighted, true otherwise.IOperator.weightMotifs()
boolean outputForScoreSequence(IOperator op,
boolean best)
Scores sequences using weighted motifs and generates and prints the
appropriate output. This method uses the given IOperator
to start the scoreSequence()-method, which will get its
necessary informations from the ICommunicator the given
operator was created with.
For every sequence scored the sequence name in FASTA format is output.
For the sequence window scores itself their are two possible output
mechanisms. If a cutoff other than Double.NaN was set
with the given ICommunicator, the scores are comprised
to bands where each band is maximal in width, does not overlap with
other bands and has scores above the cutoff. For each found band
the output is sequenceCounter: start-end: maximumScore;
minimumScore; meanScore, e.g. 0:700210-701040: 191.3644;
126.2205; 173.7372. If no cutoff was set in the given
ICommunicator or if Double.NaN was set,
each line of the output contains the middle position of a sequence
window together with its score.
At the beginning and at the end, some messages are created for
the verbose stream comm.ver(). This messages contains
the time this output method has waited for the thread to finish.
Also an error message is sent to comm.err() if the
thread could not be started.
op - The IOperator to start the method
weightMotifs() from.best - If true, only the best score for every sequence is
output. Cannot be mixed with a comprised output.
false if an error occured and no sequence
was scored, true otherwise.IOperator.scoreSequence()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||