biocypher.BioCypher

class biocypher.BioCypher(dbms: Optional[str] = None, offline: Optional[bool] = None, strict_mode: Optional[bool] = None, biocypher_config_path: Optional[str] = None, schema_config_path: Optional[str] = None, head_ontology: Optional[dict] = None, tail_ontologies: Optional[dict] = None, output_directory: Optional[str] = None, cache_directory: Optional[str] = None, db_name: Optional[str] = None)

Orchestration of BioCypher operations. Instantiate this class to interact with BioCypher.

Parameters:
  • dbms (str) – The database management system to use. For supported systems see SUPPORTED_DBMS.

  • offline (bool) – Whether to run in offline mode. If True, no connection to the database will be made.

  • 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.

__init__(dbms: Optional[str] = None, offline: Optional[bool] = None, strict_mode: Optional[bool] = None, biocypher_config_path: Optional[str] = None, schema_config_path: Optional[str] = None, head_ontology: Optional[dict] = None, tail_ontologies: Optional[dict] = None, output_directory: Optional[str] = None, cache_directory: Optional[str] = None, db_name: Optional[str] = None)

Methods

__init__([dbms, offline, strict_mode, ...])

add(entities)

Function to add entities to the in-memory database.

add_edges(edges)

Wrapper for add() to add edges to the in-memory database.

add_nodes(nodes)

Wrapper for add() to add nodes to the in-memory database.

download(*resources)

Use the Downloader class to download or load from cache the resources given by the adapter.

log_duplicates()

Get the set of duplicate nodes and edges encountered and print them to the logger.

log_missing_input_labels()

Get the set of input labels encountered without an entry in the schema_config.yaml and print them to the logger.

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()

Wrapper for showing ontology structure and logging duplicates and missing input types.

to_df()

Convert entities to a pandas DataFrame for each entity type and return a list.

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 depending on the chosen DBMS.

write_nodes(nodes[, batch_size, force])

Write nodes to database.

write_schema_info([as_node])

Write an extended schema info YAML file that extends the schema_config.yaml with run-time information of the built KG.