Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion config/biopathnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ biocypher:
root_node: entity

biopathnet:
file_format: txt
file_format: txt:bn
entity_types_file_stem: entity_types
entity_names_file_stem: entity_names
background_graph_file_stem: brg
skg_file_stem: skg
targeted_relation: "(alteration, variant biomarker for treatment, drug)"
include_properties: False

16 changes: 16 additions & 0 deletions config/owl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
biocypher:
debug: false
offline: true
dbms: owl

# Ontology configuration
head_ontology:
url: https://github.com/biolink/biolink-model/raw/v3.2.1/biolink-model.owl.ttl
root_node: entity

owl:
edge_model: ObjectProperty
file_format: turtle
labels_order: "Ascending" # Default: From more specific to more generic.
node_labels_order: "Ascending" # Default: use labels_order.
edge_labels_order: "Leaves"
20 changes: 11 additions & 9 deletions make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,21 @@ fi

echo "Weave data..." >&2

echo "CONFIG = $CONFIG" >&2

cmd="uv run python3 ${py_args} $script_dir/weave.py \
--omnipath-networks $data_dir/omnipath_networks/subset_omnipath_networks_different_type_entity_type_source_and_entity_type_target_shorter.tsv \
--copy-number-amplifications-external $decider_dir/cnas_external.csv \
--short-mutations-local $decider_dir/short_mutations_local.csv \
--short-mutations-external $decider_dir/short_mutations_external.csv \
--copy-number-amplifications-local $decider_dir/cnas_local.csv \
--open-targets-drug-molecule $data_dir/OT/drug_molecule/
--open-targets-drug_mechanism_of_action $data_dir/OT/drug_mechanism_of_action/
--open-targets-target $data_dir/OT/target/
--cgi $decider_dir/treatments_cgi.csv \
--config $CONFIG \
${weave_args}" # \
# --copy-number-amplifications-external $decider_dir/cnas_external.csv \
# --short-mutations-local $decider_dir/short_mutations_local.csv \
# --short-mutations-external $decider_dir/short_mutations_external.csv \
# --copy-number-amplifications-local $decider_dir/cnas_local.csv \
# --omnipath-networks $data_dir/omnipath_networks/omnipath_networks_different_type_entity_type_source_and_entity_type_target_shorter.tsv \
# --structural-variants $decider_dir/structural_variants.xlsx \
# --open-targets-drug-molecule $data_dir/OT/drug_molecule/
# --open-targets-drug_mechanism_of_action $data_dir/OT/drug_mechanism_of_action/
# --open-targets-target $data_dir/OT/target/
# --cgi $decider_dir/treatments_cgi.csv \
# --clinical $data_dir/DECIDER/clinical/clinical_export.xlsx \
# --oncokb $data_dir/DECIDER/$data_version/treatments.csv \

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies = [
"seaborn>=0.13.2,<0.14",
"ontoweaver>=1.4.0,<1.5.0",
"openpyxl>=3.1.5",
"pyarrow<21.0.0",
"pyarrow>20.0.0",
"fastparquet<2026.3.0",
]

Expand Down
38 changes: 22 additions & 16 deletions weave.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ def process_OT(directory, name):
parser = argparse.ArgumentParser(
description=usage)

parser.add_argument("-C", "--config", metavar="FILE", default="config/neo4j.yaml",
parser.add_argument("-C", "--config", metavar="FILE", default=["config/neo4j.yaml"],
action="append",
help="The BioCypher configuration to load [default: config/neo4j.yaml].")

parser.add_argument("-i", "--clinical", metavar="CSV", nargs="+",
Expand Down Expand Up @@ -197,10 +198,6 @@ def process_OT(directory, name):
help="Set the verbose level (default: %(default)s).")

asked = parser.parse_args()
bc = biocypher.BioCypher(
biocypher_config_path = asked.config,
schema_config_path = "config/schema.yaml"
)

logging.basicConfig()
logging.getLogger().setLevel(asked.verbose)
Expand Down Expand Up @@ -670,17 +667,26 @@ def process_OT(directory, name):
# Export the final SKG.
###################################################

logging.info(f"Write the final SKG into files...")
if fnodes:
bc.write_nodes(n.as_tuple() for n in fnodes)
if fedges:
bc.write_edges(e.as_tuple() for e in fedges)
#bc.summary()
import_file = bc.write_import_call()
logging.info(f"OK, wrote files.")

# Print on stdout for other scripts to get.
print(import_file)
configs = asked.config

for config in configs:
logging.info(f"Write the final SKG into {config} files...")

bc = biocypher.BioCypher(
biocypher_config_path = config,
schema_config_path = "config/schema.yaml"
)

if fnodes:
bc.write_nodes(n.as_tuple() for n in fnodes)
if fedges:
bc.write_edges(e.as_tuple() for e in fedges)
#bc.summary()
import_file = bc.write_import_call()
logging.info(f"OK, wrote files.")

# Print on stdout for other scripts to get.
print(import_file)

if asked.import_script_run:
shell = os.environ["SHELL"]
Expand Down