File: chaos-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 (83 lines) | stat: -rw-r--r-- 1,901 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
<bridge_layer schema="chaos">
  <notes>
    Chaos is a simplified view layer over Chado. 
    To activate, SET search_path=chaos,public,pg_catalog;
    Be warned - this rewrites standard chado tables like feature
  </notes>

  <relation id="dbxref">
    <notes>table name clash - be sure to prefix with schema name</notes>
    <sql>
 SELECT
  dbxref.*,
  db.name                            AS dbname,
  db.name || ':' || accession        AS dbxrefstr
 FROM public.dbxref
  INNER JOIN public.db USING (db_id);
    </sql>
  </relation>

  <relation id="organism">
    <notes>table name clash - be sure to prefix with schema name</notes>
    <sql>
 SELECT
  *,
  genus || ' ' || species || ' (' || common_name || ')' AS organismstr
 FROM organism
    </sql>
  </relation>

  <relation id="feature">
    <notes>table name clash - be sure to prefix with schema name</notes>
    <sql>
 SELECT 
  feature_id,
  f.name,
  uniquename,
  type_id,
  f.dbxref_id,
  t.name         AS type,
  organismstr,
  dbxrefstr,
  residues,
  seqlen,
  md5checksum
 FROM public.feature AS f
  LEFT OUTER JOIN chaos.dbxref USING (dbxref_id)
  INNER JOIN chaos.organism USING (organism_id)
  INNER JOIN cvterm AS t ON (t.cvterm_id=type_id)
    </sql>
  </relation>

  <relation id="featureprop">
    <notes>table name clash - be sure to prefix with schema name</notes>
    <sql>
 SELECT 
  feature_id,
  t.name         AS type,
  value
 FROM public.featureprop
  INNER JOIN cvterm AS t ON (t.cvterm_id=type_id)
    </sql>
  </relation>

  <relation id="featureloc">
    <notes>table name clash - be sure to prefix with schema name</notes>
    <sql>
<![CDATA[
 SELECT 
  feature_id,
  srcfeature_id,
  CASE WHEN strand < 0 THEN fmax ELSE fmin END AS nbeg,
  CASE WHEN strand < 0 THEN fmin ELSE fmax END AS nend,
  fmin,
  fmax,
  strand,
  rank,
  locgroup
 FROM public.featureloc
]]>
    </sql>
  </relation>

</bridge_layer>