diff --git a/config/biopathnet.yaml b/config/biopathnet.yaml index 6c3cc50..7d87237 100644 --- a/config/biopathnet.yaml +++ b/config/biopathnet.yaml @@ -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 diff --git a/config/owl.yaml b/config/owl.yaml new file mode 100644 index 0000000..60a2b17 --- /dev/null +++ b/config/owl.yaml @@ -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" diff --git a/make.sh b/make.sh index 5cf3e70..a7b5ad3 100755 --- a/make.sh +++ b/make.sh @@ -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 \ diff --git a/pyproject.toml b/pyproject.toml index 98bffa4..8fe1506 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", ] diff --git a/weave.py b/weave.py index 1044015..278730e 100755 --- a/weave.py +++ b/weave.py @@ -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="+", @@ -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) @@ -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"]