src/pybel/cli.py
def machine(manager: Manager, agents: List[str], local: bool, host: str):
    """Get content from the INDRA machine and upload to BEL Commons."""
    from indra.sources import indra_db_rest
    from pybel import from_indra_statements

    statements = indra_db_rest.get_statements(agents=agents)
    click.echo('got {} statements from INDRA'.format(len(statements)))

    graph = from_indra_statements(
        statements,
        name='INDRA Machine for {}'.format(', '.join(sorted(agents))),
        version=time.strftime('%Y%m%d'),
    )
    click.echo('built BEL graph with {} nodes and {} edges'.format(graph.number_of_nodes(), graph.number_of_edges()))

    if 0 == len(graph):
        click.echo('not uploading empty graph')
        sys.exit(-1)

    if local:
        to_database(graph, manager=manager)
    else:
        resp = to_bel_commons(graph, host=host)
        resp.raise_for_status()
Get content from the INDRA machine and upload to BEL Commons.
Get content from the INDRA machine and upload to BEL Commons.
Get content from the INDRA machine and upload to BEL Commons .
def machine(manager: Manager, agents: List[str], local: bool, host: str):
    from indra.sources import indra_db_rest
    from pybel import from_indra_statements
    statements = indra_db_rest.get_statements(agents=agents)
    click.echo('got {} statements from INDRA'.format(len(statements)))
    graph = from_indra_statements(
        statements,
        name='INDRA Machine for {}'.format(', '.join(sorted(agents))),
        version=time.strftime('%Y%m%d'),
    )
    click.echo('built BEL graph with {} nodes and {} edges'.format(graph.number_of_nodes(), graph.number_of_edges()))
    if 0 == len(graph):
        click.echo('not uploading empty graph')
        sys.exit(-1)
    if local:
        to_database(graph, manager=manager)
    else:
        resp = to_bel_commons(graph, host=host)
        resp.raise_for_status()
def machine ( manager : Manager , agents : List [ str ] , local : bool , host : str ) : from indra . sources import indra_db_rest from pybel import from_indra_statements statements = indra_db_rest . get_statements ( agents = agents ) click . echo ( 'got {} statements from INDRA' . format ( len ( statements ) ) ) graph = from_indra_statements ( statements , name = 'INDRA Machine for {}' . format ( ', ' . join ( sorted ( agents ) ) ) , version = time . strftime ( '%Y%m%d' ) , ) click . echo ( 'built BEL graph with {} nodes and {} edges' . format ( graph . number_of_nodes ( ) , graph . number_of_edges ( ) ) ) if 0 == len ( graph ) : click . echo ( 'not uploading empty graph' ) sys . exit ( - 1 ) if local : to_database ( graph , manager = manager ) else : resp = to_bel_commons ( graph , host = host ) resp . raise_for_status ( )
Get content from the INDRA machine and upload to BEL Commons.
Get content from the INDRA machine and upload to BEL Commons .
"""Get content from the INDRA machine and upload to BEL Commons."""
manager
Manager
agents
List[str]
local
bool
host
str