Adapter
fieldz_kb.biocypher.adapter
BioCypher adapter for fieldz_kb.
Converts fieldz objects to BioCypher-compatible node and relationship tuples.
Classes:
| Name | Description |
|---|---|
Adapter |
Adapter for converting fieldz objects to BioCypher format. |
Adapter
Adapter for converting fieldz objects to BioCypher format.
Takes a fieldz object and converts it to BioCypher-compatible nodes and relationships using the LPG conversion layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
object
|
The object to convert to BioCypher format. |
required |
Example
import dataclasses import fieldz_kb.biocypher.adapter
@dataclasses.dataclass ... class Gene: ... name: str ... chromosome: int
adapter = fieldz_kb.biocypher.adapter.Adapter(Gene(name="TP53", chromosome=17)) nodes, relationships = adapter.make_nodes_and_relationships()
Initialize the adapter with an object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
object
|
The object to convert to BioCypher format. |
required |
Methods:
| Name | Description |
|---|---|
make_nodes_and_relationships |
Convert the object to BioCypher nodes and relationships. |
Source code in src/fieldz_kb/biocypher/adapter.py
make_nodes_and_relationships
Convert the object to BioCypher nodes and relationships.
Returns:
| Type | Description |
|---|---|
list[tuple]
|
A tuple of (biocypher_nodes, biocypher_relationships) where: |
list[tuple]
|
|
tuple[list[tuple], list[tuple]]
|
|