Package org.openbel.framework.common.model

Examples of org.openbel.framework.common.model.Term


            //   - get uuid for each parameter; ordered by sequence (l to r)
            //   - (x) if no match, attempt non-equivalence query
            //   - find kam node by term signature / uuids

            // parse the bel term
            Term term = null;
            try {
                term = BELParser.parseTerm(belTerm);
                if (term == null) return null;
            } catch (Exception e) {
                // unrecognized BEL structure
                return null;
            }

            // get all parameters; remap to kam namespace by prefix
            List<Parameter> params = term.getAllParametersLeftToRight();
            remapNamespace(params, nsmap);

            // convert bel term to signature
            String termSignature = term.toTermSignature();

            // find uuids for all parameters; bucket both the mapped and
            // unmapped namespace values
            SkinnyUUID[] uuids = new SkinnyUUID[params.size()];
            Parameter[] parray = params.toArray(new Parameter[params.size()]);
            boolean missing = false;
            for (int i = 0; i < parray.length; i++) {
                Parameter param = parray[i];
                Namespace ns = param.getNamespace();
                if (ns == null) {
                    missing = true;
                    break;
                }

                String value = clean(param.getValue());

                SkinnyUUID uuid = null;
                try {
                    uuid = equivalencer.getUUID(ns, value);
                } catch (EquivalencerException e) {
                    throw new ResolverException(e);
                }

                if (uuid != null && !kAMStore.getKamNodes(kam, uuid).isEmpty()) {
                    uuids[i] = uuid;
                } else {
                    missing = true;
                    break;
                }
            }

            // TODO Handle terms that may not have UUID parameters!
            if (missing) {
                KamNode kamNode = kAMStore.getKamNode(kam, belTerm);
                return kamNode;
            }

            // find kam node by term signature / uuids
            return kAMStore.getKamNodeForTerm(kam, termSignature,
                    term.getFunctionEnum(), uuids);
        } catch (KAMStoreException e) {
            throw new ResolverException(e);
        }
    }
View Full Code Here


    }

    public KamBuilder addNodes(final String... nodes) {
        if (hasItems(nodes)) {
            for (final String n : nodes) {
                final Term term = BELParser.parseTerm(n);
                final String bel = getBEL(term);
                knodes.put(bel, new TestKamNode(knodes.size(), term
                        .getFunctionEnum(), bel));
            }
        }

        return this;
View Full Code Here

        // 1: read number of terms
        final int size = in.readInt();
        indexedTerms = sizedHashMap(size);
        for (int i = 0; i < size; ++i) {
            // 1: read each term
            final Term term = (Term) in.readObject();
            addTerm(term);
        }

        // 2: read number of global terms
        int gtisize = in.readInt();
View Full Code Here

            label = kamNode.getLabel();
            try {
                List<BelTerm> terms = kAMStore.getSupportingTerms(kamNode);
                if (!terms.isEmpty()) {
                    BelTerm bt = terms.get(0);
                    Term t = BELParser.parseTerm(bt.getLabel());
                    label = displayLongForm ? t.toBELLongForm() : t
                            .toBELShortForm();
                }
            } catch (Exception e) {
                // TODO exception
            }
View Full Code Here

public class BELStatementParserTest {

    @Test
    public void testOneParam() {
        Term term = BELParser.parseTerm("proteinAbundance(HGNC:AKT1)");
        System.out.println(term.toBELLongForm());
    }
View Full Code Here

        System.out.println(term.toBELLongForm());
    }

    @Test
    public void testMultipleParams() {
        Term term =
                BELParser
                        .parseTerm("list(HGNC:AKT1,HGNC:AKT2,GO:\"mito moto\")");
        System.out.println(term.toBELLongForm());
    }
View Full Code Here

        System.out.println(term.toBELLongForm());
    }

    @Test
    public void testMultipleInnerTerms() {
        Term term =
                BELParser
                        .parseTerm("complexAbundance(proteinAbundance(HGNC:AKT1),proteinAbundance(HGNC:AKT2),abundance(CHEBI:TLH21))");
        System.out.println(term.toBELLongForm());
    }
View Full Code Here

        System.out.println(term.toBELLongForm());
    }

    @Test
    public void testFunctionThenParams() {
        Term term =
                BELParser
                        .parseTerm("translocation(proteinAbundance(HGNC:DIABLO),GO:mitochondrion,GO:cytoplasm)");
        System.out.println(term.toBELLongForm());
    }
View Full Code Here

        System.out.println(term.toBELLongForm());
    }

    @Test
    public void testEmptyModifcation() {
        Term term =
                BELParser
                        .parseTerm("proteinAbundance(HGNC:MAP3K1,modification())");
        System.out.println(term.toBELLongForm());
    }
View Full Code Here

        System.out.println(term.toBELLongForm());
    }

    @Test
    public void testAminoAcidModifcation() {
        Term term =
                BELParser
                        .parseTerm("proteinAbundance(HGNC:MAP3K1,modification(P))");
        System.out.println(term.toBELLongForm());
    }
View Full Code Here

TOP

Related Classes of org.openbel.framework.common.model.Term

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.