예제 #1
0
def draw_graph(stmts, fname):
    graphpr = {'rankdir': 'TD'}
    nodepr = {'fontsize': 12, 'shape': 'plaintext', 'margin': '0,0', 'pad': 0}
    ga = GraphAssembler(stmts,
                        graph_properties=graphpr,
                        node_properties=nodepr)
    ga.make_model()
    ga.save_dot('%s.dot' % fname)
    ga.save_pdf('%s.pdf' % fname)
예제 #2
0
def test_save_dot():
    st = [Phosphorylation(Agent('MAP2K1'), Agent('MAPK1'))]
    ga = GraphAssembler()
    ga.add_statements(st)
    ga.make_model()
    ga.save_dot('/dev/null')
예제 #3
0
def test_save_dot():
    st = [Phosphorylation(Agent('MAP2K1'), Agent('MAPK1'))]
    ga = GraphAssembler()
    ga.add_statements(st)
    ga.make_model()
    ga.save_dot('/dev/null')
예제 #4
0
import sys
import pickle
from indra import reach
from indra.assemblers import GraphAssembler

txt = open('extension.txt', 'rt').read()
rp = reach.process_text(txt, offline=True)
st = rp.statements
for s in st:
    print '%s\t%s' % (s, s.evidence[0].text)

with open('extension.pkl', 'wb') as fh:
    pickle.dump(st, fh)

graphpr = {'rankdir': 'TD'}
nodepr = {'fontsize': 12, 'shape': 'plaintext', 'margin': '0,0', 'pad': 0}
ga = GraphAssembler(st, graph_properties=graphpr, node_properties=nodepr)
ga.make_model()
ga.save_dot('jnk_extension.dot')
ga.save_pdf('jnk_extension.pdf')
예제 #5
0
import sys
import pickle
from indra import reach
from indra.assemblers import GraphAssembler

if len(sys.argv) < 2:
    process_type = 'text'
else:
    process_type = sys.argv[1]

if process_type == 'text':
    txt = open('ras_pathway.txt', 'rt').read()
    rp = reach.process_text(txt, offline=True)
    st = rp.statements
elif process_type == 'json':
    rp = reach.process_json_file('reach_output.json')
    st = rp.statements
else:
    st = pickle.load(open('statements.pkl', 'rb'))
for s in st:
    print '%s\t%s' % (s, s.evidence[0].text)

graphpr = {'rankdir': 'TD'}
nodepr = {'fontsize': 12, 'shape': 'plaintext', 'margin': '0,0', 'pad': 0}
ga = GraphAssembler(st, graph_properties=graphpr, node_properties=nodepr)
ga.make_model()
ga.save_dot('ras_pathway.dot')
ga.save_pdf('ras_pathway.pdf')
예제 #6
0
import sys
from indra import reach
from indra.assemblers import GraphAssembler

orig_txt = [ln.strip() for ln in open('ras_pathway.txt', 'rt').readlines()]
correct_txt = [ln.strip() for ln in open('correction.txt', 'rt').readlines()]

for ln in correct_txt:
    if ln.startswith('<'):
        remove_line = ln[2:]
        orig_txt.remove(remove_line)
    elif ln.startswith('>'):
        add_line = ln[2:]
        orig_txt.append(add_line)

txt = ' '.join(orig_txt)

rp = reach.process_text(txt, offline=True)
st = rp.statements
for s in st:
    print '%s\t%s' % (s, s.evidence[0].text)

graphpr = {'rankdir': 'TD'}
nodepr = {'fontsize': 12, 'shape': 'plaintext', 'margin': '0,0', 'pad': 0}
ga = GraphAssembler(st, graph_properties=graphpr, node_properties=nodepr)
ga.make_model()
ga.save_dot('rps6ka_correction.dot')
ga.save_pdf('rps6k1_correction.pdf')