biocypher 0.5.28__tar.gz → 0.5.31__tar.gz
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-0.5.28 → biocypher-0.5.31}/PKG-INFO +1 -1
- {biocypher-0.5.28 → biocypher-0.5.31}/biocypher/_config/biocypher_config.yaml +8 -8
- {biocypher-0.5.28 → biocypher-0.5.31}/biocypher/_core.py +1 -1
- {biocypher-0.5.28 → biocypher-0.5.31}/biocypher/_logger.py +25 -17
- {biocypher-0.5.28 → biocypher-0.5.31}/biocypher/_mapping.py +1 -1
- {biocypher-0.5.28 → biocypher-0.5.31}/biocypher/_metadata.py +1 -1
- {biocypher-0.5.28 → biocypher-0.5.31}/biocypher/_ontology.py +18 -12
- {biocypher-0.5.28 → biocypher-0.5.31}/pyproject.toml +1 -1
- biocypher-0.5.28/setup.py +0 -40
- {biocypher-0.5.28 → biocypher-0.5.31}/LICENSE +0 -0
- {biocypher-0.5.28 → biocypher-0.5.31}/README.md +0 -0
- {biocypher-0.5.28 → biocypher-0.5.31}/biocypher/__init__.py +0 -0
- {biocypher-0.5.28 → biocypher-0.5.31}/biocypher/_config/__init__.py +0 -0
- {biocypher-0.5.28 → biocypher-0.5.31}/biocypher/_config/test_config.yaml +0 -0
- {biocypher-0.5.28 → biocypher-0.5.31}/biocypher/_config/test_schema_config.yaml +0 -0
- {biocypher-0.5.28 → biocypher-0.5.31}/biocypher/_config/test_schema_config_disconnected.yaml +0 -0
- {biocypher-0.5.28 → biocypher-0.5.31}/biocypher/_config/test_schema_config_extended.yaml +0 -0
- {biocypher-0.5.28 → biocypher-0.5.31}/biocypher/_connect.py +0 -0
- {biocypher-0.5.28 → biocypher-0.5.31}/biocypher/_create.py +0 -0
- {biocypher-0.5.28 → biocypher-0.5.31}/biocypher/_deduplicate.py +0 -0
- {biocypher-0.5.28 → biocypher-0.5.31}/biocypher/_get.py +0 -0
- {biocypher-0.5.28 → biocypher-0.5.31}/biocypher/_misc.py +0 -0
- {biocypher-0.5.28 → biocypher-0.5.31}/biocypher/_pandas.py +0 -0
- {biocypher-0.5.28 → biocypher-0.5.31}/biocypher/_translate.py +0 -0
- {biocypher-0.5.28 → biocypher-0.5.31}/biocypher/_write.py +0 -0
|
@@ -30,21 +30,21 @@ biocypher:
|
|
|
30
30
|
root_node: entity
|
|
31
31
|
|
|
32
32
|
### Optional parameters ###
|
|
33
|
-
## Logging granularity
|
|
34
|
-
## Set debug to true if more granular logging is desired
|
|
35
33
|
|
|
36
|
-
|
|
34
|
+
## Logging
|
|
35
|
+
# Write log to disk
|
|
36
|
+
log_to_disk: true
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
# Activate more granular logging
|
|
39
|
+
debug: true
|
|
39
40
|
|
|
41
|
+
# Change the log directory
|
|
40
42
|
# log_directory: biocypher-log
|
|
41
43
|
|
|
42
|
-
##
|
|
43
|
-
|
|
44
|
+
## Data output directory
|
|
44
45
|
# output_directory: biocypher-out
|
|
45
46
|
|
|
46
|
-
##
|
|
47
|
-
|
|
47
|
+
## Resource cache directory
|
|
48
48
|
# cache_directory: .cache
|
|
49
49
|
|
|
50
50
|
## Optional tail ontologies
|
|
@@ -60,11 +60,27 @@ def get_logger(name: str = "biocypher") -> logging.Logger:
|
|
|
60
60
|
now = datetime.now()
|
|
61
61
|
date_time = now.strftime("%Y%m%d-%H%M%S")
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
log_to_disk = _config.config("biocypher").get("log_to_disk")
|
|
64
|
+
|
|
65
|
+
if log_to_disk:
|
|
66
|
+
logdir = (
|
|
67
|
+
_config.config("biocypher").get("log_directory")
|
|
68
|
+
or "biocypher-log"
|
|
69
|
+
)
|
|
70
|
+
os.makedirs(logdir, exist_ok=True)
|
|
71
|
+
logfile = os.path.join(logdir, f"biocypher-{date_time}.log")
|
|
72
|
+
|
|
73
|
+
# file handler
|
|
74
|
+
file_handler = logging.FileHandler(logfile)
|
|
75
|
+
|
|
76
|
+
if _config.config("biocypher").get("debug"):
|
|
77
|
+
file_handler.setLevel(logging.DEBUG)
|
|
78
|
+
else:
|
|
79
|
+
file_handler.setLevel(logging.INFO)
|
|
80
|
+
|
|
81
|
+
file_handler.setFormatter(file_formatter)
|
|
82
|
+
|
|
83
|
+
logger.addHandler(file_handler)
|
|
68
84
|
|
|
69
85
|
# handlers
|
|
70
86
|
# stream handler
|
|
@@ -72,23 +88,15 @@ def get_logger(name: str = "biocypher") -> logging.Logger:
|
|
|
72
88
|
stdout_handler.setLevel(logging.INFO)
|
|
73
89
|
stdout_handler.setFormatter(stdout_formatter)
|
|
74
90
|
|
|
75
|
-
# file handler
|
|
76
|
-
file_handler = logging.FileHandler(logfile)
|
|
77
|
-
|
|
78
|
-
if _config.config("biocypher").get("debug"):
|
|
79
|
-
file_handler.setLevel(logging.DEBUG)
|
|
80
|
-
else:
|
|
81
|
-
file_handler.setLevel(logging.INFO)
|
|
82
|
-
|
|
83
|
-
file_handler.setFormatter(file_formatter)
|
|
84
|
-
|
|
85
91
|
# add handlers
|
|
86
|
-
logger.addHandler(file_handler)
|
|
87
92
|
logger.addHandler(stdout_handler)
|
|
88
93
|
|
|
89
94
|
# startup message
|
|
90
95
|
logger.info(f"This is BioCypher v{__version__}.")
|
|
91
|
-
|
|
96
|
+
if log_to_disk:
|
|
97
|
+
logger.info(f"Logging into `{logfile}`.")
|
|
98
|
+
else:
|
|
99
|
+
logger.info("Logging into stdout.")
|
|
92
100
|
|
|
93
101
|
return logging.getLogger(name)
|
|
94
102
|
|
|
@@ -40,7 +40,7 @@ class OntologyMapping:
|
|
|
40
40
|
Read the configuration file and store the ontology mapping and extensions.
|
|
41
41
|
"""
|
|
42
42
|
if config_file is None:
|
|
43
|
-
schema_config =
|
|
43
|
+
schema_config = {}
|
|
44
44
|
|
|
45
45
|
# load yaml file from web
|
|
46
46
|
elif config_file.startswith("http"):
|
|
@@ -96,16 +96,7 @@ class OntologyAdapter:
|
|
|
96
96
|
)
|
|
97
97
|
|
|
98
98
|
def _rdf_to_nx(self, g, root_label, switch_id_and_label=True):
|
|
99
|
-
|
|
100
|
-
for s, _, o in g.triples((None, rdflib.RDFS.label, None)):
|
|
101
|
-
# If the label is the root label, set the root node to the subject of the label
|
|
102
|
-
if o.eq(root_label):
|
|
103
|
-
root = s
|
|
104
|
-
break
|
|
105
|
-
else:
|
|
106
|
-
raise ValueError(
|
|
107
|
-
f"Could not find root node with label {root_label}"
|
|
108
|
-
)
|
|
99
|
+
root = self._find_root_label(g, root_label)
|
|
109
100
|
|
|
110
101
|
# Create a directed graph to represent the ontology as a tree
|
|
111
102
|
G = nx.DiGraph()
|
|
@@ -177,6 +168,21 @@ class OntologyAdapter:
|
|
|
177
168
|
|
|
178
169
|
return G
|
|
179
170
|
|
|
171
|
+
def _find_root_label(self, g, root_label):
|
|
172
|
+
# Loop through all labels in the ontology
|
|
173
|
+
for label_subject, _, label_in_ontology in g.triples(
|
|
174
|
+
(None, rdflib.RDFS.label, None)
|
|
175
|
+
):
|
|
176
|
+
# If the label is the root label, set the root node to the label's subject
|
|
177
|
+
if str(label_in_ontology) == root_label:
|
|
178
|
+
root = label_subject
|
|
179
|
+
break
|
|
180
|
+
else:
|
|
181
|
+
raise ValueError(
|
|
182
|
+
f"Could not find root node with label {root_label}"
|
|
183
|
+
)
|
|
184
|
+
return root
|
|
185
|
+
|
|
180
186
|
def _remove_prefix(self, uri: str) -> str:
|
|
181
187
|
"""
|
|
182
188
|
Remove the prefix of a URI. URIs can contain either "#" or "/" as a
|
|
@@ -565,7 +571,7 @@ class Ontology:
|
|
|
565
571
|
else:
|
|
566
572
|
msg = f"Showing ontology structure based on {len(self._tail_ontology_meta)+1} ontologies: "
|
|
567
573
|
|
|
568
|
-
|
|
574
|
+
logger.info(msg)
|
|
569
575
|
|
|
570
576
|
if not full:
|
|
571
577
|
# set of leaves and their intermediate parents up to the root
|
|
@@ -594,7 +600,7 @@ class Ontology:
|
|
|
594
600
|
f"{self.mapping.extended_schema[node].get('synonym_for')}"
|
|
595
601
|
)
|
|
596
602
|
|
|
597
|
-
|
|
603
|
+
logger.info(f"\n{tree}")
|
|
598
604
|
|
|
599
605
|
return tree
|
|
600
606
|
|
biocypher-0.5.28/setup.py
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
from setuptools import setup
|
|
3
|
-
|
|
4
|
-
packages = \
|
|
5
|
-
['biocypher', 'biocypher._config']
|
|
6
|
-
|
|
7
|
-
package_data = \
|
|
8
|
-
{'': ['*']}
|
|
9
|
-
|
|
10
|
-
install_requires = \
|
|
11
|
-
['PyYAML>=5.0',
|
|
12
|
-
'appdirs',
|
|
13
|
-
'more_itertools',
|
|
14
|
-
'neo4j-utils==0.0.7',
|
|
15
|
-
'networkx>=3.0,<4.0',
|
|
16
|
-
'pandas>=2.0.1,<3.0.0',
|
|
17
|
-
'pooch>=1.7.0,<2.0.0',
|
|
18
|
-
'rdflib>=6.2.0,<7.0.0',
|
|
19
|
-
'stringcase>=1.2.0,<2.0.0',
|
|
20
|
-
'tqdm>=4.65.0,<5.0.0',
|
|
21
|
-
'treelib==1.6.4']
|
|
22
|
-
|
|
23
|
-
setup_kwargs = {
|
|
24
|
-
'name': 'biocypher',
|
|
25
|
-
'version': '0.5.28',
|
|
26
|
-
'description': 'A unifying framework for biomedical research knowledge graphs',
|
|
27
|
-
'long_description': '# BioCypher\n\n| | | | |\n| --- | --- | --- | --- |\n| __License__ | [](https://opensource.org/licenses/MIT) | __Python__ | [](https://www.python.org) |\n| __Package__ | [](https://pypi.org/project/biocypher/) [](https://pepy.tech/project/biocypher) | __Build status__ | [](https://github.com/biocypher/biocypher/actions/workflows/tests_and_code_quality.yaml) [](https://github.com/biocypher/biocypher/actions/workflows/docs.yaml) |\n| __Tests__ | [](https://github.com/biocypher/biocypher/actions/workflows/tests_and_code_quality.yaml) | __Docker__ | [](https://hub.docker.com/repository/docker/biocypher/base/general) [](https://hub.docker.com/repository/docker/biocypher/base/general) |\n| __Development__ | [](https://www.repostatus.org/#active) [](https://github.com/pre-commit/pre-commit) [](https://black.readthedocs.io/en/stable/) | __Contributions__ | [](http://makeapullrequest.com) [](CONTRIBUTING.md) [](https://github.com/biopragmatics/bioregistry) |\n\n\n\n\n## ❓ Description\nKnowledge graphs (KGs) are an [approach to knowledge\nrepresentation](https://en.wikipedia.org/wiki/Knowledge_graph) that uses graph\nstructure to facilitate exploration and analysis of complex data, often\nleveraging semantic information. They are popular in many research areas,\nincluding the life sciences, due to their versatile use, for instance in data\nstorage, integration, reasoning, and more recently in artificial intelligence.\nThe creation of KGs is a complex task; BioCypher helps you in creating and\nmaintaining your own KG. For more overview, usage notes, and a tutorial, read\nthe docs [here](https://biocypher.org).\n\n<img\n style="display: block;\n margin-left: auto;\n margin-right: auto;\n width: 70%;"\n src="docs/graphical_abstract.png"\n alt="Graphical Abstract">\n</img>\n\n## 📖 Documentation\nTutorial and developer docs at https://biocypher.org. For a quickstart into your\nown pipeline, you can refer to our [project\ntemplate](https://github.com/biocypher/project-template), and for an overview of\nexisting and planned adapters for resources and outputs, as well as other\nfeatures, visit our [GitHub Project\nBoard](https://github.com/orgs/biocypher/projects/3/views/2).\n\n## ⚙️ Installation / Usage\nInstall the package from PyPI using `pip install biocypher`. More comprehensive\ninstallation and configuration instructions can be found\n[here](https://biocypher.org/installation.html).\n\nExemplary usage of BioCypher to build a graph database is shown in our tutorial\nand the various pipelines we have created. You can find these on the [Components\nProject Board](https://github.com/orgs/biocypher/projects/3/views/2).\n\n## 🤝 Getting involved\nWe are very happy about contributions from the community, large and small!\nIf you would like to contribute to BioCypher development, please refer to\nour [contribution guidelines](CONTRIBUTING.md). :)\n\nIf you want to ask informal questions, talk about dev things, or just chat,\nplease join our community at https://biocypher.zulipchat.com!\n\n> **Imposter syndrome disclaimer:** We want your help. No, really. There may be a little voice inside your head that is telling you that you\'re not ready, that you aren\'t skilled enough to contribute. We assure you that the little voice in your head is wrong. Most importantly, there are many valuable ways to contribute besides writing code.\n>\n> This disclaimer was adapted from the [Pooch](https://github.com/fatiando/pooch) project.\n\n## ✍️ Citation\nThe BioCypher paper has been peer-reviewed in\n[Nature Biotechnology](https://www.nature.com/articles/s41587-023-01848-y).\nBefore, it was available as a preprint at https://arxiv.org/abs/2212.13543.\n\n## Acknowledgements\nThis project has received funding from the European Union’s Horizon 2020\nresearch and innovation programme under grant agreement No 965193 for DECIDER\nand No 116030 for TransQST.\n',
|
|
28
|
-
'author': 'Sebastian Lobentanzer',
|
|
29
|
-
'author_email': 'sebastian.lobentanzer@gmail.com',
|
|
30
|
-
'maintainer': 'None',
|
|
31
|
-
'maintainer_email': 'None',
|
|
32
|
-
'url': 'https://github.com/biocypher/biocypher',
|
|
33
|
-
'packages': packages,
|
|
34
|
-
'package_data': package_data,
|
|
35
|
-
'install_requires': install_requires,
|
|
36
|
-
'python_requires': '>=3.9,<4.0',
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
setup(**setup_kwargs)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{biocypher-0.5.28 → biocypher-0.5.31}/biocypher/_config/test_schema_config_disconnected.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|