INNER CODE UNIT · Python
machine
pybel/pybel · src/pybel/cli.py:384
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(f"got {len(statements)} statements from INDRA")
graph = from_indra_statements(
statements,
name="INDRA Machine for {}".format(", ".join(sorted(agents))),
version=time.strftime("%Y%m%d"),
)
click.echo(f"built BEL graph with {graph.number_of_nodes()} nodes and {graph.number_of_edges()} edges")
if 0 == len(graph):
click.echo("not uploading empty graph")