def test_print_cyjs_graph(): cja = CyJSAssembler() cja.add_statements([st_act, st_act2]) cja.make_model() cyjs_str = cja.print_cyjs_graph() # assert output is not empty assert len(cyjs_str) > len('{\n "edges": [],\n "nodes": []\n}')
def test_print_cyjs_graph(): cja = CyJSAssembler() cja.add_statements([st_act, st_act2]) cja.make_model() cyjs_str = cja.print_cyjs_graph() # assert output is not empty assert len(cyjs_str) > len('{\n "edges": [],\n "nodes": []\n}')
def assemble_cyjs(): """Assemble INDRA Statements and return Cytoscape JS network.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_json = body.get('statements') stmts = stmts_from_json(stmts_json) cja = CyJSAssembler() cja.add_statements(stmts) cja.make_model(grouping=True) model_str = cja.print_cyjs_graph() return model_str
def assemble_cyjs(): """Assemble INDRA Statements and return Cytoscape JS network.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_json = body.get('statements') stmts = stmts_from_json(stmts_json) cja = CyJSAssembler() cja.add_statements(stmts) cja.make_model(grouping=True) model_str = cja.print_cyjs_graph() return model_str
def post(self): """Assemble INDRA Statements and return Cytoscape JS network. Parameters ---------- statements : list[indra.statements.Statement.to_json()] A list of INDRA Statements to assemble. Returns ------- json_model : dict Json dictionary containing graph information. """ args = request.json stmts_json = args.get('statements') stmts = stmts_from_json(stmts_json) cja = CyJSAssembler(stmts) cja.make_model(grouping=True) model_str = cja.print_cyjs_graph() return json.loads(model_str)