Peptide/Peak Conditions
Overview
This object is a wrapper over ConditionInterpreter and Condition on a PeptideType. It interpretes string expression over peptide type conditions. Each peptide type condition is defined as specific internal names (a, b, c, x, y, z, i or p). Here is the grammar below:
EXPR := COND | UOP EXPR | COND BOP EXPR COND := MPT_COND{1,2} | SPT_COND UOP := "!" BOP := "&" | "|" MPT_COND := "a" | "b" | "c" | "x" | "y" | "z" SPT_COND := "p" | "i"
with the following term definitions:
- BOP
- Binary Operator
- UOP
- Unary Operator
- MPT_COND
- Multiple Peptide Type Condition
- SPT_COND
- Single Peptide Type Condition
Example I
Condition<PeptideType> condition = new PeptideTypeCondition.Builder<PeptideType>("b & !y").build(); PeptideType pepType = PeptideType.getInstance(TerminusTypeImpl.TypeN.FRAG_Y, TerminusTypeImpl.TypeC.FRAG_B); Assert.assertTrue(condition.isFalse(pepType));
Warning
Any object can be tested in the condition whenever an instance of
PeptideType is reachable from that object through a Transformer
given a stub method of the condition builder:
Example II
import import org.apache.commons.collections15.Transformer; // the peptide to test type on Peptide peptide = new Peptide.Builder("ARHBRH") .nterm(TerminusTypeImpl.TypeN.FRAG_X).cterm(TerminusTypeImpl.TypeC.FRAG_B).build() // lead to peptide's type Transformer<Peptide, PeptideType> toPepType = new Transformer<Peptide, PeptideType>() { public PeptideType transform(Peptide peptide) { return peptide.getPeptideType(); } }; // create the condition Condition<Peptide> cond = new PeptideTypeCondition.Builder<Peptide>("b|y") .accessor(toPepType).build(); // testing conditions on peptides Assert.assertTrue(cond.isTrue(peptide));
[See also ConditionInterpreter]