Package org.openbel.framework.common.enums

Examples of org.openbel.framework.common.enums.FunctionEnum


                    e.printStackTrace();
                    close();
                    return null;
                }
                int id = kpn.getId();
                FunctionEnum fx = kpn.getFunctionType();
                String lbl = kpn.getLabel();
                _KamNode node = new _KamNode(id, fx, lbl);
                return node;
            }
View Full Code Here


                    e.printStackTrace();
                    close();
                    return null;
                }
                int id = kpn.getId();
                FunctionEnum fx = kpn.getFunctionType();
                String lbl = kpn.getLabel();
                _KamNode node = new _KamNode(id, fx, lbl);
                return node;
            }
View Full Code Here

        if (!(o instanceof EquivalentTerm)) {
            return false;
        }
        EquivalentTerm e = (EquivalentTerm) o;

        FunctionEnum f = getFunctionEnum();
        if (f != e.getFunctionEnum()) {
            return false;
        }

        List<BELObject> myargs = getFunctionArguments();
        List<BELObject> otherargs = e.getFunctionArguments();
        if (myargs == null) {
            if (otherargs != null) {
                return false;
            }
            return true;
        }

        if (myargs.size() != otherargs.size()) {
            return false;
        }

        if (f.isSequential()) {
            return myargs.equals(otherargs);
        }

        // Non-sequential functions can be equivalent with each other as long
        // as they have the same set of arguments. Order is not important.
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    public void checkParameterizedTerm(final Term term) throws SemanticWarning {
        final FunctionEnum funcEnum = term.getFunctionEnum();

        // Construct the signature
        final StringBuilder bldr = new StringBuilder();
        bldr.append(funcEnum.getDisplayValue());
        bldr.append("(");

        List<BELObject> functionArguments = term.getFunctionArguments();
        if (hasItems(functionArguments)) {
            for (int i = 0; i < functionArguments.size(); i++) {
                final BELObject bo = functionArguments.get(i);

                String arg = null;
                if (bo instanceof Parameter) {
                    arg = processParameter((Parameter) bo);
                } else if (bo instanceof Term) {
                    arg = processTerm((Term) bo);
                    if (arg == null) continue;
                } else {
                    String type = bo.getClass().getName();
                    final String err = "unknown function argument " + type;
                    throw new UnsupportedOperationException(err);
                }
                if (i != 0) bldr.append(",");
                bldr.append(arg);
            }
        }
        bldr.append(")");
        bldr.append(funcEnum.getReturnType().getDisplayValue());

        Signature sig = null;
        try {
            sig = new Signature(bldr.toString());
        } catch (InvalidArgument e) {
            final String lf = term.toBELLongForm();
            final String err = e.getMessage();
            throw new SemanticWarning(lf, err);
        }

        final Function function = funcEnum.getFunction();

        if (!function.validSignature(sig)) {
            final Map<Signature, SemanticStatus> map = function.getStatus(sig);
            final String lf = term.toBELLongForm();
            final String err = format(SEMANTIC_TERM_FAILURE, lf);
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    public void checkTerm(final Term term) throws SemanticWarning {
        final FunctionEnum funcEnum = term.getFunctionEnum();

        // Construct the signature
        final StringBuilder bldr = new StringBuilder();
        bldr.append(funcEnum.getDisplayValue());
        bldr.append("(");

        List<BELObject> functionArguments = term.getFunctionArguments();
        if (hasItems(functionArguments)) {
            for (int i = 0; i < functionArguments.size(); i++) {
                final BELObject bo = functionArguments.get(i);

                String arg = null;
                if (bo instanceof Term) {
                    arg = processTerm((Term) bo);
                    if (arg == null) continue;
                } else {
                    String type = bo.getClass().getName();
                    final String err = "unhandled function argument " + type;
                    throw new UnsupportedOperationException(err);
                }
                if (i != 0) bldr.append(",");
                bldr.append(arg);
            }
        }
        bldr.append(")");
        bldr.append(funcEnum.getReturnType().getDisplayValue());

        Signature sig = null;
        try {
            sig = new Signature(bldr.toString());
        } catch (InvalidArgument e) {
            final String lf = term.toBELLongForm();
            final String err = e.getMessage();
            throw new SemanticWarning(lf, err);
        }

        final Function function = funcEnum.getFunction();

        if (!function.validSignature(sig)) {
            final Map<Signature, SemanticStatus> map = function.getStatus(sig);
            final String lf = term.toBELLongForm();
            final String err = format(SEMANTIC_TERM_FAILURE, lf);
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    public List<SemanticWarning> checkAbundanceSubsets(final Term term) {
        final FunctionEnum fe = term.getFunctionEnum();
        if (fe != PROTEIN_ABUNDANCE && fe != GENE_ABUNDANCE
                && fe != RNA_ABUNDANCE) {
            return emptyList();
        }

View Full Code Here

        }
        return ret;
    }

    private List<SemanticWarning> checkAbundanceSubset(final Term term) {
        final FunctionEnum fe = term.getFunctionEnum();
        if (fe == PROTEIN_MODIFICATION) {
            return checkPModification(term);
        } else if (fe == SUBSTITUTION) {
            return checkPSubstitution(term);
        } else if (fe == TRUNCATION) {
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean match(Term term) {
        FunctionEnum fx = term.getFunctionEnum();
        if (fx != PROTEIN_ABUNDANCE) {
            // Protein abundance functions only
            return false;
        }

View Full Code Here

        // second argument of a protein mod term is the modification
        BELObject modArgument = term.getFunctionArguments().get(1);
        Term mt = (Term) modArgument;

        FunctionEnum fx = mt.getFunctionEnum();

        Term proteinTrm = new Term(PROTEIN_ABUNDANCE);
        proteinTrm.addFunctionArgument(pp);

        Statement stmt = null;
View Full Code Here

        /**
         * {@inheritDoc}
         */
        @Override
        public EquivalentTerm convert(Term src) {
            FunctionEnum f = src.getFunctionEnum();

            final List<BELObject> args = new ArrayList<BELObject>();

            List<BELObject> srcArgs = src.getFunctionArguments();
            if (noItems(srcArgs)) {
View Full Code Here

TOP

Related Classes of org.openbel.framework.common.enums.FunctionEnum

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.