Package org.openbel.framework.api

Examples of org.openbel.framework.api.KAMStore


        }

        // run orthologize
        Kam kam = kam(kamName);
        KamInfo info = kam.getKamInfo();
        KAMStore kamstore = kamstore();
        Orthologize ortho = new DefaultOrthologize();
        SpeciesDialect dialect = dialect(taxId, info, kamstore);
        OrthologizedKam orthokam = ortho.orthologize(kam, kamstore, dialect);

        // remap collapsing nodes
        kam = kam(kamName);
        info = kam.getKamInfo();
        Map<KamNode, KamNode> collapsed = orthokam.getCollapsedNodes();
        Set<Entry<KamNode, KamNode>> set = collapsed.entrySet();
        for (Entry<KamNode, KamNode> e : set) {
            KamNode collapsing = e.getKey();
            KamNode collapseTo = e.getValue();

            collapsing = kam.findNode(collapsing.getId());
            collapseTo = kam.findNode(collapseTo.getId());
            kamstore.collapseKamNode(info, collapsing, collapseTo);
        }

        // remove orthologous edges/statements
        kamstore.removeKamEdges(info, ORTHOLOGOUS);

        // coalesce duplicate edges
        kamstore.coalesceKamEdges(info);

        // clean up
        kamstore.teardown();
    }
View Full Code Here


        DBConnection c = null;
        try {
            c = db.dbConnection(sc.getKamURL(), sc.getKamUser(),
                    sc.getKamPassword());
            KAMStore store = new KAMStoreImpl(c);
            return store.getKamInfo(kam) != null;
        } catch (SQLException e) {
            return false;
        } finally {
            if (c != null) {
                c.close();
View Full Code Here

        DBConnection c = null;
        try {
            c = db.dbConnection(sc.getKamURL(), sc.getKamUser(),
                    sc.getKamPassword());
            KAMStore store = new KAMStoreImpl(c);
            return store.getKam(kam);
        } catch (SQLException e) {
            return null;
        } finally {
            if (c != null) {
                c.close();
View Full Code Here

        DBConnection dbConnection = dbservice.dbConnection(
                sysconfig.getKamURL(),
                sysconfig.getKamUser(),
                sysconfig.getKamPassword());

        KAMStore kAMStore = new KAMStoreImpl(dbConnection);

        // See if we need to set up the KAM Store schemas
        final KAMStoreSchemaService kamSchemaService =
                new KAMStoreSchemaServiceImpl(dbservice);

        // Load the KAM catalog schema, if it doesn't exist (see #88).
        kamSchemaService.setupKAMCatalogSchema();

        try {
            if (mode == Mode.LIST) {
                List<KamInfo> kamInfos = kAMStore.getCatalog();
                printKamCatalogSummary(kamInfos);

            } else if (mode == Mode.COMPARE) {
                final KamComparisonXHTMLWriter xhtmlWriter =
                        createOutputFileWriter();

                final String[] kamNames = new String[] { kam1Name, kam2Name };

                // Get the KAM catalog information for each KAM.
                final KamInfo[] kamInfos = new KamInfo[kamNames.length];
                for (int i = 0; i < kamNames.length; ++i) {
                    final KamInfo kamInfo = kAMStore.getKamInfo(kamNames[i]);
                    if (kamInfo == null) {
                        reportable.error("No KAM found with name '"
                                + kamNames[i] + "'");
                        bail(ExitCode.GENERAL_FAILURE);
                    }
                    kamInfos[i] = kamInfo;
                }

                // Create the KamComparison that will be displayed and/or written to the
                // output file.
                final KamComparison cmp = new KamComparison(kamNames);
                for (KamInfo kamInfo : kamInfos) {
                    final String kamName = kamInfo.getName();
                    final KAMStoreStatisticsDaoImpl dao =
                            new KAMStoreStatisticsDaoImpl(
                                    kamInfo.getKamDbObject().getSchemaName(),
                                    dbConnection);

                    cmp.setKamNodeCount(kamName, dao.getKamNodeCount());
                    cmp.setKamEdgeCount(kamName, dao.getKamEdgeCount());
                    cmp.setBELDocumentCount(kamName, dao.getBELDocumentCount());
                    cmp.setNamespaceCount(kamName, dao.getNamespaceCount());
                    cmp.setAnnotationDefinitionCount(kamName,
                            dao.getAnnotationDefinitonCount());
                    cmp.setAnnotationCount(kamName, dao.getAnnotationCount());
                    cmp.setStatementCount(kamName, dao.getStatementCount());
                    cmp.setTermCount(kamName, dao.getTermCount());
                    cmp.setParameterCount(kamName, dao.getParameterCount());
                    cmp.setUniqueParameterCount(kamName,
                            dao.getUniqueParameterCount());
                }

                // Write to stdout.
                writeComparison(cmp);

                // Write the output to the output file.
                if (xhtmlWriter != null) {
                    xhtmlWriter.writeKamComparison(cmp);
                    xhtmlWriter.close();
                }
            }
        } finally {
            kAMStore.teardown();
            dbConnection.getConnection().close();
        }
    }
View Full Code Here

TOP

Related Classes of org.openbel.framework.api.KAMStore

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.