biocypher.BioCypher
- class biocypher.BioCypher(dbms: str = None, offline: bool = None, strict_mode: bool = None, biocypher_config_path: str = None, schema_config_path: str = None, head_ontology: dict = None, tail_ontologies: dict = None, output_directory: str = None, cache_directory: str = None, db_name: str = None)
Orchestration of BioCypher operations.
Instantiate this class to interact with BioCypher.
Args:
- dbms (str): The database management system to use. For supported
systems see SUPPORTED_DBMS.
- offline (bool): Whether to run in offline mode. In offline mode
the Knowledge Graph is written to files. In online mode, it is written to a database or hold in memory.
- strict_mode (bool): Whether to run in strict mode. If True, the
translator will raise an error if a node or edge does not provide source, version, and licence information.
biocypher_config_path (str): Path to the BioCypher config file.
- schema_config_path (str): Path to the user schema config
file.
- head_ontology (dict): The head ontology defined by URL (‘url’) and root
node (‘root_node’).
- tail_ontologies (dict): The tail ontologies defined by URL and
join nodes for both head and tail ontology.
- output_directory (str): Path to the output directory. If not
provided, the default value ‘biocypher-out’ will be used.
cache_directory (str): Path to the cache directory.
- __init__(dbms: str = None, offline: bool = None, strict_mode: bool = None, biocypher_config_path: str = None, schema_config_path: str = None, head_ontology: dict = None, tail_ontologies: dict = None, output_directory: str = None, cache_directory: str = None, db_name: str = None)
Methods
__init__
([dbms, offline, strict_mode, ...])add
(entities)Add entities to the in-memory database.
add_edges
(edges)Add new edges to the internal representation.
add_nodes
(nodes)Add new nodes to the internal representation.
download
(*resources)Download or load from cache the resources given by the adapter.
get_kg
()Get the in-memory KG instance.
log_duplicates
()Log duplicate nodes and edges.
log_missing_input_labels
()Log missing input labels.
merge_edges
(edges)Merge edges into database.
merge_nodes
(nodes)Merge nodes into database.
reverse_translate_query
(query)Reverse translate a query from its BioCypher equivalent.
reverse_translate_term
(term)Reverse translate a term from its BioCypher equivalent.
show_ontology_structure
(**kwargs)Show the ontology structure using treelib or write to GRAPHML file.
summary
()Call convenience and reporting methods.
to_df
()Create DataFrame using internal representation.
to_networkx
()Create networkx using internal representation.
translate_query
(query)Translate a query to its BioCypher equivalent.
translate_term
(term)Translate a term to its BioCypher equivalent.
write_edges
(edges[, batch_size])Write edges to database.
write_import_call
()Write a shell script to import the database.
write_nodes
(nodes[, batch_size, force])Write nodes to database.
write_schema_info
([as_node])Write an extended schema info to file or node.