Exemplo n.º 1
0
def post(graph, service=None):
    """Sends a graph to the receiver service and returns the :mod:`requests` response object
    
    :param pybel.BELGraph graph: A BEL graph
    :param str service: The location of the PyBEL web server. Defaults to :data:`DEFAULT_SERVICE_URL`
    :return: The response object from :mod:`requests` 
    :rtype: requests.Response
    """
    service = DEFAULT_SERVICE_URL if service is None else service
    url = service + url_for('receive')
    headers = {'content-type': 'application/json'}
    return requests.post(url, json=to_json(graph), headers=headers)
Exemplo n.º 2
0
def assemble_pybel(stmts, out_file_prefix):
    """Return a PyBEL Assembler"""
    stmts = ac.filter_belief(stmts, 0.95)
    stmts = ac.filter_top_level(stmts)

    pba = PybelAssembler(stmts,
                         name='INDRA/REACH Korkut Model',
                         description='Automatically assembled model of '
                         'cancer signaling.',
                         version='0.0.10')
    pba.make_model()
    pybel.to_bel_path(pba.model, out_file_prefix + '.bel')
    with open(out_file_prefix, 'wt') as f:
        pybel.to_json_file(pba.model, f)
    url = 'https://pybel.scai.fraunhofer.de/api/receive'
    headers = {'content-type': 'application/json'}
    requests.post(url, json=pybel.to_json(pba.model), headers=headers)
Exemplo n.º 3
0
 def test_slushy_json(self):
     graph_json = to_json(self.slushy_graph)
     graph = from_json(graph_json)
     self.bel_slushy_reconstituted(graph)
Exemplo n.º 4
0
 def test_thorough_json(self):
     graph_json_dict = to_json(self.thorough_graph)
     graph = from_json(graph_json_dict)
     self.bel_thorough_reconstituted(graph)
Exemplo n.º 5
0
 def test_thorough_json(self):
     graph_json_dict = to_json(sialic_acid_graph)
     graph = from_json(graph_json_dict)
     self.help_test_equal(graph)
Exemplo n.º 6
0
    ActiveForm(elk1_p, 'transcription', True),
    IncreaseAmount(elk1_tscript, fos),
    Conversion(hk1, [glu], [g6p]),
    Complex([egfr, grb2, sos1]),
    Autophosphorylation(p38_tab1, 'Y', '100'),
    Transphosphorylation(egfr_dimer, 'Y', '1173'),
]

ev = Evidence('assertion', 'assertion', 'assertion', 'assertion')
for stmt in stmts:
    stmt.evidence = [ev]

model_description = 'Test of INDRA Statement assembly into PyBEL.'
print("Assembling to PyBEL...")

pba = PybelAssembler(stmts,
                     name='INDRA_PyBEL_test',
                     description=model_description,
                     version='0.0.22')
belgraph = pba.make_model()

# Write to BEL file
pybel.to_bel_path(belgraph, 'simple_pybel.bel')

# Upload to PyBEL web
with open('pybel_model.json', 'wt') as f:
    pybel.to_json_file(pba.model, f)
url = 'https://pybel.scai.fraunhofer.de/api/receive'
headers = {'content-type': 'application/json'}
requests.post(url, json=pybel.to_json(pba.model), headers=headers)
Exemplo n.º 7
0
 def test_thorough_json(self):
     """Test the round-trip through node-link JSON."""
     graph_json_dict = to_json(sialic_acid_graph)
     graph = from_json(graph_json_dict)
     self.help_test_equal(graph)