biocypher 0.9.0__py3-none-any.whl → 0.9.1__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/_core.py CHANGED
@@ -118,6 +118,15 @@ class BioCypher:
118
118
  else:
119
119
  self._offline = offline
120
120
 
121
+ # Check if pandas/tabular is being used in offline mode
122
+ if self._offline and self._dbms.lower() in ["pandas", "tabular"]:
123
+ msg = (
124
+ f"The '{self._dbms}' DBMS is only available in online mode. "
125
+ f"If you want to write CSV files, use 'csv' as the DBMS. "
126
+ f"If you want to use pandas, set 'offline: false' in your configuration."
127
+ )
128
+ raise ValueError(msg)
129
+
121
130
  if strict_mode is None:
122
131
  self._strict_mode = self.base_config["strict_mode"]
123
132
  else:
@@ -225,19 +234,31 @@ class BioCypher:
225
234
  The knowledge graph is returned based on the `dbms` parameter in
226
235
  the biocypher configuration file.
227
236
 
237
+ TODO: These conditionals are a hack, we need to refactor the in-memory
238
+ KG to be generic, and simplify access and conversion to output formats.
239
+
228
240
  Returns
229
241
  -------
230
242
  Any: knowledge graph.
231
243
 
232
244
  """
245
+ # If we're using an in-memory KG and it already exists, return it directly
246
+ if self._in_memory_kg and self._is_online_and_in_memory():
247
+ return self._in_memory_kg.get_kg()
248
+
249
+ # Otherwise, initialize and populate the in-memory KG
233
250
  if not self._in_memory_kg:
234
251
  self._initialize_in_memory_kg()
235
252
  if not self._translator:
236
253
  self._get_translator()
237
- tnodes = self._translator.translate_entities(self._nodes)
238
- tedges = self._translator.translate_entities(self._edges)
239
- self._in_memory_kg.add_nodes(tnodes)
240
- self._in_memory_kg.add_edges(tedges)
254
+
255
+ # These attributes might not exist when using in-memory KG directly
256
+ if hasattr(self, "_nodes") and hasattr(self, "_edges"):
257
+ tnodes = self._translator.translate_entities(self._nodes)
258
+ tedges = self._translator.translate_entities(self._edges)
259
+ self._in_memory_kg.add_nodes(tnodes)
260
+ self._in_memory_kg.add_edges(tedges)
261
+
241
262
  return self._in_memory_kg.get_kg()
242
263
 
243
264
  def _get_deduplicator(self) -> Deduplicator:
biocypher/_metadata.py CHANGED
@@ -10,7 +10,7 @@ import pathlib
10
10
 
11
11
  import toml
12
12
 
13
- _VERSION = "0.9.0"
13
+ _VERSION = "0.9.1"
14
14
 
15
15
 
16
16
  def get_metadata():
@@ -75,7 +75,7 @@ def get_writer(
75
75
  instance: an instance of the selected writer class.
76
76
 
77
77
  """
78
- dbms_config = _config(dbms)
78
+ dbms_config = _config(dbms) or {}
79
79
 
80
80
  writer = DBMS_TO_CLASS[dbms]
81
81
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: biocypher
3
- Version: 0.9.0
3
+ Version: 0.9.1
4
4
  Summary: A unifying framework for biomedical research knowledge graphs
5
5
  Home-page: https://github.com/biocypher/biocypher
6
6
  License: MIT
@@ -5,13 +5,13 @@ biocypher/_config/test_config.yaml,sha256=Np8jeS5_EP6HHOvMKb7B_Tkyqd5YaYlYz_DVsX
5
5
  biocypher/_config/test_schema_config.yaml,sha256=D1600WgEj3iTXrumVU9LIivJHJO36iaxfkOgyam9zVU,3129
6
6
  biocypher/_config/test_schema_config_disconnected.yaml,sha256=Qm8FLxEn2spHcyj_5F859KjcDvKSxNhxDvi4b4LLkvQ,68
7
7
  biocypher/_config/test_schema_config_extended.yaml,sha256=wn3A76142hhjnImhMF6RODbCFESTJ2TtPvcFdIFsAT0,3309
8
- biocypher/_core.py,sha256=CGbGHX3-JuJsQJsmLFsFNylPiPiJx83aXq05ocPSeUA,26354
8
+ biocypher/_core.py,sha256=S8frW62bc0V9M6gwU5l_D2ESa-7xwbOTffRuPqbIbT0,27382
9
9
  biocypher/_create.py,sha256=QsvXrwEQ8k0uNXvCG06UKejvw-QsJwzSaumrBjx9n1k,9884
10
10
  biocypher/_deduplicate.py,sha256=rtglcaLRaVzNjLtaPwTGP8VvCM4PHYQ5CZ-cm32CrKQ,4840
11
11
  biocypher/_get.py,sha256=2kjiBFu_onGUhgOpV7IMfGX67jyY1rpHg_GWncEUdrc,13278
12
12
  biocypher/_logger.py,sha256=y9dh3SPJOCWXnkFSYSK7aj_-pB7zlAkNCf43Dp1lt74,2941
13
13
  biocypher/_mapping.py,sha256=ntspG2C_NaQODhWTBFk0CDvolkOCjtqlQ9E-NkJAuTg,9030
14
- biocypher/_metadata.py,sha256=RArwucSNiwB9Ced95zgocZgRvQwX_u9brIi0CYGCAdQ,1415
14
+ biocypher/_metadata.py,sha256=Eop3cijNQBsHWeOO8zbBmN_2ICJutZziDPvWppV474M,1415
15
15
  biocypher/_misc.py,sha256=N8aDg8j3EEcKf9ZRqzSNruUEUK4RixCy1vQ1V4maGxk,6079
16
16
  biocypher/_ontology.py,sha256=lipZxU3aj6zrTbBrJZmCW6IRCuz-KQG3AfbYCVq6aFE,33133
17
17
  biocypher/_translate.py,sha256=9E19eLRL0VnxxDuiNhZ5vu54XyKXnfLuBhCgNcL9yAE,17000
@@ -26,7 +26,7 @@ biocypher/output/in_memory/_networkx.py,sha256=cSOSAreP7S3oeGT6noZ1kAIvSnkVnU3NU
26
26
  biocypher/output/in_memory/_pandas.py,sha256=Ot2jbK5t_YLHqw0BUv9Z_qWNy9r6IX1LYEyejOSJzos,3288
27
27
  biocypher/output/write/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
28
  biocypher/output/write/_batch_writer.py,sha256=_Dao7z4KN0Uhr86oOOWYEDrIUikR7T0v1SJC2Btd8Y4,38745
29
- biocypher/output/write/_get_writer.py,sha256=xaZXoid0UP2uG_Z0XBJFpPXjmBRoKaBRNQG61iA7Rk8,4379
29
+ biocypher/output/write/_get_writer.py,sha256=JozRWCMhvh65aQAlcGiiD5x3Nl1HSW8mK1Zf2nTSOzI,4385
30
30
  biocypher/output/write/_writer.py,sha256=y0dWI-RyQdrBLr9Fs91Y9KcCMjnlCaKJT0eWsIS2hG4,7158
31
31
  biocypher/output/write/graph/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
32
  biocypher/output/write/graph/_arangodb.py,sha256=xue3hm_DVB5pMR5qqfGXlXll3RpILA0tXos2J-as1-E,7906
@@ -38,7 +38,7 @@ biocypher/output/write/relational/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeR
38
38
  biocypher/output/write/relational/_csv.py,sha256=m0BSQXts88Qu5AEvoIgnwRz54ia38g4VN3PaA3LCYM8,2807
39
39
  biocypher/output/write/relational/_postgresql.py,sha256=RckQJBiuwvDmHAyXxS8zCavYqDecHHWW_piofurokfQ,11965
40
40
  biocypher/output/write/relational/_sqlite.py,sha256=BuGWOeeNA83lbUvjpkzqcR9_baWLsbfmLXBKe4O1EPE,2105
41
- biocypher-0.9.0.dist-info/LICENSE,sha256=oejgxuxyjSnyPw3YPloz6-dCBB_nYizJ4jDQnr-xZUU,1082
42
- biocypher-0.9.0.dist-info/METADATA,sha256=uhjbUoT1ZgKl0Rwk_vTiZOv5nOi7KUBQztsbVQehHJI,10643
43
- biocypher-0.9.0.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
44
- biocypher-0.9.0.dist-info/RECORD,,
41
+ biocypher-0.9.1.dist-info/LICENSE,sha256=oejgxuxyjSnyPw3YPloz6-dCBB_nYizJ4jDQnr-xZUU,1082
42
+ biocypher-0.9.1.dist-info/METADATA,sha256=Qjy-T-iNXAn0wye7-NbLivn7ZPz80ZrOu8utum7_4vk,10643
43
+ biocypher-0.9.1.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
44
+ biocypher-0.9.1.dist-info/RECORD,,