biocypher 0.6.2__py3-none-any.whl → 0.8.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of biocypher might be problematic. Click here for more details.
- biocypher/__init__.py +3 -13
- biocypher/_config/__init__.py +6 -23
- biocypher/_config/biocypher_config.yaml +14 -3
- biocypher/_core.py +360 -262
- biocypher/_create.py +13 -27
- biocypher/_deduplicate.py +4 -11
- biocypher/_get.py +21 -60
- biocypher/_logger.py +4 -16
- biocypher/_mapping.py +4 -17
- biocypher/_metadata.py +3 -15
- biocypher/_misc.py +14 -28
- biocypher/_ontology.py +127 -212
- biocypher/_translate.py +34 -58
- biocypher/output/connect/_get_connector.py +40 -0
- biocypher/output/connect/_neo4j_driver.py +9 -65
- biocypher/output/in_memory/_get_in_memory_kg.py +34 -0
- biocypher/output/in_memory/_in_memory_kg.py +40 -0
- biocypher/output/in_memory/_networkx.py +44 -0
- biocypher/output/in_memory/_pandas.py +20 -15
- biocypher/output/write/_batch_writer.py +166 -179
- biocypher/output/write/_get_writer.py +11 -24
- biocypher/output/write/_writer.py +43 -44
- biocypher/output/write/graph/_arangodb.py +7 -24
- biocypher/output/write/graph/_neo4j.py +51 -56
- biocypher/output/write/graph/_networkx.py +36 -43
- biocypher/output/write/graph/_rdf.py +107 -95
- biocypher/output/write/relational/_csv.py +6 -11
- biocypher/output/write/relational/_postgresql.py +5 -13
- biocypher/output/write/relational/_sqlite.py +3 -1
- {biocypher-0.6.2.dist-info → biocypher-0.8.0.dist-info}/LICENSE +1 -1
- {biocypher-0.6.2.dist-info → biocypher-0.8.0.dist-info}/METADATA +3 -3
- biocypher-0.8.0.dist-info/RECORD +43 -0
- {biocypher-0.6.2.dist-info → biocypher-0.8.0.dist-info}/WHEEL +1 -1
- biocypher-0.6.2.dist-info/RECORD +0 -39
biocypher/__init__.py
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
|
|
3
|
-
#
|
|
4
|
-
# Copyright 2021, Heidelberg University Clinic
|
|
5
|
-
#
|
|
6
|
-
# File author(s): Sebastian Lobentanzer
|
|
7
|
-
# ...
|
|
8
|
-
#
|
|
9
|
-
# Distributed under MIT licence, see the file `LICENSE`.
|
|
10
|
-
#
|
|
11
1
|
"""
|
|
12
2
|
BioCypher: a unifying framework for biomedical knowledge graphs.
|
|
13
3
|
"""
|
|
@@ -25,10 +15,10 @@ __all__ = [
|
|
|
25
15
|
"APIRequest",
|
|
26
16
|
]
|
|
27
17
|
|
|
28
|
-
from ._get import APIRequest, FileDownload
|
|
29
|
-
from ._core import BioCypher
|
|
30
18
|
from ._config import config, module_data
|
|
31
|
-
from .
|
|
19
|
+
from ._core import BioCypher
|
|
20
|
+
from ._get import APIRequest, FileDownload
|
|
21
|
+
from ._logger import log, logfile, logger
|
|
32
22
|
from ._metadata import __author__, __version__
|
|
33
23
|
|
|
34
24
|
|
biocypher/_config/__init__.py
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
|
|
3
|
-
#
|
|
4
|
-
# Copyright 2021, Heidelberg University Clinic
|
|
5
|
-
#
|
|
6
|
-
# File author(s): Sebastian Lobentanzer
|
|
7
|
-
# ...
|
|
8
|
-
#
|
|
9
|
-
# Distributed under MIT licence, see the file `LICENSE`.
|
|
10
|
-
#
|
|
11
1
|
"""
|
|
12
2
|
Module data directory, including:
|
|
13
3
|
|
|
@@ -15,12 +5,13 @@ Module data directory, including:
|
|
|
15
5
|
* The default config files
|
|
16
6
|
"""
|
|
17
7
|
|
|
18
|
-
from typing import Any, Optional
|
|
19
8
|
import os
|
|
20
9
|
import warnings
|
|
21
10
|
|
|
22
|
-
import
|
|
11
|
+
from typing import Any, Optional
|
|
12
|
+
|
|
23
13
|
import appdirs
|
|
14
|
+
import yaml
|
|
24
15
|
|
|
25
16
|
__all__ = ["module_data", "module_data_path", "read_config", "config", "reset"]
|
|
26
17
|
|
|
@@ -88,21 +79,13 @@ def read_config() -> dict:
|
|
|
88
79
|
defaults = module_data("biocypher_config")
|
|
89
80
|
user = _read_yaml(_USER_CONFIG_FILE) or {}
|
|
90
81
|
# TODO account for .yml?
|
|
91
|
-
local = (
|
|
92
|
-
_read_yaml("biocypher_config.yaml")
|
|
93
|
-
or _read_yaml("config/biocypher_config.yaml")
|
|
94
|
-
or {}
|
|
95
|
-
)
|
|
82
|
+
local = _read_yaml("biocypher_config.yaml") or _read_yaml("config/biocypher_config.yaml") or {}
|
|
96
83
|
|
|
97
84
|
for key in defaults:
|
|
98
|
-
value =
|
|
99
|
-
local[key] if key in local else user[key] if key in user else None
|
|
100
|
-
)
|
|
85
|
+
value = local[key] if key in local else user[key] if key in user else None
|
|
101
86
|
|
|
102
87
|
if value is not None:
|
|
103
|
-
if isinstance(
|
|
104
|
-
defaults[key], str
|
|
105
|
-
): # first level config (like title)
|
|
88
|
+
if isinstance(defaults[key], str): # first level config (like title)
|
|
106
89
|
defaults[key] = value
|
|
107
90
|
else:
|
|
108
91
|
defaults[key].update(value)
|
|
@@ -30,12 +30,13 @@ biocypher:
|
|
|
30
30
|
# switch_label_and_id: true
|
|
31
31
|
|
|
32
32
|
### Optional parameters ###
|
|
33
|
-
|
|
34
33
|
## Logging
|
|
35
34
|
# Write log to disk
|
|
35
|
+
|
|
36
36
|
log_to_disk: true
|
|
37
37
|
|
|
38
38
|
# Activate more granular logging
|
|
39
|
+
|
|
39
40
|
debug: true
|
|
40
41
|
|
|
41
42
|
# Change the log directory
|
|
@@ -85,6 +86,14 @@ neo4j:
|
|
|
85
86
|
array_delimiter: "|"
|
|
86
87
|
quote_character: "'"
|
|
87
88
|
|
|
89
|
+
# How to write the labels in the export files.
|
|
90
|
+
|
|
91
|
+
labels_order: "Ascending" # Default: From more specific to more generic.
|
|
92
|
+
# Or:
|
|
93
|
+
# labels_order: "Descending" # From more generic to more specific.
|
|
94
|
+
# labels_order: "Alphabetical" # Alphabetically. Legacy option.
|
|
95
|
+
# labels_order: "Leaves" # Only the more specific label.
|
|
96
|
+
|
|
88
97
|
## MultiDB functionality
|
|
89
98
|
## Set to false for using community edition or older versions of Neo4j
|
|
90
99
|
|
|
@@ -102,8 +111,8 @@ neo4j:
|
|
|
102
111
|
|
|
103
112
|
postgresql:
|
|
104
113
|
### PostgreSQL configuration ###
|
|
105
|
-
|
|
106
114
|
# PostgreSQL connection credentials
|
|
115
|
+
|
|
107
116
|
database_name: postgres # DB name
|
|
108
117
|
user: postgres # user name
|
|
109
118
|
password: postgres # password
|
|
@@ -111,6 +120,7 @@ postgresql:
|
|
|
111
120
|
port: 5432 # port
|
|
112
121
|
|
|
113
122
|
# PostgreSQL import batch writer settings
|
|
123
|
+
|
|
114
124
|
quote_character: '"'
|
|
115
125
|
delimiter: '\t'
|
|
116
126
|
# import_call_bin_prefix: '' # path to "psql"
|
|
@@ -122,11 +132,12 @@ rdf:
|
|
|
122
132
|
|
|
123
133
|
sqlite:
|
|
124
134
|
### SQLite configuration ###
|
|
125
|
-
|
|
126
135
|
# SQLite connection credentials
|
|
136
|
+
|
|
127
137
|
database_name: sqlite.db # DB name
|
|
128
138
|
|
|
129
139
|
# SQLite import batch writer settings
|
|
140
|
+
|
|
130
141
|
quote_character: '"'
|
|
131
142
|
delimiter: '\t'
|
|
132
143
|
# import_call_bin_prefix: '' # path to "sqlite3"
|