closurizer 0.5.1__tar.gz → 0.6.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: closurizer
3
- Version: 0.5.1
3
+ Version: 0.6.0
4
4
  Summary: Add closure expansion fields to kgx files following the Golr pattern
5
5
  Author: Kevin Schaper
6
6
  Author-email: kevin@tislab.org
@@ -13,4 +13,4 @@ Classifier: Programming Language :: Python :: 3.11
13
13
  Classifier: Programming Language :: Python :: 3.12
14
14
  Requires-Dist: SQLAlchemy (>=1.4.37,<2.0.0)
15
15
  Requires-Dist: click (>=8,<9)
16
- Requires-Dist: duckdb (>=0.9.1,<0.10.0)
16
+ Requires-Dist: duckdb (>=0.10.2,<0.11.0)
@@ -57,16 +57,18 @@ def node_joins(predicate):
57
57
  on {field}_edges.object = {field}_closure_label.id
58
58
  """
59
59
 
60
+
60
61
  def grouping_key(grouping_fields):
61
62
  fragments = []
62
63
  for field in grouping_fields:
63
64
  if field == 'negated':
64
- fragments.append(f"coalesce({field}.replace('True','NOT'), '')")
65
+ fragments.append(f"coalesce(cast({field} as varchar).replace('true','NOT'), '')")
65
66
  else:
66
67
  fragments.append(field)
67
68
  grouping_key_fragments = ", ".join(fragments)
68
69
  return f"concat_ws('|', {grouping_key_fragments}) as grouping_key"
69
70
 
71
+
70
72
  def add_closure(kg_archive: str,
71
73
  closure_file: str,
72
74
  nodes_output_file: str,
@@ -145,13 +147,14 @@ def add_closure(kg_archive: str,
145
147
 
146
148
  print(edges_query)
147
149
 
150
+ additional_node_constraints = f"where {additional_node_constraints}" if additional_node_constraints else ""
148
151
  nodes_query = f"""
149
152
  create or replace table denormalized_nodes as
150
153
  select nodes.*,
151
154
  {"".join([node_columns(node_field) for node_field in node_fields])}
152
155
  from nodes
153
156
  {node_joins('has_phenotype')}
154
- where {additional_node_constraints}
157
+ {additional_node_constraints}
155
158
  group by nodes.*
156
159
  """
157
160
  print(nodes_query)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "closurizer"
3
- version = "0.5.1"
3
+ version = "0.6.0"
4
4
  description = "Add closure expansion fields to kgx files following the Golr pattern"
5
5
  authors = ["Kevin Schaper <kevin@tislab.org>"]
6
6
 
@@ -8,13 +8,16 @@ authors = ["Kevin Schaper <kevin@tislab.org>"]
8
8
  python = "^3.8"
9
9
  click = "^8"
10
10
  SQLAlchemy = "^1.4.37"
11
- duckdb = "^0.9.1"
11
+ duckdb = "^0.10.2"
12
12
 
13
13
  [tool.poetry.dev-dependencies]
14
14
 
15
15
  [tool.poetry.scripts]
16
16
  closurizer = "closurizer.cli:main"
17
17
 
18
+ [tool.poetry.group.dev.dependencies]
19
+ pytest = "^8.1.1"
20
+
18
21
  [build-system]
19
22
  requires = ["poetry-core>=1.0.0"]
20
23
  build-backend = "poetry.core.masonry.api"
File without changes