Skip to content
This repository has been archived by the owner on Aug 29, 2020. It is now read-only.

Commit

Permalink
Merge pull request #145 from zhlu9890/develop
Browse files Browse the repository at this point in the history
add total_count
  • Loading branch information
jayrbolton authored Jul 21, 2020
2 parents 53eecfe + bc27f83 commit d98d642
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 18 deletions.
14 changes: 9 additions & 5 deletions stored_queries/GO/GO_get_associated_ws_features.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ params:
query_prefix: WITH ws_genome_features, ws_object_version
query: |
LET obj_ref_null=IS_NULL(@obj_ref) OR LENGTH(@obj_ref) == 0
LET raw=(
LET results=(
FOR t in GO_terms
FILTER t.id == @id
FILTER t.created <= @ts AND t.expired >= @ts
Expand All @@ -38,12 +38,16 @@ query: |
FILTER v.is_public OR v.workspace_id IN ws_ids
FILTER obj_ref_null OR v._key == @obj_ref
SORT v.workspace_id ASC, p.vertices[1].feature_id ASC
LIMIT @offset, @limit
RETURN DISTINCT {
ws_obj: KEEP(v, ['workspace_id', 'object_id', 'version', 'name']),
feature: KEEP(p.vertices[1], ['feature_id', 'updated_at'])
}
)
FOR r IN raw
COLLECT ws_obj=r.ws_obj INTO features=r.feature
RETURN {ws_obj, features}
LET total_count=COUNT(results)
LET limited=(
FOR r in results
LIMIT @offset, @limit
COLLECT ws_obj=r.ws_obj INTO features=r.feature
RETURN {ws_obj, features}
)
RETURN {results: limited, total_count}
34 changes: 21 additions & 13 deletions stored_queries/GO/GO_get_associated_ws_objects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,25 @@ params:
title: Versioning timestamp
query_prefix: WITH ws_genome_features, ws_object_version
query: |
FOR t in GO_terms
FILTER t.id == @id
FILTER t.created <= @ts AND t.expired >= @ts
LIMIT 1
FOR v, e, p IN 2 INBOUND t ws_feature_has_GO_annotation, ws_genome_has_feature
FILTER p.edges[0].created <= @ts AND p.edges[0].expired >= @ts
FILTER v.is_public OR v.workspace_id IN ws_ids
SORT v.workspace_id ASC, p.vertices[1].feature_id ASC
COLLECT ws_obj = v WITH COUNT INTO feature_count
LET results=(
FOR t in GO_terms
FILTER t.id == @id
FILTER t.created <= @ts AND t.expired >= @ts
LIMIT 1
FOR v, e, p IN 2 INBOUND t ws_feature_has_GO_annotation, ws_genome_has_feature
FILTER p.edges[0].created <= @ts AND p.edges[0].expired >= @ts
FILTER v.is_public OR v.workspace_id IN ws_ids
SORT v.workspace_id ASC, p.vertices[1].feature_id ASC
COLLECT ws_obj = v WITH COUNT INTO feature_count
RETURN DISTINCT {
ws_obj: KEEP(ws_obj, ['workspace_id', 'object_id', 'version', 'name']),
feature_count
}
)
LET total_count=COUNT(results)
LET limited=(
FOR r in results
LIMIT @offset, @limit
RETURN DISTINCT {
ws_obj: KEEP(ws_obj, ['workspace_id', 'object_id', 'version', 'name']),
feature_count
}
RETURN r
)
RETURN {results: limited, total_count}

0 comments on commit d98d642

Please sign in to comment.