Skip to content

Commit

Permalink
Backport fix from GMOD/Chado#105 (#11)
Browse files Browse the repository at this point in the history
Backport fix from GMOD/Chado#105
  • Loading branch information
hexylena authored Jul 5, 2019
2 parents 7d90d2e + c9781c4 commit f44174c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Chado Schema Builder

[![Build Status](https://build.galaxyproject.eu/buildStatus/icon?job=usegalaxy-eu%2Fchado-schema-builder)](https://build.galaxyproject.eu/job/usegalaxy-eu/job/chado-schema-builder/)

This project provides a dockerfile to automatically build the chado database
dumps. These schema dumps are necessary due to how much time and memory the
process of parsing ontologies takes. For older machines such as the author's
Expand Down
32 changes: 31 additions & 1 deletion cvtermpath_fix.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
--- example: select * from fill_cvtermpath(7); where 7 is cv_id for an ontology
--- fill path from the node to its children and their children

--- Also a bugfix backported from https://github.com/GMOD/Chado/pull/105

SELECT set_config('search_path',
string_agg(quote_ident(s),','),
false)
FROM unnest(current_schemas(false)) s;

CREATE OR REPLACE FUNCTION _fill_cvtermpath4node(BIGINT, BIGINT, BIGINT, BIGINT, INTEGER, BIGINT[]) RETURNS INTEGER AS
'
DECLARE
Expand Down Expand Up @@ -71,4 +79,26 @@ BEGIN
RETURN 1;
END;
'
LANGUAGE 'plpgsql';
LANGUAGE 'plpgsql' SET SEARCH_PATH FROM CURRENT;

CREATE OR REPLACE FUNCTION fill_cvtermpath(cv.name%TYPE) RETURNS INTEGER AS
'
DECLARE
cvname alias for $1;
cv_id int;
rtn int;
BEGIN
SELECT INTO cv_id cv.cv_id from cv WHERE cv.name = cvname;
SELECT INTO rtn fill_cvtermpath(cv_id);
RETURN rtn;
END;
'
LANGUAGE 'plpgsql' SET SEARCH_PATH FROM CURRENT;

CREATE OR REPLACE FUNCTION boxrange (bigint, bigint) RETURNS box AS
'SELECT box (create_point(CAST(0 AS bigint), $1), create_point($2,500000000))'
LANGUAGE 'sql' IMMUTABLE SET SEARCH_PATH FROM CURRENT;

CREATE OR REPLACE FUNCTION boxrange (bigint, bigint, bigint) RETURNS box AS
'SELECT box (create_point($1, $2), create_point($1,$3))'
LANGUAGE 'sql' IMMUTABLE SET SEARCH_PATH FROM CURRENT;

0 comments on commit f44174c

Please sign in to comment.