Debian Codegraph @

stag-templates/README

raw
1 CHADO STAG TEMPLATES
2 ====================
3
4 [note: this part of chado is NOT YET FULLY SUPPORTED]
5
6 This directory contains SQL Templates for querying chado in stag
7 format. The templates can either be browsed as a resource in their own
8 right, or they can be used in conjunction with the DBStag library.
9
10 These templates let you query chado via
11
12 WWW
13 Command Line
14 API
15
16 And retrieve XML or auto-objects representing nested relations from a
17 set of templated queries.
18
19 For example
20
21 chado-pcgenemodel -d chado gene_name=CG1234
22 chado-genemodel -d chado gene_name=CR15821
23 chado-protein -d chado CG1234-PA
24 chado-mrna -d chado CG1234-RA
25 chado-feature-by-direct-cvterm -d chado cvterm_name='chaperone activity'
26
27 PREREQUISITES
28 =============
29
30 You need a local chado database, AND you need to define the BDGP views
31 over them; see
32
33 chado/modules/sequence/bdgp/bdgp-views.sql
34
35 You also need
36
37 Data::Stag
38 DBIx::DBStag (version 0.02 or higher)
39
40 UNERSTANDING STAG SQL TEMPLATES
41 ===============================
42
43 A stag SQL template is fairly simple - the first part is basically an
44 SQL query with placeholder variables, and the second part is optional
45 metadata.
46
47 A placeholder variable (typically in the WHERE part of the query) looks like this
48
49 [ feature.name => &name& ]
50
51 This means the template user can optionally fill in a value for &name&
52 - this can be a string match (in which case LIKE will be used) or an
53 exact match.
54
55 DBStag utilises one extension to SQL - the "USE NESTING" clause.
56
57 This is for constructing hierarchical XML from the query results -
58 DBStag will decompose the results of any SQL query back into the
59 original relations
60
61 For full documentation on templates, install DBIx::DBStag and read the
62 pod docs for DBIx::DBStag::SQLTemplate
63
64 USING STAG TEMPLATES
65 ====================
66
67 Stag templates can either be used on the command line or via a WWW
68 interface. Both give the option of returning either row data or
69 hierarchical data (eg XML).
70
71 The WWW interface to chado via stag templates may or may not be running here:
72
73 http://www.godatabase.org/cgi-bin/ubiq/ubiq.cgi
74
75 Select one of the chado databases and you will be presented with a
76 list of possible templates; select one and then fill in the
77 placeholder variables, or your own SQL.
78
79 Alternatively, you can install DBIx::DBStag (use at least version
80 0.02) from CPAN or from cvs (http://stag.sf.net), then do this:
81
82 setenv DBSTAG_TEMPLATE_DIRS "$HOME/gmod/schema/chado/stag-templates"
83
84 (or wherever this directory resides)
85
86 You can use a template by specifying its name after the slash with the
87 following script:
88
89 selectall_xml.pl -d chado /basic-feature CG1234
90
91 or you can bind specific placeholder variables like this:
92
93 selectall_xml.pl -d chado /basic-feature name=CG1234
94
95 You can also generate an individual script for every templates; just type
96
97 make -f make-publish PUBTMPLDIR=/my/template/dir TEMPLATEBINDIR=/my/bin
98
99 (substituting appropriately)
100
101 then you can just run the templates; try
102
103 basic-feature -h
104
105 Have fun! More documentation coming soon
106
107 Chris Mungall BDGP
108 [email protected]