Skip to content

Commit

Permalink
Merge 21a4c70 into 0fe36d1
Browse files Browse the repository at this point in the history
  • Loading branch information
mboudet committed Jul 21, 2023
2 parents 0fe36d1 + 21a4c70 commit 0aba686
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 21 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/github-publish-celery-flaskomics.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish Flaskomics Docker image to github
name: Publish Flaskomics Docker image to github

on:
push:
Expand All @@ -14,13 +14,14 @@ env:

jobs:
build-and-push-image:
if: github.repository == 'askomics/flaskomics'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
-
-
name: Checkout repository
uses: actions/checkout@v3

Expand Down Expand Up @@ -60,7 +61,7 @@ jobs:
uses: docker/build-push-action@v2
with:
context: .
file: ./docker/DockerfileCelery
file: ./docker/DockerfileCelery
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
5 changes: 3 additions & 2 deletions .github/workflows/github-publish-flaskomics.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish Flaskomics Docker image to github
name: Publish Flaskomics Docker image to github

on:
push:
Expand All @@ -14,13 +14,14 @@ env:

jobs:
build-and-push-image:
if: github.repository == 'askomics/flaskomics'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
-
-
name: Checkout repository
uses: actions/checkout@v3

Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ This changelog was started for release 4.2.0.
- Fixed Gff Faldo integration (was only integrating the last selected entity)
- Fixed an issue when using filters and an 'UNION' node
- Fixed an issue when launching a query with a 'linked' attribute toggled but unselected
- Fixed missing includeIn and includeInReference in bed files
- Fixed 'overlap_with' faldo query

### Changed

Expand Down
10 changes: 10 additions & 0 deletions askomics/libaskomics/BedFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,4 +306,14 @@ def generate_rdf_content(self):
self.graph_chunk.add((begin, rdflib.RDF.type, faldo_strand))
self.graph_chunk.add((end, rdflib.RDF.type, faldo_strand))

# blocks
block_base = self.settings.getint("triplestore", "block_size")
block_start = int(self.convert_type(feature.start + 1)) // block_base
block_end = int(self.convert_type(feature.end)) // block_base

for slice_block in range(block_start, block_end + 1):
self.graph_chunk.add((entity, self.namespace_internal['includeIn'], rdflib.Literal(int(slice_block))))
block_reference = self.rdfize(self.format_uri("{}_{}".format(feature.chrom, slice_block)))
self.graph_chunk.add((entity, self.namespace_internal["includeInReference"], block_reference))

yield
18 changes: 9 additions & 9 deletions askomics/libaskomics/GffFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,15 +412,15 @@ def generate_rdf_content(self):
self.graph_chunk.add((begin, rdflib.RDF.type, faldo_strand))
self.graph_chunk.add((end, rdflib.RDF.type, faldo_strand))

# blocks
block_base = self.settings.getint("triplestore", "block_size")
block_start = int(self.convert_type(feature.location.start)) // block_base
block_end = int(self.convert_type(feature.location.end)) // block_base

for slice_block in range(block_start, block_end + 1):
self.graph_chunk.add((entity, self.namespace_internal['includeIn'], rdflib.Literal(int(slice_block))))
block_reference = self.rdfize(self.format_uri("{}_{}".format(rec.id, slice_block)))
self.graph_chunk.add((entity, self.namespace_internal["includeInReference"], block_reference))
# blocks
block_base = self.settings.getint("triplestore", "block_size")
block_start = int(self.convert_type(feature.location.start)) // block_base
block_end = int(self.convert_type(feature.location.end)) // block_base

for slice_block in range(block_start, block_end + 1):
self.graph_chunk.add((entity, self.namespace_internal['includeIn'], rdflib.Literal(int(slice_block))))
block_reference = self.rdfize(self.format_uri("{}_{}".format(rec.id, slice_block)))
self.graph_chunk.add((entity, self.namespace_internal["includeInReference"], block_reference))

yield

Expand Down
19 changes: 12 additions & 7 deletions askomics/libaskomics/SparqlQuery.py
Original file line number Diff line number Diff line change
Expand Up @@ -1036,8 +1036,9 @@ def get_source_of_special_node(self, special_node_id):
"""
for link in self.json["links"]:
if link["type"] == "specialLink":
if link["source"]["id"] == special_node_id:
return link["target"]["id"]
# Source is also a special node. Get source of source
if link["source"]['type'] in ['unionNode', 'minusNode']:
return self.get_source_of_special_node(link["source"]['id'])
if link["target"]["id"] == special_node_id:
return link["source"]["id"]
return None
Expand Down Expand Up @@ -1093,12 +1094,17 @@ def build_query_from_json(self, preview=False, for_editor=False):

# if link is special, replace the special node variable with its real node
if link["type"] == "specialLink":
special_node = link["source"] if link["source"]["type"] in ("unionNode", "minusNode") else link["target"]
real_node = link["target"] if link["source"]["type"] in ("unionNode", "minusNode") else link["source"]
special_node = link["target"]
real_node = link["source"]
real_node_id = real_node['id']

# Both end are special nodes.
if real_node['type'] in ['minusNode', 'unionNode']:
real_node_id = self.get_source_of_special_node(real_node_id)

var_to_replace.append((
self.format_sparql_variable("{}{}_uri".format(special_node["label"], special_node["id"])),
self.format_sparql_variable("{}{}_uri".format(real_node["label"], real_node["id"]))
self.format_sparql_variable("{}{}_uri".format(real_node["label"], real_node_id))
))

continue
Expand Down Expand Up @@ -1185,7 +1191,7 @@ def build_query_from_json(self, preview=False, for_editor=False):
), block_id, sblock_id, pblock_ids)

elif link["uri"] == "overlap_with":
self.store_filter("FILTER (({start2} >{equalsign} {start1} && {start2} <{equalsign} {end1}) || ({end2} >{equalsign} {start1} && {end2} <{equalsign} {end1}))".format(
self.store_filter("FILTER (({start2} >{equalsign} {start1} && {start2} <{equalsign} {end1}) || ({end2} >{equalsign} {start1} && {end2} <{equalsign} {end1}) || ({start1} >{equalsign} {start2} && {end1} <{equalsign} {end2}))".format(
start1=start_1,
start2=start_2,
end1=end_1,
Expand Down Expand Up @@ -1563,7 +1569,6 @@ def build_query_from_json(self, preview=False, for_editor=False):
self.replace_variables_in_triples(var_to_replace)

# Write the query

# query is for editor (no froms, no federated)
if for_editor:
query = """
Expand Down

0 comments on commit 0aba686

Please sign in to comment.