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>
|