def bel_process_belrdf(): """Process BEL RDF and return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) belrdf = body.get('belrdf') bp = bel.process_belrdf(belrdf) return _stmts_from_proc(bp)
def test_get_transcription(): print("Opening file") with open(test_rdf_myc, 'rt') as fh: rdf_str_myc = fh.read() print("Process BEL RDF") bp = bel.process_belrdf(rdf_str_myc) transcription_stmts = [] for stmt in bp.statements + bp.indirect_stmts: if isinstance(stmt, RegulateAmount): transcription_stmts.append(stmt) assert len(transcription_stmts) == 8 pass
def bel_process_belrdf(): """Process BEL RDF and return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) belrdf = body.get('belrdf') bp = bel.process_belrdf(belrdf) if bp and bp.statements: stmts = stmts_to_json(bp.statements) res = {'statements': stmts} return res else: res = {'statements': []} return res
def post(self): """Process BEL RDF and return INDRA Statements. Parameters ---------- belrdf : str A BEL/RDF string to be processed. This will usually come from reading a .rdf file. Returns ------- statements : list[indra.statements.Statement.to_json()] A list of extracted INDRA Statements. """ args = request.json belrdf = args.get('belrdf') bp = bel.process_belrdf(belrdf) return _stmts_from_proc(bp)
def test_process_belrdf(): with open(test_rdf_nfkb, 'rb') as fh: rdf_str_nfkb = fh.read().decode('utf-8') bp = bel.process_belrdf(rdf_str_nfkb) assert_pmids(bp.statements) unicode_strs(bp.statements)
sdict[s]=None return mon(sdict) def add_initial(model, pattern, value): """Add initial condition; if an initial condition for this pattern already exists, override it.""" complex_pattern = pysb.as_complex_pattern(pattern) for other_cp, other_value in model.initial_conditions: if complex_pattern.is_equivalent_to(other_cp): model.initial_conditions.remove((other_cp, other_value)) model.initial(complex_pattern, value) # Generate model rules via indra pa = PysbAssembler() bp = bel.process_belrdf('RAS_combined.rdf') pa.add_statements(bp.statements) model = pa.make_model(initial_conditions=False) # Useful shortcuts to access model components m = model.monomers p = model.parameters # Add ligand to the model model.add_component(Monomer('EGF')) model.add_component(Parameter('kf_ee_act', 1e-6)) model.add_component( Rule('EGF_activates_EGFR', m['EGF']() + m['EGFR']({'Kinase':'inactive'}) >> m['EGF']() + m['EGFR']({'Kinase':'active'}), p['kf_ee_act']))