closurizer 0.5.1__py3-none-any.whl → 0.6.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.
- closurizer/closurizer.py +5 -2
- {closurizer-0.5.1.dist-info → closurizer-0.6.0.dist-info}/METADATA +2 -2
- closurizer-0.6.0.dist-info/RECORD +6 -0
- {closurizer-0.5.1.dist-info → closurizer-0.6.0.dist-info}/WHEEL +1 -1
- closurizer-0.5.1.dist-info/RECORD +0 -6
- {closurizer-0.5.1.dist-info → closurizer-0.6.0.dist-info}/entry_points.txt +0 -0
closurizer/closurizer.py
CHANGED
@@ -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('
|
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
|
-
|
157
|
+
{additional_node_constraints}
|
155
158
|
group by nodes.*
|
156
159
|
"""
|
157
160
|
print(nodes_query)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: closurizer
|
3
|
-
Version: 0.
|
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.
|
16
|
+
Requires-Dist: duckdb (>=0.10.2,<0.11.0)
|
@@ -0,0 +1,6 @@
|
|
1
|
+
closurizer/cli.py,sha256=AfK0Dy0lSmngUfzxKsT6VuH_YqjUVA1yU1Ko41Yil1w,1827
|
2
|
+
closurizer/closurizer.py,sha256=MMFeYqmgKB6Pr9Eh2jWeZt4mnDS635oGg8rl0ywJRvE,6902
|
3
|
+
closurizer-0.6.0.dist-info/METADATA,sha256=IALfF2731qv6hyIPRPiwYESfFNPshLmMnQ3PPEVo9eQ,629
|
4
|
+
closurizer-0.6.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
5
|
+
closurizer-0.6.0.dist-info/entry_points.txt,sha256=MnAVu1lgP6DqDb3BZGNzVs2AnDMsp4sThi3ccWbONFo,50
|
6
|
+
closurizer-0.6.0.dist-info/RECORD,,
|
@@ -1,6 +0,0 @@
|
|
1
|
-
closurizer/cli.py,sha256=AfK0Dy0lSmngUfzxKsT6VuH_YqjUVA1yU1Ko41Yil1w,1827
|
2
|
-
closurizer/closurizer.py,sha256=1e4PeURTuWdEDRyuDxN2G4ujGmgnvy8HYxbyjHs2nqo,6777
|
3
|
-
closurizer-0.5.1.dist-info/METADATA,sha256=FqCLJcXZZqvy8SAjfmT1huatf4I9XQ4Afx27zuznUVI,628
|
4
|
-
closurizer-0.5.1.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
5
|
-
closurizer-0.5.1.dist-info/entry_points.txt,sha256=MnAVu1lgP6DqDb3BZGNzVs2AnDMsp4sThi3ccWbONFo,50
|
6
|
-
closurizer-0.5.1.dist-info/RECORD,,
|
File without changes
|