File: gadfly-bridge.sql.xml

package info (click to toggle)
libchado-perl 1.31-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 44,724 kB
  • sloc: sql: 282,721; xml: 192,553; perl: 25,524; sh: 102; python: 73; makefile: 57
file content (227 lines) | stat: -rw-r--r-- 6,103 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<bridge_layer schema="gadfly">
  <notes>
    Bridge layer for GadFly Database schema - allows chado to "masquerade"
    as a GadFly Schema, which means we can use (legacy) GadFly software; 
    GadFly is still in use at the BDGP/DHGP

    Activate this to make this bridge take precedence
    SET SEARCH_PATH TO gadfly,public;
    (note that placing gadfly first in the search path means
    that gadfly.dbxref takes precedence over public.dbxref)
  </notes>

  <relation id="seq_feature">
    <sql>
<![CDATA[
SELECT
  feature_id                    AS id,
  feature.name                  AS name,
  0                             AS created,
  CASE WHEN strand<0 THEN fmax ELSE fmin END AS "start",
  CASE WHEN strand<0 THEN fmin ELSE fmax END AS "end",
  0                             AS major_version,
  0                             AS minor_version,
  NULL                          AS primary_acc,
  NULL                          AS primary_dbname,
  t.name                        AS type,
  organism_id                   AS species_id,
  NULL                          AS annotation_id,
  feature_id                    AS seq_id,
  srcfeature_id                 AS src_seq_id
 FROM feature INNER JOIN featureloc USING (feature_id)
      INNER JOIN cvterm AS t ON (type_id=cvterm_id);
]]>
    </sql>
  </relation>

  <relation id="seq">
    <sql>SELECT
  feature_id                    AS id,
  0                             AS created,
  feature.name                  AS name,
  NULL                          AS molecule_type,
  NULL                          AS last_modified,
  residues,
  NULL                          AS description,
  seqlen                        AS length,
  0                             AS major_version,
  md5checksum
 FROM feature;
    </sql>
  </relation>

  <relation id="sf_produces_sf">
    <sql>SELECT
 produced_by_sf_id     AS subject_id,
 produces_sf_id        AS object_id
 FROM feature_relationship;
    </sql>
  </relation>

  <relation id="exon_rank">
    <sql>SELECT
 exon_sf_id              AS subject_id,
 transcript_sf_id        AS object_id,
 rank
 FROM feature_relationship;
    </sql>
  </relation>

  <relation id="analysis">
    <sql>SELECT
 analysis_id AS id,
 name,
 program,
 sourcename AS dbname,
 NULL AS descrption,
 0 AS created,
 0 AS last_modified
 FROM analysis;
    </sql>
  </relation>

  <relation id="sf_analysis">
    <sql>SELECT
 analysis_id,
 feature_id AS seq_feature_id,
 0 AS job_id
 FROM analysisfeature;
    </sql>
  </relation>

  <relation id="result_span">
    <sql>
<![CDATA[
SELECT
  f.feature_id                    AS id,
  CASE WHEN fl1.strand<0 THEN fl1.fmax ELSE fl1.fmin END AS "start1",
  CASE WHEN fl1.strand<0 THEN fl1.fmin ELSE fl1.fmax END AS "end1",
  CASE WHEN fl2.strand<0 THEN fl2.fmax ELSE fl2.fmin END AS "start1",
  CASE WHEN fl2.strand<0 THEN fl2.fmin ELSE fl2.fmax END AS "end1",
  t.name                        AS type,
  NULL                          AS annotation_id,
  fr.object_id                  AS rset_sf_id,
  0                             AS analysis_id,
  fl1.srcfeature_id             AS seq1_id,
  fl2.srcfeature_id             AS seq2_id,
  0                             AS expect_mantissa,
  0                             AS expect_exponent,
  fl1.phase                     AS query_frame,
  fl2.phase                     AS subject_frame,
  rawscore                      AS score,
  identity                      AS percent_identity
 FROM featyre AS f
 INNER JOIN featureloc AS fl1 ON (fl1.feature_id=f.feature_id)
 INNER JOIN featureloc AS fl2 ON (fl2.feature_id=f.feature_id)
 INNER JOIN cvterm AS t ON (type_id=cvterm_id)
 INNER JOIN feature_relationship AS fr ON (f.feature_id=fr.subject_id)
]]>
    </sql>
  </relation>

  <relation id="sf_property">
    <sql>SELECT
 feature_id AS seq_feature_id,
 t.name     AS p_key,
 value      AS p_val
FROM featureprop INNER JOIN cvterm AS t ON (cvterm_id=type_id);
    </sql>
  </relation>

  <relation id="sf_comment">
    <sql>SELECT
 feature_id AS seq_feature_id,
 0 AS is_internal,
 value AS comment
FROM featureprop INNER JOIN cvterm AS t ON (cvterm_id=type_id)
WHERE t.name='comment';
    </sql>
  </relation>

  <relation id="sf_description">
    <sql>SELECT
 feature_id AS seq_feature_id,
 0 AS is_internal,
 value AS comment
FROM featureprop INNER JOIN cvterm AS t ON (cvterm_id=type_id)
WHERE t.name='description';
    </sql>
  </relation>

  <relation id="result_span_data">
    <sql>SELECT
 result_span_id AS seq_feature_id,
 t.name     AS param_key,
 value      AS param_value
FROM featureprop INNER JOIN cvterm AS t ON (cvterm_id=type_id)
    </sql>
  </relation>

  <relation id="seq2dbxref">
    <sql>SELECT
 feature_id AS seq_id,
 dbxref_id
FROM feature_dbxref;
    </sql>
  </relation>

  <relation id="seq2taxon">
    <sql>SELECT
 feature_id AS seq_id,
 organism_id
FROM feature;
    </sql>
  </relation>

  <relation id="seq_feature2dbxref">
    <sql>SELECT
 feature_id AS feature_id,
 dbxref_id
FROM feature_dbxref;
    </sql>
  </relation>

  <relation id="feature2taxon">
    <sql>SELECT
 feature_id AS feature_id,
 organism_id
FROM feature;
    </sql>
  </relation>

  <relation id="dbxref">
    <notes>table name clash - be sure to prefix with schema name</notes>
    <sql>
 SELECT
  dbxref_id                          AS id,
  db.name                            AS dbname,
  dbxref.accession                   AS accession,
  CAST(NULL AS VARCHAR)              AS accessiontype,
  dbxref.description                 AS description
 FROM public.dbxref
  INNER JOIN public.db USING (db_id);
    </sql>
    <index>
CREATE INDEX dbxref_idx1 ON gadfly.dbxref (id);
CREATE INDEX dbxref_idx2 ON gadfly.dbxref (dbname);
CREATE INDEX dbxref_idx3 ON gadfly.dbxref (accession);
CREATE INDEX dbxref_idx4 ON gadfly.dbxref (accessiontype);
CREATE INDEX dbxref_idx5 ON gadfly.dbxref (description);
    </index>
  </relation>

  <relation id="taxon">
    <sql>SELECT
 organism_id AS id,
 0 AS parent_taxon_id,
 genus,
 species,
 common_name,
 '' AS taxon_code,
 '' AS embl_code
FROM organism;
    </sql>
  </relation>


</bridge_layer>