|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.util.jep.ChannelFunction
public class ChannelFunction
A JEP function class that adds a ch(int)
function to a
JEP expression parser. The function will look up the intensity value for the
given channel. For example: ch(1) / ch(2)
Note! If the current bioassay set has stored transformed intensity values,
the values are un-transformed before returned by the this function.
Use RawChannelFunction
if you need the raw values exactly
as they are stored in the database.
To be able to use this function it must be registered with the JEP
parser and, before the expression is evaluated, a SqlResult
object must be set.
For example we can evaluate an expression for every position in a bioassay:
DbControl dc = ... BioAssay assay = ... String expression = "ch(1) / ch(2)"; ChannelFunction ch = new ChannelFunction({3, 4}); JEP jep = JepUtil.newJep(expression, ch); DynamicResultIterator result = assay.getSpotData().iterate(dc); while (result.hasNext()) { ch.setSqlResult(result.next()); double value = jep.getValue(); // Do something with the value } result.close();
Jep
,
BioAssaySetUtil.createJepExpression(DbControl, String, DynamicQuery)
Field Summary | |
---|---|
private int[] |
channelToIndex
|
private int |
numParameters
|
private SqlResult |
result
|
private IntensityTransform |
transform
|
Constructor Summary | |
---|---|
ChannelFunction()
Create a new instance of this function. |
|
ChannelFunction(int[] channelToIndex)
Deprecated. In 2.12. Use ChannelFunction(int[], IntensityTransform)
instead. Using this constructor will disable the untransformation
of transformed values when JEP dynamic evalution is used. |
|
ChannelFunction(int[] channelToIndex,
IntensityTransform transform)
Create a new instance of this function which can be used to dynamically evaluate expressions. |
Method Summary | |
---|---|
Object |
channel(int channel)
Get the value of the specified channel of the current sql result. |
boolean |
checkNumberOfParameters(int n)
|
String |
getFunctionName()
Get the name of this function. |
int |
getNumberOfParameters()
|
void |
run(Stack stack)
|
void |
setCurNumberOfParameters(int n)
|
void |
setSqlResult(SqlResult result)
Set a new SqlResult object that will be used the next time the
JEP expression is evaluated. |
Expression |
toExpression(Node node)
Use the Dynamic.column(VirtualColumn) method to create an
expression referencing a channel intensity. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int[] channelToIndex
private IntensityTransform transform
private SqlResult result
private int numParameters
Constructor Detail |
---|
public ChannelFunction()
Expression
:s.
Jep.formulaToExpression(String, JepFunction[])
public ChannelFunction(int[] channelToIndex)
ChannelFunction(int[], IntensityTransform)
instead. Using this constructor will disable the untransformation
of transformed values when JEP dynamic evalution is used.
public ChannelFunction(int[] channelToIndex, IntensityTransform transform)
channelToIndex
- An array that maps channel numbers to column indexes in
the SqlResult, array position 0 maps the index of channel number 1, etc.setSqlResult(SqlResult)
Method Detail |
---|
public String getFunctionName()
JepFunction
JEP
parser.
getFunctionName
in interface JepFunction
JEP.addFunction(String, PostfixMathCommandI)
public Expression toExpression(Node node)
Dynamic.column(VirtualColumn)
method to create an
expression referencing a channel intensity.
toExpression
in interface JepExpressionFunction
node
- The node representing this function
Expression
objectpublic int getNumberOfParameters()
getNumberOfParameters
in interface org.nfunk.jep.function.PostfixMathCommandI
public void setCurNumberOfParameters(int n)
setCurNumberOfParameters
in interface org.nfunk.jep.function.PostfixMathCommandI
public boolean checkNumberOfParameters(int n)
checkNumberOfParameters
in interface org.nfunk.jep.function.PostfixMathCommandI
public void run(Stack stack) throws ParseException
run
in interface org.nfunk.jep.function.PostfixMathCommandI
ParseException
public void setSqlResult(SqlResult result)
SqlResult
object that will be used the next time the
JEP expression is evaluated.
result
- The result objectpublic Object channel(int channel) throws ParseException
channel
- The channel number
ParseException
- Either if it's an invalid channel number or
if no result object has been specified.
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |