def process_belrdf(rdf_filename): # Parse the RDF g = rdflib.Graph() g.parse(rdf_filename, format='nt') # Build BelPy statements from RDF bp = BelProcessor(g) bp.get_complexes() bp.get_activating_subs() bp.get_modifications() bp.get_dephosphorylations() bp.get_activating_mods() bp.get_composite_activating_mods() bp.get_activity_activity() # Print some output about the process bp.print_statement_coverage() print "\n--- Converted BelPy Statements -------------" bp.print_statements() return bp
def process_belrdf(rdf_str): # Parse the RDF g = rdflib.Graph() g.parse(data=rdf_str, format='nt') # Build BelPy statements from RDF bp = BelProcessor(g) bp.get_complexes() bp.get_activating_subs() bp.get_modifications() bp.get_dephosphorylations() bp.get_activating_mods() bp.get_composite_activating_mods() bp.get_activity_activity() # Print some output about the process bp.print_statement_coverage() print "\n--- Converted BelPy Statements -------------" bp.print_statements() return bp
def process_belrdf(rdf_str): """Return a BelProcessor for a BEL/RDF string. Parameters ---------- rdf_str : str A BEL/RDF string to be processed. This will usually come from reading a .rdf file. Returns ------- bp : BelProcessor A BelProcessor object which contains INDRA Statements in bp.statements. Notes ----- This function calls all the specific get_type_of_mechanism() functions of the newly constructed BelProcessor to extract INDRA Statements. """ g = rdflib.Graph() try: g.parse(data=rdf_str, format="nt") except ParseError: logger.error("Could not parse rdf.") return None # Build INDRA statements from RDF bp = BelProcessor(g) bp.get_complexes() bp.get_activating_subs() bp.get_modifications() bp.get_dephosphorylations() bp.get_activating_mods() bp.get_composite_activating_mods() bp.get_activation() # Print some output about the process bp.print_statement_coverage() logger.debug("\n--- Converted INDRA Statements -------------") bp.print_statements() return bp