Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ authors = [
{ name = "Conrad Bzura", email = "conradbzura@gmail.com" },
]
dependencies = [
"sqlglot>=20.0.0",
"sqlglot>=30.0.0",
]
description = "Genomic Interval Query Language - SQL dialect for genomic range queries"
dynamic = ["version"]
Expand Down Expand Up @@ -84,6 +84,6 @@ pytest = ">=7.0.0"
pytest-cov = ">=4.0.0"
duckdb = ">=1.4.0"
pandas = ">=2.0.0"
sqlglot = ">=20.0.0"
sqlglot = ">=30.0.0"
pip = "*"
hypothesis = ">=6.148.2,<7"
13 changes: 7 additions & 6 deletions src/giql/dialect.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,14 @@ def _parse_spatial_predicate(self, left, operator, expr_class):
self._match_r_paren()

return self.expression(
SpatialSetPredicate,
this=left,
operator=operator,
quantifier=quantifier,
ranges=ranges,
SpatialSetPredicate(
this=left,
operator=operator,
quantifier=quantifier,
ranges=ranges,
)
)
else:
# Simple spatial predicate
right = self._parse_term()
return self.expression(expr_class, this=left, expression=right)
return self.expression(expr_class(this=left, expression=right))
10 changes: 5 additions & 5 deletions src/giql/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class GenomicRange(exp.Expression):
}


class SpatialPredicate(exp.Binary):
class SpatialPredicate(exp.Expression, exp.Binary):
"""Base class for spatial predicates."""

pass
Expand Down Expand Up @@ -88,7 +88,7 @@ def _split_named_and_positional(args):
return kwargs, positional_args


class GIQLCluster(exp.Func):
class GIQLCluster(exp.Expression, exp.Func):
"""CLUSTER window function for assigning cluster IDs to overlapping intervals.

Implicitly partitions by chromosome and orders by start position.
Expand Down Expand Up @@ -116,7 +116,7 @@ def from_arg_list(cls, args):
return cls(**kwargs)


class GIQLMerge(exp.Func):
class GIQLMerge(exp.Expression, exp.Func):
"""MERGE aggregate function for combining overlapping intervals.

Merges overlapping or bookended intervals into single intervals.
Expand Down Expand Up @@ -144,7 +144,7 @@ def from_arg_list(cls, args):
return cls(**kwargs)


class GIQLDistance(exp.Func):
class GIQLDistance(exp.Expression, exp.Func):
"""DISTANCE function for calculating genomic distances between intervals.

Generates SQL CASE expression that computes distance between two genomic
Expand Down Expand Up @@ -175,7 +175,7 @@ def from_arg_list(cls, args):
return cls(**kwargs)


class GIQLNearest(exp.Func):
class GIQLNearest(exp.Expression, exp.Func):
"""NEAREST function for finding k-nearest genomic features.

Generates SQL for k-nearest neighbor queries using LATERAL joins
Expand Down
Loading