-- ==========================================
-- Chado general module
--
-- ================================================
-- TABLE: tableinfo
-- ================================================

create table tableinfo (
    tableinfo_id serial not null,
    primary key (tableinfo_id),
    name varchar(30) not null,
    primary_key_column varchar(30) null,
    is_view int not null default 0,
    view_on_table_id int null,
    superclass_table_id int null,
    is_updateable int not null default 1,
    modification_date date not null default now(),
    constraint tableinfo_c1 unique (name)
);

COMMENT ON TABLE tableinfo IS NULL;

-- ================================================
-- TABLE: db
-- ================================================

create table db (
    db_id serial not null,
    primary key (db_id),
    name varchar(255) not null,
--    contact_id int,
--    foreign key (contact_id) references contact (contact_id) on delete cascade INITIALLY DEFERRED,
    description varchar(255) null,
    urlprefix varchar(255) null,
    url varchar(255) null,
    constraint db_c1 unique (name)
);

COMMENT ON TABLE db IS 'A database authority. Typical databases in
bioinformatics are FlyBase, GO, UniProt, NCBI, MGI, etc. The authority
is generally known by this shortened form, which is unique within the
bioinformatics and biomedical realm.  To Do - add support for URIs,
URNs (e.g. LSIDs). We can do this by treating the URL as a URI -
however, some applications may expect this to be resolvable - to be
decided.';

-- ================================================
-- TABLE: dbxref
-- ================================================

create table dbxref (
    dbxref_id serial not null,
    primary key (dbxref_id),
    db_id int not null,
    foreign key (db_id) references db (db_id) on delete cascade INITIALLY DEFERRED,
    accession varchar(255) not null,
    version varchar(255) not null default '',
    description text,
    constraint dbxref_c1 unique (db_id,accession,version)
);
create index dbxref_idx1 on dbxref (db_id);
create index dbxref_idx2 on dbxref (accession);
create index dbxref_idx3 on dbxref (version);

COMMENT ON TABLE dbxref IS 'A unique, global, public, stable identifier. Not necessarily an external reference - can reference data items inside the particular chado instance being used. Typically a row in a table can be uniquely identified with a primary identifier (called dbxref_id); a table may also have secondary identifiers (in a linking table <T>_dbxref). A dbxref is generally written as <DB>:<ACCESSION> or as <DB>:<ACCESSION>:<VERSION>.';

COMMENT ON COLUMN dbxref.accession IS 'The local part of the identifier. Guaranteed by the db authority to be unique for that db.';

CREATE VIEW db_dbxref_count AS
  SELECT db.name,count(*) AS num_dbxrefs FROM db INNER JOIN dbxref USING (db_id) GROUP BY db.name;
COMMENT ON VIEW db_dbxref_count IS 'per-db dbxref counts';

CREATE OR REPLACE FUNCTION store_db (VARCHAR) 
  RETURNS INT AS 
'DECLARE
   v_name             ALIAS FOR $1;

   v_db_id            INTEGER;
 BEGIN
    SELECT INTO v_db_id db_id
      FROM db
      WHERE name=v_name;
    IF NOT FOUND THEN
      INSERT INTO db
       (name)
         VALUES
       (v_name);
       RETURN currval(''db_db_id_seq'');
    END IF;
    RETURN v_db_id;
 END;
' LANGUAGE 'plpgsql';
  
CREATE OR REPLACE FUNCTION store_dbxref (VARCHAR,VARCHAR) 
  RETURNS INT AS 
'DECLARE
   v_dbname                ALIAS FOR $1;
   v_accession             ALIAS FOR $1;

   v_db_id                 INTEGER;
   v_dbxref_id             INTEGER;
 BEGIN
    SELECT INTO v_db_id
      store_db(v_dbname);
    SELECT INTO v_dbxref_id dbxref_id
      FROM dbxref
      WHERE db_id=v_db_id       AND
            accession=v_accession;
    IF NOT FOUND THEN
      INSERT INTO dbxref
       (db_id,accession)
         VALUES
       (v_db_id,v_accession);
       RETURN currval(''dbxref_dbxref_id_seq'');
    END IF;
    RETURN v_dbxref_id;
 END;
' LANGUAGE 'plpgsql';
  
-- ==========================================
-- Chado cv module
--
-- =================================================================
-- Dependencies:
--
-- :import dbxref from general
-- =================================================================

-- ================================================
-- TABLE: cv
-- ================================================
create table cv (
    cv_id serial not null,
    primary key (cv_id),
    name varchar(255) not null,
   definition text,
   constraint cv_c1 unique (name)
);

COMMENT ON TABLE cv IS 'A controlled vocabulary or ontology. A cv is
composed of cvterms (AKA terms, classes, types, universals - relations
and properties are also stored in cvterm) and the relationships
between them.';

COMMENT ON COLUMN cv.name IS 'The name of the ontology. This
corresponds to the obo-format -namespace-. cv names uniquely identify
the cv. In OBO file format, the cv.name is known as the namespace.';

COMMENT ON COLUMN cv.definition IS 'A text description of the criteria for
membership of this ontology.';

-- ================================================
-- TABLE: cvterm
-- ================================================
create table cvterm (
    cvterm_id serial not null,
    primary key (cvterm_id),
    cv_id int not null,
    foreign key (cv_id) references cv (cv_id) on delete cascade INITIALLY DEFERRED,
    name varchar(1024) not null,
    definition text,
    dbxref_id int not null,
    foreign key (dbxref_id) references dbxref (dbxref_id) on delete set null INITIALLY DEFERRED,
    is_obsolete int not null default 0,
    is_relationshiptype int not null default 0,
    constraint cvterm_c1 unique (name,cv_id,is_obsolete),
    constraint cvterm_c2 unique (dbxref_id)
);
create index cvterm_idx1 on cvterm (cv_id);
create index cvterm_idx2 on cvterm (name);
create index cvterm_idx3 on cvterm (dbxref_id);

COMMENT ON TABLE cvterm IS 'A term, class, universal or type within an
ontology or controlled vocabulary.  This table is also used for
relations and properties. cvterms constitute nodes in the graph
defined by the collection of cvterms and cvterm_relationships.';

COMMENT ON COLUMN cvterm.cv_id IS 'The cv or ontology or namespace to which
this cvterm belongs.';

COMMENT ON COLUMN cvterm.name IS 'A concise human-readable name or
label for the cvterm. Uniquely identifies a cvterm within a cv.';

COMMENT ON COLUMN cvterm.definition IS 'A human-readable text
definition.';

COMMENT ON COLUMN cvterm.dbxref_id IS 'Primary identifier dbxref - The
unique global OBO identifier for this cvterm.  Note that a cvterm may
have multiple secondary dbxrefs - see also table: cvterm_dbxref.';

COMMENT ON COLUMN cvterm.is_obsolete IS 'Boolean 0=false,1=true; see
GO documentation for details of obsoletion. Note that two terms with
different primary dbxrefs may exist if one is obsolete.';

COMMENT ON COLUMN cvterm.is_relationshiptype IS 'Boolean
0=false,1=true relations or relationship types (also known as Typedefs
in OBO format, or as properties or slots) form a cv/ontology in
themselves. We use this flag to indicate whether this cvterm is an
actual term/class/universal or a relation. Relations may be drawn from
the OBO Relations ontology, but are not exclusively drawn from there.';

COMMENT ON INDEX cvterm_c1 IS 'A name can mean different things in
different contexts; for example "chromosome" in SO and GO. A name
should be unique within an ontology or cv. A name may exist twice in a
cv, in both obsolete and non-obsolete forms - these will be for
different cvterms with different OBO identifiers; so GO documentation
for more details on obsoletion. Note that occasionally multiple
obsolete terms with the same name will exist in the same cv. If this
is a possibility for the ontology under consideration (e.g. GO) then the
ID should be appended to the name to ensure uniqueness.';

COMMENT ON INDEX cvterm_c2 IS 'The OBO identifier is globally unique.';

-- ================================================
-- TABLE: cvterm_relationship
-- ================================================
create table cvterm_relationship (
    cvterm_relationship_id serial not null,
    primary key (cvterm_relationship_id),
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    subject_id int not null,
    foreign key (subject_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    object_id int not null,
    foreign key (object_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    constraint cvterm_relationship_c1 unique (subject_id,object_id,type_id)
);
create index cvterm_relationship_idx1 on cvterm_relationship (type_id);
create index cvterm_relationship_idx2 on cvterm_relationship (subject_id);
create index cvterm_relationship_idx3 on cvterm_relationship (object_id);

COMMENT ON TABLE cvterm_relationship IS 'A relationship linking two
cvterms. Each cvterm_relationship constitutes an edge in the graph
defined by the collection of cvterms and cvterm_relationships. The
meaning of the cvterm_relationship depends on the definition of the
cvterm R refered to by type_id. However, in general the definitions
are such that the statement "all SUBJs REL some OBJ" is true. The
cvterm_relationship statement is about the subject, not the
object. For example "insect wing part_of thorax".';

COMMENT ON COLUMN cvterm_relationship.subject_id IS 'The subject of
the subj-predicate-obj sentence. The cvterm_relationship is about the
subject. In a graph, this typically corresponds to the child node.';

COMMENT ON COLUMN cvterm_relationship.object_id IS 'The object of the
subj-predicate-obj sentence. The cvterm_relationship refers to the
object. In a graph, this typically corresponds to the parent node.';

COMMENT ON COLUMN cvterm_relationship.type_id IS 'The nature of the
relationship between subject and object. Note that relations are also
housed in the cvterm table, typically from the OBO relationship
ontology, although other relationship types are allowed.';

-- ================================================
-- TABLE: cvtermpath
-- ================================================
create table cvtermpath (
    cvtermpath_id serial not null,
    primary key (cvtermpath_id),
    type_id int,
    foreign key (type_id) references cvterm (cvterm_id) on delete set null INITIALLY DEFERRED,
    subject_id int not null,
    foreign key (subject_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    object_id int not null,
    foreign key (object_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    cv_id int not null,
    foreign key (cv_id) references cv (cv_id) on delete cascade INITIALLY DEFERRED,
    pathdistance int,
    constraint cvtermpath_c1 unique (subject_id,object_id,type_id,pathdistance)
);
create index cvtermpath_idx1 on cvtermpath (type_id);
create index cvtermpath_idx2 on cvtermpath (subject_id);
create index cvtermpath_idx3 on cvtermpath (object_id);
create index cvtermpath_idx4 on cvtermpath (cv_id);

COMMENT ON TABLE cvtermpath IS 'The reflexive transitive closure of
the cvterm_relationship relation.';

COMMENT ON COLUMN cvtermpath.type_id IS 'The relationship type that
this is a closure over. If null, then this is a closure over ALL
relationship types. If non-null, then this references a relationship
cvterm - note that the closure will apply to both this relationship
AND the OBO_REL:is_a (subclass) relationship.';

COMMENT ON COLUMN cvtermpath.cv_id IS 'Closures will mostly be within
one cv. If the closure of a relationship traverses a cv, then this
refers to the cv of the object_id cvterm.';

COMMENT ON COLUMN cvtermpath.pathdistance IS 'The number of steps
required to get from the subject cvterm to the object cvterm, counting
from zero (reflexive relationship).';

-- ================================================
-- TABLE: cvtermsynonym
-- ================================================
create table cvtermsynonym (
    cvtermsynonym_id serial not null,
    primary key (cvtermsynonym_id),
    cvterm_id int not null,
    foreign key (cvterm_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    synonym varchar(1024) not null,
    type_id int,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade  INITIALLY DEFERRED,
    constraint cvtermsynonym_c1 unique (cvterm_id,synonym)
);
create index cvtermsynonym_idx1 on cvtermsynonym (cvterm_id);

COMMENT ON TABLE cvtermsynonym IS 'A cvterm actually represents a
distinct class or concept. A concept can be refered to by different
phrases or names. In addition to the primary name (cvterm.name) there
can be a number of alternative aliases or synonyms. For example, "T
cell" as a synonym for "T lymphocyte".';

COMMENT ON COLUMN cvtermsynonym.type_id IS 'A synonym can be exact,
narrower, or broader than.';


-- ================================================
-- TABLE: cvterm_dbxref
-- ================================================
create table cvterm_dbxref (
    cvterm_dbxref_id serial not null,
    primary key (cvterm_dbxref_id),
    cvterm_id int not null,
    foreign key (cvterm_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    dbxref_id int not null,
    foreign key (dbxref_id) references dbxref (dbxref_id) on delete cascade INITIALLY DEFERRED,
    is_for_definition int not null default 0,
    constraint cvterm_dbxref_c1 unique (cvterm_id,dbxref_id)
);
create index cvterm_dbxref_idx1 on cvterm_dbxref (cvterm_id);
create index cvterm_dbxref_idx2 on cvterm_dbxref (dbxref_id);

COMMENT ON TABLE cvterm_dbxref IS 'In addition to the primary
identifier (cvterm.dbxref_id) a cvterm can have zero or more secondary
identifiers/dbxrefs, which may refer to records in external
databases. The exact semantics of cvterm_dbxref are not fixed. For
example: the dbxref could be a pubmed ID that is pertinent to the
cvterm, or it could be an equivalent or similar term in another
ontology. For example, GO cvterms are typically linked to InterPro
IDs, even though the nature of the relationship between them is
largely one of statistical association. The dbxref may be have data
records attached in the same database instance, or it could be a
"hanging" dbxref pointing to some external database. NOTE: If the
desired objective is to link two cvterms together, and the nature of
the relation is known and holds for all instances of the subject
cvterm then consider instead using cvterm_relationship together with a
well-defined relation.';

COMMENT ON COLUMN cvterm_dbxref.is_for_definition IS 'A
cvterm.definition should be supported by one or more references. If
this column is true, the dbxref is not for a term in an external database -
it is a dbxref for provenance information for the definition.';


-- ================================================
-- TABLE: cvtermprop
-- ================================================
create table cvtermprop ( 
    cvtermprop_id serial not null, 
    primary key (cvtermprop_id), 
    cvterm_id int not null, 
    foreign key (cvterm_id) references cvterm (cvterm_id) on delete cascade, 
    type_id int not null, 
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade, 
    value text not null default '', 
    rank int not null default 0,

    unique(cvterm_id, type_id, value, rank) 
);
create index cvtermprop_idx1 on cvtermprop (cvterm_id);
create index cvtermprop_idx2 on cvtermprop (type_id);

COMMENT ON TABLE cvtermprop IS 'Additional extensible properties can be attached to a cvterm using this table. Corresponds to -AnnotationProperty- in W3C OWL format.';

COMMENT ON COLUMN cvtermprop.type_id IS 'The name of the property or slot is a cvterm. The meaning of the property is defined in that cvterm.';

COMMENT ON COLUMN cvtermprop.value IS 'The value of the property, represented as text. Numeric values are converted to their text representation.';

COMMENT ON COLUMN cvtermprop.rank IS 'Property-Value ordering. Any
cvterm can have multiple values for any particular property type -
these are ordered in a list using rank, counting from zero. For
properties that are single-valued rather than multi-valued, the
default 0 value should be used.';


-- ================================================
-- TABLE: dbxrefprop
-- ================================================
create table dbxrefprop (
    dbxrefprop_id serial not null,
    primary key (dbxrefprop_id),
    dbxref_id int not null,
    foreign key (dbxref_id) references dbxref (dbxref_id) INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) INITIALLY DEFERRED,
    value text not null default '',
    rank int not null default 0,
    constraint dbxrefprop_c1 unique (dbxref_id,type_id,rank)
);
create index dbxrefprop_idx1 on dbxrefprop (dbxref_id);
create index dbxrefprop_idx2 on dbxrefprop (type_id);

COMMENT ON TABLE dbxrefprop IS 'Metadata about a dbxref. Note that this is not defined in the dbxref module, as it depends on the cvterm table. This table has a structure analagous to cvtermprop.';


-- ================================================
-- TABLE: cvprop
-- ================================================
create table cvprop (
    cvprop_id serial not null,
    primary key (cvprop_id),
    cv_id int not null,
    foreign key (cv_id) references cv (cv_id) INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) INITIALLY DEFERRED,
    value text,
    rank int not null default 0,
    constraint cvprop_c1 unique (cv_id,type_id,rank)
);

COMMENT ON TABLE cvprop IS 'Additional extensible properties can be attached to a cv using this table.  A notable example would be the cv version';

COMMENT ON COLUMN cvprop.type_id IS 'The name of the property or slot is a cvterm. The meaning of the property is defined in that cvterm.';
COMMENT ON COLUMN cvprop.value IS 'The value of the property, represented as text. Numeric values are converted to their text representation.';

COMMENT ON COLUMN cvprop.rank IS 'Property-Value ordering. Any
cv can have multiple values for any particular property type -
these are ordered in a list using rank, counting from zero. For
properties that are single-valued rather than multi-valued, the
default 0 value should be used.';

-- ================================================
-- TABLE: chadoprop
-- ================================================
create table chadoprop (
    chadoprop_id serial not null,
    primary key (chadoprop_id),
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) INITIALLY DEFERRED,
    value text,
    rank int not null default 0,
    constraint chadoprop_c1 unique (type_id,rank)
);

COMMENT ON TABLE chadoprop IS 'This table is different from other prop tables in the database, as it is for storing information about the database itself, like schema version';

COMMENT ON COLUMN chadoprop.type_id IS 'The name of the property or slot is a cvterm. The meaning of the property is defined in that cvterm.';
COMMENT ON COLUMN chadoprop.value IS 'The value of the property, represented as text. Numeric values are converted to their text representation.';

COMMENT ON COLUMN chadoprop.rank IS 'Property-Value ordering. Any
cv can have multiple values for any particular property type -
these are ordered in a list using rank, counting from zero. For
properties that are single-valued rather than multi-valued, the
default 0 value should be used.';

CREATE OR REPLACE VIEW cv_root AS
 SELECT 
  cv_id,
  cvterm_id AS root_cvterm_id
 FROM cvterm
 WHERE 
  cvterm_id NOT IN ( SELECT subject_id FROM cvterm_relationship)    AND
  is_obsolete=0;

COMMENT ON VIEW cv_root IS 'the roots of a cv are the set of terms
which have no parents (terms that are not the subject of a
relation). Most cvs will have a single root, some may have >1. All
will have at least 1';

CREATE OR REPLACE VIEW cv_leaf AS
 SELECT 
  cv_id,
  cvterm_id
 FROM cvterm
 WHERE 
  cvterm_id NOT IN ( SELECT object_id FROM cvterm_relationship);

COMMENT ON VIEW cv_leaf IS 'the leaves of a cv are the set of terms
which have no children (terms that are not the object of a
relation). All cvs will have at least 1 leaf';

CREATE OR REPLACE VIEW common_ancestor_cvterm AS
 SELECT
  p1.subject_id          AS cvterm1_id,
  p2.subject_id          AS cvterm2_id,
  p1.object_id           AS ancestor_cvterm_id,
  p1.pathdistance        AS pathdistance1,
  p2.pathdistance        AS pathdistance2,
  p1.pathdistance + p2.pathdistance
                         AS total_pathdistance
 FROM
  cvtermpath AS p1,
  cvtermpath AS p2
 WHERE 
  p1.object_id = p2.object_id;

COMMENT ON VIEW common_ancestor_cvterm IS 'The common ancestor of any
two terms is the intersection of both terms ancestors. Two terms can
have multiple common ancestors. Use total_pathdistance to get the
least common ancestor';

CREATE OR REPLACE VIEW common_descendant_cvterm AS
 SELECT
  p1.object_id           AS cvterm1_id,
  p2.object_id           AS cvterm2_id,
  p1.subject_id          AS ancestor_cvterm_id,
  p1.pathdistance        AS pathdistance1,
  p2.pathdistance        AS pathdistance2,
  p1.pathdistance + p2.pathdistance
                         AS total_pathdistance
 FROM
  cvtermpath AS p1,
  cvtermpath AS p2
 WHERE 
  p1.subject_id = p2.subject_id;

COMMENT ON VIEW common_descendant_cvterm IS 'The common descendant of
any two terms is the intersection of both terms descendants. Two terms
can have multiple common descendants. Use total_pathdistance to get
the least common ancestor';

CREATE OR REPLACE VIEW stats_paths_to_root AS
 SELECT 
  subject_id                            AS cvterm_id, 
  count(DISTINCT cvtermpath_id)         AS total_paths,
  avg(pathdistance)                     AS avg_distance,
  min(pathdistance)                     AS min_distance,
  max(pathdistance)                     AS max_distance
 FROM cvtermpath INNER JOIN cv_root ON (object_id=root_cvterm_id)
 GROUP BY cvterm_id;

COMMENT ON VIEW stats_paths_to_root IS 'per-cvterm statistics on its
placement in the DAG relative to the root. There may be multiple paths
from any term to the root. This gives the total number of paths, and
the average minimum and maximum distances. Here distance is defined by
cvtermpath.pathdistance';
CREATE VIEW cv_cvterm_count AS
  SELECT cv.name,count(*) AS num_terms_excl_obs FROM cv INNER JOIN cvterm USING (cv_id) WHERE is_obsolete=0 GROUP BY cv.name;
COMMENT ON VIEW cv_cvterm_count IS 'per-cv terms counts (excludes obsoletes)';

CREATE VIEW cv_cvterm_count_with_obs AS
  SELECT cv.name,count(*) AS num_terms_incl_obs FROM cv INNER JOIN cvterm USING (cv_id) GROUP BY cv.name;
COMMENT ON VIEW cv_cvterm_count_with_obs IS 'per-cv terms counts (includes obsoletes)';

CREATE VIEW cv_link_count AS
 SELECT cv.name AS cv_name,
        relation.name AS relation_name,
        relation_cv.name AS relation_cv_name,
        count(*) AS num_links
 FROM cv 
  INNER JOIN cvterm ON (cvterm.cv_id=cv.cv_id) 
  INNER JOIN cvterm_relationship ON (cvterm.cvterm_id=subject_id)
  INNER JOIN cvterm AS relation ON (type_id=relation.cvterm_id)
  INNER JOIN cv AS relation_cv ON (relation.cv_id=relation_cv.cv_id) 
 GROUP BY cv.name,relation.name,relation_cv.name;

COMMENT ON VIEW cv_link_count IS 'per-cv summary of number of
links (cvterm_relationships) broken down by
relationship_type. num_links is the total # of links of the specified
type in which the subject_id of the link is in the named cv';

CREATE VIEW cv_path_count AS
 SELECT cv.name AS cv_name,
        relation.name AS relation_name,
        relation_cv.name AS relation_cv_name,
        count(*) AS num_paths
 FROM cv 
  INNER JOIN cvterm ON (cvterm.cv_id=cv.cv_id) 
  INNER JOIN cvtermpath ON (cvterm.cvterm_id=subject_id)
  INNER JOIN cvterm AS relation ON (type_id=relation.cvterm_id)
  INNER JOIN cv AS relation_cv ON (relation.cv_id=relation_cv.cv_id) 
 GROUP BY cv.name,relation.name,relation_cv.name;

COMMENT ON VIEW cv_path_count IS 'per-cv summary of number of
paths (cvtermpaths) broken down by relationship_type. num_paths is the
total # of paths of the specified type in which the subject_id of the
path is in the named cv. See also: cv_distinct_relations';

CREATE OR REPLACE FUNCTION _get_all_subject_ids(integer) RETURNS SETOF cvtermpath AS
'
DECLARE
    root alias for $1;
    cterm cvtermpath%ROWTYPE;
    cterm2 cvtermpath%ROWTYPE;
BEGIN

    FOR cterm IN SELECT * FROM cvterm_relationship WHERE object_id = root LOOP
        RETURN NEXT cterm;
        FOR cterm2 IN SELECT * FROM _get_all_subject_ids(cterm.subject_id) LOOP
            RETURN NEXT cterm2;
        END LOOP;
    END LOOP;
    RETURN;
END;   
'
LANGUAGE 'plpgsql';

---arg: parent term id
---return: all children term id and their parent term id with relationship type id
CREATE OR REPLACE FUNCTION get_all_subject_ids(integer) RETURNS SETOF cvtermpath AS
'
DECLARE
    root alias for $1;
    cterm cvtermpath%ROWTYPE;
    exist_c int;
BEGIN

    SELECT INTO exist_c count(*) FROM cvtermpath WHERE object_id = root and pathdistance <= 0;
    IF (exist_c > 0) THEN
        FOR cterm IN SELECT * FROM cvtermpath WHERE object_id = root and pathdistance > 0 LOOP
            RETURN NEXT cterm;
        END LOOP;
    ELSE
        FOR cterm IN SELECT * FROM _get_all_subject_ids(root) LOOP
            RETURN NEXT cterm;
        END LOOP;
    END IF;
    RETURN;
END;   
'
LANGUAGE 'plpgsql';

CREATE OR REPLACE FUNCTION get_graph_below(integer) RETURNS SETOF cvtermpath AS
'
DECLARE
    root alias for $1;
    cterm cvtermpath%ROWTYPE;
    cterm2 cvtermpath%ROWTYPE;

BEGIN

    FOR cterm IN SELECT * FROM cvterm_relationship WHERE object_id = root LOOP
        RETURN NEXT cterm;
        FOR cterm2 IN SELECT * FROM get_all_subject_ids(cterm.subject_id) LOOP
            RETURN NEXT cterm2;
        END LOOP;
    END LOOP;
    RETURN;
END;   
'
LANGUAGE 'plpgsql';


CREATE OR REPLACE FUNCTION get_graph_above(integer) RETURNS SETOF cvtermpath AS
'
DECLARE
    leaf alias for $1;
    cterm cvtermpath%ROWTYPE;
    cterm2 cvtermpath%ROWTYPE;

BEGIN

    FOR cterm IN SELECT * FROM cvterm_relationship WHERE subject_id = leaf LOOP
        RETURN NEXT cterm;
        FOR cterm2 IN SELECT * FROM get_all_object_ids(cterm.object_id) LOOP
            RETURN NEXT cterm2;
        END LOOP;
    END LOOP;
    RETURN;
END;   
'
LANGUAGE 'plpgsql';

CREATE OR REPLACE FUNCTION _get_all_object_ids(integer) RETURNS SETOF cvtermpath AS
'
DECLARE
    leaf alias for $1;
    cterm cvtermpath%ROWTYPE;
    cterm2 cvtermpath%ROWTYPE;
BEGIN

    FOR cterm IN SELECT * FROM cvterm_relationship WHERE subject_id = leaf LOOP
        RETURN NEXT cterm;
        FOR cterm2 IN SELECT * FROM _get_all_object_ids(cterm.object_id) LOOP
            RETURN NEXT cterm2;
        END LOOP;
    END LOOP;
    RETURN;
END;   
'
LANGUAGE 'plpgsql';

---arg: child term id
---return: all parent term id and their childrent term id with relationship type id
CREATE OR REPLACE FUNCTION get_all_object_ids(integer) RETURNS SETOF cvtermpath AS
'
DECLARE
    leaf alias for $1;
    cterm cvtermpath%ROWTYPE;
    exist_c int;
BEGIN


    SELECT INTO exist_c count(*) FROM cvtermpath WHERE object_id = leaf and pathdistance <= 0;
    IF (exist_c > 0) THEN
        FOR cterm IN SELECT * FROM cvtermpath WHERE subject_id = leaf AND pathdistance > 0 LOOP
            RETURN NEXT cterm;
        END LOOP;
    ELSE
        FOR cterm IN SELECT * FROM _get_all_object_ids(leaf) LOOP
            RETURN NEXT cterm;
        END LOOP;
    END IF;
    RETURN;
END;   
'
LANGUAGE 'plpgsql';

---arg: sql statement which must be in the form of select cvterm_id from ...
---return: a set of cvterm ids that includes what is in sql statement and their children (subject ids)
CREATE OR REPLACE FUNCTION get_it_sub_cvterm_ids(text) RETURNS SETOF cvterm AS
'
DECLARE
    query alias for $1;
    cterm cvterm%ROWTYPE;
    cterm2 cvterm%ROWTYPE;
BEGIN
    FOR cterm IN EXECUTE query LOOP
        RETURN NEXT cterm;
        FOR cterm2 IN SELECT subject_id as cvterm_id FROM get_all_subject_ids(cterm.cvterm_id) LOOP
            RETURN NEXT cterm2;
        END LOOP;
    END LOOP;
    RETURN;
END;   
'
LANGUAGE 'plpgsql';
--- 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
CREATE OR REPLACE FUNCTION _fill_cvtermpath4node(INTEGER, INTEGER, INTEGER, INTEGER, INTEGER) RETURNS INTEGER AS
'
DECLARE
    origin alias for $1;
    child_id alias for $2;
    cvid alias for $3;
    typeid alias for $4;
    depth alias for $5;
    cterm cvterm_relationship%ROWTYPE;
    exist_c int;

BEGIN

    --- RAISE NOTICE ''depth=% root=%'', depth,child_id;
    --- not check type_id as it may be null and not very meaningful in cvtermpath when pathdistance > 1
    SELECT INTO exist_c count(*) FROM cvtermpath WHERE cv_id = cvid AND object_id = origin AND subject_id = child_id AND pathdistance = depth;

    IF (exist_c = 0) THEN
        INSERT INTO cvtermpath (object_id, subject_id, cv_id, type_id, pathdistance) VALUES(origin, child_id, cvid, typeid, depth);
    END IF;
    FOR cterm IN SELECT * FROM cvterm_relationship WHERE object_id = child_id LOOP
        PERFORM _fill_cvtermpath4node(origin, cterm.subject_id, cvid, cterm.type_id, depth+1);
    END LOOP;
    RETURN 1;
END;
'
LANGUAGE 'plpgsql';


CREATE OR REPLACE FUNCTION _fill_cvtermpath4root(INTEGER, INTEGER) RETURNS INTEGER AS
'
DECLARE
    rootid alias for $1;
    cvid alias for $2;
    ttype int;
    cterm cvterm_relationship%ROWTYPE;
    child cvterm_relationship%ROWTYPE;

BEGIN

    SELECT INTO ttype cvterm_id FROM cvterm WHERE (name = ''isa'' OR name = ''is_a'');
    PERFORM _fill_cvtermpath4node(rootid, rootid, cvid, ttype, 0);
    FOR cterm IN SELECT * FROM cvterm_relationship WHERE object_id = rootid LOOP
        PERFORM _fill_cvtermpath4root(cterm.subject_id, cvid);
        -- RAISE NOTICE ''DONE for term, %'', cterm.subject_id;
    END LOOP;
    RETURN 1;
END;
'
LANGUAGE 'plpgsql';

CREATE OR REPLACE FUNCTION fill_cvtermpath(INTEGER) RETURNS INTEGER AS
'
DECLARE
    cvid alias for $1;
    root cvterm%ROWTYPE;

BEGIN

    DELETE FROM cvtermpath WHERE cv_id = cvid;

    FOR root IN SELECT DISTINCT t.* from cvterm t LEFT JOIN cvterm_relationship r ON (t.cvterm_id = r.subject_id) INNER JOIN cvterm_relationship r2 ON (t.cvterm_id = r2.object_id) WHERE t.cv_id = cvid AND r.subject_id is null LOOP
        PERFORM _fill_cvtermpath4root(root.cvterm_id, root.cv_id);
    END LOOP;
    RETURN 1;
END;   
'
LANGUAGE 'plpgsql';

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

CREATE OR REPLACE FUNCTION _fill_cvtermpath4node2detect_cycle(INTEGER, INTEGER, INTEGER, INTEGER, INTEGER) RETURNS INTEGER AS
'
DECLARE
    origin alias for $1;
    child_id alias for $2;
    cvid alias for $3;
    typeid alias for $4;
    depth alias for $5;
    cterm cvterm_relationship%ROWTYPE;
    exist_c int;
    ccount  int;
    ecount  int;
    rtn     int;
BEGIN

    EXECUTE ''SELECT * FROM tmpcvtermpath p1, tmpcvtermpath p2 WHERE p1.subject_id=p2.object_id AND p1.object_id=p2.subject_id AND p1.object_id = ''|| origin || '' AND p2.subject_id = '' || child_id || ''AND '' || depth || ''> 0'';
    GET DIAGNOSTICS ccount = ROW_COUNT;
    IF (ccount > 0) THEN
        --RAISE EXCEPTION ''FOUND CYCLE: node % on cycle path'',origin;
        RETURN origin;
    END IF;

    EXECUTE ''SELECT * FROM tmpcvtermpath WHERE cv_id = '' || cvid || '' AND object_id = '' || origin || '' AND subject_id = '' || child_id || '' AND '' || origin || ''<>'' || child_id;
    GET DIAGNOSTICS ecount = ROW_COUNT;
    IF (ecount > 0) THEN
        --RAISE NOTICE ''FOUND TWICE (node), will check root obj % subj %'',origin, child_id;
        SELECT INTO rtn _fill_cvtermpath4root2detect_cycle(child_id, cvid);
        IF (rtn > 0) THEN
            RETURN rtn;
        END IF;
    END IF;

    EXECUTE ''SELECT * FROM tmpcvtermpath WHERE cv_id = '' || cvid || '' AND object_id = '' || origin || '' AND subject_id = '' || child_id || '' AND pathdistance = '' || depth;
    GET DIAGNOSTICS exist_c = ROW_COUNT;
    IF (exist_c = 0) THEN
        EXECUTE ''INSERT INTO tmpcvtermpath (object_id, subject_id, cv_id, type_id, pathdistance) VALUES('' || origin || '', '' || child_id || '', '' || cvid || '', '' || typeid || '', '' || depth || '')'';
    END IF;

    FOR cterm IN SELECT * FROM cvterm_relationship WHERE object_id = child_id LOOP
        --RAISE NOTICE ''DOING for node, % %'', origin, cterm.subject_id;
        SELECT INTO rtn _fill_cvtermpath4node2detect_cycle(origin, cterm.subject_id, cvid, cterm.type_id, depth+1);
        IF (rtn > 0) THEN
            RETURN rtn;
        END IF;
    END LOOP;
    RETURN 0;
END;
'
LANGUAGE 'plpgsql';


CREATE OR REPLACE FUNCTION _fill_cvtermpath4root2detect_cycle(INTEGER, INTEGER) RETURNS INTEGER AS
'
DECLARE
    rootid alias for $1;
    cvid alias for $2;
    ttype int;
    ccount int;
    cterm cvterm_relationship%ROWTYPE;
    child cvterm_relationship%ROWTYPE;
    rtn     int;
BEGIN

    SELECT INTO ttype cvterm_id FROM cvterm WHERE (name = ''isa'' OR name = ''is_a'');
    SELECT INTO rtn _fill_cvtermpath4node2detect_cycle(rootid, rootid, cvid, ttype, 0);
    IF (rtn > 0) THEN
        RETURN rtn;
    END IF;
    FOR cterm IN SELECT * FROM cvterm_relationship WHERE object_id = rootid LOOP
        EXECUTE ''SELECT * FROM tmpcvtermpath p1, tmpcvtermpath p2 WHERE p1.subject_id=p2.object_id AND p1.object_id=p2.subject_id AND p1.object_id='' || rootid || '' AND p1.subject_id='' || cterm.subject_id;
        GET DIAGNOSTICS ccount = ROW_COUNT;
        IF (ccount > 0) THEN
            --RAISE NOTICE ''FOUND TWICE (root), will check root obj % subj %'',rootid,cterm.subject_id;
            SELECT INTO rtn _fill_cvtermpath4node2detect_cycle(rootid, cterm.subject_id, cvid, ttype, 0);
            IF (rtn > 0) THEN
                RETURN rtn;
            END IF;
        ELSE
            SELECT INTO rtn _fill_cvtermpath4root2detect_cycle(cterm.subject_id, cvid);
            IF (rtn > 0) THEN
                RETURN rtn;
            END IF;
        END IF;
    END LOOP;
    RETURN 0;
END;
'
LANGUAGE 'plpgsql';

CREATE OR REPLACE FUNCTION get_cycle_cvterm_id(INTEGER, INTEGER) RETURNS INTEGER AS
'
DECLARE
    cvid alias for $1;
    rootid alias for $2;
    rtn     int;
BEGIN

    CREATE TEMP TABLE tmpcvtermpath(object_id int, subject_id int, cv_id int, type_id int, pathdistance int);
    CREATE INDEX tmp_cvtpath1 ON tmpcvtermpath(object_id, subject_id);

    SELECT INTO rtn _fill_cvtermpath4root2detect_cycle(rootid, cvid);
    IF (rtn > 0) THEN
        DROP TABLE tmpcvtermpath;
        RETURN rtn;
    END IF;
    DROP TABLE tmpcvtermpath;
    RETURN 0;
END;   
'
LANGUAGE 'plpgsql';

CREATE OR REPLACE FUNCTION get_cycle_cvterm_ids(INTEGER) RETURNS SETOF INTEGER AS
'
DECLARE
    cvid alias for $1;
    root cvterm%ROWTYPE;
    rtn     int;
BEGIN


    FOR root IN SELECT DISTINCT t.* from cvterm t WHERE cv_id = cvid LOOP
        SELECT INTO rtn get_cycle_cvterm_id(cvid,root.cvterm_id);
        IF (rtn > 0) THEN
            RETURN NEXT rtn;
        END IF;
    END LOOP;
    RETURN;
END;   
'
LANGUAGE 'plpgsql';

CREATE OR REPLACE FUNCTION get_cycle_cvterm_id(INTEGER) RETURNS INTEGER AS
'
DECLARE
    cvid alias for $1;
    root cvterm%ROWTYPE;
    rtn     int;
BEGIN

    CREATE TEMP TABLE tmpcvtermpath(object_id int, subject_id int, cv_id int, type_id int, pathdistance int);
    CREATE INDEX tmp_cvtpath1 ON tmpcvtermpath(object_id, subject_id);

    FOR root IN SELECT DISTINCT t.* from cvterm t LEFT JOIN cvterm_relationship r ON (t.cvterm_id = r.subject_id) INNER JOIN cvterm_relationship r2 ON (t.cvterm_id = r2.object_id) WHERE t.cv_id = cvid AND r.subject_id is null LOOP
        SELECT INTO rtn _fill_cvtermpath4root2detect_cycle(root.cvterm_id, root.cv_id);
        IF (rtn > 0) THEN
            DROP TABLE tmpcvtermpath;
            RETURN rtn;
        END IF;
    END LOOP;
    DROP TABLE tmpcvtermpath;
    RETURN 0;
END;   
'
LANGUAGE 'plpgsql';

CREATE OR REPLACE FUNCTION get_cycle_cvterm_id(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  get_cycle_cvterm_id(cv_id);

    RETURN rtn;
END;   
'
LANGUAGE 'plpgsql';
-- ==========================================
-- Chado pub module
--
-- =================================================================
-- Dependencies:
--
-- :import cvterm from cv
-- :import dbxref from general
-- =================================================================

-- ================================================
-- TABLE: pub
-- ================================================

create table pub (
    pub_id serial not null,
    primary key (pub_id),
    title text,
    volumetitle text,
    volume varchar(255),
    series_name varchar(255),
    issue varchar(255),
    pyear varchar(255),
    pages varchar(255),
    miniref varchar(255),
    uniquename text not null,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    is_obsolete boolean default 'false',
    publisher varchar(255),
    pubplace varchar(255),
    constraint pub_c1 unique (uniquename)
);
CREATE INDEX pub_idx1 ON pub (type_id);

COMMENT ON TABLE pub IS 'A documented provenance artefact - publications,
documents, personal communication.';
COMMENT ON COLUMN pub.title IS 'Descriptive general heading.';
COMMENT ON COLUMN pub.volumetitle IS 'Title of part if one of a series.';
COMMENT ON COLUMN pub.series_name IS 'Full name of (journal) series.';
COMMENT ON COLUMN pub.pages IS 'Page number range[s], e.g. 457--459, viii + 664pp, lv--lvii.';
COMMENT ON COLUMN pub.type_id IS  'The type of the publication (book, journal, poem, graffiti, etc). Uses pub cv.';

-- ================================================
-- TABLE: pub_relationship
-- ================================================

create table pub_relationship (
    pub_relationship_id serial not null,
    primary key (pub_relationship_id),
    subject_id int not null,
    foreign key (subject_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
    object_id int not null,
    foreign key (object_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,

    constraint pub_relationship_c1 unique (subject_id,object_id,type_id)
);
create index pub_relationship_idx1 on pub_relationship (subject_id);
create index pub_relationship_idx2 on pub_relationship (object_id);
create index pub_relationship_idx3 on pub_relationship (type_id);

COMMENT ON TABLE pub_relationship IS 'Handle relationships between
publications, e.g. when one publication makes others obsolete, when one
publication contains errata with respect to other publication(s), or
when one publication also appears in another pub.';

-- ================================================
-- TABLE: pub_dbxref
-- ================================================

create table pub_dbxref (
    pub_dbxref_id serial not null,
    primary key (pub_dbxref_id),
    pub_id int not null,
    foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
    dbxref_id int not null,
    foreign key (dbxref_id) references dbxref (dbxref_id) on delete cascade INITIALLY DEFERRED,
    is_current boolean not null default 'true',
    constraint pub_dbxref_c1 unique (pub_id,dbxref_id)
);
create index pub_dbxref_idx1 on pub_dbxref (pub_id);
create index pub_dbxref_idx2 on pub_dbxref (dbxref_id);

COMMENT ON TABLE pub_dbxref IS 'Handle links to repositories,
e.g. Pubmed, Biosis, zoorec, OCLC, Medline, ISSN, coden...';


-- ================================================
-- TABLE: pubauthor
-- ================================================

create table pubauthor (
    pubauthor_id serial not null,
    primary key (pubauthor_id),
    pub_id int not null,
    foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
    rank int not null,
    editor boolean default 'false',
    surname varchar(100) not null,
    givennames varchar(100),
    suffix varchar(100),

    constraint pubauthor_c1 unique (pub_id, rank)
);
create index pubauthor_idx2 on pubauthor (pub_id);

COMMENT ON TABLE pubauthor IS 'An author for a publication. Note the denormalisation (hence lack of _ in table name) - this is deliberate as it is in general too hard to assign IDs to authors.';
COMMENT ON COLUMN pubauthor.givennames IS 'First name, initials';
COMMENT ON COLUMN pubauthor.suffix IS 'Jr., Sr., etc';
COMMENT ON COLUMN pubauthor.rank IS 'Order of author in author list for this pub - order is important.';
COMMENT ON COLUMN pubauthor.editor IS 'Indicates whether the author is an editor for linked publication. Note: this is a boolean field but does not follow the normal chado convention for naming booleans.';


-- ================================================
-- TABLE: pubprop
-- ================================================

create table pubprop (
    pubprop_id serial not null,
    primary key (pubprop_id),
    pub_id int not null,
    foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    value text not null,
    rank integer,

    constraint pubprop_c1 unique (pub_id,type_id,rank)
);
create index pubprop_idx1 on pubprop (pub_id);
create index pubprop_idx2 on pubprop (type_id);

COMMENT ON TABLE pubprop IS 'Property-value pairs for a pub. Follows standard chado pattern.';
-- ==========================================
-- Chado organism module
--
-- ============
-- DEPENDENCIES
-- ============
-- :import cvterm from cv
-- :import dbxref from general
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-- ================================================
-- TABLE: organism
-- ================================================

create table organism (
	organism_id serial not null,
	primary key (organism_id),
	abbreviation varchar(255) null,
	genus varchar(255) not null,
	species varchar(255) not null,
	common_name varchar(255) null,
	comment text null,
	constraint organism_c1 unique (genus,species)
);

COMMENT ON TABLE organism IS 'The organismal taxonomic
classification. Note that phylogenies are represented using the
phylogeny module, and taxonomies can be represented using the cvterm
module or the phylogeny module.';

COMMENT ON COLUMN organism.species IS 'A type of organism is always
uniquely identified by genus and species. When mapping from the NCBI
taxonomy names.dmp file, this column must be used where it
is present, as the common_name column is not always unique (e.g. environmental
samples). If a particular strain or subspecies is to be represented,
this is appended onto the species name. Follows standard NCBI taxonomy
pattern.';

-- ================================================
-- TABLE: organism_dbxref
-- ================================================

create table organism_dbxref (
    organism_dbxref_id serial not null,
    primary key (organism_dbxref_id),
    organism_id int not null,
    foreign key (organism_id) references organism (organism_id) on delete cascade INITIALLY DEFERRED,
    dbxref_id int not null,
    foreign key (dbxref_id) references dbxref (dbxref_id) on delete cascade INITIALLY DEFERRED,
    constraint organism_dbxref_c1 unique (organism_id,dbxref_id)
);
create index organism_dbxref_idx1 on organism_dbxref (organism_id);
create index organism_dbxref_idx2 on organism_dbxref (dbxref_id);

-- ================================================
-- TABLE: organismprop
-- ================================================

create table organismprop (
    organismprop_id serial not null,
    primary key (organismprop_id),
    organism_id int not null,
    foreign key (organism_id) references organism (organism_id) on delete cascade INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    value text null,
    rank int not null default 0,
    constraint organismprop_c1 unique (organism_id,type_id,rank)
);
create index organismprop_idx1 on organismprop (organism_id);
create index organismprop_idx2 on organismprop (type_id);

COMMENT ON TABLE organismprop IS 'Tag-value properties - follows standard chado model.';


CREATE OR REPLACE FUNCTION get_organism_id(VARCHAR,VARCHAR) RETURNS INT
 AS '
  SELECT organism_id 
  FROM organism
  WHERE genus=$1
    AND species=$2
 ' LANGUAGE 'sql';

CREATE OR REPLACE FUNCTION get_organism_id(VARCHAR) RETURNS INT
 AS ' 
SELECT organism_id
  FROM organism
  WHERE genus=substring($1,1,position('' '' IN $1)-1)
    AND species=substring($1,position('' '' IN $1)+1)
 ' LANGUAGE 'sql';

CREATE OR REPLACE FUNCTION get_organism_id_abbrev(VARCHAR) RETURNS INT
 AS '
SELECT organism_id
  FROM organism
  WHERE substr(genus,1,1)=substring($1,1,1)
    AND species=substring($1,position('' '' IN $1)+1)
 ' LANGUAGE 'sql';

CREATE OR REPLACE FUNCTION store_organism (VARCHAR,VARCHAR,VARCHAR) 
  RETURNS INT AS 
'DECLARE
   v_genus            ALIAS FOR $1;
   v_species          ALIAS FOR $2;
   v_common_name      ALIAS FOR $3;

   v_organism_id      INTEGER;
 BEGIN
    SELECT INTO v_organism_id organism_id
      FROM organism
      WHERE genus=v_genus               AND
            species=v_species;
    IF NOT FOUND THEN
      INSERT INTO organism
       (genus,species,common_name)
         VALUES
       (v_genus,v_species,v_common_name);
       RETURN currval(''organism_organism_id_seq'');
    ELSE
      UPDATE organism
       SET common_name=v_common_name
      WHERE organism_id = v_organism_id;
    END IF;
    RETURN v_organism_id;
 END;
' LANGUAGE 'plpgsql';
  
-- ==========================================
-- Chado sequence module
--
-- =================================================================
-- Dependencies:
--
-- :import cvterm from cv
-- :import pub from pub
-- :import organism from organism
-- :import dbxref from general
-- =================================================================

-- ================================================
-- TABLE: feature
-- ================================================

create table feature (
    feature_id serial not null,
    primary key (feature_id),
    dbxref_id int,
    foreign key (dbxref_id) references dbxref (dbxref_id) on delete set null INITIALLY DEFERRED,
    organism_id int not null,
    foreign key (organism_id) references organism (organism_id) on delete cascade INITIALLY DEFERRED,
    name varchar(255),
    uniquename text not null,
    residues text,
    seqlen int,
    md5checksum char(32),
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    is_analysis boolean not null default 'false',
    is_obsolete boolean not null default 'false',
    timeaccessioned timestamp not null default current_timestamp,
    timelastmodified timestamp not null default current_timestamp,
    constraint feature_c1 unique (organism_id,uniquename,type_id)
);
create sequence feature_uniquename_seq;
create index feature_name_ind1 on feature(name);
create index feature_idx1 on feature (dbxref_id);
create index feature_idx2 on feature (organism_id);
create index feature_idx3 on feature (type_id);
create index feature_idx4 on feature (uniquename);
create index feature_idx5 on feature (lower(name));

ALTER TABLE feature ALTER residues SET STORAGE EXTERNAL;

COMMENT ON TABLE feature IS 'A feature is a biological sequence or a
section of a biological sequence, or a collection of such
sections. Examples include genes, exons, transcripts, regulatory
regions, polypeptides, protein domains, chromosome sequences, sequence
variations, cross-genome match regions such as hits and HSPs and so
on; see the Sequence Ontology for more. The combination of
organism_id, uniquename and type_id should be unique.';

COMMENT ON COLUMN feature.dbxref_id IS 'An optional primary public stable
identifier for this feature. Secondary identifiers and external
dbxrefs go in the table feature_dbxref.';

COMMENT ON COLUMN feature.organism_id IS 'The organism to which this feature
belongs. This column is mandatory.';

COMMENT ON COLUMN feature.name IS 'The optional human-readable common name for
a feature, for display purposes.';

COMMENT ON COLUMN feature.uniquename IS 'The unique name for a feature; may
not be necessarily be particularly human-readable, although this is
preferred. This name must be unique for this type of feature within
this organism.';

COMMENT ON COLUMN feature.residues IS 'A sequence of alphabetic characters
representing biological residues (nucleic acids, amino acids). This
column does not need to be manifested for all features; it is optional
for features such as exons where the residues can be derived from the
featureloc. It is recommended that the value for this column be
manifested for features which may may non-contiguous sublocations (e.g.
transcripts), since derivation at query time is non-trivial. For
expressed sequence, the DNA sequence should be used rather than the
RNA sequence. The default storage method for the residues column is
EXTERNAL, which will store it uncompressed to make substring operations
faster.';

COMMENT ON COLUMN feature.seqlen IS 'The length of the residue feature. See
column:residues. This column is partially redundant with the residues
column, and also with featureloc. This column is required because the
location may be unknown and the residue sequence may not be
manifested, yet it may be desirable to store and query the length of
the feature. The seqlen should always be manifested where the length
of the sequence is known.';

COMMENT ON COLUMN feature.md5checksum IS 'The 32-character checksum of the sequence,
calculated using the MD5 algorithm. This is practically guaranteed to
be unique for any feature. This column thus acts as a unique
identifier on the mathematical sequence.';

COMMENT ON COLUMN feature.type_id IS 'A required reference to a table:cvterm
giving the feature type. This will typically be a Sequence Ontology
identifier. This column is thus used to subclass the feature table.';

COMMENT ON COLUMN feature.is_analysis IS 'Boolean indicating whether this
feature is annotated or the result of an automated analysis. Analysis
results also use the companalysis module. Note that the dividing line
between analysis and annotation may be fuzzy, this should be determined on
a per-project basis in a consistent manner. One requirement is that
there should only be one non-analysis version of each wild-type gene
feature in a genome, whereas the same gene feature can be predicted
multiple times in different analyses.';

COMMENT ON COLUMN feature.is_obsolete IS 'Boolean indicating whether this
feature has been obsoleted. Some chado instances may choose to simply
remove the feature altogether, others may choose to keep an obsolete
row in the table.';

COMMENT ON COLUMN feature.timeaccessioned IS 'For handling object
accession or modification timestamps (as opposed to database auditing data,
handled elsewhere). The expectation is that these fields would be
available to software interacting with chado.';

COMMENT ON COLUMN feature.timelastmodified IS 'For handling object
accession or modification timestamps (as opposed to database auditing data,
handled elsewhere). The expectation is that these fields would be
available to software interacting with chado.';

--- COMMENT ON INDEX feature_c1 IS 'Any feature can be globally identified
--- by the combination of organism, uniquename and feature type';

-- ================================================
-- TABLE: featureloc
-- ================================================

create table featureloc (
    featureloc_id serial not null,
    primary key (featureloc_id),
    feature_id int not null,
    foreign key (feature_id) references feature (feature_id) on delete cascade INITIALLY DEFERRED,
    srcfeature_id int,
    foreign key (srcfeature_id) references feature (feature_id) on delete set null INITIALLY DEFERRED,
    fmin int,
    is_fmin_partial boolean not null default 'false',
    fmax int,
    is_fmax_partial boolean not null default 'false',
    strand smallint,
    phase int,
    residue_info text,
    locgroup int not null default 0,
    rank int not null default 0,
    constraint featureloc_c1 unique (feature_id,locgroup,rank),
    constraint featureloc_c2 check (fmin <= fmax)
);
create index featureloc_idx1 on featureloc (feature_id);
create index featureloc_idx2 on featureloc (srcfeature_id);
create index featureloc_idx3 on featureloc (srcfeature_id,fmin,fmax);

COMMENT ON TABLE featureloc IS 'The location of a feature relative to
another feature. Important: interbase coordinates are used. This is
vital as it allows us to represent zero-length features e.g. splice
sites, insertion points without an awkward fuzzy system. Features
typically have exactly ONE location, but this need not be the
case. Some features may not be localized (e.g. a gene that has been
characterized genetically but no sequence or molecular information is
available). Note on multiple locations: Each feature can have 0 or
more locations. Multiple locations do NOT indicate non-contiguous
locations (if a feature such as a transcript has a non-contiguous
location, then the subfeatures such as exons should always be
manifested). Instead, multiple featurelocs for a feature designate
alternate locations or grouped locations; for instance, a feature
designating a blast hit or hsp will have two locations, one on the
query feature, one on the subject feature. Features representing
sequence variation could have alternate locations instantiated on a
feature on the mutant strain. The column:rank is used to
differentiate these different locations. Reflexive locations should
never be stored - this is for -proper- (i.e. non-self) locations only; nothing should be located relative to itself.';

COMMENT ON COLUMN featureloc.feature_id IS 'The feature that is being located. Any feature can have zero or more featurelocs.';

COMMENT ON COLUMN featureloc.srcfeature_id IS 'The source feature which this location is relative to. Every location is relative to another feature (however, this column is nullable, because the srcfeature may not be known). All locations are -proper- that is, nothing should be located relative to itself. No cycles are allowed in the featureloc graph.';

COMMENT ON COLUMN featureloc.fmin IS 'The leftmost/minimal boundary in the linear range represented by the featureloc. Sometimes (e.g. in Bioperl) this is called -start- although this is confusing because it does not necessarily represent the 5-prime coordinate. Important: This is space-based (interbase) coordinates, counting from zero. To convert this to the leftmost position in a base-oriented system (eg GFF, Bioperl), add 1 to fmin.';

COMMENT ON COLUMN featureloc.fmax IS 'The rightmost/maximal boundary in the linear range represented by the featureloc. Sometimes (e.g. in bioperl) this is called -end- although this is confusing because it does not necessarily represent the 3-prime coordinate. Important: This is space-based (interbase) coordinates, counting from zero. No conversion is required to go from fmax to the rightmost coordinate in a base-oriented system that counts from 1 (e.g. GFF, Bioperl).';

COMMENT ON COLUMN featureloc.strand IS 'The orientation/directionality of the
location. Should be 0, -1 or +1.';

COMMENT ON COLUMN featureloc.rank IS 'Used when a feature has >1
location, otherwise the default rank 0 is used. Some features (e.g.
blast hits and HSPs) have two locations - one on the query and one on
the subject. Rank is used to differentiate these. Rank=0 is always
used for the query, Rank=1 for the subject. For multiple alignments,
assignment of rank is arbitrary. Rank is also used for
sequence_variant features, such as SNPs. Rank=0 indicates the wildtype
(or baseline) feature, Rank=1 indicates the mutant (or compared) feature.';

COMMENT ON COLUMN featureloc.locgroup IS 'This is used to manifest redundant,
derivable extra locations for a feature. The default locgroup=0 is
used for the DIRECT location of a feature. Important: most Chado users may
never use featurelocs WITH logroup > 0. Transitively derived locations
are indicated with locgroup > 0. For example, the position of an exon on
a BAC and in global chromosome coordinates. This column is used to
differentiate these groupings of locations. The default locgroup 0
is used for the main or primary location, from which the others can be
derived via coordinate transformations. Another example of redundant
locations is storing ORF coordinates relative to both transcript and
genome. Redundant locations open the possibility of the database
getting into inconsistent states; this schema gives us the flexibility
of both warehouse instantiations with redundant locations (easier for
querying) and management instantiations with no redundant
locations. An example of using both locgroup and rank: imagine a
feature indicating a conserved region between the chromosomes of two
different species. We may want to keep redundant locations on both
contigs and chromosomes. We would thus have 4 locations for the single
conserved region feature - two distinct locgroups (contig level and
chromosome level) and two distinct ranks (for the two species).';

COMMENT ON COLUMN featureloc.residue_info IS 'Alternative residues,
when these differ from feature.residues. For instance, a SNP feature
located on a wild and mutant protein would have different alternative residues.
for alignment/similarity features, the alternative residues is used to
represent the alignment string (CIGAR format). Note on variation
features; even if we do not want to instantiate a mutant
chromosome/contig feature, we can still represent a SNP etc with 2
locations, one (rank 0) on the genome, the other (rank 1) would have
most fields null, except for alternative residues.';

COMMENT ON COLUMN featureloc.phase IS 'Phase of translation with
respect to srcfeature_id.
Values are 0, 1, 2. It may not be possible to manifest this column for
some features such as exons, because the phase is dependant on the
spliceform (the same exon can appear in multiple spliceforms). This column is mostly useful for predicted exons and CDSs.';

COMMENT ON COLUMN featureloc.is_fmin_partial IS 'This is typically
false, but may be true if the value for column:fmin is inaccurate or
the leftmost part of the range is unknown/unbounded.';

COMMENT ON COLUMN featureloc.is_fmax_partial IS 'This is typically
false, but may be true if the value for column:fmax is inaccurate or
the rightmost part of the range is unknown/unbounded.';

--- COMMENT ON INDEX featureloc_c1 IS 'locgroup and rank serve to uniquely
--- partition locations for any one feature';


-- ================================================
-- TABLE: featureloc_pub
-- ================================================

create table featureloc_pub (
    featureloc_pub_id serial not null,
    primary key (featureloc_pub_id),
    featureloc_id int not null,
    foreign key (featureloc_id) references featureloc (featureloc_id) on delete cascade INITIALLY DEFERRED,
    pub_id int not null,
    foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
    constraint featureloc_pub_c1 unique (featureloc_id,pub_id)
);
create index featureloc_pub_idx1 on featureloc_pub (featureloc_id);
create index featureloc_pub_idx2 on featureloc_pub (pub_id);

COMMENT ON TABLE featureloc_pub IS 'Provenance of featureloc. Linking table between featurelocs and publications that mention them.';


-- ================================================
-- TABLE: feature_pub
-- ================================================

create table feature_pub (
    feature_pub_id serial not null,
    primary key (feature_pub_id),
    feature_id int not null,
    foreign key (feature_id) references feature (feature_id) on delete cascade INITIALLY DEFERRED,
    pub_id int not null,
    foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
    constraint feature_pub_c1 unique (feature_id,pub_id)
);
create index feature_pub_idx1 on feature_pub (feature_id);
create index feature_pub_idx2 on feature_pub (pub_id);

COMMENT ON TABLE feature_pub IS 'Provenance. Linking table between features and publications that mention them.';


-- ================================================
-- TABLE: feature_pubprop
-- ================================================

create table feature_pubprop (
    feature_pubprop_id serial not null,
    primary key (feature_pubprop_id),
    feature_pub_id int not null,
    foreign key (feature_pub_id) references feature_pub (feature_pub_id) on delete cascade INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    value text null,
    rank int not null default 0,
    constraint feature_pubprop_c1 unique (feature_pub_id,type_id,rank)
);
create index feature_pubprop_idx1 on feature_pubprop (feature_pub_id);

COMMENT ON TABLE feature_pubprop IS 'Property or attribute of a feature_pub link.';


-- ================================================
-- TABLE: featureprop
-- ================================================

create table featureprop (
    featureprop_id serial not null,
    primary key (featureprop_id),
    feature_id int not null,
    foreign key (feature_id) references feature (feature_id) on delete cascade INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    value text null,
    rank int not null default 0,
    constraint featureprop_c1 unique (feature_id,type_id,rank)
);
create index featureprop_idx1 on featureprop (feature_id);
create index featureprop_idx2 on featureprop (type_id);

COMMENT ON TABLE featureprop IS 'A feature can have any number of slot-value property tags attached to it. This is an alternative to hardcoding a list of columns in the relational schema, and is completely extensible.';

COMMENT ON COLUMN featureprop.type_id IS 'The name of the
property/slot is a cvterm. The meaning of the property is defined in
that cvterm. Certain property types will only apply to certain feature
types (e.g. the anticodon property will only apply to tRNA features) ;
the types here come from the sequence feature property ontology.';

COMMENT ON COLUMN featureprop.value IS 'The value of the property, represented as text. Numeric values are converted to their text representation. This is less efficient than using native database types, but is easier to query.';

COMMENT ON COLUMN featureprop.rank IS 'Property-Value ordering. Any
feature can have multiple values for any particular property type -
these are ordered in a list using rank, counting from zero. For
properties that are single-valued rather than multi-valued, the
default 0 value should be used';

COMMENT ON INDEX featureprop_c1 IS 'For any one feature, multivalued
property-value pairs must be differentiated by rank.';


-- ================================================
-- TABLE: featureprop_pub
-- ================================================

create table featureprop_pub (
    featureprop_pub_id serial not null,
    primary key (featureprop_pub_id),
    featureprop_id int not null,
    foreign key (featureprop_id) references featureprop (featureprop_id) on delete cascade INITIALLY DEFERRED,
    pub_id int not null,
    foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
    constraint featureprop_pub_c1 unique (featureprop_id,pub_id)
);
create index featureprop_pub_idx1 on featureprop_pub (featureprop_id);
create index featureprop_pub_idx2 on featureprop_pub (pub_id);

COMMENT ON TABLE featureprop_pub IS 'Provenance. Any featureprop assignment can optionally be supported by a publication.';


-- ================================================
-- TABLE: feature_dbxref
-- ================================================

create table feature_dbxref (
    feature_dbxref_id serial not null,
    primary key (feature_dbxref_id),
    feature_id int not null,
    foreign key (feature_id) references feature (feature_id) on delete cascade INITIALLY DEFERRED,
    dbxref_id int not null,
    foreign key (dbxref_id) references dbxref (dbxref_id) on delete cascade INITIALLY DEFERRED,
    is_current boolean not null default 'true',
    constraint feature_dbxref_c1 unique (feature_id,dbxref_id)
);
create index feature_dbxref_idx1 on feature_dbxref (feature_id);
create index feature_dbxref_idx2 on feature_dbxref (dbxref_id);

COMMENT ON TABLE feature_dbxref IS 'Links a feature to dbxrefs. This is for secondary identifiers; primary identifiers should use feature.dbxref_id.';

COMMENT ON COLUMN feature_dbxref.is_current IS 'True if this secondary dbxref is the most up to date accession in the corresponding db. Retired accessions should set this field to false';


-- ================================================
-- TABLE: feature_relationship
-- ================================================

create table feature_relationship (
    feature_relationship_id serial not null,
    primary key (feature_relationship_id),
    subject_id int not null,
    foreign key (subject_id) references feature (feature_id) on delete cascade INITIALLY DEFERRED,
    object_id int not null,
    foreign key (object_id) references feature (feature_id) on delete cascade INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    value text null,
    rank int not null default 0,
    constraint feature_relationship_c1 unique (subject_id,object_id,type_id,rank)
);
create index feature_relationship_idx1 on feature_relationship (subject_id);
create index feature_relationship_idx2 on feature_relationship (object_id);
create index feature_relationship_idx3 on feature_relationship (type_id);

COMMENT ON TABLE feature_relationship IS 'Features can be arranged in
graphs, e.g. "exon part_of transcript part_of gene"; If type is
thought of as a verb, the each arc or edge makes a statement
[Subject Verb Object]. The object can also be thought of as parent
(containing feature), and subject as child (contained feature or
subfeature). We include the relationship rank/order, because even
though most of the time we can order things implicitly by sequence
coordinates, we can not always do this - e.g. transpliced genes. It is also
useful for quickly getting implicit introns.';

COMMENT ON COLUMN feature_relationship.subject_id IS 'The subject of the subj-predicate-obj sentence. This is typically the subfeature.';

COMMENT ON COLUMN feature_relationship.object_id IS 'The object of the subj-predicate-obj sentence. This is typically the container feature.';

COMMENT ON COLUMN feature_relationship.type_id IS 'Relationship type between subject and object. This is a cvterm, typically from the OBO relationship ontology, although other relationship types are allowed. The most common relationship type is OBO_REL:part_of. Valid relationship types are constrained by the Sequence Ontology.';

COMMENT ON COLUMN feature_relationship.rank IS 'The ordering of subject features with respect to the object feature may be important (for example, exon ordering on a transcript - not always derivable if you take trans spliced genes into consideration). Rank is used to order these; starts from zero.';

COMMENT ON COLUMN feature_relationship.value IS 'Additional notes or comments.';


-- ================================================
-- TABLE: feature_relationship_pub
-- ================================================
 
create table feature_relationship_pub (
	feature_relationship_pub_id serial not null,
	primary key (feature_relationship_pub_id),
	feature_relationship_id int not null,
	foreign key (feature_relationship_id) references feature_relationship (feature_relationship_id) on delete cascade INITIALLY DEFERRED,
	pub_id int not null,
	foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
    constraint feature_relationship_pub_c1 unique (feature_relationship_id,pub_id)
);
create index feature_relationship_pub_idx1 on feature_relationship_pub (feature_relationship_id);
create index feature_relationship_pub_idx2 on feature_relationship_pub (pub_id);

COMMENT ON TABLE feature_relationship_pub IS 'Provenance. Attach optional evidence to a feature_relationship in the form of a publication.';

 
-- ================================================
-- TABLE: feature_relationshipprop
-- ================================================

create table feature_relationshipprop (
    feature_relationshipprop_id serial not null,
    primary key (feature_relationshipprop_id),
    feature_relationship_id int not null,
    foreign key (feature_relationship_id) references feature_relationship (feature_relationship_id) on delete cascade,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    value text null,
    rank int not null default 0,
    constraint feature_relationshipprop_c1 unique (feature_relationship_id,type_id,rank)
);
create index feature_relationshipprop_idx1 on feature_relationshipprop (feature_relationship_id);
create index feature_relationshipprop_idx2 on feature_relationshipprop (type_id);

COMMENT ON TABLE feature_relationshipprop IS 'Extensible properties
for feature_relationships. Analagous structure to featureprop. This
table is largely optional and not used with a high frequency. Typical
scenarios may be if one wishes to attach additional data to a
feature_relationship - for example to say that the
feature_relationship is only true in certain contexts.';

COMMENT ON COLUMN feature_relationshipprop.type_id IS 'The name of the
property/slot is a cvterm. The meaning of the property is defined in
that cvterm. Currently there is no standard ontology for
feature_relationship property types.';

COMMENT ON COLUMN feature_relationshipprop.value IS 'The value of the
property, represented as text. Numeric values are converted to their
text representation. This is less efficient than using native database
types, but is easier to query.';

COMMENT ON COLUMN feature_relationshipprop.rank IS 'Property-Value
ordering. Any feature_relationship can have multiple values for any particular
property type - these are ordered in a list using rank, counting from
zero. For properties that are single-valued rather than multi-valued,
the default 0 value should be used.';

-- ================================================
-- TABLE: feature_relationshipprop_pub
-- ================================================

create table feature_relationshipprop_pub (
    feature_relationshipprop_pub_id serial not null,
    primary key (feature_relationshipprop_pub_id),
    feature_relationshipprop_id int not null,
    foreign key (feature_relationshipprop_id) references feature_relationshipprop (feature_relationshipprop_id) on delete cascade INITIALLY DEFERRED,
    pub_id int not null,
    foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
    constraint feature_relationshipprop_pub_c1 unique (feature_relationshipprop_id,pub_id)
);
create index feature_relationshipprop_pub_idx1 on feature_relationshipprop_pub (feature_relationshipprop_id);
create index feature_relationshipprop_pub_idx2 on feature_relationshipprop_pub (pub_id);

COMMENT ON TABLE feature_relationshipprop_pub IS 'Provenance for feature_relationshipprop.';

-- ================================================
-- TABLE: feature_cvterm
-- ================================================

create table feature_cvterm (
    feature_cvterm_id serial not null,
    primary key (feature_cvterm_id),
    feature_id int not null,
    foreign key (feature_id) references feature (feature_id) on delete cascade INITIALLY DEFERRED,
    cvterm_id int not null,
    foreign key (cvterm_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    pub_id int not null,
    foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
    is_not boolean not null default false,
    rank integer not null default 0,
    constraint feature_cvterm_c1 unique (feature_id,cvterm_id,pub_id,rank)
);
create index feature_cvterm_idx1 on feature_cvterm (feature_id);
create index feature_cvterm_idx2 on feature_cvterm (cvterm_id);
create index feature_cvterm_idx3 on feature_cvterm (pub_id);

COMMENT ON TABLE feature_cvterm IS 'Associate a term from a cv with a feature, for example, GO annotation.';

COMMENT ON COLUMN feature_cvterm.pub_id IS 'Provenance for the annotation. Each annotation should have a single primary publication (which may be of the appropriate type for computational analyses) where more details can be found. Additional provenance dbxrefs can be attached using feature_cvterm_dbxref.';

COMMENT ON COLUMN feature_cvterm.is_not IS 'If this is set to true, then this annotation is interpreted as a NEGATIVE annotation - i.e. the feature does NOT have the specified function, process, component, part, etc. See GO docs for more details.';


-- ================================================
-- TABLE: feature_cvtermprop
-- ================================================

create table feature_cvtermprop (
    feature_cvtermprop_id serial not null,
    primary key (feature_cvtermprop_id),
    feature_cvterm_id int not null,
    foreign key (feature_cvterm_id) references feature_cvterm (feature_cvterm_id) on delete cascade,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    value text null,
    rank int not null default 0,
    constraint feature_cvtermprop_c1 unique (feature_cvterm_id,type_id,rank)
);
create index feature_cvtermprop_idx1 on feature_cvtermprop (feature_cvterm_id);
create index feature_cvtermprop_idx2 on feature_cvtermprop (type_id);

COMMENT ON TABLE feature_cvtermprop IS 'Extensible properties for
feature to cvterm associations. Examples: GO evidence codes;
qualifiers; metadata such as the date on which the entry was curated
and the source of the association. See the featureprop table for
meanings of type_id, value and rank.';

COMMENT ON COLUMN feature_cvtermprop.type_id IS 'The name of the
property/slot is a cvterm. The meaning of the property is defined in
that cvterm. cvterms may come from the OBO evidence code cv.';

COMMENT ON COLUMN feature_cvtermprop.value IS 'The value of the
property, represented as text. Numeric values are converted to their
text representation. This is less efficient than using native database
types, but is easier to query.';

COMMENT ON COLUMN feature_cvtermprop.rank IS 'Property-Value
ordering. Any feature_cvterm can have multiple values for any particular
property type - these are ordered in a list using rank, counting from
zero. For properties that are single-valued rather than multi-valued,
the default 0 value should be used.';


-- ================================================
-- TABLE: feature_cvterm_dbxref
-- ================================================

create table feature_cvterm_dbxref (
    feature_cvterm_dbxref_id serial not null,
    primary key (feature_cvterm_dbxref_id),
    feature_cvterm_id int not null,
    foreign key (feature_cvterm_id) references feature_cvterm (feature_cvterm_id) on delete cascade,
    dbxref_id int not null,
    foreign key (dbxref_id) references dbxref (dbxref_id) on delete cascade INITIALLY DEFERRED,
    constraint feature_cvterm_dbxref_c1 unique (feature_cvterm_id,dbxref_id)
);
create index feature_cvterm_dbxref_idx1 on feature_cvterm_dbxref (feature_cvterm_id);
create index feature_cvterm_dbxref_idx2 on feature_cvterm_dbxref (dbxref_id);

COMMENT ON TABLE feature_cvterm_dbxref IS 'Additional dbxrefs for an association. Rows in the feature_cvterm table may be backed up by dbxrefs. For example, a feature_cvterm association that was inferred via a protein-protein interaction may be backed by by refering to the dbxref for the alternate protein. Corresponds to the WITH column in a GO gene association file (but can also be used for other analagous associations). See http://www.geneontology.org/doc/GO.annotation.shtml#file for more details.';

-- ================================================
-- TABLE: feature_cvterm_pub
-- ================================================

create table feature_cvterm_pub (
    feature_cvterm_pub_id serial not null,
    primary key (feature_cvterm_pub_id),
    feature_cvterm_id int not null,
    foreign key (feature_cvterm_id) references feature_cvterm (feature_cvterm_id) on delete cascade,
    pub_id int not null,
    foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
    constraint feature_cvterm_pub_c1 unique (feature_cvterm_id,pub_id)
);
create index feature_cvterm_pub_idx1 on feature_cvterm_pub (feature_cvterm_id);
create index feature_cvterm_pub_idx2 on feature_cvterm_pub (pub_id);

COMMENT ON TABLE feature_cvterm_pub IS 'Secondary pubs for an
association. Each feature_cvterm association is supported by a single
primary publication. Additional secondary pubs can be added using this
linking table (in a GO gene association file, these corresponding to
any IDs after the pipe symbol in the publications column.';

-- ================================================
-- TABLE: synonym
-- ================================================

create table synonym (
    synonym_id serial not null,
    primary key (synonym_id),
    name varchar(255) not null,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    synonym_sgml varchar(255) not null,
    constraint synonym_c1 unique (name,type_id)
);
create index synonym_idx1 on synonym (type_id);
create index synonym_idx2 on synonym ((lower(synonym_sgml)));

COMMENT ON TABLE synonym IS 'A synonym for a feature. One feature can have multiple synonyms, and the same synonym can apply to multiple features.';

COMMENT ON COLUMN synonym.name IS 'The synonym itself. Should be human-readable machine-searchable ascii text.';

COMMENT ON COLUMN synonym.synonym_sgml IS 'The fully specified synonym, with any non-ascii characters encoded in SGML.';

COMMENT ON COLUMN synonym.type_id IS 'Types would be symbol and fullname for now.';


-- ================================================
-- TABLE: feature_synonym
-- ================================================

create table feature_synonym (
    feature_synonym_id serial not null,
    primary key (feature_synonym_id),
    synonym_id int not null,
    foreign key (synonym_id) references synonym (synonym_id) on delete cascade INITIALLY DEFERRED,
    feature_id int not null,
    foreign key (feature_id) references feature (feature_id) on delete cascade INITIALLY DEFERRED,
    pub_id int not null,
    foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
    is_current boolean not null default 'false',
    is_internal boolean not null default 'false',
    constraint feature_synonym_c1 unique (synonym_id,feature_id,pub_id)
);
create index feature_synonym_idx1 on feature_synonym (synonym_id);
create index feature_synonym_idx2 on feature_synonym (feature_id);
create index feature_synonym_idx3 on feature_synonym (pub_id);

COMMENT ON TABLE feature_synonym IS 'Linking table between feature and synonym.';

COMMENT ON COLUMN feature_synonym.pub_id IS 'The pub_id link is for relating the usage of a given synonym to the publication in which it was used.';

COMMENT ON COLUMN feature_synonym.is_current IS 'The is_current boolean indicates whether the linked synonym is the  current -official- symbol for the linked feature.';

COMMENT ON COLUMN feature_synonym.is_internal IS 'Typically a synonym exists so that somebody querying the db with an obsolete name can find the object theyre looking for (under its current name.  If the synonym has been used publicly and deliberately (e.g. in a paper), it may also be listed in reports as a synonym. If the synonym was not used deliberately (e.g. there was a typo which went public), then the is_internal boolean may be set to -true- so that it is known that the synonym is -internal- and should be queryable but should not be listed in reports as a valid synonym.';
CREATE VIEW type_feature_count AS
  SELECT t.name AS type,count(*) AS num_features 
   FROM cvterm AS t INNER JOIN feature ON (type_id=t.cvterm_id) 
  GROUP BY t.name;
COMMENT ON VIEW type_feature_count IS 'per-feature-type feature counts';
CREATE SCHEMA genetic_code;
SET search_path = genetic_code,public,pg_catalog;

CREATE TABLE gencode (
        gencode_id      INTEGER PRIMARY KEY NOT NULL,
        organismstr     VARCHAR(512) NOT NULL
);

CREATE TABLE gencode_codon_aa (
        gencode_id      INTEGER NOT NULL REFERENCES gencode(gencode_id),
        codon           CHAR(3) NOT NULL,
        aa              CHAR(1) NOT NULL,
        CONSTRAINT gencode_codon_unique UNIQUE( gencode_id, codon )
);
CREATE INDEX gencode_codon_aa_i1 ON gencode_codon_aa(gencode_id,codon,aa);

CREATE TABLE gencode_startcodon (
        gencode_id      INTEGER NOT NULL REFERENCES gencode(gencode_id),
        codon           CHAR(3),
        CONSTRAINT gencode_startcodon_unique UNIQUE( gencode_id, codon )
);
SET search_path = public,pg_catalog;
--
-- functions operating on featureloc ranges
--

-- create a point
CREATE OR REPLACE FUNCTION create_point (int, int) RETURNS point AS
 'SELECT point ($1, $2)'
LANGUAGE 'sql';

-- create a range box
-- (make this immutable so we can index it)
CREATE OR REPLACE FUNCTION boxrange (int, int) RETURNS box AS
 'SELECT box (create_point(0, $1), create_point($2,500000000))'
LANGUAGE 'sql' IMMUTABLE;

-- create a query box
CREATE OR REPLACE FUNCTION boxquery (int, int) RETURNS box AS
 'SELECT box (create_point($1, $2), create_point($1, $2))'
LANGUAGE 'sql' IMMUTABLE;

--functional index that depends on the above functions
CREATE INDEX binloc_boxrange ON featureloc USING RTREE (boxrange(fmin, fmax));


CREATE OR REPLACE FUNCTION featureloc_slice(int, int) RETURNS setof featureloc AS
  'SELECT * from featureloc where boxquery($1, $2) @ boxrange(fmin,fmax)'
LANGUAGE 'sql';

CREATE OR REPLACE FUNCTION featureloc_slice(varchar, int, int)
  RETURNS setof featureloc AS
  'SELECT featureloc.* 
   FROM featureloc 
   INNER JOIN feature AS srcf ON (srcf.feature_id = featureloc.srcfeature_id)
   WHERE boxquery($2, $3) @ boxrange(fmin,fmax)
   AND srcf.name = $1 '
LANGUAGE 'sql';

CREATE OR REPLACE FUNCTION featureloc_slice(int, int, int)
  RETURNS setof featureloc AS
  'SELECT * 
   FROM featureloc 
   WHERE boxquery($2, $3) @ boxrange(fmin,fmax)
   AND srcfeature_id = $1 '
LANGUAGE 'sql';


-- can we not just do these as views?
CREATE OR REPLACE FUNCTION feature_overlaps(int)
 RETURNS setof feature AS
 'SELECT feature.*
  FROM feature
   INNER JOIN featureloc AS x ON (x.feature_id=feature.feature_id)
   INNER JOIN featureloc AS y ON (y.feature_id = $1)
  WHERE
   x.srcfeature_id = y.srcfeature_id            AND
   ( x.fmax >= y.fmin AND x.fmin <= y.fmax ) '
LANGUAGE 'sql';

CREATE OR REPLACE FUNCTION feature_disjoint_from(int)
 RETURNS setof feature AS
 'SELECT feature.*
  FROM feature
   INNER JOIN featureloc AS x ON (x.feature_id=feature.feature_id)
   INNER JOIN featureloc AS y ON (y.feature_id = $1)
  WHERE
   x.srcfeature_id = y.srcfeature_id            AND
   ( x.fmax < y.fmin OR x.fmin > y.fmax ) '
LANGUAGE 'sql';



--Evolution of the methods found in range.plpgsql (C. Pommier)
--Goal : increase performances of segment fetching
--       Implies to optimise featureloc_slice

--Background : The existing featureloc_slice uses uses a spatial rtree index. The spatial objects used are a boxrange ((0,fmin), (fmax,500000000)) and a boxquery ((fmin,fmax),(fmin,fmax)) . The boxranges are indexed. 
--             To speed up things (for gbrowse) featureloc_slice has been overiden to filter simultaneously on the boxrange and the srcfeature_id. This gives good results.
--             The goal here is to push this logic further and to include the srcfeature_id filter directly into the boxrange object. We propose to consider the following boxs : 
--             boxrange : ((srcfeature_id,fmin),(srcfeature_id,fmax))
--             boxquery : ((srcfeature_id,fmin),(srcfeature_id,fmax))



CREATE OR REPLACE FUNCTION boxrange (int, int, int) RETURNS box AS
 'SELECT box (create_point($1, $2), create_point($1,$3))'
LANGUAGE 'sql' IMMUTABLE;

-- create a query box
CREATE OR REPLACE FUNCTION boxquery (int, int, int) RETURNS box AS
 'SELECT box (create_point($1, $2), create_point($1, $3))'
LANGUAGE 'sql' IMMUTABLE;

CREATE INDEX binloc_boxrange_src ON featureloc USING RTREE (boxrange(srcfeature_id,fmin, fmax));

CREATE OR REPLACE FUNCTION featureloc_slice(int, int, int)
  RETURNS setof featureloc AS
  'SELECT * 
   FROM featureloc 
   WHERE boxquery($1, $2, $3) && boxrange(srcfeature_id,fmin,fmax)'   
LANGUAGE 'sql';
-- reverse_string
CREATE OR REPLACE FUNCTION reverse_string(TEXT) RETURNS TEXT AS 
'
 DECLARE 
  reversed_string TEXT;
  incoming ALIAS FOR $1;
 BEGIN
   reversed_string = '''';
   FOR i IN REVERSE char_length(incoming)..1 loop
     reversed_string = reversed_string || substring(incoming FROM i FOR 1);
   END loop;
 RETURN reversed_string;
END'
language plpgsql;

-- complements DNA
CREATE OR REPLACE FUNCTION complement_residues(text) RETURNS text AS
 'SELECT (translate($1, 
                   ''acgtrymkswhbvdnxACGTRYMKSWHBVDNX'',
                   ''tgcayrkmswdvbhnxTGCAYRKMSWDVBHNX''))'
LANGUAGE 'sql';

-- revcomp
CREATE OR REPLACE FUNCTION reverse_complement(TEXT) RETURNS TEXT AS
 'SELECT reverse_string(complement_residues($1))'
LANGUAGE 'sql';

-- DNA to AA
CREATE OR REPLACE FUNCTION translate_dna(TEXT,INT) RETURNS TEXT AS 
'
 DECLARE 
  dnaseq ALIAS FOR $1;
  gcode ALIAS FOR $2;
  translation TEXT;
  dnaseqlen INT;
  codon CHAR(3);
  aa CHAR(1);
  i INT;
 BEGIN
   translation = '''';
   dnaseqlen = char_length(dnaseq);
   i=1;
   WHILE i+1 < dnaseqlen loop
     codon = substring(dnaseq,i,3);
     aa = translate_codon(codon,gcode);
     translation = translation || aa;
     i = i+3;
   END loop;
 RETURN translation;
END'
language plpgsql;

-- DNA to AA, default genetic code
CREATE OR REPLACE FUNCTION translate_dna(TEXT) RETURNS TEXT AS
 'SELECT translate_dna($1,1)'
LANGUAGE 'sql';


CREATE OR REPLACE FUNCTION translate_codon(TEXT,INT) RETURNS CHAR AS
 'SELECT aa FROM genetic_code.gencode_codon_aa WHERE codon=$1 AND gencode_id=$2'
LANGUAGE 'sql';



CREATE OR REPLACE FUNCTION concat_pair (text, text) RETURNS text AS
 'SELECT $1 || $2'
LANGUAGE 'sql';

CREATE AGGREGATE concat (
sfunc = concat_pair,
basetype = text,
stype = text,
initcond = ''
);


--function to 'unshare' exons.  It looks for exons that have the same fmin
--and fmax and belong to the same gene and only keeps one.  The other,
--redundant exons are marked obsolete in the feature table.  Nothing
--is done with those features' entries in the featureprop, feature_dbxref,
--feature_pub, or feature_cvterm tables.  For the moment, I'm assuming
--that any annotations that they have when this script is run are
--identical to their non-obsoleted doppelgangers.  If that's not the case, 
--they could be merged via query.
--
--The bulk of this code was contributed by Robin Houston at
--GeneDB/Sanger Centre.

CREATE OR REPLACE FUNCTION share_exons () RETURNS void AS '    
  DECLARE    
  BEGIN
    /* Generate a table of shared exons */
    CREATE temporary TABLE shared_exons AS
      SELECT gene.feature_id as gene_feature_id
           , gene.uniquename as gene_uniquename
           , transcript1.uniquename as transcript1
           , exon1.feature_id as exon1_feature_id
           , exon1.uniquename as exon1_uniquename
           , transcript2.uniquename as transcript2
           , exon2.feature_id as exon2_feature_id
           , exon2.uniquename as exon2_uniquename
           , exon1_loc.fmin /* = exon2_loc.fmin */
           , exon1_loc.fmax /* = exon2_loc.fmax */
      FROM feature gene
        JOIN cvterm gene_type ON gene.type_id = gene_type.cvterm_id
        JOIN cv gene_type_cv USING (cv_id)
        JOIN feature_relationship gene_transcript1 ON gene.feature_id = gene_transcript1.object_id
        JOIN feature transcript1 ON gene_transcript1.subject_id = transcript1.feature_id
        JOIN cvterm transcript1_type ON transcript1.type_id = transcript1_type.cvterm_id
        JOIN cv transcript1_type_cv ON transcript1_type.cv_id = transcript1_type_cv.cv_id
        JOIN feature_relationship transcript1_exon1 ON transcript1_exon1.object_id = transcript1.feature_id
        JOIN feature exon1 ON transcript1_exon1.subject_id = exon1.feature_id
        JOIN cvterm exon1_type ON exon1.type_id = exon1_type.cvterm_id
        JOIN cv exon1_type_cv ON exon1_type.cv_id = exon1_type_cv.cv_id
        JOIN featureloc exon1_loc ON exon1_loc.feature_id = exon1.feature_id
        JOIN feature_relationship gene_transcript2 ON gene.feature_id = gene_transcript2.object_id
        JOIN feature transcript2 ON gene_transcript2.subject_id = transcript2.feature_id
        JOIN cvterm transcript2_type ON transcript2.type_id = transcript2_type.cvterm_id
        JOIN cv transcript2_type_cv ON transcript2_type.cv_id = transcript2_type_cv.cv_id
        JOIN feature_relationship transcript2_exon2 ON transcript2_exon2.object_id = transcript2.feature_id
        JOIN feature exon2 ON transcript2_exon2.subject_id = exon2.feature_id
        JOIN cvterm exon2_type ON exon2.type_id = exon2_type.cvterm_id
        JOIN cv exon2_type_cv ON exon2_type.cv_id = exon2_type_cv.cv_id
        JOIN featureloc exon2_loc ON exon2_loc.feature_id = exon2.feature_id
      WHERE gene_type_cv.name = ''sequence''
        AND gene_type.name = ''gene''
        AND transcript1_type_cv.name = ''sequence''
        AND transcript1_type.name = ''mRNA''
        AND transcript2_type_cv.name = ''sequence''
        AND transcript2_type.name = ''mRNA''
        AND exon1_type_cv.name = ''sequence''
        AND exon1_type.name = ''exon''
        AND exon2_type_cv.name = ''sequence''
        AND exon2_type.name = ''exon''
        AND exon1.feature_id < exon2.feature_id
        AND exon1_loc.rank = 0
        AND exon2_loc.rank = 0
        AND exon1_loc.fmin = exon2_loc.fmin
        AND exon1_loc.fmax = exon2_loc.fmax
    ;
    
    /* Choose one of the shared exons to be the canonical representative.
       We pick the one with the smallest feature_id.
     */
    CREATE temporary TABLE canonical_exon_representatives AS
      SELECT gene_feature_id, min(exon1_feature_id) AS canonical_feature_id, fmin
      FROM shared_exons
      GROUP BY gene_feature_id,fmin
    ;
    
    CREATE temporary TABLE exon_replacements AS
      SELECT DISTINCT shared_exons.exon2_feature_id AS actual_feature_id
                    , canonical_exon_representatives.canonical_feature_id
                    , canonical_exon_representatives.fmin
      FROM shared_exons
        JOIN canonical_exon_representatives USING (gene_feature_id)
      WHERE shared_exons.exon2_feature_id <> canonical_exon_representatives.canonical_feature_id
        AND shared_exons.fmin = canonical_exon_representatives.fmin
    ;
    
    UPDATE feature_relationship 
      SET subject_id = (
            SELECT canonical_feature_id
            FROM exon_replacements
            WHERE feature_relationship.subject_id = exon_replacements.actual_feature_id)
      WHERE subject_id IN (
        SELECT actual_feature_id FROM exon_replacements
    );
    
    UPDATE feature_relationship
      SET object_id = (
            SELECT canonical_feature_id
            FROM exon_replacements
            WHERE feature_relationship.subject_id = exon_replacements.actual_feature_id)
      WHERE object_id IN (
        SELECT actual_feature_id FROM exon_replacements
    );
    
    UPDATE feature
      SET is_obsolete = true
      WHERE feature_id IN (
        SELECT actual_feature_id FROM exon_replacements
    );
  END;    
' LANGUAGE 'plpgsql';

--This is a function to seek out exons of transcripts and orders them,
--using feature_relationship.rank, in "transcript order" numbering
--from 0, taking strand into account. It will not touch transcripts that
--already have their exons ordered (in case they have a non-obvious
--ordering due to trans splicing). It takes as an argument the
--feature.type_id of the parent transcript type (typically, mRNA, although
--non coding transcript types should work too).

CREATE OR REPLACE FUNCTION order_exons (integer) RETURNS void AS '
  DECLARE
    parent_type      ALIAS FOR $1;
    exon_id          int;
    part_of          int;
    exon_type        int;
    strand           int;
    arow             RECORD;
    order_by         varchar;
    rowcount         int;
    exon_count       int;
    ordered_exons    int;    
    transcript_id    int;
    transcript_row   feature%ROWTYPE;
  BEGIN
    SELECT INTO part_of cvterm_id FROM cvterm WHERE name=''part_of''
      AND cv_id IN (SELECT cv_id FROM cv WHERE name=''relationship'');
    --SELECT INTO exon_type cvterm_id FROM cvterm WHERE name=''exon''
    --  AND cv_id IN (SELECT cv_id FROM cv WHERE name=''sequence'');

    --RAISE NOTICE ''part_of %, exon %'',part_of,exon_type;

    FOR transcript_row IN
      SELECT * FROM feature WHERE type_id = parent_type
    LOOP
      transcript_id = transcript_row.feature_id;
      SELECT INTO rowcount count(*) FROM feature_relationship
        WHERE object_id = transcript_id
          AND rank = 0;

      --Dont modify this transcript if there are already numbered exons or
      --if there is only one exon
      IF rowcount = 1 THEN
        --RAISE NOTICE ''skipping transcript %, row count %'',transcript_id,rowcount;
        CONTINUE;
      END IF;

      --need to reverse the order if the strand is negative
      SELECT INTO strand strand FROM featureloc WHERE feature_id=transcript_id;
      IF strand > 0 THEN
          order_by = ''fl.fmin'';      
      ELSE
          order_by = ''fl.fmax desc'';
      END IF;

      exon_count = 0;
      FOR arow IN EXECUTE 
        ''SELECT fr.*, fl.fmin, fl.fmax
          FROM feature_relationship fr, featureloc fl
          WHERE fr.object_id  = ''||transcript_id||''
            AND fr.subject_id = fl.feature_id
            AND fr.type_id    = ''||part_of||''
            ORDER BY ''||order_by
      LOOP
        --number the exons for a given transcript
        UPDATE feature_relationship
          SET rank = exon_count 
          WHERE feature_relationship_id = arow.feature_relationship_id;
        exon_count = exon_count + 1;
      END LOOP; 

    END LOOP;

  END;
' LANGUAGE 'plpgsql';
-- down the graph: eg from  chromosome to contig
CREATE OR REPLACE FUNCTION project_point_up(int,int,int,int)
 RETURNS int AS
'SELECT
  CASE WHEN $4<0
   THEN $3-$1             -- rev strand
   ELSE $1-$2             -- fwd strand
  END AS p'
LANGUAGE 'sql'; 

-- down the graph: eg from contig to chromosome
CREATE OR REPLACE FUNCTION project_point_down(int,int,int,int)
 RETURNS int AS
'SELECT
  CASE WHEN $4<0
   THEN $3-$1
   ELSE $1+$2
  END AS p'
LANGUAGE 'sql'; 

CREATE OR REPLACE FUNCTION project_featureloc_up(int,int)
 RETURNS featureloc AS
'
DECLARE
    in_featureloc_id alias for $1;
    up_srcfeature_id alias for $2;
    in_featureloc featureloc%ROWTYPE;
    up_featureloc featureloc%ROWTYPE;
    nu_featureloc featureloc%ROWTYPE;
    nu_fmin INT;
    nu_fmax INT;
    nu_strand INT;
BEGIN
 SELECT INTO in_featureloc
   featureloc.*
  FROM featureloc
  WHERE featureloc_id = in_featureloc_id;

 SELECT INTO up_featureloc
   up_fl.*
  FROM featureloc AS in_fl
  INNER JOIN featureloc AS up_fl
    ON (in_fl.srcfeature_id = up_fl.feature_id)
  WHERE
   in_fl.featureloc_id = in_featureloc_id AND
   up_fl.srcfeature_id = up_srcfeature_id;

  IF up_featureloc.strand IS NULL
   THEN RETURN NULL;
  END IF;
  
  IF up_featureloc.strand < 0
  THEN
   nu_fmin = project_point_up(in_featureloc.fmax,
                              up_featureloc.fmin,up_featureloc.fmax,-1);
   nu_fmax = project_point_up(in_featureloc.fmin,
                              up_featureloc.fmin,up_featureloc.fmax,-1);
   nu_strand = -in_featureloc.strand;
  ELSE
   nu_fmin = project_point_up(in_featureloc.fmin,
                              up_featureloc.fmin,up_featureloc.fmax,1);
   nu_fmax = project_point_up(in_featureloc.fmax,
                              up_featureloc.fmin,up_featureloc.fmax,1);
   nu_strand = in_featureloc.strand;
  END IF;
  in_featureloc.fmin = nu_fmin;
  in_featureloc.fmax = nu_fmax;
  in_featureloc.strand = nu_strand;
  in_featureloc.srcfeature_id = up_featureloc.srcfeature_id;
  RETURN in_featureloc;
END
'   
LANGUAGE 'plpgsql';

CREATE OR REPLACE FUNCTION project_point_g2t(int,int,int)
 RETURNS INT AS '
 DECLARE
    in_p             alias for $1;
    srcf_id          alias for $2;
    t_id             alias for $3;
    e_floc           featureloc%ROWTYPE;
    out_p            INT;
    exon_cvterm_id   INT;
BEGIN
 SELECT INTO exon_cvterm_id get_feature_type_id(''exon'');
 SELECT INTO out_p
  CASE 
   WHEN strand<0 THEN fmax-p
   ELSE p-fmin
   END AS p
  FROM featureloc
   INNER JOIN feature USING (feature_id)
   INNER JOIN feature_relationship ON (feature.feature_id=subject_id)
  WHERE
   object_id = t_id                     AND
   feature.type_id = exon_cvterm_id     AND
   featureloc.srcfeature_id = srcf_id   AND
   in_p >= fmin                         AND
   in_p <= fmax;
  RETURN in_featureloc;
END
'   
LANGUAGE 'plpgsql';


CREATE OR REPLACE FUNCTION get_cv_id_for_feature() RETURNS INT
 AS 'SELECT cv_id FROM cv WHERE name=''sequence''' LANGUAGE 'sql';
CREATE OR REPLACE FUNCTION get_cv_id_for_featureprop() RETURNS INT
 AS 'SELECT cv_id FROM cv WHERE name=''feature_property''' LANGUAGE 'sql';
CREATE OR REPLACE FUNCTION get_cv_id_for_feature_relationsgip() RETURNS INT
 AS 'SELECT cv_id FROM cv WHERE name=''relationship''' LANGUAGE 'sql';

CREATE OR REPLACE FUNCTION get_feature_type_id(VARCHAR) RETURNS INT
 AS ' 
  SELECT cvterm_id 
  FROM cv INNER JOIN cvterm USING (cv_id)
  WHERE cvterm.name=$1 AND cv.name=''sequence''
 ' LANGUAGE 'sql';

CREATE OR REPLACE FUNCTION get_featureprop_type_id(VARCHAR) RETURNS INT
 AS '
  SELECT cvterm_id 
  FROM cv INNER JOIN cvterm USING (cv_id)
  WHERE cvterm.name=$1 AND cv.name=''feature_property''
 ' LANGUAGE 'sql';

CREATE OR REPLACE FUNCTION get_feature_relationship_type_id(VARCHAR) RETURNS INT
 AS '
  SELECT cvterm_id 
  FROM cv INNER JOIN cvterm USING (cv_id)
  WHERE cvterm.name=$1 AND cv.name=''relationship''
 ' LANGUAGE 'sql';

-- depends on sequence-cv-helper
CREATE OR REPLACE FUNCTION get_feature_id(VARCHAR,VARCHAR,VARCHAR) RETURNS INT
 AS '
  SELECT feature_id 
  FROM feature
  WHERE uniquename=$1
    AND type_id=get_feature_type_id($2)
    AND organism_id=get_organism_id($3)
 ' LANGUAGE 'sql';
--This is an automatically generated file; do not edit it as changes will not
--be saved.  Instead, modify bin/create-so-bridge.pl, which creates this file.


CREATE SCHEMA so;
SET search_path=so,public,pg_catalog;

--- ************************************************
--- *** relation: region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence_feature with an extent greate ***
--- *** r than zero. A nucleotide region is comp ***
--- *** osed of bases and a polypeptide region i ***
--- *** s composed of amino acids.               ***
--- ************************************************
---

CREATE VIEW region AS
  SELECT
    feature_id AS region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'biomaterial_region' OR cvterm.name = 'experimental_feature' OR cvterm.name = 'biological_region' OR cvterm.name = 'topologically_defined_region' OR cvterm.name = 'reagent' OR cvterm.name = 'engineered_region' OR cvterm.name = 'PCR_product' OR cvterm.name = 'clone' OR cvterm.name = 'rescue_region' OR cvterm.name = 'oligo' OR cvterm.name = 'clone_insert' OR cvterm.name = 'cloned_region' OR cvterm.name = 'databank_entry' OR cvterm.name = 'RAPD' OR cvterm.name = 'genomic_clone' OR cvterm.name = 'cDNA_clone' OR cvterm.name = 'tiling_path_clone' OR cvterm.name = 'validated_cDNA_clone' OR cvterm.name = 'invalidated_cDNA_clone' OR cvterm.name = 'three_prime_RACE_clone' OR cvterm.name = 'chimeric_cDNA_clone' OR cvterm.name = 'genomically_contaminated_cDNA_clone' OR cvterm.name = 'polyA_primed_cDNA_clone' OR cvterm.name = 'partially_processed_cDNA_clone' OR cvterm.name = 'engineered_rescue_region' OR cvterm.name = 'aptamer' OR cvterm.name = 'probe' OR cvterm.name = 'tag' OR cvterm.name = 'ss_oligo' OR cvterm.name = 'ds_oligo' OR cvterm.name = 'DNAzyme' OR cvterm.name = 'synthetic_oligo' OR cvterm.name = 'DNA_aptamer' OR cvterm.name = 'RNA_aptamer' OR cvterm.name = 'microarray_oligo' OR cvterm.name = 'SAGE_tag' OR cvterm.name = 'STS' OR cvterm.name = 'EST' OR cvterm.name = 'engineered_tag' OR cvterm.name = 'five_prime_EST' OR cvterm.name = 'three_prime_EST' OR cvterm.name = 'UST' OR cvterm.name = 'RST' OR cvterm.name = 'three_prime_UST' OR cvterm.name = 'five_prime_UST' OR cvterm.name = 'three_prime_RST' OR cvterm.name = 'five_prime_RST' OR cvterm.name = 'primer' OR cvterm.name = 'sequencing_primer' OR cvterm.name = 'forward_primer' OR cvterm.name = 'reverse_primer' OR cvterm.name = 'ASPE_primer' OR cvterm.name = 'dCAPS_primer' OR cvterm.name = 'RNAi_reagent' OR cvterm.name = 'DNA_constraint_sequence' OR cvterm.name = 'morpholino_oligo' OR cvterm.name = 'PNA_oligo' OR cvterm.name = 'LNA_oligo' OR cvterm.name = 'TNA_oligo' OR cvterm.name = 'GNA_oligo' OR cvterm.name = 'R_GNA_oligo' OR cvterm.name = 'S_GNA_oligo' OR cvterm.name = 'cloned_cDNA_insert' OR cvterm.name = 'cloned_genomic_insert' OR cvterm.name = 'engineered_insert' OR cvterm.name = 'BAC_cloned_genomic_insert' OR cvterm.name = 'engineered_gene' OR cvterm.name = 'engineered_plasmid' OR cvterm.name = 'engineered_rescue_region' OR cvterm.name = 'engineered_transposable_element' OR cvterm.name = 'engineered_foreign_region' OR cvterm.name = 'engineered_tag' OR cvterm.name = 'engineered_insert' OR cvterm.name = 'targeting_vector' OR cvterm.name = 'engineered_foreign_gene' OR cvterm.name = 'engineered_fusion_gene' OR cvterm.name = 'engineered_foreign_transposable_element_gene' OR cvterm.name = 'engineered_episome' OR cvterm.name = 'gene_trap_construct' OR cvterm.name = 'promoter_trap_construct' OR cvterm.name = 'enhancer_trap_construct' OR cvterm.name = 'engineered_foreign_transposable_element' OR cvterm.name = 'engineered_foreign_gene' OR cvterm.name = 'engineered_foreign_repetitive_element' OR cvterm.name = 'engineered_foreign_transposable_element' OR cvterm.name = 'engineered_foreign_transposable_element_gene' OR cvterm.name = 'match_part' OR cvterm.name = 'assembly_component' OR cvterm.name = 'conserved_region' OR cvterm.name = 'match' OR cvterm.name = 'remark' OR cvterm.name = 'reading_frame' OR cvterm.name = 'consensus_region' OR cvterm.name = 'low_complexity_region' OR cvterm.name = 'assembly' OR cvterm.name = 'transcribed_fragment' OR cvterm.name = 'transcribed_cluster' OR cvterm.name = 'high_identity_region' OR cvterm.name = 'mathematically_defined_repeat' OR cvterm.name = 'experimentally_defined_binding_region' OR cvterm.name = 'contig' OR cvterm.name = 'read' OR cvterm.name = 'restriction_fragment' OR cvterm.name = 'golden_path_fragment' OR cvterm.name = 'tiling_path_fragment' OR cvterm.name = 'gap' OR cvterm.name = 'sonicate_fragment' OR cvterm.name = 'paired_end_fragment' OR cvterm.name = 'read_pair' OR cvterm.name = 'contig_read' OR cvterm.name = 'BAC_end' OR cvterm.name = 'dye_terminator_read' OR cvterm.name = 'pyrosequenced_read' OR cvterm.name = 'ligation_based_read' OR cvterm.name = 'polymerase_synthesis_read' OR cvterm.name = 'PAC_end' OR cvterm.name = 'YAC_end' OR cvterm.name = 'clone_end' OR cvterm.name = 'RFLP_fragment' OR cvterm.name = 'tiling_path_clone' OR cvterm.name = 'coding_conserved_region' OR cvterm.name = 'nc_conserved_region' OR cvterm.name = 'RR_tract' OR cvterm.name = 'homologous_region' OR cvterm.name = 'centromere_DNA_Element_I' OR cvterm.name = 'centromere_DNA_Element_II' OR cvterm.name = 'centromere_DNA_Element_III' OR cvterm.name = 'X_element' OR cvterm.name = 'U_box' OR cvterm.name = 'regional_centromere_central_core' OR cvterm.name = 'syntenic_region' OR cvterm.name = 'paralogous_region' OR cvterm.name = 'orthologous_region' OR cvterm.name = 'nucleotide_match' OR cvterm.name = 'protein_match' OR cvterm.name = 'expressed_sequence_match' OR cvterm.name = 'cross_genome_match' OR cvterm.name = 'translated_nucleotide_match' OR cvterm.name = 'primer_match' OR cvterm.name = 'EST_match' OR cvterm.name = 'cDNA_match' OR cvterm.name = 'UST_match' OR cvterm.name = 'RST_match' OR cvterm.name = 'sequence_difference' OR cvterm.name = 'experimental_result_region' OR cvterm.name = 'polypeptide_sequencing_information' OR cvterm.name = 'possible_base_call_error' OR cvterm.name = 'possible_assembly_error' OR cvterm.name = 'assembly_error_correction' OR cvterm.name = 'base_call_error_correction' OR cvterm.name = 'overlapping_feature_set' OR cvterm.name = 'no_output' OR cvterm.name = 'overlapping_EST_set' OR cvterm.name = 'non_adjacent_residues' OR cvterm.name = 'non_terminal_residue' OR cvterm.name = 'sequence_conflict' OR cvterm.name = 'sequence_uncertainty' OR cvterm.name = 'contig_collection' OR cvterm.name = 'ORF' OR cvterm.name = 'blocked_reading_frame' OR cvterm.name = 'mini_gene' OR cvterm.name = 'rescue_mini_gene' OR cvterm.name = 'consensus_mRNA' OR cvterm.name = 'sequence_assembly' OR cvterm.name = 'fragment_assembly' OR cvterm.name = 'supercontig' OR cvterm.name = 'contig' OR cvterm.name = 'tiling_path' OR cvterm.name = 'virtual_sequence' OR cvterm.name = 'golden_path' OR cvterm.name = 'ultracontig' OR cvterm.name = 'expressed_sequence_assembly' OR cvterm.name = 'fingerprint_map' OR cvterm.name = 'STS_map' OR cvterm.name = 'RH_map' OR cvterm.name = 'unigene_cluster' OR cvterm.name = 'CHiP_seq_region' OR cvterm.name = 'sequence_secondary_structure' OR cvterm.name = 'linkage_group' OR cvterm.name = 'polypeptide' OR cvterm.name = 'deletion' OR cvterm.name = 'origin_of_replication' OR cvterm.name = 'recombination_feature' OR cvterm.name = 'CpG_island' OR cvterm.name = 'pseudogene' OR cvterm.name = 'binding_site' OR cvterm.name = 'pseudogenic_region' OR cvterm.name = 'cap' OR cvterm.name = 'intergenic_region' OR cvterm.name = 'oligo_U_tail' OR cvterm.name = 'polyA_sequence' OR cvterm.name = 'repeat_region' OR cvterm.name = 'insertion' OR cvterm.name = 'gene' OR cvterm.name = 'repeat_unit' OR cvterm.name = 'QTL' OR cvterm.name = 'chromosome_part' OR cvterm.name = 'gene_member_region' OR cvterm.name = 'transcript_region' OR cvterm.name = 'polypeptide_region' OR cvterm.name = 'gene_component_region' OR cvterm.name = 'mobile_genetic_element' OR cvterm.name = 'replicon' OR cvterm.name = 'base' OR cvterm.name = 'amino_acid' OR cvterm.name = 'genetic_marker' OR cvterm.name = 'sequence_motif' OR cvterm.name = 'restriction_enzyme_recognition_site' OR cvterm.name = 'restriction_enzyme_single_strand_overhang' OR cvterm.name = 'epigenetically_modified_region' OR cvterm.name = 'open_chromatin_region' OR cvterm.name = 'gene_group' OR cvterm.name = 'substitution' OR cvterm.name = 'inversion' OR cvterm.name = 'retron' OR cvterm.name = 'G_quartet' OR cvterm.name = 'base_pair' OR cvterm.name = 'RNA_sequence_secondary_structure' OR cvterm.name = 'DNA_sequence_secondary_structure' OR cvterm.name = 'pseudoknot' OR cvterm.name = 'WC_base_pair' OR cvterm.name = 'sugar_edge_base_pair' OR cvterm.name = 'Hoogsteen_base_pair' OR cvterm.name = 'reverse_Hoogsteen_base_pair' OR cvterm.name = 'wobble_base_pair' OR cvterm.name = 'stem_loop' OR cvterm.name = 'tetraloop' OR cvterm.name = 'i_motif' OR cvterm.name = 'recoding_pseudoknot' OR cvterm.name = 'H_pseudoknot' OR cvterm.name = 'D_loop' OR cvterm.name = 'ARS' OR cvterm.name = 'oriT' OR cvterm.name = 'amplification_origin' OR cvterm.name = 'oriV' OR cvterm.name = 'oriC' OR cvterm.name = 'recombination_hotspot' OR cvterm.name = 'haplotype_block' OR cvterm.name = 'sequence_rearrangement_feature' OR cvterm.name = 'iDNA' OR cvterm.name = 'specific_recombination_site' OR cvterm.name = 'chromosome_breakage_sequence' OR cvterm.name = 'internal_eliminated_sequence' OR cvterm.name = 'macronucleus_destined_segment' OR cvterm.name = 'recombination_feature_of_rearranged_gene' OR cvterm.name = 'site_specific_recombination_target_region' OR cvterm.name = 'recombination_signal_sequence' OR cvterm.name = 'vertebrate_immune_system_gene_recombination_feature' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_segment' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_gene_cluster' OR cvterm.name = 'vertebrate_immune_system_gene_recombination_spacer' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_rearranged_segment' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster' OR cvterm.name = 'vertebrate_immune_system_gene_recombination_signal_feature' OR cvterm.name = 'D_gene' OR cvterm.name = 'V_gene' OR cvterm.name = 'J_gene' OR cvterm.name = 'C_gene' OR cvterm.name = 'D_J_C_cluster' OR cvterm.name = 'J_C_cluster' OR cvterm.name = 'J_cluster' OR cvterm.name = 'V_cluster' OR cvterm.name = 'V_J_cluster' OR cvterm.name = 'V_J_C_cluster' OR cvterm.name = 'C_cluster' OR cvterm.name = 'D_cluster' OR cvterm.name = 'D_J_cluster' OR cvterm.name = 'three_prime_D_spacer' OR cvterm.name = 'five_prime_D_spacer' OR cvterm.name = 'J_spacer' OR cvterm.name = 'V_spacer' OR cvterm.name = 'VD_gene' OR cvterm.name = 'DJ_gene' OR cvterm.name = 'VDJ_gene' OR cvterm.name = 'VJ_gene' OR cvterm.name = 'DJ_J_cluster' OR cvterm.name = 'VDJ_J_C_cluster' OR cvterm.name = 'VDJ_J_cluster' OR cvterm.name = 'VJ_C_cluster' OR cvterm.name = 'VJ_J_C_cluster' OR cvterm.name = 'VJ_J_cluster' OR cvterm.name = 'D_DJ_C_cluster' OR cvterm.name = 'D_DJ_cluster' OR cvterm.name = 'D_DJ_J_C_cluster' OR cvterm.name = 'D_DJ_J_cluster' OR cvterm.name = 'V_DJ_cluster' OR cvterm.name = 'V_DJ_J_cluster' OR cvterm.name = 'V_VDJ_C_cluster' OR cvterm.name = 'V_VDJ_cluster' OR cvterm.name = 'V_VDJ_J_cluster' OR cvterm.name = 'V_VJ_C_cluster' OR cvterm.name = 'V_VJ_cluster' OR cvterm.name = 'V_VJ_J_cluster' OR cvterm.name = 'V_D_DJ_C_cluster' OR cvterm.name = 'V_D_DJ_cluster' OR cvterm.name = 'V_D_DJ_J_C_cluster' OR cvterm.name = 'V_D_DJ_J_cluster' OR cvterm.name = 'V_D_J_C_cluster' OR cvterm.name = 'V_D_J_cluster' OR cvterm.name = 'DJ_C_cluster' OR cvterm.name = 'DJ_J_C_cluster' OR cvterm.name = 'VDJ_C_cluster' OR cvterm.name = 'V_DJ_C_cluster' OR cvterm.name = 'V_DJ_J_C_cluster' OR cvterm.name = 'V_VDJ_J_C_cluster' OR cvterm.name = 'V_VJ_J_C_cluster' OR cvterm.name = 'J_gene_recombination_feature' OR cvterm.name = 'D_gene_recombination_feature' OR cvterm.name = 'V_gene_recombination_feature' OR cvterm.name = 'heptamer_of_recombination_feature_of_vertebrate_immune_system_gene' OR cvterm.name = 'nonamer_of_recombination_feature_of_vertebrate_immune_system_gene' OR cvterm.name = 'five_prime_D_recombination_signal_sequence' OR cvterm.name = 'three_prime_D_recombination_signal_sequence' OR cvterm.name = 'three_prime_D_heptamer' OR cvterm.name = 'five_prime_D_heptamer' OR cvterm.name = 'J_heptamer' OR cvterm.name = 'V_heptamer' OR cvterm.name = 'three_prime_D_nonamer' OR cvterm.name = 'five_prime_D_nonamer' OR cvterm.name = 'J_nonamer' OR cvterm.name = 'V_nonamer' OR cvterm.name = 'integration_excision_site' OR cvterm.name = 'resolution_site' OR cvterm.name = 'inversion_site' OR cvterm.name = 'inversion_site_part' OR cvterm.name = 'attI_site' OR cvterm.name = 'attP_site' OR cvterm.name = 'attB_site' OR cvterm.name = 'attL_site' OR cvterm.name = 'attR_site' OR cvterm.name = 'attC_site' OR cvterm.name = 'attCtn_site' OR cvterm.name = 'loxP_site' OR cvterm.name = 'dif_site' OR cvterm.name = 'FRT_site' OR cvterm.name = 'IRLinv_site' OR cvterm.name = 'IRRinv_site' OR cvterm.name = 'processed_pseudogene' OR cvterm.name = 'non_processed_pseudogene' OR cvterm.name = 'pseudogene_by_unequal_crossing_over' OR cvterm.name = 'nuclear_mt_pseudogene' OR cvterm.name = 'cassette_pseudogene' OR cvterm.name = 'duplicated_pseudogene' OR cvterm.name = 'unitary_pseudogene' OR cvterm.name = 'protein_binding_site' OR cvterm.name = 'epitope' OR cvterm.name = 'nucleotide_binding_site' OR cvterm.name = 'metal_binding_site' OR cvterm.name = 'ligand_binding_site' OR cvterm.name = 'protein_protein_contact' OR cvterm.name = 'nucleotide_to_protein_binding_site' OR cvterm.name = 'nuclease_binding_site' OR cvterm.name = 'TF_binding_site' OR cvterm.name = 'histone_binding_site' OR cvterm.name = 'insulator_binding_site' OR cvterm.name = 'enhancer_binding_site' OR cvterm.name = 'restriction_enzyme_binding_site' OR cvterm.name = 'nuclease_sensitive_site' OR cvterm.name = 'homing_endonuclease_binding_site' OR cvterm.name = 'nuclease_hypersensitive_site' OR cvterm.name = 'group_1_intron_homing_endonuclease_target_region' OR cvterm.name = 'DNAseI_hypersensitive_site' OR cvterm.name = 'miRNA_target_site' OR cvterm.name = 'DNA_binding_site' OR cvterm.name = 'primer_binding_site' OR cvterm.name = 'polypeptide_DNA_contact' OR cvterm.name = 'polypeptide_metal_contact' OR cvterm.name = 'polypeptide_calcium_ion_contact_site' OR cvterm.name = 'polypeptide_cobalt_ion_contact_site' OR cvterm.name = 'polypeptide_copper_ion_contact_site' OR cvterm.name = 'polypeptide_iron_ion_contact_site' OR cvterm.name = 'polypeptide_magnesium_ion_contact_site' OR cvterm.name = 'polypeptide_manganese_ion_contact_site' OR cvterm.name = 'polypeptide_molybdenum_ion_contact_site' OR cvterm.name = 'polypeptide_nickel_ion_contact_site' OR cvterm.name = 'polypeptide_tungsten_ion_contact_site' OR cvterm.name = 'polypeptide_zinc_ion_contact_site' OR cvterm.name = 'polypeptide_ligand_contact' OR cvterm.name = 'decayed_exon' OR cvterm.name = 'pseudogenic_exon' OR cvterm.name = 'pseudogenic_transcript' OR cvterm.name = 'pseudogenic_rRNA' OR cvterm.name = 'pseudogenic_tRNA' OR cvterm.name = 'long_terminal_repeat' OR cvterm.name = 'engineered_foreign_repetitive_element' OR cvterm.name = 'inverted_repeat' OR cvterm.name = 'direct_repeat' OR cvterm.name = 'non_LTR_retrotransposon_polymeric_tract' OR cvterm.name = 'dispersed_repeat' OR cvterm.name = 'tandem_repeat' OR cvterm.name = 'X_element_combinatorial_repeat' OR cvterm.name = 'Y_prime_element' OR cvterm.name = 'telomeric_repeat' OR cvterm.name = 'nested_repeat' OR cvterm.name = 'centromeric_repeat' OR cvterm.name = 'five_prime_LTR' OR cvterm.name = 'three_prime_LTR' OR cvterm.name = 'solo_LTR' OR cvterm.name = 'terminal_inverted_repeat' OR cvterm.name = 'five_prime_terminal_inverted_repeat' OR cvterm.name = 'three_prime_terminal_inverted_repeat' OR cvterm.name = 'target_site_duplication' OR cvterm.name = 'CRISPR' OR cvterm.name = 'satellite_DNA' OR cvterm.name = 'microsatellite' OR cvterm.name = 'minisatellite' OR cvterm.name = 'dinucleotide_repeat_microsatellite_feature' OR cvterm.name = 'trinucleotide_repeat_microsatellite_feature' OR cvterm.name = 'tetranucleotide_repeat_microsatellite_feature' OR cvterm.name = 'nested_tandem_repeat' OR cvterm.name = 'regional_centromere_inner_repeat_region' OR cvterm.name = 'regional_centromere_outer_repeat_region' OR cvterm.name = 'transgenic_insertion' OR cvterm.name = 'duplication' OR cvterm.name = 'tandem_duplication' OR cvterm.name = 'direct_tandem_duplication' OR cvterm.name = 'inverted_tandem_duplication' OR cvterm.name = 'nuclear_gene' OR cvterm.name = 'mt_gene' OR cvterm.name = 'plastid_gene' OR cvterm.name = 'nucleomorph_gene' OR cvterm.name = 'plasmid_gene' OR cvterm.name = 'proviral_gene' OR cvterm.name = 'transposable_element_gene' OR cvterm.name = 'silenced_gene' OR cvterm.name = 'engineered_gene' OR cvterm.name = 'foreign_gene' OR cvterm.name = 'fusion_gene' OR cvterm.name = 'recombinationally_rearranged_gene' OR cvterm.name = 'gene_with_trans_spliced_transcript' OR cvterm.name = 'gene_with_polycistronic_transcript' OR cvterm.name = 'rescue_gene' OR cvterm.name = 'post_translationally_regulated_gene' OR cvterm.name = 'negatively_autoregulated_gene' OR cvterm.name = 'positively_autoregulated_gene' OR cvterm.name = 'translationally_regulated_gene' OR cvterm.name = 'epigenetically_modified_gene' OR cvterm.name = 'transgene' OR cvterm.name = 'predicted_gene' OR cvterm.name = 'protein_coding_gene' OR cvterm.name = 'retrogene' OR cvterm.name = 'ncRNA_gene' OR cvterm.name = 'cryptic_gene' OR cvterm.name = 'gene_with_non_canonical_start_codon' OR cvterm.name = 'gene_cassette' OR cvterm.name = 'kinetoplast_gene' OR cvterm.name = 'maxicircle_gene' OR cvterm.name = 'minicircle_gene' OR cvterm.name = 'cryptogene' OR cvterm.name = 'apicoplast_gene' OR cvterm.name = 'ct_gene' OR cvterm.name = 'chromoplast_gene' OR cvterm.name = 'cyanelle_gene' OR cvterm.name = 'leucoplast_gene' OR cvterm.name = 'proplastid_gene' OR cvterm.name = 'endogenous_retroviral_gene' OR cvterm.name = 'engineered_foreign_transposable_element_gene' OR cvterm.name = 'gene_silenced_by_DNA_modification' OR cvterm.name = 'gene_silenced_by_RNA_interference' OR cvterm.name = 'gene_silenced_by_histone_modification' OR cvterm.name = 'gene_silenced_by_DNA_methylation' OR cvterm.name = 'gene_silenced_by_histone_methylation' OR cvterm.name = 'gene_silenced_by_histone_deacetylation' OR cvterm.name = 'engineered_foreign_gene' OR cvterm.name = 'engineered_fusion_gene' OR cvterm.name = 'engineered_foreign_transposable_element_gene' OR cvterm.name = 'engineered_foreign_gene' OR cvterm.name = 'engineered_foreign_transposable_element_gene' OR cvterm.name = 'engineered_fusion_gene' OR cvterm.name = 'recombinationally_inverted_gene' OR cvterm.name = 'recombinationally_rearranged_vertebrate_immune_system_gene' OR cvterm.name = 'gene_with_dicistronic_transcript' OR cvterm.name = 'gene_with_dicistronic_primary_transcript' OR cvterm.name = 'gene_with_dicistronic_mRNA' OR cvterm.name = 'wild_type_rescue_gene' OR cvterm.name = 'gene_rearranged_at_DNA_level' OR cvterm.name = 'maternally_imprinted_gene' OR cvterm.name = 'paternally_imprinted_gene' OR cvterm.name = 'allelically_excluded_gene' OR cvterm.name = 'floxed_gene' OR cvterm.name = 'gene_with_polyadenylated_mRNA' OR cvterm.name = 'gene_with_mRNA_with_frameshift' OR cvterm.name = 'gene_with_edited_transcript' OR cvterm.name = 'gene_with_recoded_mRNA' OR cvterm.name = 'gene_with_stop_codon_read_through' OR cvterm.name = 'gene_with_mRNA_recoded_by_translational_bypass' OR cvterm.name = 'gene_with_transcript_with_translational_frameshift' OR cvterm.name = 'gene_with_stop_codon_redefined_as_pyrrolysine' OR cvterm.name = 'gene_with_stop_codon_redefined_as_selenocysteine' OR cvterm.name = 'gRNA_gene' OR cvterm.name = 'miRNA_gene' OR cvterm.name = 'scRNA_gene' OR cvterm.name = 'snoRNA_gene' OR cvterm.name = 'snRNA_gene' OR cvterm.name = 'SRP_RNA_gene' OR cvterm.name = 'stRNA_gene' OR cvterm.name = 'tmRNA_gene' OR cvterm.name = 'tRNA_gene' OR cvterm.name = 'rRNA_gene' OR cvterm.name = 'piRNA_gene' OR cvterm.name = 'RNase_P_RNA_gene' OR cvterm.name = 'RNase_MRP_RNA_gene' OR cvterm.name = 'lincRNA_gene' OR cvterm.name = 'telomerase_RNA_gene' OR cvterm.name = 'cryptogene' OR cvterm.name = 'gene_with_start_codon_CUG' OR cvterm.name = 'chromosome_arm' OR cvterm.name = 'chromosome_band' OR cvterm.name = 'interband' OR cvterm.name = 'chromosomal_regulatory_element' OR cvterm.name = 'chromosomal_structural_element' OR cvterm.name = 'introgressed_chromosome_region' OR cvterm.name = 'matrix_attachment_site' OR cvterm.name = 'centromere' OR cvterm.name = 'telomere' OR cvterm.name = 'point_centromere' OR cvterm.name = 'regional_centromere' OR cvterm.name = 'transcript' OR cvterm.name = 'regulatory_region' OR cvterm.name = 'polycistronic_transcript' OR cvterm.name = 'transcript_with_translational_frameshift' OR cvterm.name = 'primary_transcript' OR cvterm.name = 'mature_transcript' OR cvterm.name = 'transcript_bound_by_nucleic_acid' OR cvterm.name = 'transcript_bound_by_protein' OR cvterm.name = 'enzymatic_RNA' OR cvterm.name = 'trans_spliced_transcript' OR cvterm.name = 'monocistronic_transcript' OR cvterm.name = 'aberrant_processed_transcript' OR cvterm.name = 'edited_transcript' OR cvterm.name = 'processed_transcript' OR cvterm.name = 'alternatively_spliced_transcript' OR cvterm.name = 'dicistronic_transcript' OR cvterm.name = 'polycistronic_primary_transcript' OR cvterm.name = 'polycistronic_mRNA' OR cvterm.name = 'dicistronic_mRNA' OR cvterm.name = 'dicistronic_primary_transcript' OR cvterm.name = 'dicistronic_primary_transcript' OR cvterm.name = 'dicistronic_mRNA' OR cvterm.name = 'protein_coding_primary_transcript' OR cvterm.name = 'nc_primary_transcript' OR cvterm.name = 'polycistronic_primary_transcript' OR cvterm.name = 'monocistronic_primary_transcript' OR cvterm.name = 'mini_exon_donor_RNA' OR cvterm.name = 'antisense_primary_transcript' OR cvterm.name = 'capped_primary_transcript' OR cvterm.name = 'pre_edited_mRNA' OR cvterm.name = 'scRNA_primary_transcript' OR cvterm.name = 'rRNA_primary_transcript' OR cvterm.name = 'tRNA_primary_transcript' OR cvterm.name = 'snRNA_primary_transcript' OR cvterm.name = 'snoRNA_primary_transcript' OR cvterm.name = 'tmRNA_primary_transcript' OR cvterm.name = 'SRP_RNA_primary_transcript' OR cvterm.name = 'miRNA_primary_transcript' OR cvterm.name = 'tasiRNA_primary_transcript' OR cvterm.name = 'rRNA_small_subunit_primary_transcript' OR cvterm.name = 'rRNA_large_subunit_primary_transcript' OR cvterm.name = 'alanine_tRNA_primary_transcript' OR cvterm.name = 'arginine_tRNA_primary_transcript' OR cvterm.name = 'asparagine_tRNA_primary_transcript' OR cvterm.name = 'aspartic_acid_tRNA_primary_transcript' OR cvterm.name = 'cysteine_tRNA_primary_transcript' OR cvterm.name = 'glutamic_acid_tRNA_primary_transcript' OR cvterm.name = 'glutamine_tRNA_primary_transcript' OR cvterm.name = 'glycine_tRNA_primary_transcript' OR cvterm.name = 'histidine_tRNA_primary_transcript' OR cvterm.name = 'isoleucine_tRNA_primary_transcript' OR cvterm.name = 'leucine_tRNA_primary_transcript' OR cvterm.name = 'lysine_tRNA_primary_transcript' OR cvterm.name = 'methionine_tRNA_primary_transcript' OR cvterm.name = 'phenylalanine_tRNA_primary_transcript' OR cvterm.name = 'proline_tRNA_primary_transcript' OR cvterm.name = 'serine_tRNA_primary_transcript' OR cvterm.name = 'threonine_tRNA_primary_transcript' OR cvterm.name = 'tryptophan_tRNA_primary_transcript' OR cvterm.name = 'tyrosine_tRNA_primary_transcript' OR cvterm.name = 'valine_tRNA_primary_transcript' OR cvterm.name = 'pyrrolysine_tRNA_primary_transcript' OR cvterm.name = 'selenocysteine_tRNA_primary_transcript' OR cvterm.name = 'methylation_guide_snoRNA_primary_transcript' OR cvterm.name = 'rRNA_cleavage_snoRNA_primary_transcript' OR cvterm.name = 'C_D_box_snoRNA_primary_transcript' OR cvterm.name = 'H_ACA_box_snoRNA_primary_transcript' OR cvterm.name = 'U14_snoRNA_primary_transcript' OR cvterm.name = 'stRNA_primary_transcript' OR cvterm.name = 'dicistronic_primary_transcript' OR cvterm.name = 'mRNA' OR cvterm.name = 'ncRNA' OR cvterm.name = 'mRNA_with_frameshift' OR cvterm.name = 'monocistronic_mRNA' OR cvterm.name = 'polycistronic_mRNA' OR cvterm.name = 'exemplar_mRNA' OR cvterm.name = 'capped_mRNA' OR cvterm.name = 'polyadenylated_mRNA' OR cvterm.name = 'trans_spliced_mRNA' OR cvterm.name = 'edited_mRNA' OR cvterm.name = 'consensus_mRNA' OR cvterm.name = 'recoded_mRNA' OR cvterm.name = 'mRNA_with_minus_1_frameshift' OR cvterm.name = 'mRNA_with_plus_1_frameshift' OR cvterm.name = 'mRNA_with_plus_2_frameshift' OR cvterm.name = 'mRNA_with_minus_2_frameshift' OR cvterm.name = 'dicistronic_mRNA' OR cvterm.name = 'mRNA_recoded_by_translational_bypass' OR cvterm.name = 'mRNA_recoded_by_codon_redefinition' OR cvterm.name = 'scRNA' OR cvterm.name = 'rRNA' OR cvterm.name = 'tRNA' OR cvterm.name = 'snRNA' OR cvterm.name = 'snoRNA' OR cvterm.name = 'small_regulatory_ncRNA' OR cvterm.name = 'RNase_MRP_RNA' OR cvterm.name = 'RNase_P_RNA' OR cvterm.name = 'telomerase_RNA' OR cvterm.name = 'vault_RNA' OR cvterm.name = 'Y_RNA' OR cvterm.name = 'rasiRNA' OR cvterm.name = 'SRP_RNA' OR cvterm.name = 'guide_RNA' OR cvterm.name = 'antisense_RNA' OR cvterm.name = 'siRNA' OR cvterm.name = 'stRNA' OR cvterm.name = 'class_II_RNA' OR cvterm.name = 'class_I_RNA' OR cvterm.name = 'piRNA' OR cvterm.name = 'lincRNA' OR cvterm.name = 'tasiRNA' OR cvterm.name = 'rRNA_cleavage_RNA' OR cvterm.name = 'small_subunit_rRNA' OR cvterm.name = 'large_subunit_rRNA' OR cvterm.name = 'rRNA_18S' OR cvterm.name = 'rRNA_16S' OR cvterm.name = 'rRNA_5_8S' OR cvterm.name = 'rRNA_5S' OR cvterm.name = 'rRNA_28S' OR cvterm.name = 'rRNA_23S' OR cvterm.name = 'rRNA_25S' OR cvterm.name = 'rRNA_21S' OR cvterm.name = 'alanyl_tRNA' OR cvterm.name = 'asparaginyl_tRNA' OR cvterm.name = 'aspartyl_tRNA' OR cvterm.name = 'cysteinyl_tRNA' OR cvterm.name = 'glutaminyl_tRNA' OR cvterm.name = 'glutamyl_tRNA' OR cvterm.name = 'glycyl_tRNA' OR cvterm.name = 'histidyl_tRNA' OR cvterm.name = 'isoleucyl_tRNA' OR cvterm.name = 'leucyl_tRNA' OR cvterm.name = 'lysyl_tRNA' OR cvterm.name = 'methionyl_tRNA' OR cvterm.name = 'phenylalanyl_tRNA' OR cvterm.name = 'prolyl_tRNA' OR cvterm.name = 'seryl_tRNA' OR cvterm.name = 'threonyl_tRNA' OR cvterm.name = 'tryptophanyl_tRNA' OR cvterm.name = 'tyrosyl_tRNA' OR cvterm.name = 'valyl_tRNA' OR cvterm.name = 'pyrrolysyl_tRNA' OR cvterm.name = 'arginyl_tRNA' OR cvterm.name = 'selenocysteinyl_tRNA' OR cvterm.name = 'U1_snRNA' OR cvterm.name = 'U2_snRNA' OR cvterm.name = 'U4_snRNA' OR cvterm.name = 'U4atac_snRNA' OR cvterm.name = 'U5_snRNA' OR cvterm.name = 'U6_snRNA' OR cvterm.name = 'U6atac_snRNA' OR cvterm.name = 'U11_snRNA' OR cvterm.name = 'U12_snRNA' OR cvterm.name = 'C_D_box_snoRNA' OR cvterm.name = 'H_ACA_box_snoRNA' OR cvterm.name = 'U14_snoRNA' OR cvterm.name = 'U3_snoRNA' OR cvterm.name = 'methylation_guide_snoRNA' OR cvterm.name = 'pseudouridylation_guide_snoRNA' OR cvterm.name = 'miRNA' OR cvterm.name = 'RNA_6S' OR cvterm.name = 'CsrB_RsmB_RNA' OR cvterm.name = 'DsrA_RNA' OR cvterm.name = 'OxyS_RNA' OR cvterm.name = 'RprA_RNA' OR cvterm.name = 'RRE_RNA' OR cvterm.name = 'spot_42_RNA' OR cvterm.name = 'tmRNA' OR cvterm.name = 'GcvB_RNA' OR cvterm.name = 'MicF_RNA' OR cvterm.name = 'ribozyme' OR cvterm.name = 'trans_spliced_mRNA' OR cvterm.name = 'monocistronic_primary_transcript' OR cvterm.name = 'monocistronic_mRNA' OR cvterm.name = 'edited_transcript_by_A_to_I_substitution' OR cvterm.name = 'edited_mRNA' OR cvterm.name = 'transcription_regulatory_region' OR cvterm.name = 'translation_regulatory_region' OR cvterm.name = 'recombination_regulatory_region' OR cvterm.name = 'replication_regulatory_region' OR cvterm.name = 'terminator' OR cvterm.name = 'TF_binding_site' OR cvterm.name = 'polyA_signal_sequence' OR cvterm.name = 'gene_group_regulatory_region' OR cvterm.name = 'transcriptional_cis_regulatory_region' OR cvterm.name = 'splicing_regulatory_region' OR cvterm.name = 'cis_regulatory_frameshift_element' OR cvterm.name = 'intronic_regulatory_region' OR cvterm.name = 'bacterial_terminator' OR cvterm.name = 'eukaryotic_terminator' OR cvterm.name = 'rho_dependent_bacterial_terminator' OR cvterm.name = 'rho_independent_bacterial_terminator' OR cvterm.name = 'terminator_of_type_2_RNApol_III_promoter' OR cvterm.name = 'operator' OR cvterm.name = 'bacterial_RNApol_promoter' OR cvterm.name = 'bacterial_terminator' OR cvterm.name = 'bacterial_RNApol_promoter_sigma_70' OR cvterm.name = 'bacterial_RNApol_promoter_sigma54' OR cvterm.name = 'rho_dependent_bacterial_terminator' OR cvterm.name = 'rho_independent_bacterial_terminator' OR cvterm.name = 'promoter' OR cvterm.name = 'insulator' OR cvterm.name = 'CRM' OR cvterm.name = 'promoter_targeting_sequence' OR cvterm.name = 'ISRE' OR cvterm.name = 'bidirectional_promoter' OR cvterm.name = 'RNA_polymerase_promoter' OR cvterm.name = 'RNApol_I_promoter' OR cvterm.name = 'RNApol_II_promoter' OR cvterm.name = 'RNApol_III_promoter' OR cvterm.name = 'bacterial_RNApol_promoter' OR cvterm.name = 'Phage_RNA_Polymerase_Promoter' OR cvterm.name = 'RNApol_II_core_promoter' OR cvterm.name = 'RNApol_III_promoter_type_1' OR cvterm.name = 'RNApol_III_promoter_type_2' OR cvterm.name = 'RNApol_III_promoter_type_3' OR cvterm.name = 'bacterial_RNApol_promoter_sigma_70' OR cvterm.name = 'bacterial_RNApol_promoter_sigma54' OR cvterm.name = 'SP6_RNA_Polymerase_Promoter' OR cvterm.name = 'T3_RNA_Polymerase_Promoter' OR cvterm.name = 'T7_RNA_Polymerase_Promoter' OR cvterm.name = 'locus_control_region' OR cvterm.name = 'enhancer' OR cvterm.name = 'silencer' OR cvterm.name = 'enhancer_bound_by_factor' OR cvterm.name = 'shadow_enhancer' OR cvterm.name = 'splice_enhancer' OR cvterm.name = 'intronic_splice_enhancer' OR cvterm.name = 'exonic_splice_enhancer' OR cvterm.name = 'attenuator' OR cvterm.name = 'exon' OR cvterm.name = 'edited_transcript_feature' OR cvterm.name = 'mature_transcript_region' OR cvterm.name = 'primary_transcript_region' OR cvterm.name = 'exon_region' OR cvterm.name = 'anchor_binding_site' OR cvterm.name = 'coding_exon' OR cvterm.name = 'noncoding_exon' OR cvterm.name = 'interior_exon' OR cvterm.name = 'exon_of_single_exon_gene' OR cvterm.name = 'interior_coding_exon' OR cvterm.name = 'five_prime_coding_exon' OR cvterm.name = 'three_prime_coding_exon' OR cvterm.name = 'three_prime_noncoding_exon' OR cvterm.name = 'five_prime_noncoding_exon' OR cvterm.name = 'pre_edited_region' OR cvterm.name = 'editing_block' OR cvterm.name = 'editing_domain' OR cvterm.name = 'unedited_region' OR cvterm.name = 'mRNA_region' OR cvterm.name = 'tmRNA_region' OR cvterm.name = 'guide_RNA_region' OR cvterm.name = 'tRNA_region' OR cvterm.name = 'riboswitch' OR cvterm.name = 'ribosome_entry_site' OR cvterm.name = 'UTR' OR cvterm.name = 'CDS' OR cvterm.name = 'five_prime_open_reading_frame' OR cvterm.name = 'UTR_region' OR cvterm.name = 'CDS_region' OR cvterm.name = 'translational_frameshift' OR cvterm.name = 'recoding_stimulatory_region' OR cvterm.name = 'internal_ribosome_entry_site' OR cvterm.name = 'Shine_Dalgarno_sequence' OR cvterm.name = 'kozak_sequence' OR cvterm.name = 'internal_Shine_Dalgarno_sequence' OR cvterm.name = 'five_prime_UTR' OR cvterm.name = 'three_prime_UTR' OR cvterm.name = 'internal_UTR' OR cvterm.name = 'untranslated_region_polycistronic_mRNA' OR cvterm.name = 'edited_CDS' OR cvterm.name = 'CDS_fragment' OR cvterm.name = 'CDS_independently_known' OR cvterm.name = 'CDS_predicted' OR cvterm.name = 'orphan_CDS' OR cvterm.name = 'CDS_supported_by_sequence_similarity_data' OR cvterm.name = 'CDS_supported_by_domain_match_data' OR cvterm.name = 'CDS_supported_by_EST_or_cDNA_data' OR cvterm.name = 'upstream_AUG_codon' OR cvterm.name = 'AU_rich_element' OR cvterm.name = 'Bruno_response_element' OR cvterm.name = 'iron_responsive_element' OR cvterm.name = 'coding_start' OR cvterm.name = 'coding_end' OR cvterm.name = 'codon' OR cvterm.name = 'recoded_codon' OR cvterm.name = 'start_codon' OR cvterm.name = 'stop_codon' OR cvterm.name = 'stop_codon_read_through' OR cvterm.name = 'stop_codon_redefined_as_pyrrolysine' OR cvterm.name = 'stop_codon_redefined_as_selenocysteine' OR cvterm.name = 'non_canonical_start_codon' OR cvterm.name = 'four_bp_start_codon' OR cvterm.name = 'CTG_start_codon' OR cvterm.name = 'plus_1_translational_frameshift' OR cvterm.name = 'plus_2_translational_frameshift' OR cvterm.name = 'internal_Shine_Dalgarno_sequence' OR cvterm.name = 'SECIS_element' OR cvterm.name = 'three_prime_recoding_site' OR cvterm.name = 'five_prime_recoding_site' OR cvterm.name = 'stop_codon_signal' OR cvterm.name = 'three_prime_stem_loop_structure' OR cvterm.name = 'flanking_three_prime_quadruplet_recoding_signal' OR cvterm.name = 'three_prime_repeat_recoding_signal' OR cvterm.name = 'distant_three_prime_recoding_signal' OR cvterm.name = 'UAG_stop_codon_signal' OR cvterm.name = 'UAA_stop_codon_signal' OR cvterm.name = 'UGA_stop_codon_signal' OR cvterm.name = 'tmRNA_coding_piece' OR cvterm.name = 'tmRNA_acceptor_piece' OR cvterm.name = 'anchor_region' OR cvterm.name = 'template_region' OR cvterm.name = 'anticodon_loop' OR cvterm.name = 'anticodon' OR cvterm.name = 'CCA_tail' OR cvterm.name = 'DHU_loop' OR cvterm.name = 'T_loop' OR cvterm.name = 'splice_site' OR cvterm.name = 'intron' OR cvterm.name = 'clip' OR cvterm.name = 'TSS' OR cvterm.name = 'transcription_end_site' OR cvterm.name = 'spliced_leader_RNA' OR cvterm.name = 'rRNA_primary_transcript_region' OR cvterm.name = 'spliceosomal_intron_region' OR cvterm.name = 'intron_domain' OR cvterm.name = 'miRNA_primary_transcript_region' OR cvterm.name = 'outron' OR cvterm.name = 'cis_splice_site' OR cvterm.name = 'trans_splice_site' OR cvterm.name = 'cryptic_splice_site' OR cvterm.name = 'five_prime_cis_splice_site' OR cvterm.name = 'three_prime_cis_splice_site' OR cvterm.name = 'recursive_splice_site' OR cvterm.name = 'canonical_five_prime_splice_site' OR cvterm.name = 'non_canonical_five_prime_splice_site' OR cvterm.name = 'canonical_three_prime_splice_site' OR cvterm.name = 'non_canonical_three_prime_splice_site' OR cvterm.name = 'trans_splice_acceptor_site' OR cvterm.name = 'trans_splice_donor_site' OR cvterm.name = 'SL1_acceptor_site' OR cvterm.name = 'SL2_acceptor_site' OR cvterm.name = 'SL3_acceptor_site' OR cvterm.name = 'SL4_acceptor_site' OR cvterm.name = 'SL5_acceptor_site' OR cvterm.name = 'SL6_acceptor_site' OR cvterm.name = 'SL7_acceptor_site' OR cvterm.name = 'SL8_acceptor_site' OR cvterm.name = 'SL9_acceptor_site' OR cvterm.name = 'SL10_accceptor_site' OR cvterm.name = 'SL11_acceptor_site' OR cvterm.name = 'SL12_acceptor_site' OR cvterm.name = 'five_prime_intron' OR cvterm.name = 'interior_intron' OR cvterm.name = 'three_prime_intron' OR cvterm.name = 'twintron' OR cvterm.name = 'UTR_intron' OR cvterm.name = 'autocatalytically_spliced_intron' OR cvterm.name = 'spliceosomal_intron' OR cvterm.name = 'mobile_intron' OR cvterm.name = 'endonuclease_spliced_intron' OR cvterm.name = 'five_prime_UTR_intron' OR cvterm.name = 'three_prime_UTR_intron' OR cvterm.name = 'group_I_intron' OR cvterm.name = 'group_II_intron' OR cvterm.name = 'group_III_intron' OR cvterm.name = 'group_IIA_intron' OR cvterm.name = 'group_IIB_intron' OR cvterm.name = 'U2_intron' OR cvterm.name = 'U12_intron' OR cvterm.name = 'archaeal_intron' OR cvterm.name = 'tRNA_intron' OR cvterm.name = 'five_prime_clip' OR cvterm.name = 'three_prime_clip' OR cvterm.name = 'major_TSS' OR cvterm.name = 'minor_TSS' OR cvterm.name = 'transcribed_spacer_region' OR cvterm.name = 'internal_transcribed_spacer_region' OR cvterm.name = 'external_transcribed_spacer_region' OR cvterm.name = 'intronic_splice_enhancer' OR cvterm.name = 'branch_site' OR cvterm.name = 'polypyrimidine_tract' OR cvterm.name = 'internal_guide_sequence' OR cvterm.name = 'mirtron' OR cvterm.name = 'pre_miRNA' OR cvterm.name = 'miRNA_stem' OR cvterm.name = 'miRNA_loop' OR cvterm.name = 'miRNA_antiguide' OR cvterm.name = 'noncoding_region_of_exon' OR cvterm.name = 'coding_region_of_exon' OR cvterm.name = 'three_prime_coding_exon_noncoding_region' OR cvterm.name = 'five_prime_coding_exon_noncoding_region' OR cvterm.name = 'five_prime_coding_exon_coding_region' OR cvterm.name = 'three_prime_coding_exon_coding_region' OR cvterm.name = 'mature_protein_region' OR cvterm.name = 'immature_peptide_region' OR cvterm.name = 'compositionally_biased_region_of_peptide' OR cvterm.name = 'polypeptide_structural_region' OR cvterm.name = 'polypeptide_variation_site' OR cvterm.name = 'peptide_localization_signal' OR cvterm.name = 'cleaved_peptide_region' OR cvterm.name = 'hydrophobic_region_of_peptide' OR cvterm.name = 'polypeptide_conserved_region' OR cvterm.name = 'active_peptide' OR cvterm.name = 'polypeptide_domain' OR cvterm.name = 'membrane_structure' OR cvterm.name = 'extramembrane_polypeptide_region' OR cvterm.name = 'intramembrane_polypeptide_region' OR cvterm.name = 'polypeptide_secondary_structure' OR cvterm.name = 'polypeptide_structural_motif' OR cvterm.name = 'intrinsically_unstructured_polypeptide_region' OR cvterm.name = 'cytoplasmic_polypeptide_region' OR cvterm.name = 'non_cytoplasmic_polypeptide_region' OR cvterm.name = 'membrane_peptide_loop' OR cvterm.name = 'transmembrane_polypeptide_region' OR cvterm.name = 'asx_motif' OR cvterm.name = 'beta_bulge' OR cvterm.name = 'beta_bulge_loop' OR cvterm.name = 'beta_strand' OR cvterm.name = 'peptide_helix' OR cvterm.name = 'polypeptide_nest_motif' OR cvterm.name = 'schellmann_loop' OR cvterm.name = 'serine_threonine_motif' OR cvterm.name = 'serine_threonine_staple_motif' OR cvterm.name = 'polypeptide_turn_motif' OR cvterm.name = 'catmat_left_handed_three' OR cvterm.name = 'catmat_left_handed_four' OR cvterm.name = 'catmat_right_handed_three' OR cvterm.name = 'catmat_right_handed_four' OR cvterm.name = 'alpha_beta_motif' OR cvterm.name = 'peptide_coil' OR cvterm.name = 'beta_bulge_loop_five' OR cvterm.name = 'beta_bulge_loop_six' OR cvterm.name = 'antiparallel_beta_strand' OR cvterm.name = 'parallel_beta_strand' OR cvterm.name = 'left_handed_peptide_helix' OR cvterm.name = 'right_handed_peptide_helix' OR cvterm.name = 'alpha_helix' OR cvterm.name = 'pi_helix' OR cvterm.name = 'three_ten_helix' OR cvterm.name = 'polypeptide_nest_left_right_motif' OR cvterm.name = 'polypeptide_nest_right_left_motif' OR cvterm.name = 'schellmann_loop_seven' OR cvterm.name = 'schellmann_loop_six' OR cvterm.name = 'asx_turn' OR cvterm.name = 'beta_turn' OR cvterm.name = 'gamma_turn' OR cvterm.name = 'serine_threonine_turn' OR cvterm.name = 'asx_turn_left_handed_type_one' OR cvterm.name = 'asx_turn_left_handed_type_two' OR cvterm.name = 'asx_turn_right_handed_type_two' OR cvterm.name = 'asx_turn_right_handed_type_one' OR cvterm.name = 'beta_turn_left_handed_type_one' OR cvterm.name = 'beta_turn_left_handed_type_two' OR cvterm.name = 'beta_turn_right_handed_type_one' OR cvterm.name = 'beta_turn_right_handed_type_two' OR cvterm.name = 'beta_turn_type_six' OR cvterm.name = 'beta_turn_type_eight' OR cvterm.name = 'beta_turn_type_six_a' OR cvterm.name = 'beta_turn_type_six_b' OR cvterm.name = 'beta_turn_type_six_a_one' OR cvterm.name = 'beta_turn_type_six_a_two' OR cvterm.name = 'gamma_turn_classic' OR cvterm.name = 'gamma_turn_inverse' OR cvterm.name = 'st_turn_left_handed_type_one' OR cvterm.name = 'st_turn_left_handed_type_two' OR cvterm.name = 'st_turn_right_handed_type_one' OR cvterm.name = 'st_turn_right_handed_type_two' OR cvterm.name = 'coiled_coil' OR cvterm.name = 'helix_turn_helix' OR cvterm.name = 'natural_variant_site' OR cvterm.name = 'mutated_variant_site' OR cvterm.name = 'alternate_sequence_site' OR cvterm.name = 'signal_peptide' OR cvterm.name = 'transit_peptide' OR cvterm.name = 'nuclear_localization_signal' OR cvterm.name = 'endosomal_localization_signal' OR cvterm.name = 'lysosomal_localization_signal' OR cvterm.name = 'nuclear_export_signal' OR cvterm.name = 'nuclear_rim_localization_signal' OR cvterm.name = 'cleaved_initiator_methionine' OR cvterm.name = 'intein' OR cvterm.name = 'propeptide_cleavage_site' OR cvterm.name = 'propeptide' OR cvterm.name = 'cleaved_for_gpi_anchor_region' OR cvterm.name = 'lipoprotein_signal_peptide' OR cvterm.name = 'n_terminal_region' OR cvterm.name = 'c_terminal_region' OR cvterm.name = 'central_hydrophobic_region_of_signal_peptide' OR cvterm.name = 'polypeptide_domain' OR cvterm.name = 'polypeptide_motif' OR cvterm.name = 'polypeptide_repeat' OR cvterm.name = 'biochemical_region_of_peptide' OR cvterm.name = 'polypeptide_conserved_motif' OR cvterm.name = 'post_translationally_modified_region' OR cvterm.name = 'conformational_switch' OR cvterm.name = 'molecular_contact_region' OR cvterm.name = 'polypeptide_binding_motif' OR cvterm.name = 'polypeptide_catalytic_motif' OR cvterm.name = 'histone_modification' OR cvterm.name = 'histone_methylation_site' OR cvterm.name = 'histone_acetylation_site' OR cvterm.name = 'histone_ubiqitination_site' OR cvterm.name = 'histone_acylation_region' OR cvterm.name = 'H4K20_monomethylation_site' OR cvterm.name = 'H2BK5_monomethylation_site' OR cvterm.name = 'H3K27_methylation_site' OR cvterm.name = 'H3K36_methylation_site' OR cvterm.name = 'H3K4_methylation_site' OR cvterm.name = 'H3K79_methylation_site' OR cvterm.name = 'H3K9_methylation_site' OR cvterm.name = 'H3K27_monomethylation_site' OR cvterm.name = 'H3K27_trimethylation_site' OR cvterm.name = 'H3K27_dimethylation_site' OR cvterm.name = 'H3K36_monomethylation_site' OR cvterm.name = 'H3K36_dimethylation_site' OR cvterm.name = 'H3K36_trimethylation_site' OR cvterm.name = 'H3K4_monomethylation_site' OR cvterm.name = 'H3K4_trimethylation' OR cvterm.name = 'H3K4_dimethylation_site' OR cvterm.name = 'H3K79_monomethylation_site' OR cvterm.name = 'H3K79_dimethylation_site' OR cvterm.name = 'H3K79_trimethylation_site' OR cvterm.name = 'H3K9_trimethylation_site' OR cvterm.name = 'H3K9_monomethylation_site' OR cvterm.name = 'H3K9_dimethylation_site' OR cvterm.name = 'H3K9_acetylation_site' OR cvterm.name = 'H3K14_acetylation_site' OR cvterm.name = 'H3K18_acetylation_site' OR cvterm.name = 'H3K23_acylation site' OR cvterm.name = 'H3K27_acylation_site' OR cvterm.name = 'H4K16_acylation_site' OR cvterm.name = 'H4K5_acylation_site' OR cvterm.name = 'H4K8_acylation site' OR cvterm.name = 'H2B_ubiquitination_site' OR cvterm.name = 'H4K_acylation_region' OR cvterm.name = 'polypeptide_metal_contact' OR cvterm.name = 'protein_protein_contact' OR cvterm.name = 'polypeptide_ligand_contact' OR cvterm.name = 'polypeptide_DNA_contact' OR cvterm.name = 'polypeptide_calcium_ion_contact_site' OR cvterm.name = 'polypeptide_cobalt_ion_contact_site' OR cvterm.name = 'polypeptide_copper_ion_contact_site' OR cvterm.name = 'polypeptide_iron_ion_contact_site' OR cvterm.name = 'polypeptide_magnesium_ion_contact_site' OR cvterm.name = 'polypeptide_manganese_ion_contact_site' OR cvterm.name = 'polypeptide_molybdenum_ion_contact_site' OR cvterm.name = 'polypeptide_nickel_ion_contact_site' OR cvterm.name = 'polypeptide_tungsten_ion_contact_site' OR cvterm.name = 'polypeptide_zinc_ion_contact_site' OR cvterm.name = 'non_transcribed_region' OR cvterm.name = 'gene_fragment' OR cvterm.name = 'TSS_region' OR cvterm.name = 'gene_segment' OR cvterm.name = 'pseudogenic_gene_segment' OR cvterm.name = 'mobile_intron' OR cvterm.name = 'extrachromosomal_mobile_genetic_element' OR cvterm.name = 'integrated_mobile_genetic_element' OR cvterm.name = 'natural_transposable_element' OR cvterm.name = 'viral_sequence' OR cvterm.name = 'natural_plasmid' OR cvterm.name = 'phage_sequence' OR cvterm.name = 'ds_RNA_viral_sequence' OR cvterm.name = 'ds_DNA_viral_sequence' OR cvterm.name = 'ss_RNA_viral_sequence' OR cvterm.name = 'negative_sense_ssRNA_viral_sequence' OR cvterm.name = 'positive_sense_ssRNA_viral_sequence' OR cvterm.name = 'ambisense_ssRNA_viral_sequence' OR cvterm.name = 'transposable_element' OR cvterm.name = 'proviral_region' OR cvterm.name = 'integron' OR cvterm.name = 'genomic_island' OR cvterm.name = 'integrated_plasmid' OR cvterm.name = 'cointegrated_plasmid' OR cvterm.name = 'retrotransposon' OR cvterm.name = 'DNA_transposon' OR cvterm.name = 'foreign_transposable_element' OR cvterm.name = 'transgenic_transposable_element' OR cvterm.name = 'natural_transposable_element' OR cvterm.name = 'engineered_transposable_element' OR cvterm.name = 'nested_transposon' OR cvterm.name = 'LTR_retrotransposon' OR cvterm.name = 'non_LTR_retrotransposon' OR cvterm.name = 'LINE_element' OR cvterm.name = 'SINE_element' OR cvterm.name = 'terminal_inverted_repeat_element' OR cvterm.name = 'foldback_element' OR cvterm.name = 'conjugative_transposon' OR cvterm.name = 'helitron' OR cvterm.name = 'p_element' OR cvterm.name = 'MITE' OR cvterm.name = 'insertion_sequence' OR cvterm.name = 'polinton' OR cvterm.name = 'engineered_foreign_transposable_element' OR cvterm.name = 'engineered_foreign_transposable_element' OR cvterm.name = 'prophage' OR cvterm.name = 'pathogenic_island' OR cvterm.name = 'metabolic_island' OR cvterm.name = 'adaptive_island' OR cvterm.name = 'symbiosis_island' OR cvterm.name = 'cryptic_prophage' OR cvterm.name = 'defective_conjugative_transposon' OR cvterm.name = 'plasmid' OR cvterm.name = 'chromosome' OR cvterm.name = 'vector_replicon' OR cvterm.name = 'maxicircle' OR cvterm.name = 'minicircle' OR cvterm.name = 'viral_sequence' OR cvterm.name = 'engineered_plasmid' OR cvterm.name = 'episome' OR cvterm.name = 'natural_plasmid' OR cvterm.name = 'engineered_episome' OR cvterm.name = 'gene_trap_construct' OR cvterm.name = 'promoter_trap_construct' OR cvterm.name = 'enhancer_trap_construct' OR cvterm.name = 'engineered_episome' OR cvterm.name = 'mitochondrial_chromosome' OR cvterm.name = 'chloroplast_chromosome' OR cvterm.name = 'chromoplast_chromosome' OR cvterm.name = 'cyanelle_chromosome' OR cvterm.name = 'leucoplast_chromosome' OR cvterm.name = 'macronuclear_chromosome' OR cvterm.name = 'micronuclear_chromosome' OR cvterm.name = 'nuclear_chromosome' OR cvterm.name = 'nucleomorphic_chromosome' OR cvterm.name = 'DNA_chromosome' OR cvterm.name = 'RNA_chromosome' OR cvterm.name = 'apicoplast_chromosome' OR cvterm.name = 'double_stranded_DNA_chromosome' OR cvterm.name = 'single_stranded_DNA_chromosome' OR cvterm.name = 'linear_double_stranded_DNA_chromosome' OR cvterm.name = 'circular_double_stranded_DNA_chromosome' OR cvterm.name = 'linear_single_stranded_DNA_chromosome' OR cvterm.name = 'circular_single_stranded_DNA_chromosome' OR cvterm.name = 'single_stranded_RNA_chromosome' OR cvterm.name = 'double_stranded_RNA_chromosome' OR cvterm.name = 'linear_single_stranded_RNA_chromosome' OR cvterm.name = 'circular_single_stranded_RNA_chromosome' OR cvterm.name = 'linear_double_stranded_RNA_chromosome' OR cvterm.name = 'circular_double_stranded_RNA_chromosome' OR cvterm.name = 'YAC' OR cvterm.name = 'BAC' OR cvterm.name = 'PAC' OR cvterm.name = 'cosmid' OR cvterm.name = 'phagemid' OR cvterm.name = 'fosmid' OR cvterm.name = 'lambda_vector' OR cvterm.name = 'plasmid_vector' OR cvterm.name = 'targeting_vector' OR cvterm.name = 'phage_sequence' OR cvterm.name = 'ds_RNA_viral_sequence' OR cvterm.name = 'ds_DNA_viral_sequence' OR cvterm.name = 'ss_RNA_viral_sequence' OR cvterm.name = 'negative_sense_ssRNA_viral_sequence' OR cvterm.name = 'positive_sense_ssRNA_viral_sequence' OR cvterm.name = 'ambisense_ssRNA_viral_sequence' OR cvterm.name = 'modified_RNA_base_feature' OR cvterm.name = 'inosine' OR cvterm.name = 'seven_methylguanine' OR cvterm.name = 'ribothymidine' OR cvterm.name = 'modified_adenosine' OR cvterm.name = 'modified_cytidine' OR cvterm.name = 'modified_guanosine' OR cvterm.name = 'modified_uridine' OR cvterm.name = 'modified_inosine' OR cvterm.name = 'methylinosine' OR cvterm.name = 'one_methylinosine' OR cvterm.name = 'one_two_prime_O_dimethylinosine' OR cvterm.name = 'two_prime_O_methylinosine' OR cvterm.name = 'one_methyladenosine' OR cvterm.name = 'two_methyladenosine' OR cvterm.name = 'N6_methyladenosine' OR cvterm.name = 'two_prime_O_methyladenosine' OR cvterm.name = 'two_methylthio_N6_methyladenosine' OR cvterm.name = 'N6_isopentenyladenosine' OR cvterm.name = 'two_methylthio_N6_isopentenyladenosine' OR cvterm.name = 'N6_cis_hydroxyisopentenyl_adenosine' OR cvterm.name = 'two_methylthio_N6_cis_hydroxyisopentenyl_adenosine' OR cvterm.name = 'N6_glycinylcarbamoyladenosine' OR cvterm.name = 'N6_threonylcarbamoyladenosine' OR cvterm.name = 'two_methylthio_N6_threonyl_carbamoyladenosine' OR cvterm.name = 'N6_methyl_N6_threonylcarbamoyladenosine' OR cvterm.name = 'N6_hydroxynorvalylcarbamoyladenosine' OR cvterm.name = 'two_methylthio_N6_hydroxynorvalyl_carbamoyladenosine' OR cvterm.name = 'two_prime_O_ribosyladenosine_phosphate' OR cvterm.name = 'N6_N6_dimethyladenosine' OR cvterm.name = 'N6_2_prime_O_dimethyladenosine' OR cvterm.name = 'N6_N6_2_prime_O_trimethyladenosine' OR cvterm.name = 'one_two_prime_O_dimethyladenosine' OR cvterm.name = 'N6_acetyladenosine' OR cvterm.name = 'three_methylcytidine' OR cvterm.name = 'five_methylcytidine' OR cvterm.name = 'two_prime_O_methylcytidine' OR cvterm.name = 'two_thiocytidine' OR cvterm.name = 'N4_acetylcytidine' OR cvterm.name = 'five_formylcytidine' OR cvterm.name = 'five_two_prime_O_dimethylcytidine' OR cvterm.name = 'N4_acetyl_2_prime_O_methylcytidine' OR cvterm.name = 'lysidine' OR cvterm.name = 'N4_methylcytidine' OR cvterm.name = 'N4_2_prime_O_dimethylcytidine' OR cvterm.name = 'five_hydroxymethylcytidine' OR cvterm.name = 'five_formyl_two_prime_O_methylcytidine' OR cvterm.name = 'N4_N4_2_prime_O_trimethylcytidine' OR cvterm.name = 'seven_deazaguanosine' OR cvterm.name = 'one_methylguanosine' OR cvterm.name = 'N2_methylguanosine' OR cvterm.name = 'seven_methylguanosine' OR cvterm.name = 'two_prime_O_methylguanosine' OR cvterm.name = 'N2_N2_dimethylguanosine' OR cvterm.name = 'N2_2_prime_O_dimethylguanosine' OR cvterm.name = 'N2_N2_2_prime_O_trimethylguanosine' OR cvterm.name = 'two_prime_O_ribosylguanosine_phosphate' OR cvterm.name = 'wybutosine' OR cvterm.name = 'peroxywybutosine' OR cvterm.name = 'hydroxywybutosine' OR cvterm.name = 'undermodified_hydroxywybutosine' OR cvterm.name = 'wyosine' OR cvterm.name = 'methylwyosine' OR cvterm.name = 'N2_7_dimethylguanosine' OR cvterm.name = 'N2_N2_7_trimethylguanosine' OR cvterm.name = 'one_two_prime_O_dimethylguanosine' OR cvterm.name = 'four_demethylwyosine' OR cvterm.name = 'isowyosine' OR cvterm.name = 'N2_7_2prirme_O_trimethylguanosine' OR cvterm.name = 'queuosine' OR cvterm.name = 'epoxyqueuosine' OR cvterm.name = 'galactosyl_queuosine' OR cvterm.name = 'mannosyl_queuosine' OR cvterm.name = 'seven_cyano_seven_deazaguanosine' OR cvterm.name = 'seven_aminomethyl_seven_deazaguanosine' OR cvterm.name = 'archaeosine' OR cvterm.name = 'dihydrouridine' OR cvterm.name = 'pseudouridine' OR cvterm.name = 'five_methyluridine' OR cvterm.name = 'two_prime_O_methyluridine' OR cvterm.name = 'five_two_prime_O_dimethyluridine' OR cvterm.name = 'one_methylpseudouridine' OR cvterm.name = 'two_prime_O_methylpseudouridine' OR cvterm.name = 'two_thiouridine' OR cvterm.name = 'four_thiouridine' OR cvterm.name = 'five_methyl_2_thiouridine' OR cvterm.name = 'two_thio_two_prime_O_methyluridine' OR cvterm.name = 'three_three_amino_three_carboxypropyl_uridine' OR cvterm.name = 'five_hydroxyuridine' OR cvterm.name = 'five_methoxyuridine' OR cvterm.name = 'uridine_five_oxyacetic_acid' OR cvterm.name = 'uridine_five_oxyacetic_acid_methyl_ester' OR cvterm.name = 'five_carboxyhydroxymethyl_uridine' OR cvterm.name = 'five_carboxyhydroxymethyl_uridine_methyl_ester' OR cvterm.name = 'five_methoxycarbonylmethyluridine' OR cvterm.name = 'five_methoxycarbonylmethyl_two_prime_O_methyluridine' OR cvterm.name = 'five_methoxycarbonylmethyl_two_thiouridine' OR cvterm.name = 'five_aminomethyl_two_thiouridine' OR cvterm.name = 'five_methylaminomethyluridine' OR cvterm.name = 'five_methylaminomethyl_two_thiouridine' OR cvterm.name = 'five_methylaminomethyl_two_selenouridine' OR cvterm.name = 'five_carbamoylmethyluridine' OR cvterm.name = 'five_carbamoylmethyl_two_prime_O_methyluridine' OR cvterm.name = 'five_carboxymethylaminomethyluridine' OR cvterm.name = 'five_carboxymethylaminomethyl_two_prime_O_methyluridine' OR cvterm.name = 'five_carboxymethylaminomethyl_two_thiouridine' OR cvterm.name = 'three_methyluridine' OR cvterm.name = 'one_methyl_three_three_amino_three_carboxypropyl_pseudouridine' OR cvterm.name = 'five_carboxymethyluridine' OR cvterm.name = 'three_two_prime_O_dimethyluridine' OR cvterm.name = 'five_methyldihydrouridine' OR cvterm.name = 'three_methylpseudouridine' OR cvterm.name = 'five_taurinomethyluridine' OR cvterm.name = 'five_taurinomethyl_two_thiouridine' OR cvterm.name = 'five_isopentenylaminomethyl_uridine' OR cvterm.name = 'five_isopentenylaminomethyl_two_thiouridine' OR cvterm.name = 'five_isopentenylaminomethyl_two_prime_O_methyluridine' OR cvterm.name = 'catalytic_residue' OR cvterm.name = 'modified_amino_acid_feature' OR cvterm.name = 'alanine' OR cvterm.name = 'valine' OR cvterm.name = 'leucine' OR cvterm.name = 'isoleucine' OR cvterm.name = 'proline' OR cvterm.name = 'tryptophan' OR cvterm.name = 'phenylalanine' OR cvterm.name = 'methionine' OR cvterm.name = 'glycine' OR cvterm.name = 'serine' OR cvterm.name = 'threonine' OR cvterm.name = 'tyrosine' OR cvterm.name = 'cysteine' OR cvterm.name = 'glutamine' OR cvterm.name = 'asparagine' OR cvterm.name = 'lysine' OR cvterm.name = 'arginine' OR cvterm.name = 'histidine' OR cvterm.name = 'aspartic_acid' OR cvterm.name = 'glutamic_acid' OR cvterm.name = 'selenocysteine' OR cvterm.name = 'pyrrolysine' OR cvterm.name = 'modified_glycine' OR cvterm.name = 'modified_L_alanine' OR cvterm.name = 'modified_L_asparagine' OR cvterm.name = 'modified_L_aspartic_acid' OR cvterm.name = 'modified_L_cysteine' OR cvterm.name = 'modified_L_glutamic_acid' OR cvterm.name = 'modified_L_threonine' OR cvterm.name = 'modified_L_tryptophan' OR cvterm.name = 'modified_L_glutamine' OR cvterm.name = 'modified_L_methionine' OR cvterm.name = 'modified_L_isoleucine' OR cvterm.name = 'modified_L_phenylalanine' OR cvterm.name = 'modified_L_histidine' OR cvterm.name = 'modified_L_serine' OR cvterm.name = 'modified_L_lysine' OR cvterm.name = 'modified_L_leucine' OR cvterm.name = 'modified_L_selenocysteine' OR cvterm.name = 'modified_L_valine' OR cvterm.name = 'modified_L_proline' OR cvterm.name = 'modified_L_tyrosine' OR cvterm.name = 'modified_L_arginine' OR cvterm.name = 'heritable_phenotypic_marker' OR cvterm.name = 'DArT_marker' OR cvterm.name = 'nucleotide_motif' OR cvterm.name = 'DNA_motif' OR cvterm.name = 'RNA_motif' OR cvterm.name = 'PSE_motif' OR cvterm.name = 'CAAT_signal' OR cvterm.name = 'minus_10_signal' OR cvterm.name = 'minus_35_signal' OR cvterm.name = 'DRE_motif' OR cvterm.name = 'E_box_motif' OR cvterm.name = 'INR1_motif' OR cvterm.name = 'GAGA_motif' OR cvterm.name = 'octamer_motif' OR cvterm.name = 'retinoic_acid_responsive_element' OR cvterm.name = 'promoter_element' OR cvterm.name = 'DCE_SI' OR cvterm.name = 'DCE_SII' OR cvterm.name = 'DCE_SIII' OR cvterm.name = 'minus_12_signal' OR cvterm.name = 'minus_24_signal' OR cvterm.name = 'GC_rich_promoter_region' OR cvterm.name = 'DMv4_motif' OR cvterm.name = 'DMv5_motif' OR cvterm.name = 'DMv3_motif' OR cvterm.name = 'DMv2_motif' OR cvterm.name = 'DPE1_motif' OR cvterm.name = 'DMv1_motif' OR cvterm.name = 'NDM2_motif' OR cvterm.name = 'NDM3_motif' OR cvterm.name = 'core_promoter_element' OR cvterm.name = 'regulatory_promoter_element' OR cvterm.name = 'INR_motif' OR cvterm.name = 'DPE_motif' OR cvterm.name = 'BREu_motif' OR cvterm.name = 'TATA_box' OR cvterm.name = 'A_box' OR cvterm.name = 'B_box' OR cvterm.name = 'C_box' OR cvterm.name = 'MTE' OR cvterm.name = 'BREd_motif' OR cvterm.name = 'DCE' OR cvterm.name = 'intermediate_element' OR cvterm.name = 'RNA_polymerase_II_TATA_box' OR cvterm.name = 'RNA_polymerase_III_TATA_box' OR cvterm.name = 'A_box_type_1' OR cvterm.name = 'A_box_type_2' OR cvterm.name = 'proximal_promoter_element' OR cvterm.name = 'distal_promoter_element' OR cvterm.name = 'RNA_internal_loop' OR cvterm.name = 'A_minor_RNA_motif' OR cvterm.name = 'RNA_junction_loop' OR cvterm.name = 'hammerhead_ribozyme' OR cvterm.name = 'asymmetric_RNA_internal_loop' OR cvterm.name = 'symmetric_RNA_internal_loop' OR cvterm.name = 'K_turn_RNA_motif' OR cvterm.name = 'sarcin_like_RNA_motif' OR cvterm.name = 'RNA_hook_turn' OR cvterm.name = 'blunt_end_restriction_enzyme_cleavage_site' OR cvterm.name = 'sticky_end_restriction_enzyme_cleavage_site' OR cvterm.name = 'modified_base' OR cvterm.name = 'epigenetically_modified_gene' OR cvterm.name = 'histone_modification' OR cvterm.name = 'methylated_base_feature' OR cvterm.name = 'methylated_C' OR cvterm.name = 'methylated_A' OR cvterm.name = 'gene_rearranged_at_DNA_level' OR cvterm.name = 'maternally_imprinted_gene' OR cvterm.name = 'paternally_imprinted_gene' OR cvterm.name = 'allelically_excluded_gene' OR cvterm.name = 'histone_methylation_site' OR cvterm.name = 'histone_acetylation_site' OR cvterm.name = 'histone_ubiqitination_site' OR cvterm.name = 'histone_acylation_region' OR cvterm.name = 'H4K20_monomethylation_site' OR cvterm.name = 'H2BK5_monomethylation_site' OR cvterm.name = 'H3K27_methylation_site' OR cvterm.name = 'H3K36_methylation_site' OR cvterm.name = 'H3K4_methylation_site' OR cvterm.name = 'H3K79_methylation_site' OR cvterm.name = 'H3K9_methylation_site' OR cvterm.name = 'H3K27_monomethylation_site' OR cvterm.name = 'H3K27_trimethylation_site' OR cvterm.name = 'H3K27_dimethylation_site' OR cvterm.name = 'H3K36_monomethylation_site' OR cvterm.name = 'H3K36_dimethylation_site' OR cvterm.name = 'H3K36_trimethylation_site' OR cvterm.name = 'H3K4_monomethylation_site' OR cvterm.name = 'H3K4_trimethylation' OR cvterm.name = 'H3K4_dimethylation_site' OR cvterm.name = 'H3K79_monomethylation_site' OR cvterm.name = 'H3K79_dimethylation_site' OR cvterm.name = 'H3K79_trimethylation_site' OR cvterm.name = 'H3K9_trimethylation_site' OR cvterm.name = 'H3K9_monomethylation_site' OR cvterm.name = 'H3K9_dimethylation_site' OR cvterm.name = 'H3K9_acetylation_site' OR cvterm.name = 'H3K14_acetylation_site' OR cvterm.name = 'H3K18_acetylation_site' OR cvterm.name = 'H3K23_acylation site' OR cvterm.name = 'H3K27_acylation_site' OR cvterm.name = 'H4K16_acylation_site' OR cvterm.name = 'H4K5_acylation_site' OR cvterm.name = 'H4K8_acylation site' OR cvterm.name = 'H2B_ubiquitination_site' OR cvterm.name = 'H4K_acylation_region' OR cvterm.name = 'operon' OR cvterm.name = 'mating_type_region' OR cvterm.name = 'gene_array' OR cvterm.name = 'gene_subarray' OR cvterm.name = 'gene_cassette_array' OR cvterm.name = 'regulon' OR cvterm.name = 'sequence_length_variation' OR cvterm.name = 'MNP' OR cvterm.name = 'SNV' OR cvterm.name = 'complex_substitution' OR cvterm.name = 'simple_sequence_length_variation' OR cvterm.name = 'SNP' OR cvterm.name = 'point_mutation' OR cvterm.name = 'transition' OR cvterm.name = 'transversion' OR cvterm.name = 'pyrimidine_transition' OR cvterm.name = 'purine_transition' OR cvterm.name = 'C_to_T_transition' OR cvterm.name = 'T_to_C_transition' OR cvterm.name = 'C_to_T_transition_at_pCpG_site' OR cvterm.name = 'A_to_G_transition' OR cvterm.name = 'G_to_A_transition' OR cvterm.name = 'pyrimidine_to_purine_transversion' OR cvterm.name = 'purine_to_pyrimidine_transversion' OR cvterm.name = 'C_to_A_transversion' OR cvterm.name = 'C_to_G_transversion' OR cvterm.name = 'T_to_A_transversion' OR cvterm.name = 'T_to_G_transversion' OR cvterm.name = 'A_to_C_transversion' OR cvterm.name = 'A_to_T_transversion' OR cvterm.name = 'G_to_C_transversion' OR cvterm.name = 'G_to_T_transversion' OR cvterm.name = 'flanking_region' OR cvterm.name = 'repeat_component' OR cvterm.name = 'transposable_element_flanking_region' OR cvterm.name = 'five_prime_flanking_region' OR cvterm.name = 'three_prime_flanking_region' OR cvterm.name = 'non_LTR_retrotransposon_polymeric_tract' OR cvterm.name = 'LTR_component' OR cvterm.name = 'repeat_fragment' OR cvterm.name = 'transposon_fragment' OR cvterm.name = 'U5_LTR_region' OR cvterm.name = 'R_LTR_region' OR cvterm.name = 'U3_LTR_region' OR cvterm.name = 'three_prime_LTR_component' OR cvterm.name = 'five_prime_LTR_component' OR cvterm.name = 'U5_five_prime_LTR_region' OR cvterm.name = 'R_five_prime_LTR_region' OR cvterm.name = 'U3_five_prime_LTR_region' OR cvterm.name = 'R_three_prime_LTR_region' OR cvterm.name = 'U3_three_prime_LTR_region' OR cvterm.name = 'U5_three_prime_LTR_region' OR cvterm.name = 'R_five_prime_LTR_region' OR cvterm.name = 'U5_five_prime_LTR_region' OR cvterm.name = 'U3_five_prime_LTR_region' OR cvterm.name = 'region';

--- ************************************************
--- *** relation: sequence_secondary_structure ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A folded sequence.                       ***
--- ************************************************
---

CREATE VIEW sequence_secondary_structure AS
  SELECT
    feature_id AS sequence_secondary_structure_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'G_quartet' OR cvterm.name = 'base_pair' OR cvterm.name = 'RNA_sequence_secondary_structure' OR cvterm.name = 'DNA_sequence_secondary_structure' OR cvterm.name = 'pseudoknot' OR cvterm.name = 'WC_base_pair' OR cvterm.name = 'sugar_edge_base_pair' OR cvterm.name = 'Hoogsteen_base_pair' OR cvterm.name = 'reverse_Hoogsteen_base_pair' OR cvterm.name = 'wobble_base_pair' OR cvterm.name = 'stem_loop' OR cvterm.name = 'tetraloop' OR cvterm.name = 'i_motif' OR cvterm.name = 'recoding_pseudoknot' OR cvterm.name = 'H_pseudoknot' OR cvterm.name = 'sequence_secondary_structure';

--- ************************************************
--- *** relation: g_quartet ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** G-quartets are unusual nucleic acid stru ***
--- *** ctures consisting of a planar arrangemen ***
--- *** t where each guanine is hydrogen bonded  ***
--- *** by hoogsteen pairing to another guanine  ***
--- *** in the quartet.                          ***
--- ************************************************
---

CREATE VIEW g_quartet AS
  SELECT
    feature_id AS g_quartet_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'G_quartet';

--- ************************************************
--- *** relation: interior_coding_exon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW interior_coding_exon AS
  SELECT
    feature_id AS interior_coding_exon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'interior_coding_exon';

--- ************************************************
--- *** relation: satellite_dna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The many tandem repeats (identical or re ***
--- *** lated) of a short basic repeating unit;  ***
--- *** many have a base composition or other pr ***
--- *** operty different from the genome average ***
--- ***  that allows them to be separated from t ***
--- *** he bulk (main band) genomic DNA.         ***
--- ************************************************
---

CREATE VIEW satellite_dna AS
  SELECT
    feature_id AS satellite_dna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'microsatellite' OR cvterm.name = 'minisatellite' OR cvterm.name = 'dinucleotide_repeat_microsatellite_feature' OR cvterm.name = 'trinucleotide_repeat_microsatellite_feature' OR cvterm.name = 'tetranucleotide_repeat_microsatellite_feature' OR cvterm.name = 'satellite_DNA';

--- ************************************************
--- *** relation: pcr_product ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region amplified by a PCR reaction.    ***
--- ************************************************
---

CREATE VIEW pcr_product AS
  SELECT
    feature_id AS pcr_product_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RAPD' OR cvterm.name = 'PCR_product';

--- ************************************************
--- *** relation: read_pair ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** One of a pair of sequencing reads in whi ***
--- *** ch the two members of the pair are relat ***
--- *** ed by originating at either end of a clo ***
--- *** ne insert.                               ***
--- ************************************************
---

CREATE VIEW read_pair AS
  SELECT
    feature_id AS read_pair_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'read_pair';

--- ************************************************
--- *** relation: protein_coding ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW protein_coding AS
  SELECT
    feature_id AS protein_coding_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'intein_containing' OR cvterm.name = 'protein_coding';

--- ************************************************
--- *** relation: non_protein_coding ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW non_protein_coding AS
  SELECT
    feature_id AS non_protein_coding_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'miRNA_encoding' OR cvterm.name = 'rRNA_encoding' OR cvterm.name = 'scRNA_encoding' OR cvterm.name = 'snoRNA_encoding' OR cvterm.name = 'snRNA_encoding' OR cvterm.name = 'SRP_RNA_encoding' OR cvterm.name = 'stRNA_encoding' OR cvterm.name = 'tmRNA_encoding' OR cvterm.name = 'tRNA_encoding' OR cvterm.name = 'gRNA_encoding' OR cvterm.name = 'C_D_box_snoRNA_encoding' OR cvterm.name = 'H_ACA_box_snoRNA_encoding' OR cvterm.name = 'non_protein_coding';

--- ************************************************
--- *** relation: scrna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The primary transcript of any one of sev ***
--- *** eral small cytoplasmic RNA molecules pre ***
--- *** sent in the cytoplasm and sometimes nucl ***
--- *** eus of a eukaryote.                      ***
--- ************************************************
---

CREATE VIEW scrna_primary_transcript AS
  SELECT
    feature_id AS scrna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'scRNA_primary_transcript';

--- ************************************************
--- *** relation: scrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A small non coding RNA sequence, present ***
--- ***  in the cytoplasm.                       ***
--- ************************************************
---

CREATE VIEW scrna AS
  SELECT
    feature_id AS scrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'scRNA';

--- ************************************************
--- *** relation: inr_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence element characteristic of som ***
--- *** e RNA polymerase II promoters required f ***
--- *** or the correct positioning of the polyme ***
--- *** rase for the start of transcription. Ove ***
--- *** rlaps the TSS. The mammalian consensus s ***
--- *** equence is YYAN(T|A)YY; the Drosophila c ***
--- *** onsensus sequence is TCA(G|T)t(T|C). In  ***
--- *** each the A is at position +1 with respec ***
--- *** t to the TSS. Functionally similar to th ***
--- *** e TATA box element.                      ***
--- ************************************************
---

CREATE VIEW inr_motif AS
  SELECT
    feature_id AS inr_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'INR_motif';

--- ************************************************
--- *** relation: dpe_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence element characteristic of som ***
--- *** e RNA polymerase II promoters; Positione ***
--- *** d from +28 to +32 with respect to the TS ***
--- *** S (+1). Experimental results suggest tha ***
--- *** t the DPE acts in conjunction with the I ***
--- *** NR_motif to provide a binding site for T ***
--- *** FIID in the absence of a TATA box to med ***
--- *** iate transcription of TATA-less promoter ***
--- *** s. Consensus sequence (A|G)G(A|T)(C|T)(G ***
--- *** |A|C).                                   ***
--- ************************************************
---

CREATE VIEW dpe_motif AS
  SELECT
    feature_id AS dpe_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DPE_motif';

--- ************************************************
--- *** relation: breu_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence element characteristic of som ***
--- *** e RNA polymerase II promoters, located i ***
--- *** mmediately upstream of some TATA box ele ***
--- *** ments at -37 to -32 with respect to the  ***
--- *** TSS (+1). Consensus sequence is (G|C)(G| ***
--- *** C)(G|A)CGCC. Binds TFIIB.                ***
--- ************************************************
---

CREATE VIEW breu_motif AS
  SELECT
    feature_id AS breu_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'BREu_motif';

--- ************************************************
--- *** relation: pse_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence element characteristic of the ***
--- ***  promoters of snRNA genes transcribed by ***
--- ***  RNA polymerase II or by RNA polymerase  ***
--- *** III. Located between -45 and -60 relativ ***
--- *** e to the TSS. The human PSE_motif consen ***
--- *** sus sequence is TCACCNTNA(C|G)TNAAAAG(T| ***
--- *** G).                                      ***
--- ************************************************
---

CREATE VIEW pse_motif AS
  SELECT
    feature_id AS pse_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'PSE_motif';

--- ************************************************
--- *** relation: linkage_group ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A group of loci that can be grouped in a ***
--- ***  linear order representing the different ***
--- ***  degrees of linkage among the genes conc ***
--- *** erned.                                   ***
--- ************************************************
---

CREATE VIEW linkage_group AS
  SELECT
    feature_id AS linkage_group_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'linkage_group';

--- ************************************************
--- *** relation: rna_internal_loop ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of double stranded RNA where th ***
--- *** e bases do not conform to WC base pairin ***
--- *** g. The loop is closed on both sides by c ***
--- *** anonical base pairing. If the interrupti ***
--- *** on to base pairing occurs on one strand  ***
--- *** only, it is known as a bulge.            ***
--- ************************************************
---

CREATE VIEW rna_internal_loop AS
  SELECT
    feature_id AS rna_internal_loop_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'asymmetric_RNA_internal_loop' OR cvterm.name = 'symmetric_RNA_internal_loop' OR cvterm.name = 'K_turn_RNA_motif' OR cvterm.name = 'sarcin_like_RNA_motif' OR cvterm.name = 'RNA_internal_loop';

--- ************************************************
--- *** relation: asymmetric_rna_internal_loop ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An internal RNA loop where one of the st ***
--- *** rands includes more bases than the corre ***
--- *** sponding region on the other strand.     ***
--- ************************************************
---

CREATE VIEW asymmetric_rna_internal_loop AS
  SELECT
    feature_id AS asymmetric_rna_internal_loop_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'K_turn_RNA_motif' OR cvterm.name = 'sarcin_like_RNA_motif' OR cvterm.name = 'asymmetric_RNA_internal_loop';

--- ************************************************
--- *** relation: a_minor_rna_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region forming a motif, composed of ad ***
--- *** enines, where the minor groove edges are ***
--- ***  inserted into the minor groove of anoth ***
--- *** er helix.                                ***
--- ************************************************
---

CREATE VIEW a_minor_rna_motif AS
  SELECT
    feature_id AS a_minor_rna_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'A_minor_RNA_motif';

--- ************************************************
--- *** relation: k_turn_rna_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The kink turn (K-turn) is an RNA structu ***
--- *** ral motif that creates a sharp (~120 deg ***
--- *** ree) bend between two continuous helices ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW k_turn_rna_motif AS
  SELECT
    feature_id AS k_turn_rna_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'K_turn_RNA_motif';

--- ************************************************
--- *** relation: sarcin_like_rna_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A loop in ribosomal RNA containing the s ***
--- *** ites of attack for ricin and sarcin.     ***
--- ************************************************
---

CREATE VIEW sarcin_like_rna_motif AS
  SELECT
    feature_id AS sarcin_like_rna_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'sarcin_like_RNA_motif';

--- ************************************************
--- *** relation: symmetric_rna_internal_loop ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An internal RNA loop where the extent of ***
--- ***  the loop on both stands is the same siz ***
--- *** e.                                       ***
--- ************************************************
---

CREATE VIEW symmetric_rna_internal_loop AS
  SELECT
    feature_id AS symmetric_rna_internal_loop_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'symmetric_RNA_internal_loop';

--- ************************************************
--- *** relation: rna_junction_loop ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW rna_junction_loop AS
  SELECT
    feature_id AS rna_junction_loop_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RNA_hook_turn' OR cvterm.name = 'RNA_junction_loop';

--- ************************************************
--- *** relation: rna_hook_turn ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW rna_hook_turn AS
  SELECT
    feature_id AS rna_hook_turn_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RNA_hook_turn';

--- ************************************************
--- *** relation: base_pair ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW base_pair AS
  SELECT
    feature_id AS base_pair_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'WC_base_pair' OR cvterm.name = 'sugar_edge_base_pair' OR cvterm.name = 'Hoogsteen_base_pair' OR cvterm.name = 'reverse_Hoogsteen_base_pair' OR cvterm.name = 'wobble_base_pair' OR cvterm.name = 'base_pair';

--- ************************************************
--- *** relation: wc_base_pair ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The canonical base pair, where two bases ***
--- ***  interact via WC edges, with glycosidic  ***
--- *** bonds oriented cis relative to the axis  ***
--- *** of orientation.                          ***
--- ************************************************
---

CREATE VIEW wc_base_pair AS
  SELECT
    feature_id AS wc_base_pair_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'WC_base_pair';

--- ************************************************
--- *** relation: sugar_edge_base_pair ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A type of non-canonical base-pairing.    ***
--- ************************************************
---

CREATE VIEW sugar_edge_base_pair AS
  SELECT
    feature_id AS sugar_edge_base_pair_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'sugar_edge_base_pair';

--- ************************************************
--- *** relation: aptamer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** DNA or RNA molecules that have been sele ***
--- *** cted from random pools based on their ab ***
--- *** ility to bind other molecules.           ***
--- ************************************************
---

CREATE VIEW aptamer AS
  SELECT
    feature_id AS aptamer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DNA_aptamer' OR cvterm.name = 'RNA_aptamer' OR cvterm.name = 'aptamer';

--- ************************************************
--- *** relation: dna_aptamer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** DNA molecules that have been selected fr ***
--- *** om random pools based on their ability t ***
--- *** o bind other molecules.                  ***
--- ************************************************
---

CREATE VIEW dna_aptamer AS
  SELECT
    feature_id AS dna_aptamer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DNA_aptamer';

--- ************************************************
--- *** relation: rna_aptamer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** RNA molecules that have been selected fr ***
--- *** om random pools based on their ability t ***
--- *** o bind other molecules.                  ***
--- ************************************************
---

CREATE VIEW rna_aptamer AS
  SELECT
    feature_id AS rna_aptamer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RNA_aptamer';

--- ************************************************
--- *** relation: morpholino_oligo ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Morpholino oligos are synthesized from f ***
--- *** our different Morpholino subunits, each  ***
--- *** of which contains one of the four geneti ***
--- *** c bases (A, C, G, T) linked to a 6-membe ***
--- *** red morpholine ring. Eighteen to 25 subu ***
--- *** nits of these four subunit types are joi ***
--- *** ned in a specific order by non-ionic pho ***
--- *** sphorodiamidate intersubunit linkages to ***
--- ***  give a Morpholino.                      ***
--- ************************************************
---

CREATE VIEW morpholino_oligo AS
  SELECT
    feature_id AS morpholino_oligo_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'morpholino_oligo';

--- ************************************************
--- *** relation: riboswitch ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A riboswitch is a part of an mRNA that c ***
--- *** an act as a direct sensor of small molec ***
--- *** ules to control their own expression. A  ***
--- *** riboswitch is a cis element in the 5' en ***
--- *** d of an mRNA, that acts as a direct sens ***
--- *** or of metabolites.                       ***
--- ************************************************
---

CREATE VIEW riboswitch AS
  SELECT
    feature_id AS riboswitch_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'riboswitch';

--- ************************************************
--- *** relation: matrix_attachment_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A DNA region that is required for the bi ***
--- *** nding of chromatin to the nuclear matrix ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW matrix_attachment_site AS
  SELECT
    feature_id AS matrix_attachment_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'matrix_attachment_site';

--- ************************************************
--- *** relation: locus_control_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A DNA region that includes DNAse hyperse ***
--- *** nsitive sites located 5' to a gene that  ***
--- *** confers the high-level, position-indepen ***
--- *** dent, and copy number-dependent expressi ***
--- *** on to that gene.                         ***
--- ************************************************
---

CREATE VIEW locus_control_region AS
  SELECT
    feature_id AS locus_control_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'locus_control_region';

--- ************************************************
--- *** relation: match_part ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A part of a match, for example an hsp fr ***
--- *** om blast is a match_part.                ***
--- ************************************************
---

CREATE VIEW match_part AS
  SELECT
    feature_id AS match_part_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'match_part';

--- ************************************************
--- *** relation: genomic_clone ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A clone of a DNA region of a genome.     ***
--- ************************************************
---

CREATE VIEW genomic_clone AS
  SELECT
    feature_id AS genomic_clone_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'genomic_clone';

--- ************************************************
--- *** relation: processed_pseudogene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A pseudogene where by an mRNA was retrot ***
--- *** ransposed. The mRNA sequence is transcri ***
--- *** bed back into the genome, lacking intron ***
--- *** s and promoters, but often including a p ***
--- *** olyA tail.                               ***
--- ************************************************
---

CREATE VIEW processed_pseudogene AS
  SELECT
    feature_id AS processed_pseudogene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'processed_pseudogene';

--- ************************************************
--- *** relation: pseudogene_by_unequal_crossing_over ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A pseudogene caused by unequal crossing  ***
--- *** over at recombination.                   ***
--- ************************************************
---

CREATE VIEW pseudogene_by_unequal_crossing_over AS
  SELECT
    feature_id AS pseudogene_by_unequal_crossing_over_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pseudogene_by_unequal_crossing_over';

--- ************************************************
--- *** relation: probe ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A DNA sequence used experimentally to de ***
--- *** tect the presence or absence of a comple ***
--- *** mentary nucleic acid.                    ***
--- ************************************************
---

CREATE VIEW probe AS
  SELECT
    feature_id AS probe_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'microarray_oligo' OR cvterm.name = 'probe';

--- ************************************************
--- *** relation: aneuploid ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of chromosome variation where the ***
--- ***  chromosome complement is not an exact m ***
--- *** ultiple of the haploid number.           ***
--- ************************************************
---

CREATE VIEW aneuploid AS
  SELECT
    feature_id AS aneuploid_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'hyperploid' OR cvterm.name = 'hypoploid' OR cvterm.name = 'aneuploid';

--- ************************************************
--- *** relation: hyperploid ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of chromosome variation where the ***
--- ***  chromosome complement is not an exact m ***
--- *** ultiple of the haploid number as extra c ***
--- *** hromosomes are present.                  ***
--- ************************************************
---

CREATE VIEW hyperploid AS
  SELECT
    feature_id AS hyperploid_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'hyperploid';

--- ************************************************
--- *** relation: hypoploid ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of chromosome variation where the ***
--- ***  chromosome complement is not an exact m ***
--- *** ultiple of the haploid number as some ch ***
--- *** romosomes are missing.                   ***
--- ************************************************
---

CREATE VIEW hypoploid AS
  SELECT
    feature_id AS hypoploid_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'hypoploid';

--- ************************************************
--- *** relation: operator ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A regulatory element of an operon to whi ***
--- *** ch activators or repressors bind thereby ***
--- ***  effecting translation of genes in that  ***
--- *** operon.                                  ***
--- ************************************************
---

CREATE VIEW operator AS
  SELECT
    feature_id AS operator_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'operator';

--- ************************************************
--- *** relation: nuclease_binding_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A binding site that, of a nucleotide mol ***
--- *** ecule, that interacts selectively and no ***
--- *** n-covalently with polypeptide residues o ***
--- *** f a nuclease.                            ***
--- ************************************************
---

CREATE VIEW nuclease_binding_site AS
  SELECT
    feature_id AS nuclease_binding_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'restriction_enzyme_binding_site' OR cvterm.name = 'nuclease_sensitive_site' OR cvterm.name = 'homing_endonuclease_binding_site' OR cvterm.name = 'nuclease_hypersensitive_site' OR cvterm.name = 'group_1_intron_homing_endonuclease_target_region' OR cvterm.name = 'DNAseI_hypersensitive_site' OR cvterm.name = 'nuclease_binding_site';

--- ************************************************
--- *** relation: compound_chromosome_arm ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW compound_chromosome_arm AS
  SELECT
    feature_id AS compound_chromosome_arm_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'compound_chromosome_arm';

--- ************************************************
--- *** relation: restriction_enzyme_binding_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A binding site that, in the nucleotide m ***
--- *** olecule, interacts selectively and non-c ***
--- *** ovalently with polypeptide residues of a ***
--- ***  restriction enzyme.                     ***
--- ************************************************
---

CREATE VIEW restriction_enzyme_binding_site AS
  SELECT
    feature_id AS restriction_enzyme_binding_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'restriction_enzyme_binding_site';

--- ************************************************
--- *** relation: d_intrachr_transposition ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An intrachromosomal transposition whereb ***
--- *** y a translocation in which one of the fo ***
--- *** ur broken ends loses a segment before re ***
--- *** -joining.                                ***
--- ************************************************
---

CREATE VIEW d_intrachr_transposition AS
  SELECT
    feature_id AS d_intrachr_transposition_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'deficient_intrachromosomal_transposition';

--- ************************************************
--- *** relation: d_interchr_transposition ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An interchromosomal transposition whereb ***
--- *** y a translocation in which one of the fo ***
--- *** ur broken ends loses a segment before re ***
--- *** -joining.                                ***
--- ************************************************
---

CREATE VIEW d_interchr_transposition AS
  SELECT
    feature_id AS d_interchr_transposition_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'deficient_interchromosomal_transposition';

--- ************************************************
--- *** relation: free_chromosome_arm ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosome structure variation whereby ***
--- ***  an arm exists as an individual chromoso ***
--- *** me element.                              ***
--- ************************************************
---

CREATE VIEW free_chromosome_arm AS
  SELECT
    feature_id AS free_chromosome_arm_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'free_chromosome_arm';

--- ************************************************
--- *** relation: gene_to_gene_feature ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW gene_to_gene_feature AS
  SELECT
    feature_id AS gene_to_gene_feature_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'overlapping' OR cvterm.name = 'inside_intron' OR cvterm.name = 'five_prime_three_prime_overlap' OR cvterm.name = 'five_prime_five_prime_overlap' OR cvterm.name = 'three_prime_three_prime_overlap' OR cvterm.name = 'three_prime_five_prime_overlap' OR cvterm.name = 'antisense' OR cvterm.name = 'inside_intron_antiparallel' OR cvterm.name = 'inside_intron_parallel' OR cvterm.name = 'gene_to_gene_feature';

--- ************************************************
--- *** relation: overlapping ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a gene that has  ***
--- *** a sequence that overlaps the sequence of ***
--- ***  another gene.                           ***
--- ************************************************
---

CREATE VIEW overlapping AS
  SELECT
    feature_id AS overlapping_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inside_intron' OR cvterm.name = 'five_prime_three_prime_overlap' OR cvterm.name = 'five_prime_five_prime_overlap' OR cvterm.name = 'three_prime_three_prime_overlap' OR cvterm.name = 'three_prime_five_prime_overlap' OR cvterm.name = 'antisense' OR cvterm.name = 'inside_intron_antiparallel' OR cvterm.name = 'inside_intron_parallel' OR cvterm.name = 'overlapping';

--- ************************************************
--- *** relation: inside_intron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute to describe a gene when it  ***
--- *** is located within the intron of another  ***
--- *** gene.                                    ***
--- ************************************************
---

CREATE VIEW inside_intron AS
  SELECT
    feature_id AS inside_intron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inside_intron_antiparallel' OR cvterm.name = 'inside_intron_parallel' OR cvterm.name = 'inside_intron';

--- ************************************************
--- *** relation: inside_intron_antiparallel ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute to describe a gene when it  ***
--- *** is located within the intron of another  ***
--- *** gene and on the opposite strand.         ***
--- ************************************************
---

CREATE VIEW inside_intron_antiparallel AS
  SELECT
    feature_id AS inside_intron_antiparallel_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inside_intron_antiparallel';

--- ************************************************
--- *** relation: inside_intron_parallel ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute to describe a gene when it  ***
--- *** is located within the intron of another  ***
--- *** gene and on the same strand.             ***
--- ************************************************
---

CREATE VIEW inside_intron_parallel AS
  SELECT
    feature_id AS inside_intron_parallel_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inside_intron_parallel';

--- ************************************************
--- *** relation: five_prime_three_prime_overlap ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute to describe a gene when the ***
--- ***  five prime region overlaps with another ***
--- ***  gene's 3' region.                       ***
--- ************************************************
---

CREATE VIEW five_prime_three_prime_overlap AS
  SELECT
    feature_id AS five_prime_three_prime_overlap_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_three_prime_overlap';

--- ************************************************
--- *** relation: five_prime_five_prime_overlap ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute to describe a gene when the ***
--- ***  five prime region overlaps with another ***
--- ***  gene's five prime region.               ***
--- ************************************************
---

CREATE VIEW five_prime_five_prime_overlap AS
  SELECT
    feature_id AS five_prime_five_prime_overlap_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_five_prime_overlap';

--- ************************************************
--- *** relation: three_prime_three_prime_overlap ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute to describe a gene when the ***
--- ***  3' region overlaps with another gene's  ***
--- *** 3' region.                               ***
--- ************************************************
---

CREATE VIEW three_prime_three_prime_overlap AS
  SELECT
    feature_id AS three_prime_three_prime_overlap_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_three_prime_overlap';

--- ************************************************
--- *** relation: three_prime_five_prime_overlap ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute to describe a gene when the ***
--- ***  3' region overlaps with another gene's  ***
--- *** 5' region.                               ***
--- ************************************************
---

CREATE VIEW three_prime_five_prime_overlap AS
  SELECT
    feature_id AS three_prime_five_prime_overlap_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_five_prime_overlap';

--- ************************************************
--- *** relation: antisense ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region sequence that is complementary  ***
--- *** to a sequence of messenger RNA.          ***
--- ************************************************
---

CREATE VIEW antisense AS
  SELECT
    feature_id AS antisense_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'antisense';

--- ************************************************
--- *** relation: polycistronic_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transcript that is polycistronic.      ***
--- ************************************************
---

CREATE VIEW polycistronic_transcript AS
  SELECT
    feature_id AS polycistronic_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'dicistronic_transcript' OR cvterm.name = 'polycistronic_primary_transcript' OR cvterm.name = 'polycistronic_mRNA' OR cvterm.name = 'dicistronic_mRNA' OR cvterm.name = 'dicistronic_primary_transcript' OR cvterm.name = 'dicistronic_primary_transcript' OR cvterm.name = 'dicistronic_mRNA' OR cvterm.name = 'polycistronic_transcript';

--- ************************************************
--- *** relation: dicistronic_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transcript that is dicistronic.        ***
--- ************************************************
---

CREATE VIEW dicistronic_transcript AS
  SELECT
    feature_id AS dicistronic_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'dicistronic_mRNA' OR cvterm.name = 'dicistronic_primary_transcript' OR cvterm.name = 'dicistronic_transcript';

--- ************************************************
--- *** relation: operon_member ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW operon_member AS
  SELECT
    feature_id AS operon_member_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'operon_member';

--- ************************************************
--- *** relation: gene_array_member ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW gene_array_member AS
  SELECT
    feature_id AS gene_array_member_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'operon_member' OR cvterm.name = 'gene_cassette_member' OR cvterm.name = 'gene_subarray_member' OR cvterm.name = 'member_of_regulon' OR cvterm.name = 'cassette_array_member' OR cvterm.name = 'gene_array_member';

--- ************************************************
--- *** relation: macronuclear_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW macronuclear_sequence AS
  SELECT
    feature_id AS macronuclear_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'macronuclear_sequence';

--- ************************************************
--- *** relation: micronuclear_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW micronuclear_sequence AS
  SELECT
    feature_id AS micronuclear_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'micronuclear_sequence';

--- ************************************************
--- *** relation: nuclear_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene from nuclear sequence.            ***
--- ************************************************
---

CREATE VIEW nuclear_gene AS
  SELECT
    feature_id AS nuclear_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'nuclear_gene';

--- ************************************************
--- *** relation: mt_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene located in mitochondrial sequence ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW mt_gene AS
  SELECT
    feature_id AS mt_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'kinetoplast_gene' OR cvterm.name = 'maxicircle_gene' OR cvterm.name = 'minicircle_gene' OR cvterm.name = 'cryptogene' OR cvterm.name = 'mt_gene';

--- ************************************************
--- *** relation: kinetoplast_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene located in kinetoplast sequence.  ***
--- ************************************************
---

CREATE VIEW kinetoplast_gene AS
  SELECT
    feature_id AS kinetoplast_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'maxicircle_gene' OR cvterm.name = 'minicircle_gene' OR cvterm.name = 'cryptogene' OR cvterm.name = 'kinetoplast_gene';

--- ************************************************
--- *** relation: plastid_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene from plastid sequence.            ***
--- ************************************************
---

CREATE VIEW plastid_gene AS
  SELECT
    feature_id AS plastid_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'apicoplast_gene' OR cvterm.name = 'ct_gene' OR cvterm.name = 'chromoplast_gene' OR cvterm.name = 'cyanelle_gene' OR cvterm.name = 'leucoplast_gene' OR cvterm.name = 'proplastid_gene' OR cvterm.name = 'plastid_gene';

--- ************************************************
--- *** relation: apicoplast_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene from apicoplast sequence.         ***
--- ************************************************
---

CREATE VIEW apicoplast_gene AS
  SELECT
    feature_id AS apicoplast_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'apicoplast_gene';

--- ************************************************
--- *** relation: ct_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene from chloroplast sequence.        ***
--- ************************************************
---

CREATE VIEW ct_gene AS
  SELECT
    feature_id AS ct_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'ct_gene';

--- ************************************************
--- *** relation: chromoplast_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene from chromoplast_sequence.        ***
--- ************************************************
---

CREATE VIEW chromoplast_gene AS
  SELECT
    feature_id AS chromoplast_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'chromoplast_gene';

--- ************************************************
--- *** relation: cyanelle_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene from cyanelle sequence.           ***
--- ************************************************
---

CREATE VIEW cyanelle_gene AS
  SELECT
    feature_id AS cyanelle_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cyanelle_gene';

--- ************************************************
--- *** relation: leucoplast_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A plastid gene from leucoplast sequence. ***
--- ************************************************
---

CREATE VIEW leucoplast_gene AS
  SELECT
    feature_id AS leucoplast_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'leucoplast_gene';

--- ************************************************
--- *** relation: proplastid_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene from proplastid sequence.         ***
--- ************************************************
---

CREATE VIEW proplastid_gene AS
  SELECT
    feature_id AS proplastid_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'proplastid_gene';

--- ************************************************
--- *** relation: nucleomorph_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene from nucleomorph sequence.        ***
--- ************************************************
---

CREATE VIEW nucleomorph_gene AS
  SELECT
    feature_id AS nucleomorph_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'nucleomorph_gene';

--- ************************************************
--- *** relation: plasmid_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene from plasmid sequence.            ***
--- ************************************************
---

CREATE VIEW plasmid_gene AS
  SELECT
    feature_id AS plasmid_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'plasmid_gene';

--- ************************************************
--- *** relation: proviral_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene from proviral sequence.           ***
--- ************************************************
---

CREATE VIEW proviral_gene AS
  SELECT
    feature_id AS proviral_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'endogenous_retroviral_gene' OR cvterm.name = 'proviral_gene';

--- ************************************************
--- *** relation: endogenous_retroviral_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A proviral gene with origin endogenous r ***
--- *** etrovirus.                               ***
--- ************************************************
---

CREATE VIEW endogenous_retroviral_gene AS
  SELECT
    feature_id AS endogenous_retroviral_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'endogenous_retroviral_gene';

--- ************************************************
--- *** relation: transposable_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transposon or insertion sequence. An e ***
--- *** lement that can insert in a variety of D ***
--- *** NA sequences.                            ***
--- ************************************************
---

CREATE VIEW transposable_element AS
  SELECT
    feature_id AS transposable_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'retrotransposon' OR cvterm.name = 'DNA_transposon' OR cvterm.name = 'foreign_transposable_element' OR cvterm.name = 'transgenic_transposable_element' OR cvterm.name = 'natural_transposable_element' OR cvterm.name = 'engineered_transposable_element' OR cvterm.name = 'nested_transposon' OR cvterm.name = 'LTR_retrotransposon' OR cvterm.name = 'non_LTR_retrotransposon' OR cvterm.name = 'LINE_element' OR cvterm.name = 'SINE_element' OR cvterm.name = 'terminal_inverted_repeat_element' OR cvterm.name = 'foldback_element' OR cvterm.name = 'conjugative_transposon' OR cvterm.name = 'helitron' OR cvterm.name = 'p_element' OR cvterm.name = 'MITE' OR cvterm.name = 'insertion_sequence' OR cvterm.name = 'polinton' OR cvterm.name = 'engineered_foreign_transposable_element' OR cvterm.name = 'engineered_foreign_transposable_element' OR cvterm.name = 'transposable_element';

--- ************************************************
--- *** relation: expressed_sequence_match ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A match to an EST or cDNA sequence.      ***
--- ************************************************
---

CREATE VIEW expressed_sequence_match AS
  SELECT
    feature_id AS expressed_sequence_match_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'EST_match' OR cvterm.name = 'cDNA_match' OR cvterm.name = 'UST_match' OR cvterm.name = 'RST_match' OR cvterm.name = 'expressed_sequence_match';

--- ************************************************
--- *** relation: clone_insert_end ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The end of the clone insert.             ***
--- ************************************************
---

CREATE VIEW clone_insert_end AS
  SELECT
    feature_id AS clone_insert_end_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'clone_insert_end';

--- ************************************************
--- *** relation: polypeptide ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence of amino acids linked by pept ***
--- *** ide bonds which may lack appreciable ter ***
--- *** tiary structure and may not be liable to ***
--- ***  irreversible denaturation.              ***
--- ************************************************
---

CREATE VIEW polypeptide AS
  SELECT
    feature_id AS polypeptide_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide';

--- ************************************************
--- *** relation: chromosome_arm ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of the chromosome between the c ***
--- *** entromere and the telomere. Human chromo ***
--- *** somes have two arms, the p arm (short) a ***
--- *** nd the q arm (long) which are separated  ***
--- *** from each other by the centromere.       ***
--- ************************************************
---

CREATE VIEW chromosome_arm AS
  SELECT
    feature_id AS chromosome_arm_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'chromosome_arm';

--- ************************************************
--- *** relation: sequencing_primer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW sequencing_primer AS
  SELECT
    feature_id AS sequencing_primer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'sequencing_primer';

--- ************************************************
--- *** relation: mrna_with_frameshift ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An mRNA with a frameshift.               ***
--- ************************************************
---

CREATE VIEW mrna_with_frameshift AS
  SELECT
    feature_id AS mrna_with_frameshift_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mRNA_with_minus_1_frameshift' OR cvterm.name = 'mRNA_with_plus_1_frameshift' OR cvterm.name = 'mRNA_with_plus_2_frameshift' OR cvterm.name = 'mRNA_with_minus_2_frameshift' OR cvterm.name = 'mRNA_with_frameshift';

--- ************************************************
--- *** relation: sequence_feature ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An extent of biological sequence.        ***
--- ************************************************
---

CREATE VIEW sequence_feature AS
  SELECT
    feature_id AS sequence_feature_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'region' OR cvterm.name = 'junction' OR cvterm.name = 'sequence_alteration' OR cvterm.name = 'biomaterial_region' OR cvterm.name = 'experimental_feature' OR cvterm.name = 'biological_region' OR cvterm.name = 'topologically_defined_region' OR cvterm.name = 'reagent' OR cvterm.name = 'engineered_region' OR cvterm.name = 'PCR_product' OR cvterm.name = 'clone' OR cvterm.name = 'rescue_region' OR cvterm.name = 'oligo' OR cvterm.name = 'clone_insert' OR cvterm.name = 'cloned_region' OR cvterm.name = 'databank_entry' OR cvterm.name = 'RAPD' OR cvterm.name = 'genomic_clone' OR cvterm.name = 'cDNA_clone' OR cvterm.name = 'tiling_path_clone' OR cvterm.name = 'validated_cDNA_clone' OR cvterm.name = 'invalidated_cDNA_clone' OR cvterm.name = 'three_prime_RACE_clone' OR cvterm.name = 'chimeric_cDNA_clone' OR cvterm.name = 'genomically_contaminated_cDNA_clone' OR cvterm.name = 'polyA_primed_cDNA_clone' OR cvterm.name = 'partially_processed_cDNA_clone' OR cvterm.name = 'engineered_rescue_region' OR cvterm.name = 'aptamer' OR cvterm.name = 'probe' OR cvterm.name = 'tag' OR cvterm.name = 'ss_oligo' OR cvterm.name = 'ds_oligo' OR cvterm.name = 'DNAzyme' OR cvterm.name = 'synthetic_oligo' OR cvterm.name = 'DNA_aptamer' OR cvterm.name = 'RNA_aptamer' OR cvterm.name = 'microarray_oligo' OR cvterm.name = 'SAGE_tag' OR cvterm.name = 'STS' OR cvterm.name = 'EST' OR cvterm.name = 'engineered_tag' OR cvterm.name = 'five_prime_EST' OR cvterm.name = 'three_prime_EST' OR cvterm.name = 'UST' OR cvterm.name = 'RST' OR cvterm.name = 'three_prime_UST' OR cvterm.name = 'five_prime_UST' OR cvterm.name = 'three_prime_RST' OR cvterm.name = 'five_prime_RST' OR cvterm.name = 'primer' OR cvterm.name = 'sequencing_primer' OR cvterm.name = 'forward_primer' OR cvterm.name = 'reverse_primer' OR cvterm.name = 'ASPE_primer' OR cvterm.name = 'dCAPS_primer' OR cvterm.name = 'RNAi_reagent' OR cvterm.name = 'DNA_constraint_sequence' OR cvterm.name = 'morpholino_oligo' OR cvterm.name = 'PNA_oligo' OR cvterm.name = 'LNA_oligo' OR cvterm.name = 'TNA_oligo' OR cvterm.name = 'GNA_oligo' OR cvterm.name = 'R_GNA_oligo' OR cvterm.name = 'S_GNA_oligo' OR cvterm.name = 'cloned_cDNA_insert' OR cvterm.name = 'cloned_genomic_insert' OR cvterm.name = 'engineered_insert' OR cvterm.name = 'BAC_cloned_genomic_insert' OR cvterm.name = 'engineered_gene' OR cvterm.name = 'engineered_plasmid' OR cvterm.name = 'engineered_rescue_region' OR cvterm.name = 'engineered_transposable_element' OR cvterm.name = 'engineered_foreign_region' OR cvterm.name = 'engineered_tag' OR cvterm.name = 'engineered_insert' OR cvterm.name = 'targeting_vector' OR cvterm.name = 'engineered_foreign_gene' OR cvterm.name = 'engineered_fusion_gene' OR cvterm.name = 'engineered_foreign_transposable_element_gene' OR cvterm.name = 'engineered_episome' OR cvterm.name = 'gene_trap_construct' OR cvterm.name = 'promoter_trap_construct' OR cvterm.name = 'enhancer_trap_construct' OR cvterm.name = 'engineered_foreign_transposable_element' OR cvterm.name = 'engineered_foreign_gene' OR cvterm.name = 'engineered_foreign_repetitive_element' OR cvterm.name = 'engineered_foreign_transposable_element' OR cvterm.name = 'engineered_foreign_transposable_element_gene' OR cvterm.name = 'match_part' OR cvterm.name = 'assembly_component' OR cvterm.name = 'conserved_region' OR cvterm.name = 'match' OR cvterm.name = 'remark' OR cvterm.name = 'reading_frame' OR cvterm.name = 'consensus_region' OR cvterm.name = 'low_complexity_region' OR cvterm.name = 'assembly' OR cvterm.name = 'transcribed_fragment' OR cvterm.name = 'transcribed_cluster' OR cvterm.name = 'high_identity_region' OR cvterm.name = 'mathematically_defined_repeat' OR cvterm.name = 'experimentally_defined_binding_region' OR cvterm.name = 'contig' OR cvterm.name = 'read' OR cvterm.name = 'restriction_fragment' OR cvterm.name = 'golden_path_fragment' OR cvterm.name = 'tiling_path_fragment' OR cvterm.name = 'gap' OR cvterm.name = 'sonicate_fragment' OR cvterm.name = 'paired_end_fragment' OR cvterm.name = 'read_pair' OR cvterm.name = 'contig_read' OR cvterm.name = 'BAC_end' OR cvterm.name = 'dye_terminator_read' OR cvterm.name = 'pyrosequenced_read' OR cvterm.name = 'ligation_based_read' OR cvterm.name = 'polymerase_synthesis_read' OR cvterm.name = 'PAC_end' OR cvterm.name = 'YAC_end' OR cvterm.name = 'clone_end' OR cvterm.name = 'RFLP_fragment' OR cvterm.name = 'tiling_path_clone' OR cvterm.name = 'coding_conserved_region' OR cvterm.name = 'nc_conserved_region' OR cvterm.name = 'RR_tract' OR cvterm.name = 'homologous_region' OR cvterm.name = 'centromere_DNA_Element_I' OR cvterm.name = 'centromere_DNA_Element_II' OR cvterm.name = 'centromere_DNA_Element_III' OR cvterm.name = 'X_element' OR cvterm.name = 'U_box' OR cvterm.name = 'regional_centromere_central_core' OR cvterm.name = 'syntenic_region' OR cvterm.name = 'paralogous_region' OR cvterm.name = 'orthologous_region' OR cvterm.name = 'nucleotide_match' OR cvterm.name = 'protein_match' OR cvterm.name = 'expressed_sequence_match' OR cvterm.name = 'cross_genome_match' OR cvterm.name = 'translated_nucleotide_match' OR cvterm.name = 'primer_match' OR cvterm.name = 'EST_match' OR cvterm.name = 'cDNA_match' OR cvterm.name = 'UST_match' OR cvterm.name = 'RST_match' OR cvterm.name = 'sequence_difference' OR cvterm.name = 'experimental_result_region' OR cvterm.name = 'polypeptide_sequencing_information' OR cvterm.name = 'possible_base_call_error' OR cvterm.name = 'possible_assembly_error' OR cvterm.name = 'assembly_error_correction' OR cvterm.name = 'base_call_error_correction' OR cvterm.name = 'overlapping_feature_set' OR cvterm.name = 'no_output' OR cvterm.name = 'overlapping_EST_set' OR cvterm.name = 'non_adjacent_residues' OR cvterm.name = 'non_terminal_residue' OR cvterm.name = 'sequence_conflict' OR cvterm.name = 'sequence_uncertainty' OR cvterm.name = 'contig_collection' OR cvterm.name = 'ORF' OR cvterm.name = 'blocked_reading_frame' OR cvterm.name = 'mini_gene' OR cvterm.name = 'rescue_mini_gene' OR cvterm.name = 'consensus_mRNA' OR cvterm.name = 'sequence_assembly' OR cvterm.name = 'fragment_assembly' OR cvterm.name = 'supercontig' OR cvterm.name = 'contig' OR cvterm.name = 'tiling_path' OR cvterm.name = 'virtual_sequence' OR cvterm.name = 'golden_path' OR cvterm.name = 'ultracontig' OR cvterm.name = 'expressed_sequence_assembly' OR cvterm.name = 'fingerprint_map' OR cvterm.name = 'STS_map' OR cvterm.name = 'RH_map' OR cvterm.name = 'unigene_cluster' OR cvterm.name = 'CHiP_seq_region' OR cvterm.name = 'sequence_secondary_structure' OR cvterm.name = 'linkage_group' OR cvterm.name = 'polypeptide' OR cvterm.name = 'deletion' OR cvterm.name = 'origin_of_replication' OR cvterm.name = 'recombination_feature' OR cvterm.name = 'CpG_island' OR cvterm.name = 'pseudogene' OR cvterm.name = 'binding_site' OR cvterm.name = 'pseudogenic_region' OR cvterm.name = 'cap' OR cvterm.name = 'intergenic_region' OR cvterm.name = 'oligo_U_tail' OR cvterm.name = 'polyA_sequence' OR cvterm.name = 'repeat_region' OR cvterm.name = 'insertion' OR cvterm.name = 'gene' OR cvterm.name = 'repeat_unit' OR cvterm.name = 'QTL' OR cvterm.name = 'chromosome_part' OR cvterm.name = 'gene_member_region' OR cvterm.name = 'transcript_region' OR cvterm.name = 'polypeptide_region' OR cvterm.name = 'gene_component_region' OR cvterm.name = 'mobile_genetic_element' OR cvterm.name = 'replicon' OR cvterm.name = 'base' OR cvterm.name = 'amino_acid' OR cvterm.name = 'genetic_marker' OR cvterm.name = 'sequence_motif' OR cvterm.name = 'restriction_enzyme_recognition_site' OR cvterm.name = 'restriction_enzyme_single_strand_overhang' OR cvterm.name = 'epigenetically_modified_region' OR cvterm.name = 'open_chromatin_region' OR cvterm.name = 'gene_group' OR cvterm.name = 'substitution' OR cvterm.name = 'inversion' OR cvterm.name = 'retron' OR cvterm.name = 'G_quartet' OR cvterm.name = 'base_pair' OR cvterm.name = 'RNA_sequence_secondary_structure' OR cvterm.name = 'DNA_sequence_secondary_structure' OR cvterm.name = 'pseudoknot' OR cvterm.name = 'WC_base_pair' OR cvterm.name = 'sugar_edge_base_pair' OR cvterm.name = 'Hoogsteen_base_pair' OR cvterm.name = 'reverse_Hoogsteen_base_pair' OR cvterm.name = 'wobble_base_pair' OR cvterm.name = 'stem_loop' OR cvterm.name = 'tetraloop' OR cvterm.name = 'i_motif' OR cvterm.name = 'recoding_pseudoknot' OR cvterm.name = 'H_pseudoknot' OR cvterm.name = 'D_loop' OR cvterm.name = 'ARS' OR cvterm.name = 'oriT' OR cvterm.name = 'amplification_origin' OR cvterm.name = 'oriV' OR cvterm.name = 'oriC' OR cvterm.name = 'recombination_hotspot' OR cvterm.name = 'haplotype_block' OR cvterm.name = 'sequence_rearrangement_feature' OR cvterm.name = 'iDNA' OR cvterm.name = 'specific_recombination_site' OR cvterm.name = 'chromosome_breakage_sequence' OR cvterm.name = 'internal_eliminated_sequence' OR cvterm.name = 'macronucleus_destined_segment' OR cvterm.name = 'recombination_feature_of_rearranged_gene' OR cvterm.name = 'site_specific_recombination_target_region' OR cvterm.name = 'recombination_signal_sequence' OR cvterm.name = 'vertebrate_immune_system_gene_recombination_feature' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_segment' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_gene_cluster' OR cvterm.name = 'vertebrate_immune_system_gene_recombination_spacer' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_rearranged_segment' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster' OR cvterm.name = 'vertebrate_immune_system_gene_recombination_signal_feature' OR cvterm.name = 'D_gene' OR cvterm.name = 'V_gene' OR cvterm.name = 'J_gene' OR cvterm.name = 'C_gene' OR cvterm.name = 'D_J_C_cluster' OR cvterm.name = 'J_C_cluster' OR cvterm.name = 'J_cluster' OR cvterm.name = 'V_cluster' OR cvterm.name = 'V_J_cluster' OR cvterm.name = 'V_J_C_cluster' OR cvterm.name = 'C_cluster' OR cvterm.name = 'D_cluster' OR cvterm.name = 'D_J_cluster' OR cvterm.name = 'three_prime_D_spacer' OR cvterm.name = 'five_prime_D_spacer' OR cvterm.name = 'J_spacer' OR cvterm.name = 'V_spacer' OR cvterm.name = 'VD_gene' OR cvterm.name = 'DJ_gene' OR cvterm.name = 'VDJ_gene' OR cvterm.name = 'VJ_gene' OR cvterm.name = 'DJ_J_cluster' OR cvterm.name = 'VDJ_J_C_cluster' OR cvterm.name = 'VDJ_J_cluster' OR cvterm.name = 'VJ_C_cluster' OR cvterm.name = 'VJ_J_C_cluster' OR cvterm.name = 'VJ_J_cluster' OR cvterm.name = 'D_DJ_C_cluster' OR cvterm.name = 'D_DJ_cluster' OR cvterm.name = 'D_DJ_J_C_cluster' OR cvterm.name = 'D_DJ_J_cluster' OR cvterm.name = 'V_DJ_cluster' OR cvterm.name = 'V_DJ_J_cluster' OR cvterm.name = 'V_VDJ_C_cluster' OR cvterm.name = 'V_VDJ_cluster' OR cvterm.name = 'V_VDJ_J_cluster' OR cvterm.name = 'V_VJ_C_cluster' OR cvterm.name = 'V_VJ_cluster' OR cvterm.name = 'V_VJ_J_cluster' OR cvterm.name = 'V_D_DJ_C_cluster' OR cvterm.name = 'V_D_DJ_cluster' OR cvterm.name = 'V_D_DJ_J_C_cluster' OR cvterm.name = 'V_D_DJ_J_cluster' OR cvterm.name = 'V_D_J_C_cluster' OR cvterm.name = 'V_D_J_cluster' OR cvterm.name = 'DJ_C_cluster' OR cvterm.name = 'DJ_J_C_cluster' OR cvterm.name = 'VDJ_C_cluster' OR cvterm.name = 'V_DJ_C_cluster' OR cvterm.name = 'V_DJ_J_C_cluster' OR cvterm.name = 'V_VDJ_J_C_cluster' OR cvterm.name = 'V_VJ_J_C_cluster' OR cvterm.name = 'J_gene_recombination_feature' OR cvterm.name = 'D_gene_recombination_feature' OR cvterm.name = 'V_gene_recombination_feature' OR cvterm.name = 'heptamer_of_recombination_feature_of_vertebrate_immune_system_gene' OR cvterm.name = 'nonamer_of_recombination_feature_of_vertebrate_immune_system_gene' OR cvterm.name = 'five_prime_D_recombination_signal_sequence' OR cvterm.name = 'three_prime_D_recombination_signal_sequence' OR cvterm.name = 'three_prime_D_heptamer' OR cvterm.name = 'five_prime_D_heptamer' OR cvterm.name = 'J_heptamer' OR cvterm.name = 'V_heptamer' OR cvterm.name = 'three_prime_D_nonamer' OR cvterm.name = 'five_prime_D_nonamer' OR cvterm.name = 'J_nonamer' OR cvterm.name = 'V_nonamer' OR cvterm.name = 'integration_excision_site' OR cvterm.name = 'resolution_site' OR cvterm.name = 'inversion_site' OR cvterm.name = 'inversion_site_part' OR cvterm.name = 'attI_site' OR cvterm.name = 'attP_site' OR cvterm.name = 'attB_site' OR cvterm.name = 'attL_site' OR cvterm.name = 'attR_site' OR cvterm.name = 'attC_site' OR cvterm.name = 'attCtn_site' OR cvterm.name = 'loxP_site' OR cvterm.name = 'dif_site' OR cvterm.name = 'FRT_site' OR cvterm.name = 'IRLinv_site' OR cvterm.name = 'IRRinv_site' OR cvterm.name = 'processed_pseudogene' OR cvterm.name = 'non_processed_pseudogene' OR cvterm.name = 'pseudogene_by_unequal_crossing_over' OR cvterm.name = 'nuclear_mt_pseudogene' OR cvterm.name = 'cassette_pseudogene' OR cvterm.name = 'duplicated_pseudogene' OR cvterm.name = 'unitary_pseudogene' OR cvterm.name = 'protein_binding_site' OR cvterm.name = 'epitope' OR cvterm.name = 'nucleotide_binding_site' OR cvterm.name = 'metal_binding_site' OR cvterm.name = 'ligand_binding_site' OR cvterm.name = 'protein_protein_contact' OR cvterm.name = 'nucleotide_to_protein_binding_site' OR cvterm.name = 'nuclease_binding_site' OR cvterm.name = 'TF_binding_site' OR cvterm.name = 'histone_binding_site' OR cvterm.name = 'insulator_binding_site' OR cvterm.name = 'enhancer_binding_site' OR cvterm.name = 'restriction_enzyme_binding_site' OR cvterm.name = 'nuclease_sensitive_site' OR cvterm.name = 'homing_endonuclease_binding_site' OR cvterm.name = 'nuclease_hypersensitive_site' OR cvterm.name = 'group_1_intron_homing_endonuclease_target_region' OR cvterm.name = 'DNAseI_hypersensitive_site' OR cvterm.name = 'miRNA_target_site' OR cvterm.name = 'DNA_binding_site' OR cvterm.name = 'primer_binding_site' OR cvterm.name = 'polypeptide_DNA_contact' OR cvterm.name = 'polypeptide_metal_contact' OR cvterm.name = 'polypeptide_calcium_ion_contact_site' OR cvterm.name = 'polypeptide_cobalt_ion_contact_site' OR cvterm.name = 'polypeptide_copper_ion_contact_site' OR cvterm.name = 'polypeptide_iron_ion_contact_site' OR cvterm.name = 'polypeptide_magnesium_ion_contact_site' OR cvterm.name = 'polypeptide_manganese_ion_contact_site' OR cvterm.name = 'polypeptide_molybdenum_ion_contact_site' OR cvterm.name = 'polypeptide_nickel_ion_contact_site' OR cvterm.name = 'polypeptide_tungsten_ion_contact_site' OR cvterm.name = 'polypeptide_zinc_ion_contact_site' OR cvterm.name = 'polypeptide_ligand_contact' OR cvterm.name = 'decayed_exon' OR cvterm.name = 'pseudogenic_exon' OR cvterm.name = 'pseudogenic_transcript' OR cvterm.name = 'pseudogenic_rRNA' OR cvterm.name = 'pseudogenic_tRNA' OR cvterm.name = 'long_terminal_repeat' OR cvterm.name = 'engineered_foreign_repetitive_element' OR cvterm.name = 'inverted_repeat' OR cvterm.name = 'direct_repeat' OR cvterm.name = 'non_LTR_retrotransposon_polymeric_tract' OR cvterm.name = 'dispersed_repeat' OR cvterm.name = 'tandem_repeat' OR cvterm.name = 'X_element_combinatorial_repeat' OR cvterm.name = 'Y_prime_element' OR cvterm.name = 'telomeric_repeat' OR cvterm.name = 'nested_repeat' OR cvterm.name = 'centromeric_repeat' OR cvterm.name = 'five_prime_LTR' OR cvterm.name = 'three_prime_LTR' OR cvterm.name = 'solo_LTR' OR cvterm.name = 'terminal_inverted_repeat' OR cvterm.name = 'five_prime_terminal_inverted_repeat' OR cvterm.name = 'three_prime_terminal_inverted_repeat' OR cvterm.name = 'target_site_duplication' OR cvterm.name = 'CRISPR' OR cvterm.name = 'satellite_DNA' OR cvterm.name = 'microsatellite' OR cvterm.name = 'minisatellite' OR cvterm.name = 'dinucleotide_repeat_microsatellite_feature' OR cvterm.name = 'trinucleotide_repeat_microsatellite_feature' OR cvterm.name = 'tetranucleotide_repeat_microsatellite_feature' OR cvterm.name = 'nested_tandem_repeat' OR cvterm.name = 'regional_centromere_inner_repeat_region' OR cvterm.name = 'regional_centromere_outer_repeat_region' OR cvterm.name = 'transgenic_insertion' OR cvterm.name = 'duplication' OR cvterm.name = 'tandem_duplication' OR cvterm.name = 'direct_tandem_duplication' OR cvterm.name = 'inverted_tandem_duplication' OR cvterm.name = 'nuclear_gene' OR cvterm.name = 'mt_gene' OR cvterm.name = 'plastid_gene' OR cvterm.name = 'nucleomorph_gene' OR cvterm.name = 'plasmid_gene' OR cvterm.name = 'proviral_gene' OR cvterm.name = 'transposable_element_gene' OR cvterm.name = 'silenced_gene' OR cvterm.name = 'engineered_gene' OR cvterm.name = 'foreign_gene' OR cvterm.name = 'fusion_gene' OR cvterm.name = 'recombinationally_rearranged_gene' OR cvterm.name = 'gene_with_trans_spliced_transcript' OR cvterm.name = 'gene_with_polycistronic_transcript' OR cvterm.name = 'rescue_gene' OR cvterm.name = 'post_translationally_regulated_gene' OR cvterm.name = 'negatively_autoregulated_gene' OR cvterm.name = 'positively_autoregulated_gene' OR cvterm.name = 'translationally_regulated_gene' OR cvterm.name = 'epigenetically_modified_gene' OR cvterm.name = 'transgene' OR cvterm.name = 'predicted_gene' OR cvterm.name = 'protein_coding_gene' OR cvterm.name = 'retrogene' OR cvterm.name = 'ncRNA_gene' OR cvterm.name = 'cryptic_gene' OR cvterm.name = 'gene_with_non_canonical_start_codon' OR cvterm.name = 'gene_cassette' OR cvterm.name = 'kinetoplast_gene' OR cvterm.name = 'maxicircle_gene' OR cvterm.name = 'minicircle_gene' OR cvterm.name = 'cryptogene' OR cvterm.name = 'apicoplast_gene' OR cvterm.name = 'ct_gene' OR cvterm.name = 'chromoplast_gene' OR cvterm.name = 'cyanelle_gene' OR cvterm.name = 'leucoplast_gene' OR cvterm.name = 'proplastid_gene' OR cvterm.name = 'endogenous_retroviral_gene' OR cvterm.name = 'engineered_foreign_transposable_element_gene' OR cvterm.name = 'gene_silenced_by_DNA_modification' OR cvterm.name = 'gene_silenced_by_RNA_interference' OR cvterm.name = 'gene_silenced_by_histone_modification' OR cvterm.name = 'gene_silenced_by_DNA_methylation' OR cvterm.name = 'gene_silenced_by_histone_methylation' OR cvterm.name = 'gene_silenced_by_histone_deacetylation' OR cvterm.name = 'engineered_foreign_gene' OR cvterm.name = 'engineered_fusion_gene' OR cvterm.name = 'engineered_foreign_transposable_element_gene' OR cvterm.name = 'engineered_foreign_gene' OR cvterm.name = 'engineered_foreign_transposable_element_gene' OR cvterm.name = 'engineered_fusion_gene' OR cvterm.name = 'recombinationally_inverted_gene' OR cvterm.name = 'recombinationally_rearranged_vertebrate_immune_system_gene' OR cvterm.name = 'gene_with_dicistronic_transcript' OR cvterm.name = 'gene_with_dicistronic_primary_transcript' OR cvterm.name = 'gene_with_dicistronic_mRNA' OR cvterm.name = 'wild_type_rescue_gene' OR cvterm.name = 'gene_rearranged_at_DNA_level' OR cvterm.name = 'maternally_imprinted_gene' OR cvterm.name = 'paternally_imprinted_gene' OR cvterm.name = 'allelically_excluded_gene' OR cvterm.name = 'floxed_gene' OR cvterm.name = 'gene_with_polyadenylated_mRNA' OR cvterm.name = 'gene_with_mRNA_with_frameshift' OR cvterm.name = 'gene_with_edited_transcript' OR cvterm.name = 'gene_with_recoded_mRNA' OR cvterm.name = 'gene_with_stop_codon_read_through' OR cvterm.name = 'gene_with_mRNA_recoded_by_translational_bypass' OR cvterm.name = 'gene_with_transcript_with_translational_frameshift' OR cvterm.name = 'gene_with_stop_codon_redefined_as_pyrrolysine' OR cvterm.name = 'gene_with_stop_codon_redefined_as_selenocysteine' OR cvterm.name = 'gRNA_gene' OR cvterm.name = 'miRNA_gene' OR cvterm.name = 'scRNA_gene' OR cvterm.name = 'snoRNA_gene' OR cvterm.name = 'snRNA_gene' OR cvterm.name = 'SRP_RNA_gene' OR cvterm.name = 'stRNA_gene' OR cvterm.name = 'tmRNA_gene' OR cvterm.name = 'tRNA_gene' OR cvterm.name = 'rRNA_gene' OR cvterm.name = 'piRNA_gene' OR cvterm.name = 'RNase_P_RNA_gene' OR cvterm.name = 'RNase_MRP_RNA_gene' OR cvterm.name = 'lincRNA_gene' OR cvterm.name = 'telomerase_RNA_gene' OR cvterm.name = 'cryptogene' OR cvterm.name = 'gene_with_start_codon_CUG' OR cvterm.name = 'chromosome_arm' OR cvterm.name = 'chromosome_band' OR cvterm.name = 'interband' OR cvterm.name = 'chromosomal_regulatory_element' OR cvterm.name = 'chromosomal_structural_element' OR cvterm.name = 'introgressed_chromosome_region' OR cvterm.name = 'matrix_attachment_site' OR cvterm.name = 'centromere' OR cvterm.name = 'telomere' OR cvterm.name = 'point_centromere' OR cvterm.name = 'regional_centromere' OR cvterm.name = 'transcript' OR cvterm.name = 'regulatory_region' OR cvterm.name = 'polycistronic_transcript' OR cvterm.name = 'transcript_with_translational_frameshift' OR cvterm.name = 'primary_transcript' OR cvterm.name = 'mature_transcript' OR cvterm.name = 'transcript_bound_by_nucleic_acid' OR cvterm.name = 'transcript_bound_by_protein' OR cvterm.name = 'enzymatic_RNA' OR cvterm.name = 'trans_spliced_transcript' OR cvterm.name = 'monocistronic_transcript' OR cvterm.name = 'aberrant_processed_transcript' OR cvterm.name = 'edited_transcript' OR cvterm.name = 'processed_transcript' OR cvterm.name = 'alternatively_spliced_transcript' OR cvterm.name = 'dicistronic_transcript' OR cvterm.name = 'polycistronic_primary_transcript' OR cvterm.name = 'polycistronic_mRNA' OR cvterm.name = 'dicistronic_mRNA' OR cvterm.name = 'dicistronic_primary_transcript' OR cvterm.name = 'dicistronic_primary_transcript' OR cvterm.name = 'dicistronic_mRNA' OR cvterm.name = 'protein_coding_primary_transcript' OR cvterm.name = 'nc_primary_transcript' OR cvterm.name = 'polycistronic_primary_transcript' OR cvterm.name = 'monocistronic_primary_transcript' OR cvterm.name = 'mini_exon_donor_RNA' OR cvterm.name = 'antisense_primary_transcript' OR cvterm.name = 'capped_primary_transcript' OR cvterm.name = 'pre_edited_mRNA' OR cvterm.name = 'scRNA_primary_transcript' OR cvterm.name = 'rRNA_primary_transcript' OR cvterm.name = 'tRNA_primary_transcript' OR cvterm.name = 'snRNA_primary_transcript' OR cvterm.name = 'snoRNA_primary_transcript' OR cvterm.name = 'tmRNA_primary_transcript' OR cvterm.name = 'SRP_RNA_primary_transcript' OR cvterm.name = 'miRNA_primary_transcript' OR cvterm.name = 'tasiRNA_primary_transcript' OR cvterm.name = 'rRNA_small_subunit_primary_transcript' OR cvterm.name = 'rRNA_large_subunit_primary_transcript' OR cvterm.name = 'alanine_tRNA_primary_transcript' OR cvterm.name = 'arginine_tRNA_primary_transcript' OR cvterm.name = 'asparagine_tRNA_primary_transcript' OR cvterm.name = 'aspartic_acid_tRNA_primary_transcript' OR cvterm.name = 'cysteine_tRNA_primary_transcript' OR cvterm.name = 'glutamic_acid_tRNA_primary_transcript' OR cvterm.name = 'glutamine_tRNA_primary_transcript' OR cvterm.name = 'glycine_tRNA_primary_transcript' OR cvterm.name = 'histidine_tRNA_primary_transcript' OR cvterm.name = 'isoleucine_tRNA_primary_transcript' OR cvterm.name = 'leucine_tRNA_primary_transcript' OR cvterm.name = 'lysine_tRNA_primary_transcript' OR cvterm.name = 'methionine_tRNA_primary_transcript' OR cvterm.name = 'phenylalanine_tRNA_primary_transcript' OR cvterm.name = 'proline_tRNA_primary_transcript' OR cvterm.name = 'serine_tRNA_primary_transcript' OR cvterm.name = 'threonine_tRNA_primary_transcript' OR cvterm.name = 'tryptophan_tRNA_primary_transcript' OR cvterm.name = 'tyrosine_tRNA_primary_transcript' OR cvterm.name = 'valine_tRNA_primary_transcript' OR cvterm.name = 'pyrrolysine_tRNA_primary_transcript' OR cvterm.name = 'selenocysteine_tRNA_primary_transcript' OR cvterm.name = 'methylation_guide_snoRNA_primary_transcript' OR cvterm.name = 'rRNA_cleavage_snoRNA_primary_transcript' OR cvterm.name = 'C_D_box_snoRNA_primary_transcript' OR cvterm.name = 'H_ACA_box_snoRNA_primary_transcript' OR cvterm.name = 'U14_snoRNA_primary_transcript' OR cvterm.name = 'stRNA_primary_transcript' OR cvterm.name = 'dicistronic_primary_transcript' OR cvterm.name = 'mRNA' OR cvterm.name = 'ncRNA' OR cvterm.name = 'mRNA_with_frameshift' OR cvterm.name = 'monocistronic_mRNA' OR cvterm.name = 'polycistronic_mRNA' OR cvterm.name = 'exemplar_mRNA' OR cvterm.name = 'capped_mRNA' OR cvterm.name = 'polyadenylated_mRNA' OR cvterm.name = 'trans_spliced_mRNA' OR cvterm.name = 'edited_mRNA' OR cvterm.name = 'consensus_mRNA' OR cvterm.name = 'recoded_mRNA' OR cvterm.name = 'mRNA_with_minus_1_frameshift' OR cvterm.name = 'mRNA_with_plus_1_frameshift' OR cvterm.name = 'mRNA_with_plus_2_frameshift' OR cvterm.name = 'mRNA_with_minus_2_frameshift' OR cvterm.name = 'dicistronic_mRNA' OR cvterm.name = 'mRNA_recoded_by_translational_bypass' OR cvterm.name = 'mRNA_recoded_by_codon_redefinition' OR cvterm.name = 'scRNA' OR cvterm.name = 'rRNA' OR cvterm.name = 'tRNA' OR cvterm.name = 'snRNA' OR cvterm.name = 'snoRNA' OR cvterm.name = 'small_regulatory_ncRNA' OR cvterm.name = 'RNase_MRP_RNA' OR cvterm.name = 'RNase_P_RNA' OR cvterm.name = 'telomerase_RNA' OR cvterm.name = 'vault_RNA' OR cvterm.name = 'Y_RNA' OR cvterm.name = 'rasiRNA' OR cvterm.name = 'SRP_RNA' OR cvterm.name = 'guide_RNA' OR cvterm.name = 'antisense_RNA' OR cvterm.name = 'siRNA' OR cvterm.name = 'stRNA' OR cvterm.name = 'class_II_RNA' OR cvterm.name = 'class_I_RNA' OR cvterm.name = 'piRNA' OR cvterm.name = 'lincRNA' OR cvterm.name = 'tasiRNA' OR cvterm.name = 'rRNA_cleavage_RNA' OR cvterm.name = 'small_subunit_rRNA' OR cvterm.name = 'large_subunit_rRNA' OR cvterm.name = 'rRNA_18S' OR cvterm.name = 'rRNA_16S' OR cvterm.name = 'rRNA_5_8S' OR cvterm.name = 'rRNA_5S' OR cvterm.name = 'rRNA_28S' OR cvterm.name = 'rRNA_23S' OR cvterm.name = 'rRNA_25S' OR cvterm.name = 'rRNA_21S' OR cvterm.name = 'alanyl_tRNA' OR cvterm.name = 'asparaginyl_tRNA' OR cvterm.name = 'aspartyl_tRNA' OR cvterm.name = 'cysteinyl_tRNA' OR cvterm.name = 'glutaminyl_tRNA' OR cvterm.name = 'glutamyl_tRNA' OR cvterm.name = 'glycyl_tRNA' OR cvterm.name = 'histidyl_tRNA' OR cvterm.name = 'isoleucyl_tRNA' OR cvterm.name = 'leucyl_tRNA' OR cvterm.name = 'lysyl_tRNA' OR cvterm.name = 'methionyl_tRNA' OR cvterm.name = 'phenylalanyl_tRNA' OR cvterm.name = 'prolyl_tRNA' OR cvterm.name = 'seryl_tRNA' OR cvterm.name = 'threonyl_tRNA' OR cvterm.name = 'tryptophanyl_tRNA' OR cvterm.name = 'tyrosyl_tRNA' OR cvterm.name = 'valyl_tRNA' OR cvterm.name = 'pyrrolysyl_tRNA' OR cvterm.name = 'arginyl_tRNA' OR cvterm.name = 'selenocysteinyl_tRNA' OR cvterm.name = 'U1_snRNA' OR cvterm.name = 'U2_snRNA' OR cvterm.name = 'U4_snRNA' OR cvterm.name = 'U4atac_snRNA' OR cvterm.name = 'U5_snRNA' OR cvterm.name = 'U6_snRNA' OR cvterm.name = 'U6atac_snRNA' OR cvterm.name = 'U11_snRNA' OR cvterm.name = 'U12_snRNA' OR cvterm.name = 'C_D_box_snoRNA' OR cvterm.name = 'H_ACA_box_snoRNA' OR cvterm.name = 'U14_snoRNA' OR cvterm.name = 'U3_snoRNA' OR cvterm.name = 'methylation_guide_snoRNA' OR cvterm.name = 'pseudouridylation_guide_snoRNA' OR cvterm.name = 'miRNA' OR cvterm.name = 'RNA_6S' OR cvterm.name = 'CsrB_RsmB_RNA' OR cvterm.name = 'DsrA_RNA' OR cvterm.name = 'OxyS_RNA' OR cvterm.name = 'RprA_RNA' OR cvterm.name = 'RRE_RNA' OR cvterm.name = 'spot_42_RNA' OR cvterm.name = 'tmRNA' OR cvterm.name = 'GcvB_RNA' OR cvterm.name = 'MicF_RNA' OR cvterm.name = 'ribozyme' OR cvterm.name = 'trans_spliced_mRNA' OR cvterm.name = 'monocistronic_primary_transcript' OR cvterm.name = 'monocistronic_mRNA' OR cvterm.name = 'edited_transcript_by_A_to_I_substitution' OR cvterm.name = 'edited_mRNA' OR cvterm.name = 'transcription_regulatory_region' OR cvterm.name = 'translation_regulatory_region' OR cvterm.name = 'recombination_regulatory_region' OR cvterm.name = 'replication_regulatory_region' OR cvterm.name = 'terminator' OR cvterm.name = 'TF_binding_site' OR cvterm.name = 'polyA_signal_sequence' OR cvterm.name = 'gene_group_regulatory_region' OR cvterm.name = 'transcriptional_cis_regulatory_region' OR cvterm.name = 'splicing_regulatory_region' OR cvterm.name = 'cis_regulatory_frameshift_element' OR cvterm.name = 'intronic_regulatory_region' OR cvterm.name = 'bacterial_terminator' OR cvterm.name = 'eukaryotic_terminator' OR cvterm.name = 'rho_dependent_bacterial_terminator' OR cvterm.name = 'rho_independent_bacterial_terminator' OR cvterm.name = 'terminator_of_type_2_RNApol_III_promoter' OR cvterm.name = 'operator' OR cvterm.name = 'bacterial_RNApol_promoter' OR cvterm.name = 'bacterial_terminator' OR cvterm.name = 'bacterial_RNApol_promoter_sigma_70' OR cvterm.name = 'bacterial_RNApol_promoter_sigma54' OR cvterm.name = 'rho_dependent_bacterial_terminator' OR cvterm.name = 'rho_independent_bacterial_terminator' OR cvterm.name = 'promoter' OR cvterm.name = 'insulator' OR cvterm.name = 'CRM' OR cvterm.name = 'promoter_targeting_sequence' OR cvterm.name = 'ISRE' OR cvterm.name = 'bidirectional_promoter' OR cvterm.name = 'RNA_polymerase_promoter' OR cvterm.name = 'RNApol_I_promoter' OR cvterm.name = 'RNApol_II_promoter' OR cvterm.name = 'RNApol_III_promoter' OR cvterm.name = 'bacterial_RNApol_promoter' OR cvterm.name = 'Phage_RNA_Polymerase_Promoter' OR cvterm.name = 'RNApol_II_core_promoter' OR cvterm.name = 'RNApol_III_promoter_type_1' OR cvterm.name = 'RNApol_III_promoter_type_2' OR cvterm.name = 'RNApol_III_promoter_type_3' OR cvterm.name = 'bacterial_RNApol_promoter_sigma_70' OR cvterm.name = 'bacterial_RNApol_promoter_sigma54' OR cvterm.name = 'SP6_RNA_Polymerase_Promoter' OR cvterm.name = 'T3_RNA_Polymerase_Promoter' OR cvterm.name = 'T7_RNA_Polymerase_Promoter' OR cvterm.name = 'locus_control_region' OR cvterm.name = 'enhancer' OR cvterm.name = 'silencer' OR cvterm.name = 'enhancer_bound_by_factor' OR cvterm.name = 'shadow_enhancer' OR cvterm.name = 'splice_enhancer' OR cvterm.name = 'intronic_splice_enhancer' OR cvterm.name = 'exonic_splice_enhancer' OR cvterm.name = 'attenuator' OR cvterm.name = 'exon' OR cvterm.name = 'edited_transcript_feature' OR cvterm.name = 'mature_transcript_region' OR cvterm.name = 'primary_transcript_region' OR cvterm.name = 'exon_region' OR cvterm.name = 'anchor_binding_site' OR cvterm.name = 'coding_exon' OR cvterm.name = 'noncoding_exon' OR cvterm.name = 'interior_exon' OR cvterm.name = 'exon_of_single_exon_gene' OR cvterm.name = 'interior_coding_exon' OR cvterm.name = 'five_prime_coding_exon' OR cvterm.name = 'three_prime_coding_exon' OR cvterm.name = 'three_prime_noncoding_exon' OR cvterm.name = 'five_prime_noncoding_exon' OR cvterm.name = 'pre_edited_region' OR cvterm.name = 'editing_block' OR cvterm.name = 'editing_domain' OR cvterm.name = 'unedited_region' OR cvterm.name = 'mRNA_region' OR cvterm.name = 'tmRNA_region' OR cvterm.name = 'guide_RNA_region' OR cvterm.name = 'tRNA_region' OR cvterm.name = 'riboswitch' OR cvterm.name = 'ribosome_entry_site' OR cvterm.name = 'UTR' OR cvterm.name = 'CDS' OR cvterm.name = 'five_prime_open_reading_frame' OR cvterm.name = 'UTR_region' OR cvterm.name = 'CDS_region' OR cvterm.name = 'translational_frameshift' OR cvterm.name = 'recoding_stimulatory_region' OR cvterm.name = 'internal_ribosome_entry_site' OR cvterm.name = 'Shine_Dalgarno_sequence' OR cvterm.name = 'kozak_sequence' OR cvterm.name = 'internal_Shine_Dalgarno_sequence' OR cvterm.name = 'five_prime_UTR' OR cvterm.name = 'three_prime_UTR' OR cvterm.name = 'internal_UTR' OR cvterm.name = 'untranslated_region_polycistronic_mRNA' OR cvterm.name = 'edited_CDS' OR cvterm.name = 'CDS_fragment' OR cvterm.name = 'CDS_independently_known' OR cvterm.name = 'CDS_predicted' OR cvterm.name = 'orphan_CDS' OR cvterm.name = 'CDS_supported_by_sequence_similarity_data' OR cvterm.name = 'CDS_supported_by_domain_match_data' OR cvterm.name = 'CDS_supported_by_EST_or_cDNA_data' OR cvterm.name = 'upstream_AUG_codon' OR cvterm.name = 'AU_rich_element' OR cvterm.name = 'Bruno_response_element' OR cvterm.name = 'iron_responsive_element' OR cvterm.name = 'coding_start' OR cvterm.name = 'coding_end' OR cvterm.name = 'codon' OR cvterm.name = 'recoded_codon' OR cvterm.name = 'start_codon' OR cvterm.name = 'stop_codon' OR cvterm.name = 'stop_codon_read_through' OR cvterm.name = 'stop_codon_redefined_as_pyrrolysine' OR cvterm.name = 'stop_codon_redefined_as_selenocysteine' OR cvterm.name = 'non_canonical_start_codon' OR cvterm.name = 'four_bp_start_codon' OR cvterm.name = 'CTG_start_codon' OR cvterm.name = 'plus_1_translational_frameshift' OR cvterm.name = 'plus_2_translational_frameshift' OR cvterm.name = 'internal_Shine_Dalgarno_sequence' OR cvterm.name = 'SECIS_element' OR cvterm.name = 'three_prime_recoding_site' OR cvterm.name = 'five_prime_recoding_site' OR cvterm.name = 'stop_codon_signal' OR cvterm.name = 'three_prime_stem_loop_structure' OR cvterm.name = 'flanking_three_prime_quadruplet_recoding_signal' OR cvterm.name = 'three_prime_repeat_recoding_signal' OR cvterm.name = 'distant_three_prime_recoding_signal' OR cvterm.name = 'UAG_stop_codon_signal' OR cvterm.name = 'UAA_stop_codon_signal' OR cvterm.name = 'UGA_stop_codon_signal' OR cvterm.name = 'tmRNA_coding_piece' OR cvterm.name = 'tmRNA_acceptor_piece' OR cvterm.name = 'anchor_region' OR cvterm.name = 'template_region' OR cvterm.name = 'anticodon_loop' OR cvterm.name = 'anticodon' OR cvterm.name = 'CCA_tail' OR cvterm.name = 'DHU_loop' OR cvterm.name = 'T_loop' OR cvterm.name = 'splice_site' OR cvterm.name = 'intron' OR cvterm.name = 'clip' OR cvterm.name = 'TSS' OR cvterm.name = 'transcription_end_site' OR cvterm.name = 'spliced_leader_RNA' OR cvterm.name = 'rRNA_primary_transcript_region' OR cvterm.name = 'spliceosomal_intron_region' OR cvterm.name = 'intron_domain' OR cvterm.name = 'miRNA_primary_transcript_region' OR cvterm.name = 'outron' OR cvterm.name = 'cis_splice_site' OR cvterm.name = 'trans_splice_site' OR cvterm.name = 'cryptic_splice_site' OR cvterm.name = 'five_prime_cis_splice_site' OR cvterm.name = 'three_prime_cis_splice_site' OR cvterm.name = 'recursive_splice_site' OR cvterm.name = 'canonical_five_prime_splice_site' OR cvterm.name = 'non_canonical_five_prime_splice_site' OR cvterm.name = 'canonical_three_prime_splice_site' OR cvterm.name = 'non_canonical_three_prime_splice_site' OR cvterm.name = 'trans_splice_acceptor_site' OR cvterm.name = 'trans_splice_donor_site' OR cvterm.name = 'SL1_acceptor_site' OR cvterm.name = 'SL2_acceptor_site' OR cvterm.name = 'SL3_acceptor_site' OR cvterm.name = 'SL4_acceptor_site' OR cvterm.name = 'SL5_acceptor_site' OR cvterm.name = 'SL6_acceptor_site' OR cvterm.name = 'SL7_acceptor_site' OR cvterm.name = 'SL8_acceptor_site' OR cvterm.name = 'SL9_acceptor_site' OR cvterm.name = 'SL10_accceptor_site' OR cvterm.name = 'SL11_acceptor_site' OR cvterm.name = 'SL12_acceptor_site' OR cvterm.name = 'five_prime_intron' OR cvterm.name = 'interior_intron' OR cvterm.name = 'three_prime_intron' OR cvterm.name = 'twintron' OR cvterm.name = 'UTR_intron' OR cvterm.name = 'autocatalytically_spliced_intron' OR cvterm.name = 'spliceosomal_intron' OR cvterm.name = 'mobile_intron' OR cvterm.name = 'endonuclease_spliced_intron' OR cvterm.name = 'five_prime_UTR_intron' OR cvterm.name = 'three_prime_UTR_intron' OR cvterm.name = 'group_I_intron' OR cvterm.name = 'group_II_intron' OR cvterm.name = 'group_III_intron' OR cvterm.name = 'group_IIA_intron' OR cvterm.name = 'group_IIB_intron' OR cvterm.name = 'U2_intron' OR cvterm.name = 'U12_intron' OR cvterm.name = 'archaeal_intron' OR cvterm.name = 'tRNA_intron' OR cvterm.name = 'five_prime_clip' OR cvterm.name = 'three_prime_clip' OR cvterm.name = 'major_TSS' OR cvterm.name = 'minor_TSS' OR cvterm.name = 'transcribed_spacer_region' OR cvterm.name = 'internal_transcribed_spacer_region' OR cvterm.name = 'external_transcribed_spacer_region' OR cvterm.name = 'intronic_splice_enhancer' OR cvterm.name = 'branch_site' OR cvterm.name = 'polypyrimidine_tract' OR cvterm.name = 'internal_guide_sequence' OR cvterm.name = 'mirtron' OR cvterm.name = 'pre_miRNA' OR cvterm.name = 'miRNA_stem' OR cvterm.name = 'miRNA_loop' OR cvterm.name = 'miRNA_antiguide' OR cvterm.name = 'noncoding_region_of_exon' OR cvterm.name = 'coding_region_of_exon' OR cvterm.name = 'three_prime_coding_exon_noncoding_region' OR cvterm.name = 'five_prime_coding_exon_noncoding_region' OR cvterm.name = 'five_prime_coding_exon_coding_region' OR cvterm.name = 'three_prime_coding_exon_coding_region' OR cvterm.name = 'mature_protein_region' OR cvterm.name = 'immature_peptide_region' OR cvterm.name = 'compositionally_biased_region_of_peptide' OR cvterm.name = 'polypeptide_structural_region' OR cvterm.name = 'polypeptide_variation_site' OR cvterm.name = 'peptide_localization_signal' OR cvterm.name = 'cleaved_peptide_region' OR cvterm.name = 'hydrophobic_region_of_peptide' OR cvterm.name = 'polypeptide_conserved_region' OR cvterm.name = 'active_peptide' OR cvterm.name = 'polypeptide_domain' OR cvterm.name = 'membrane_structure' OR cvterm.name = 'extramembrane_polypeptide_region' OR cvterm.name = 'intramembrane_polypeptide_region' OR cvterm.name = 'polypeptide_secondary_structure' OR cvterm.name = 'polypeptide_structural_motif' OR cvterm.name = 'intrinsically_unstructured_polypeptide_region' OR cvterm.name = 'cytoplasmic_polypeptide_region' OR cvterm.name = 'non_cytoplasmic_polypeptide_region' OR cvterm.name = 'membrane_peptide_loop' OR cvterm.name = 'transmembrane_polypeptide_region' OR cvterm.name = 'asx_motif' OR cvterm.name = 'beta_bulge' OR cvterm.name = 'beta_bulge_loop' OR cvterm.name = 'beta_strand' OR cvterm.name = 'peptide_helix' OR cvterm.name = 'polypeptide_nest_motif' OR cvterm.name = 'schellmann_loop' OR cvterm.name = 'serine_threonine_motif' OR cvterm.name = 'serine_threonine_staple_motif' OR cvterm.name = 'polypeptide_turn_motif' OR cvterm.name = 'catmat_left_handed_three' OR cvterm.name = 'catmat_left_handed_four' OR cvterm.name = 'catmat_right_handed_three' OR cvterm.name = 'catmat_right_handed_four' OR cvterm.name = 'alpha_beta_motif' OR cvterm.name = 'peptide_coil' OR cvterm.name = 'beta_bulge_loop_five' OR cvterm.name = 'beta_bulge_loop_six' OR cvterm.name = 'antiparallel_beta_strand' OR cvterm.name = 'parallel_beta_strand' OR cvterm.name = 'left_handed_peptide_helix' OR cvterm.name = 'right_handed_peptide_helix' OR cvterm.name = 'alpha_helix' OR cvterm.name = 'pi_helix' OR cvterm.name = 'three_ten_helix' OR cvterm.name = 'polypeptide_nest_left_right_motif' OR cvterm.name = 'polypeptide_nest_right_left_motif' OR cvterm.name = 'schellmann_loop_seven' OR cvterm.name = 'schellmann_loop_six' OR cvterm.name = 'asx_turn' OR cvterm.name = 'beta_turn' OR cvterm.name = 'gamma_turn' OR cvterm.name = 'serine_threonine_turn' OR cvterm.name = 'asx_turn_left_handed_type_one' OR cvterm.name = 'asx_turn_left_handed_type_two' OR cvterm.name = 'asx_turn_right_handed_type_two' OR cvterm.name = 'asx_turn_right_handed_type_one' OR cvterm.name = 'beta_turn_left_handed_type_one' OR cvterm.name = 'beta_turn_left_handed_type_two' OR cvterm.name = 'beta_turn_right_handed_type_one' OR cvterm.name = 'beta_turn_right_handed_type_two' OR cvterm.name = 'beta_turn_type_six' OR cvterm.name = 'beta_turn_type_eight' OR cvterm.name = 'beta_turn_type_six_a' OR cvterm.name = 'beta_turn_type_six_b' OR cvterm.name = 'beta_turn_type_six_a_one' OR cvterm.name = 'beta_turn_type_six_a_two' OR cvterm.name = 'gamma_turn_classic' OR cvterm.name = 'gamma_turn_inverse' OR cvterm.name = 'st_turn_left_handed_type_one' OR cvterm.name = 'st_turn_left_handed_type_two' OR cvterm.name = 'st_turn_right_handed_type_one' OR cvterm.name = 'st_turn_right_handed_type_two' OR cvterm.name = 'coiled_coil' OR cvterm.name = 'helix_turn_helix' OR cvterm.name = 'natural_variant_site' OR cvterm.name = 'mutated_variant_site' OR cvterm.name = 'alternate_sequence_site' OR cvterm.name = 'signal_peptide' OR cvterm.name = 'transit_peptide' OR cvterm.name = 'nuclear_localization_signal' OR cvterm.name = 'endosomal_localization_signal' OR cvterm.name = 'lysosomal_localization_signal' OR cvterm.name = 'nuclear_export_signal' OR cvterm.name = 'nuclear_rim_localization_signal' OR cvterm.name = 'cleaved_initiator_methionine' OR cvterm.name = 'intein' OR cvterm.name = 'propeptide_cleavage_site' OR cvterm.name = 'propeptide' OR cvterm.name = 'cleaved_for_gpi_anchor_region' OR cvterm.name = 'lipoprotein_signal_peptide' OR cvterm.name = 'n_terminal_region' OR cvterm.name = 'c_terminal_region' OR cvterm.name = 'central_hydrophobic_region_of_signal_peptide' OR cvterm.name = 'polypeptide_domain' OR cvterm.name = 'polypeptide_motif' OR cvterm.name = 'polypeptide_repeat' OR cvterm.name = 'biochemical_region_of_peptide' OR cvterm.name = 'polypeptide_conserved_motif' OR cvterm.name = 'post_translationally_modified_region' OR cvterm.name = 'conformational_switch' OR cvterm.name = 'molecular_contact_region' OR cvterm.name = 'polypeptide_binding_motif' OR cvterm.name = 'polypeptide_catalytic_motif' OR cvterm.name = 'histone_modification' OR cvterm.name = 'histone_methylation_site' OR cvterm.name = 'histone_acetylation_site' OR cvterm.name = 'histone_ubiqitination_site' OR cvterm.name = 'histone_acylation_region' OR cvterm.name = 'H4K20_monomethylation_site' OR cvterm.name = 'H2BK5_monomethylation_site' OR cvterm.name = 'H3K27_methylation_site' OR cvterm.name = 'H3K36_methylation_site' OR cvterm.name = 'H3K4_methylation_site' OR cvterm.name = 'H3K79_methylation_site' OR cvterm.name = 'H3K9_methylation_site' OR cvterm.name = 'H3K27_monomethylation_site' OR cvterm.name = 'H3K27_trimethylation_site' OR cvterm.name = 'H3K27_dimethylation_site' OR cvterm.name = 'H3K36_monomethylation_site' OR cvterm.name = 'H3K36_dimethylation_site' OR cvterm.name = 'H3K36_trimethylation_site' OR cvterm.name = 'H3K4_monomethylation_site' OR cvterm.name = 'H3K4_trimethylation' OR cvterm.name = 'H3K4_dimethylation_site' OR cvterm.name = 'H3K79_monomethylation_site' OR cvterm.name = 'H3K79_dimethylation_site' OR cvterm.name = 'H3K79_trimethylation_site' OR cvterm.name = 'H3K9_trimethylation_site' OR cvterm.name = 'H3K9_monomethylation_site' OR cvterm.name = 'H3K9_dimethylation_site' OR cvterm.name = 'H3K9_acetylation_site' OR cvterm.name = 'H3K14_acetylation_site' OR cvterm.name = 'H3K18_acetylation_site' OR cvterm.name = 'H3K23_acylation site' OR cvterm.name = 'H3K27_acylation_site' OR cvterm.name = 'H4K16_acylation_site' OR cvterm.name = 'H4K5_acylation_site' OR cvterm.name = 'H4K8_acylation site' OR cvterm.name = 'H2B_ubiquitination_site' OR cvterm.name = 'H4K_acylation_region' OR cvterm.name = 'polypeptide_metal_contact' OR cvterm.name = 'protein_protein_contact' OR cvterm.name = 'polypeptide_ligand_contact' OR cvterm.name = 'polypeptide_DNA_contact' OR cvterm.name = 'polypeptide_calcium_ion_contact_site' OR cvterm.name = 'polypeptide_cobalt_ion_contact_site' OR cvterm.name = 'polypeptide_copper_ion_contact_site' OR cvterm.name = 'polypeptide_iron_ion_contact_site' OR cvterm.name = 'polypeptide_magnesium_ion_contact_site' OR cvterm.name = 'polypeptide_manganese_ion_contact_site' OR cvterm.name = 'polypeptide_molybdenum_ion_contact_site' OR cvterm.name = 'polypeptide_nickel_ion_contact_site' OR cvterm.name = 'polypeptide_tungsten_ion_contact_site' OR cvterm.name = 'polypeptide_zinc_ion_contact_site' OR cvterm.name = 'non_transcribed_region' OR cvterm.name = 'gene_fragment' OR cvterm.name = 'TSS_region' OR cvterm.name = 'gene_segment' OR cvterm.name = 'pseudogenic_gene_segment' OR cvterm.name = 'mobile_intron' OR cvterm.name = 'extrachromosomal_mobile_genetic_element' OR cvterm.name = 'integrated_mobile_genetic_element' OR cvterm.name = 'natural_transposable_element' OR cvterm.name = 'viral_sequence' OR cvterm.name = 'natural_plasmid' OR cvterm.name = 'phage_sequence' OR cvterm.name = 'ds_RNA_viral_sequence' OR cvterm.name = 'ds_DNA_viral_sequence' OR cvterm.name = 'ss_RNA_viral_sequence' OR cvterm.name = 'negative_sense_ssRNA_viral_sequence' OR cvterm.name = 'positive_sense_ssRNA_viral_sequence' OR cvterm.name = 'ambisense_ssRNA_viral_sequence' OR cvterm.name = 'transposable_element' OR cvterm.name = 'proviral_region' OR cvterm.name = 'integron' OR cvterm.name = 'genomic_island' OR cvterm.name = 'integrated_plasmid' OR cvterm.name = 'cointegrated_plasmid' OR cvterm.name = 'retrotransposon' OR cvterm.name = 'DNA_transposon' OR cvterm.name = 'foreign_transposable_element' OR cvterm.name = 'transgenic_transposable_element' OR cvterm.name = 'natural_transposable_element' OR cvterm.name = 'engineered_transposable_element' OR cvterm.name = 'nested_transposon' OR cvterm.name = 'LTR_retrotransposon' OR cvterm.name = 'non_LTR_retrotransposon' OR cvterm.name = 'LINE_element' OR cvterm.name = 'SINE_element' OR cvterm.name = 'terminal_inverted_repeat_element' OR cvterm.name = 'foldback_element' OR cvterm.name = 'conjugative_transposon' OR cvterm.name = 'helitron' OR cvterm.name = 'p_element' OR cvterm.name = 'MITE' OR cvterm.name = 'insertion_sequence' OR cvterm.name = 'polinton' OR cvterm.name = 'engineered_foreign_transposable_element' OR cvterm.name = 'engineered_foreign_transposable_element' OR cvterm.name = 'prophage' OR cvterm.name = 'pathogenic_island' OR cvterm.name = 'metabolic_island' OR cvterm.name = 'adaptive_island' OR cvterm.name = 'symbiosis_island' OR cvterm.name = 'cryptic_prophage' OR cvterm.name = 'defective_conjugative_transposon' OR cvterm.name = 'plasmid' OR cvterm.name = 'chromosome' OR cvterm.name = 'vector_replicon' OR cvterm.name = 'maxicircle' OR cvterm.name = 'minicircle' OR cvterm.name = 'viral_sequence' OR cvterm.name = 'engineered_plasmid' OR cvterm.name = 'episome' OR cvterm.name = 'natural_plasmid' OR cvterm.name = 'engineered_episome' OR cvterm.name = 'gene_trap_construct' OR cvterm.name = 'promoter_trap_construct' OR cvterm.name = 'enhancer_trap_construct' OR cvterm.name = 'engineered_episome' OR cvterm.name = 'mitochondrial_chromosome' OR cvterm.name = 'chloroplast_chromosome' OR cvterm.name = 'chromoplast_chromosome' OR cvterm.name = 'cyanelle_chromosome' OR cvterm.name = 'leucoplast_chromosome' OR cvterm.name = 'macronuclear_chromosome' OR cvterm.name = 'micronuclear_chromosome' OR cvterm.name = 'nuclear_chromosome' OR cvterm.name = 'nucleomorphic_chromosome' OR cvterm.name = 'DNA_chromosome' OR cvterm.name = 'RNA_chromosome' OR cvterm.name = 'apicoplast_chromosome' OR cvterm.name = 'double_stranded_DNA_chromosome' OR cvterm.name = 'single_stranded_DNA_chromosome' OR cvterm.name = 'linear_double_stranded_DNA_chromosome' OR cvterm.name = 'circular_double_stranded_DNA_chromosome' OR cvterm.name = 'linear_single_stranded_DNA_chromosome' OR cvterm.name = 'circular_single_stranded_DNA_chromosome' OR cvterm.name = 'single_stranded_RNA_chromosome' OR cvterm.name = 'double_stranded_RNA_chromosome' OR cvterm.name = 'linear_single_stranded_RNA_chromosome' OR cvterm.name = 'circular_single_stranded_RNA_chromosome' OR cvterm.name = 'linear_double_stranded_RNA_chromosome' OR cvterm.name = 'circular_double_stranded_RNA_chromosome' OR cvterm.name = 'YAC' OR cvterm.name = 'BAC' OR cvterm.name = 'PAC' OR cvterm.name = 'cosmid' OR cvterm.name = 'phagemid' OR cvterm.name = 'fosmid' OR cvterm.name = 'lambda_vector' OR cvterm.name = 'plasmid_vector' OR cvterm.name = 'targeting_vector' OR cvterm.name = 'phage_sequence' OR cvterm.name = 'ds_RNA_viral_sequence' OR cvterm.name = 'ds_DNA_viral_sequence' OR cvterm.name = 'ss_RNA_viral_sequence' OR cvterm.name = 'negative_sense_ssRNA_viral_sequence' OR cvterm.name = 'positive_sense_ssRNA_viral_sequence' OR cvterm.name = 'ambisense_ssRNA_viral_sequence' OR cvterm.name = 'modified_RNA_base_feature' OR cvterm.name = 'inosine' OR cvterm.name = 'seven_methylguanine' OR cvterm.name = 'ribothymidine' OR cvterm.name = 'modified_adenosine' OR cvterm.name = 'modified_cytidine' OR cvterm.name = 'modified_guanosine' OR cvterm.name = 'modified_uridine' OR cvterm.name = 'modified_inosine' OR cvterm.name = 'methylinosine' OR cvterm.name = 'one_methylinosine' OR cvterm.name = 'one_two_prime_O_dimethylinosine' OR cvterm.name = 'two_prime_O_methylinosine' OR cvterm.name = 'one_methyladenosine' OR cvterm.name = 'two_methyladenosine' OR cvterm.name = 'N6_methyladenosine' OR cvterm.name = 'two_prime_O_methyladenosine' OR cvterm.name = 'two_methylthio_N6_methyladenosine' OR cvterm.name = 'N6_isopentenyladenosine' OR cvterm.name = 'two_methylthio_N6_isopentenyladenosine' OR cvterm.name = 'N6_cis_hydroxyisopentenyl_adenosine' OR cvterm.name = 'two_methylthio_N6_cis_hydroxyisopentenyl_adenosine' OR cvterm.name = 'N6_glycinylcarbamoyladenosine' OR cvterm.name = 'N6_threonylcarbamoyladenosine' OR cvterm.name = 'two_methylthio_N6_threonyl_carbamoyladenosine' OR cvterm.name = 'N6_methyl_N6_threonylcarbamoyladenosine' OR cvterm.name = 'N6_hydroxynorvalylcarbamoyladenosine' OR cvterm.name = 'two_methylthio_N6_hydroxynorvalyl_carbamoyladenosine' OR cvterm.name = 'two_prime_O_ribosyladenosine_phosphate' OR cvterm.name = 'N6_N6_dimethyladenosine' OR cvterm.name = 'N6_2_prime_O_dimethyladenosine' OR cvterm.name = 'N6_N6_2_prime_O_trimethyladenosine' OR cvterm.name = 'one_two_prime_O_dimethyladenosine' OR cvterm.name = 'N6_acetyladenosine' OR cvterm.name = 'three_methylcytidine' OR cvterm.name = 'five_methylcytidine' OR cvterm.name = 'two_prime_O_methylcytidine' OR cvterm.name = 'two_thiocytidine' OR cvterm.name = 'N4_acetylcytidine' OR cvterm.name = 'five_formylcytidine' OR cvterm.name = 'five_two_prime_O_dimethylcytidine' OR cvterm.name = 'N4_acetyl_2_prime_O_methylcytidine' OR cvterm.name = 'lysidine' OR cvterm.name = 'N4_methylcytidine' OR cvterm.name = 'N4_2_prime_O_dimethylcytidine' OR cvterm.name = 'five_hydroxymethylcytidine' OR cvterm.name = 'five_formyl_two_prime_O_methylcytidine' OR cvterm.name = 'N4_N4_2_prime_O_trimethylcytidine' OR cvterm.name = 'seven_deazaguanosine' OR cvterm.name = 'one_methylguanosine' OR cvterm.name = 'N2_methylguanosine' OR cvterm.name = 'seven_methylguanosine' OR cvterm.name = 'two_prime_O_methylguanosine' OR cvterm.name = 'N2_N2_dimethylguanosine' OR cvterm.name = 'N2_2_prime_O_dimethylguanosine' OR cvterm.name = 'N2_N2_2_prime_O_trimethylguanosine' OR cvterm.name = 'two_prime_O_ribosylguanosine_phosphate' OR cvterm.name = 'wybutosine' OR cvterm.name = 'peroxywybutosine' OR cvterm.name = 'hydroxywybutosine' OR cvterm.name = 'undermodified_hydroxywybutosine' OR cvterm.name = 'wyosine' OR cvterm.name = 'methylwyosine' OR cvterm.name = 'N2_7_dimethylguanosine' OR cvterm.name = 'N2_N2_7_trimethylguanosine' OR cvterm.name = 'one_two_prime_O_dimethylguanosine' OR cvterm.name = 'four_demethylwyosine' OR cvterm.name = 'isowyosine' OR cvterm.name = 'N2_7_2prirme_O_trimethylguanosine' OR cvterm.name = 'queuosine' OR cvterm.name = 'epoxyqueuosine' OR cvterm.name = 'galactosyl_queuosine' OR cvterm.name = 'mannosyl_queuosine' OR cvterm.name = 'seven_cyano_seven_deazaguanosine' OR cvterm.name = 'seven_aminomethyl_seven_deazaguanosine' OR cvterm.name = 'archaeosine' OR cvterm.name = 'dihydrouridine' OR cvterm.name = 'pseudouridine' OR cvterm.name = 'five_methyluridine' OR cvterm.name = 'two_prime_O_methyluridine' OR cvterm.name = 'five_two_prime_O_dimethyluridine' OR cvterm.name = 'one_methylpseudouridine' OR cvterm.name = 'two_prime_O_methylpseudouridine' OR cvterm.name = 'two_thiouridine' OR cvterm.name = 'four_thiouridine' OR cvterm.name = 'five_methyl_2_thiouridine' OR cvterm.name = 'two_thio_two_prime_O_methyluridine' OR cvterm.name = 'three_three_amino_three_carboxypropyl_uridine' OR cvterm.name = 'five_hydroxyuridine' OR cvterm.name = 'five_methoxyuridine' OR cvterm.name = 'uridine_five_oxyacetic_acid' OR cvterm.name = 'uridine_five_oxyacetic_acid_methyl_ester' OR cvterm.name = 'five_carboxyhydroxymethyl_uridine' OR cvterm.name = 'five_carboxyhydroxymethyl_uridine_methyl_ester' OR cvterm.name = 'five_methoxycarbonylmethyluridine' OR cvterm.name = 'five_methoxycarbonylmethyl_two_prime_O_methyluridine' OR cvterm.name = 'five_methoxycarbonylmethyl_two_thiouridine' OR cvterm.name = 'five_aminomethyl_two_thiouridine' OR cvterm.name = 'five_methylaminomethyluridine' OR cvterm.name = 'five_methylaminomethyl_two_thiouridine' OR cvterm.name = 'five_methylaminomethyl_two_selenouridine' OR cvterm.name = 'five_carbamoylmethyluridine' OR cvterm.name = 'five_carbamoylmethyl_two_prime_O_methyluridine' OR cvterm.name = 'five_carboxymethylaminomethyluridine' OR cvterm.name = 'five_carboxymethylaminomethyl_two_prime_O_methyluridine' OR cvterm.name = 'five_carboxymethylaminomethyl_two_thiouridine' OR cvterm.name = 'three_methyluridine' OR cvterm.name = 'one_methyl_three_three_amino_three_carboxypropyl_pseudouridine' OR cvterm.name = 'five_carboxymethyluridine' OR cvterm.name = 'three_two_prime_O_dimethyluridine' OR cvterm.name = 'five_methyldihydrouridine' OR cvterm.name = 'three_methylpseudouridine' OR cvterm.name = 'five_taurinomethyluridine' OR cvterm.name = 'five_taurinomethyl_two_thiouridine' OR cvterm.name = 'five_isopentenylaminomethyl_uridine' OR cvterm.name = 'five_isopentenylaminomethyl_two_thiouridine' OR cvterm.name = 'five_isopentenylaminomethyl_two_prime_O_methyluridine' OR cvterm.name = 'catalytic_residue' OR cvterm.name = 'modified_amino_acid_feature' OR cvterm.name = 'alanine' OR cvterm.name = 'valine' OR cvterm.name = 'leucine' OR cvterm.name = 'isoleucine' OR cvterm.name = 'proline' OR cvterm.name = 'tryptophan' OR cvterm.name = 'phenylalanine' OR cvterm.name = 'methionine' OR cvterm.name = 'glycine' OR cvterm.name = 'serine' OR cvterm.name = 'threonine' OR cvterm.name = 'tyrosine' OR cvterm.name = 'cysteine' OR cvterm.name = 'glutamine' OR cvterm.name = 'asparagine' OR cvterm.name = 'lysine' OR cvterm.name = 'arginine' OR cvterm.name = 'histidine' OR cvterm.name = 'aspartic_acid' OR cvterm.name = 'glutamic_acid' OR cvterm.name = 'selenocysteine' OR cvterm.name = 'pyrrolysine' OR cvterm.name = 'modified_glycine' OR cvterm.name = 'modified_L_alanine' OR cvterm.name = 'modified_L_asparagine' OR cvterm.name = 'modified_L_aspartic_acid' OR cvterm.name = 'modified_L_cysteine' OR cvterm.name = 'modified_L_glutamic_acid' OR cvterm.name = 'modified_L_threonine' OR cvterm.name = 'modified_L_tryptophan' OR cvterm.name = 'modified_L_glutamine' OR cvterm.name = 'modified_L_methionine' OR cvterm.name = 'modified_L_isoleucine' OR cvterm.name = 'modified_L_phenylalanine' OR cvterm.name = 'modified_L_histidine' OR cvterm.name = 'modified_L_serine' OR cvterm.name = 'modified_L_lysine' OR cvterm.name = 'modified_L_leucine' OR cvterm.name = 'modified_L_selenocysteine' OR cvterm.name = 'modified_L_valine' OR cvterm.name = 'modified_L_proline' OR cvterm.name = 'modified_L_tyrosine' OR cvterm.name = 'modified_L_arginine' OR cvterm.name = 'heritable_phenotypic_marker' OR cvterm.name = 'DArT_marker' OR cvterm.name = 'nucleotide_motif' OR cvterm.name = 'DNA_motif' OR cvterm.name = 'RNA_motif' OR cvterm.name = 'PSE_motif' OR cvterm.name = 'CAAT_signal' OR cvterm.name = 'minus_10_signal' OR cvterm.name = 'minus_35_signal' OR cvterm.name = 'DRE_motif' OR cvterm.name = 'E_box_motif' OR cvterm.name = 'INR1_motif' OR cvterm.name = 'GAGA_motif' OR cvterm.name = 'octamer_motif' OR cvterm.name = 'retinoic_acid_responsive_element' OR cvterm.name = 'promoter_element' OR cvterm.name = 'DCE_SI' OR cvterm.name = 'DCE_SII' OR cvterm.name = 'DCE_SIII' OR cvterm.name = 'minus_12_signal' OR cvterm.name = 'minus_24_signal' OR cvterm.name = 'GC_rich_promoter_region' OR cvterm.name = 'DMv4_motif' OR cvterm.name = 'DMv5_motif' OR cvterm.name = 'DMv3_motif' OR cvterm.name = 'DMv2_motif' OR cvterm.name = 'DPE1_motif' OR cvterm.name = 'DMv1_motif' OR cvterm.name = 'NDM2_motif' OR cvterm.name = 'NDM3_motif' OR cvterm.name = 'core_promoter_element' OR cvterm.name = 'regulatory_promoter_element' OR cvterm.name = 'INR_motif' OR cvterm.name = 'DPE_motif' OR cvterm.name = 'BREu_motif' OR cvterm.name = 'TATA_box' OR cvterm.name = 'A_box' OR cvterm.name = 'B_box' OR cvterm.name = 'C_box' OR cvterm.name = 'MTE' OR cvterm.name = 'BREd_motif' OR cvterm.name = 'DCE' OR cvterm.name = 'intermediate_element' OR cvterm.name = 'RNA_polymerase_II_TATA_box' OR cvterm.name = 'RNA_polymerase_III_TATA_box' OR cvterm.name = 'A_box_type_1' OR cvterm.name = 'A_box_type_2' OR cvterm.name = 'proximal_promoter_element' OR cvterm.name = 'distal_promoter_element' OR cvterm.name = 'RNA_internal_loop' OR cvterm.name = 'A_minor_RNA_motif' OR cvterm.name = 'RNA_junction_loop' OR cvterm.name = 'hammerhead_ribozyme' OR cvterm.name = 'asymmetric_RNA_internal_loop' OR cvterm.name = 'symmetric_RNA_internal_loop' OR cvterm.name = 'K_turn_RNA_motif' OR cvterm.name = 'sarcin_like_RNA_motif' OR cvterm.name = 'RNA_hook_turn' OR cvterm.name = 'blunt_end_restriction_enzyme_cleavage_site' OR cvterm.name = 'sticky_end_restriction_enzyme_cleavage_site' OR cvterm.name = 'modified_base' OR cvterm.name = 'epigenetically_modified_gene' OR cvterm.name = 'histone_modification' OR cvterm.name = 'methylated_base_feature' OR cvterm.name = 'methylated_C' OR cvterm.name = 'methylated_A' OR cvterm.name = 'gene_rearranged_at_DNA_level' OR cvterm.name = 'maternally_imprinted_gene' OR cvterm.name = 'paternally_imprinted_gene' OR cvterm.name = 'allelically_excluded_gene' OR cvterm.name = 'histone_methylation_site' OR cvterm.name = 'histone_acetylation_site' OR cvterm.name = 'histone_ubiqitination_site' OR cvterm.name = 'histone_acylation_region' OR cvterm.name = 'H4K20_monomethylation_site' OR cvterm.name = 'H2BK5_monomethylation_site' OR cvterm.name = 'H3K27_methylation_site' OR cvterm.name = 'H3K36_methylation_site' OR cvterm.name = 'H3K4_methylation_site' OR cvterm.name = 'H3K79_methylation_site' OR cvterm.name = 'H3K9_methylation_site' OR cvterm.name = 'H3K27_monomethylation_site' OR cvterm.name = 'H3K27_trimethylation_site' OR cvterm.name = 'H3K27_dimethylation_site' OR cvterm.name = 'H3K36_monomethylation_site' OR cvterm.name = 'H3K36_dimethylation_site' OR cvterm.name = 'H3K36_trimethylation_site' OR cvterm.name = 'H3K4_monomethylation_site' OR cvterm.name = 'H3K4_trimethylation' OR cvterm.name = 'H3K4_dimethylation_site' OR cvterm.name = 'H3K79_monomethylation_site' OR cvterm.name = 'H3K79_dimethylation_site' OR cvterm.name = 'H3K79_trimethylation_site' OR cvterm.name = 'H3K9_trimethylation_site' OR cvterm.name = 'H3K9_monomethylation_site' OR cvterm.name = 'H3K9_dimethylation_site' OR cvterm.name = 'H3K9_acetylation_site' OR cvterm.name = 'H3K14_acetylation_site' OR cvterm.name = 'H3K18_acetylation_site' OR cvterm.name = 'H3K23_acylation site' OR cvterm.name = 'H3K27_acylation_site' OR cvterm.name = 'H4K16_acylation_site' OR cvterm.name = 'H4K5_acylation_site' OR cvterm.name = 'H4K8_acylation site' OR cvterm.name = 'H2B_ubiquitination_site' OR cvterm.name = 'H4K_acylation_region' OR cvterm.name = 'operon' OR cvterm.name = 'mating_type_region' OR cvterm.name = 'gene_array' OR cvterm.name = 'gene_subarray' OR cvterm.name = 'gene_cassette_array' OR cvterm.name = 'regulon' OR cvterm.name = 'sequence_length_variation' OR cvterm.name = 'MNP' OR cvterm.name = 'SNV' OR cvterm.name = 'complex_substitution' OR cvterm.name = 'simple_sequence_length_variation' OR cvterm.name = 'SNP' OR cvterm.name = 'point_mutation' OR cvterm.name = 'transition' OR cvterm.name = 'transversion' OR cvterm.name = 'pyrimidine_transition' OR cvterm.name = 'purine_transition' OR cvterm.name = 'C_to_T_transition' OR cvterm.name = 'T_to_C_transition' OR cvterm.name = 'C_to_T_transition_at_pCpG_site' OR cvterm.name = 'A_to_G_transition' OR cvterm.name = 'G_to_A_transition' OR cvterm.name = 'pyrimidine_to_purine_transversion' OR cvterm.name = 'purine_to_pyrimidine_transversion' OR cvterm.name = 'C_to_A_transversion' OR cvterm.name = 'C_to_G_transversion' OR cvterm.name = 'T_to_A_transversion' OR cvterm.name = 'T_to_G_transversion' OR cvterm.name = 'A_to_C_transversion' OR cvterm.name = 'A_to_T_transversion' OR cvterm.name = 'G_to_C_transversion' OR cvterm.name = 'G_to_T_transversion' OR cvterm.name = 'flanking_region' OR cvterm.name = 'repeat_component' OR cvterm.name = 'transposable_element_flanking_region' OR cvterm.name = 'five_prime_flanking_region' OR cvterm.name = 'three_prime_flanking_region' OR cvterm.name = 'non_LTR_retrotransposon_polymeric_tract' OR cvterm.name = 'LTR_component' OR cvterm.name = 'repeat_fragment' OR cvterm.name = 'transposon_fragment' OR cvterm.name = 'U5_LTR_region' OR cvterm.name = 'R_LTR_region' OR cvterm.name = 'U3_LTR_region' OR cvterm.name = 'three_prime_LTR_component' OR cvterm.name = 'five_prime_LTR_component' OR cvterm.name = 'U5_five_prime_LTR_region' OR cvterm.name = 'R_five_prime_LTR_region' OR cvterm.name = 'U3_five_prime_LTR_region' OR cvterm.name = 'R_three_prime_LTR_region' OR cvterm.name = 'U3_three_prime_LTR_region' OR cvterm.name = 'U5_three_prime_LTR_region' OR cvterm.name = 'R_five_prime_LTR_region' OR cvterm.name = 'U5_five_prime_LTR_region' OR cvterm.name = 'U3_five_prime_LTR_region' OR cvterm.name = 'clone_insert_end' OR cvterm.name = 'clone_insert_start' OR cvterm.name = 'exon_junction' OR cvterm.name = 'insertion_site' OR cvterm.name = 'polyA_site' OR cvterm.name = 'deletion_junction' OR cvterm.name = 'chromosome_breakpoint' OR cvterm.name = 'splice_junction' OR cvterm.name = 'trans_splice_junction' OR cvterm.name = 'restriction_enzyme_cleavage_junction' OR cvterm.name = 'transposable_element_insertion_site' OR cvterm.name = 'inversion_breakpoint' OR cvterm.name = 'translocation_breakpoint' OR cvterm.name = 'insertion_breakpoint' OR cvterm.name = 'deletion_breakpoint' OR cvterm.name = 'blunt_end_restriction_enzyme_cleavage_junction' OR cvterm.name = 'single_strand_restriction_enzyme_cleavage_site' OR cvterm.name = 'five_prime_restriction_enzyme_junction' OR cvterm.name = 'three_prime_restriction_enzyme_junction' OR cvterm.name = 'deletion' OR cvterm.name = 'translocation' OR cvterm.name = 'insertion' OR cvterm.name = 'copy_number_variation' OR cvterm.name = 'UPD' OR cvterm.name = 'structural_alteration' OR cvterm.name = 'substitution' OR cvterm.name = 'indel' OR cvterm.name = 'inversion' OR cvterm.name = 'transgenic_insertion' OR cvterm.name = 'duplication' OR cvterm.name = 'tandem_duplication' OR cvterm.name = 'direct_tandem_duplication' OR cvterm.name = 'inverted_tandem_duplication' OR cvterm.name = 'copy_number_gain' OR cvterm.name = 'copy_number_loss' OR cvterm.name = 'maternal_uniparental_disomy' OR cvterm.name = 'paternal_uniparental_disomy' OR cvterm.name = 'complex_structural_alteration' OR cvterm.name = 'sequence_length_variation' OR cvterm.name = 'MNP' OR cvterm.name = 'SNV' OR cvterm.name = 'complex_substitution' OR cvterm.name = 'simple_sequence_length_variation' OR cvterm.name = 'SNP' OR cvterm.name = 'point_mutation' OR cvterm.name = 'transition' OR cvterm.name = 'transversion' OR cvterm.name = 'pyrimidine_transition' OR cvterm.name = 'purine_transition' OR cvterm.name = 'C_to_T_transition' OR cvterm.name = 'T_to_C_transition' OR cvterm.name = 'C_to_T_transition_at_pCpG_site' OR cvterm.name = 'A_to_G_transition' OR cvterm.name = 'G_to_A_transition' OR cvterm.name = 'pyrimidine_to_purine_transversion' OR cvterm.name = 'purine_to_pyrimidine_transversion' OR cvterm.name = 'C_to_A_transversion' OR cvterm.name = 'C_to_G_transversion' OR cvterm.name = 'T_to_A_transversion' OR cvterm.name = 'T_to_G_transversion' OR cvterm.name = 'A_to_C_transversion' OR cvterm.name = 'A_to_T_transversion' OR cvterm.name = 'G_to_C_transversion' OR cvterm.name = 'G_to_T_transversion' OR cvterm.name = 'sequence_feature';

--- ************************************************
--- *** relation: transposable_element_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene encoded within a transposable ele ***
--- *** ment. For example gag, int, env and pol  ***
--- *** are the transposable element genes of th ***
--- *** e TY element in yeast.                   ***
--- ************************************************
---

CREATE VIEW transposable_element_gene AS
  SELECT
    feature_id AS transposable_element_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'engineered_foreign_transposable_element_gene' OR cvterm.name = 'transposable_element_gene';

--- ************************************************
--- *** relation: primer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An oligo to which new deoxyribonucleotid ***
--- *** es can be added by DNA polymerase.       ***
--- ************************************************
---

CREATE VIEW primer AS
  SELECT
    feature_id AS primer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'sequencing_primer' OR cvterm.name = 'forward_primer' OR cvterm.name = 'reverse_primer' OR cvterm.name = 'ASPE_primer' OR cvterm.name = 'dCAPS_primer' OR cvterm.name = 'primer';

--- ************************************************
--- *** relation: proviral_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A viral sequence which has integrated in ***
--- *** to a host genome.                        ***
--- ************************************************
---

CREATE VIEW proviral_region AS
  SELECT
    feature_id AS proviral_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'prophage' OR cvterm.name = 'proviral_region';

--- ************************************************
--- *** relation: methylated_c ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A methylated deoxy-cytosine.             ***
--- ************************************************
---

CREATE VIEW methylated_c AS
  SELECT
    feature_id AS methylated_c_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'methylated_C';

--- ************************************************
--- *** relation: edited ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a sequence that  ***
--- *** is modified by editing.                  ***
--- ************************************************
---

CREATE VIEW edited AS
  SELECT
    feature_id AS edited_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'edited';

--- ************************************************
--- *** relation: transcript_with_translational_frameshift ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transcript with a translational frames ***
--- *** hift.                                    ***
--- ************************************************
---

CREATE VIEW transcript_with_translational_frameshift AS
  SELECT
    feature_id AS transcript_with_translational_frameshift_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'transcript_with_translational_frameshift';

--- ************************************************
--- *** relation: regulated ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute to describe a sequence that ***
--- ***  is regulated.                           ***
--- ************************************************
---

CREATE VIEW regulated AS
  SELECT
    feature_id AS regulated_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'transcriptionally_regulated' OR cvterm.name = 'post_translationally_regulated' OR cvterm.name = 'translationally_regulated' OR cvterm.name = 'imprinted' OR cvterm.name = 'transcriptionally_constitutive' OR cvterm.name = 'transcriptionally_induced' OR cvterm.name = 'transcriptionally_repressed' OR cvterm.name = 'autoregulated' OR cvterm.name = 'positively_autoregulated' OR cvterm.name = 'negatively_autoregulated' OR cvterm.name = 'silenced' OR cvterm.name = 'silenced_by_DNA_modification' OR cvterm.name = 'silenced_by_RNA_interference' OR cvterm.name = 'silenced_by_histone_modification' OR cvterm.name = 'silenced_by_DNA_methylation' OR cvterm.name = 'silenced_by_histone_methylation' OR cvterm.name = 'silenced_by_histone_deacetylation' OR cvterm.name = 'negatively_autoregulated' OR cvterm.name = 'positively_autoregulated' OR cvterm.name = 'post_translationally_regulated_by_protein_stability' OR cvterm.name = 'post_translationally_regulated_by_protein_modification' OR cvterm.name = 'maternally_imprinted' OR cvterm.name = 'paternally_imprinted' OR cvterm.name = 'regulated';

--- ************************************************
--- *** relation: protein_coding_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript that, at least in p ***
--- *** art, encodes one or more proteins.       ***
--- ************************************************
---

CREATE VIEW protein_coding_primary_transcript AS
  SELECT
    feature_id AS protein_coding_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pre_edited_mRNA' OR cvterm.name = 'protein_coding_primary_transcript';

--- ************************************************
--- *** relation: forward_primer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A single stranded oligo used for polymer ***
--- *** ase chain reaction.                      ***
--- ************************************************
---

CREATE VIEW forward_primer AS
  SELECT
    feature_id AS forward_primer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'forward_primer';

--- ************************************************
--- *** relation: rna_sequence_secondary_structure ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A folded RNA sequence.                   ***
--- ************************************************
---

CREATE VIEW rna_sequence_secondary_structure AS
  SELECT
    feature_id AS rna_sequence_secondary_structure_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'stem_loop' OR cvterm.name = 'tetraloop' OR cvterm.name = 'RNA_sequence_secondary_structure';

--- ************************************************
--- *** relation: transcriptionally_regulated ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a gene that is r ***
--- *** egulated at transcription.               ***
--- ************************************************
---

CREATE VIEW transcriptionally_regulated AS
  SELECT
    feature_id AS transcriptionally_regulated_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'transcriptionally_constitutive' OR cvterm.name = 'transcriptionally_induced' OR cvterm.name = 'transcriptionally_repressed' OR cvterm.name = 'autoregulated' OR cvterm.name = 'positively_autoregulated' OR cvterm.name = 'negatively_autoregulated' OR cvterm.name = 'silenced' OR cvterm.name = 'silenced_by_DNA_modification' OR cvterm.name = 'silenced_by_RNA_interference' OR cvterm.name = 'silenced_by_histone_modification' OR cvterm.name = 'silenced_by_DNA_methylation' OR cvterm.name = 'silenced_by_histone_methylation' OR cvterm.name = 'silenced_by_histone_deacetylation' OR cvterm.name = 'negatively_autoregulated' OR cvterm.name = 'positively_autoregulated' OR cvterm.name = 'transcriptionally_regulated';

--- ************************************************
--- *** relation: transcriptionally_constitutive ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Expressed in relatively constant amounts ***
--- ***  without regard to cellular environmenta ***
--- *** l conditions such as the concentration o ***
--- *** f a particular substrate.                ***
--- ************************************************
---

CREATE VIEW transcriptionally_constitutive AS
  SELECT
    feature_id AS transcriptionally_constitutive_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'transcriptionally_constitutive';

--- ************************************************
--- *** relation: transcriptionally_induced ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An inducer molecule is required for tran ***
--- *** scription to occur.                      ***
--- ************************************************
---

CREATE VIEW transcriptionally_induced AS
  SELECT
    feature_id AS transcriptionally_induced_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'positively_autoregulated' OR cvterm.name = 'transcriptionally_induced';

--- ************************************************
--- *** relation: transcriptionally_repressed ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A repressor molecule is required for tra ***
--- *** nscription to stop.                      ***
--- ************************************************
---

CREATE VIEW transcriptionally_repressed AS
  SELECT
    feature_id AS transcriptionally_repressed_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'negatively_autoregulated' OR cvterm.name = 'silenced' OR cvterm.name = 'silenced_by_DNA_modification' OR cvterm.name = 'silenced_by_RNA_interference' OR cvterm.name = 'silenced_by_histone_modification' OR cvterm.name = 'silenced_by_DNA_methylation' OR cvterm.name = 'silenced_by_histone_methylation' OR cvterm.name = 'silenced_by_histone_deacetylation' OR cvterm.name = 'transcriptionally_repressed';

--- ************************************************
--- *** relation: silenced_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is silenced.                 ***
--- ************************************************
---

CREATE VIEW silenced_gene AS
  SELECT
    feature_id AS silenced_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_silenced_by_DNA_modification' OR cvterm.name = 'gene_silenced_by_RNA_interference' OR cvterm.name = 'gene_silenced_by_histone_modification' OR cvterm.name = 'gene_silenced_by_DNA_methylation' OR cvterm.name = 'gene_silenced_by_histone_methylation' OR cvterm.name = 'gene_silenced_by_histone_deacetylation' OR cvterm.name = 'silenced_gene';

--- ************************************************
--- *** relation: gene_silenced_by_dna_modification ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is silenced by DNA modificat ***
--- *** ion.                                     ***
--- ************************************************
---

CREATE VIEW gene_silenced_by_dna_modification AS
  SELECT
    feature_id AS gene_silenced_by_dna_modification_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_silenced_by_DNA_methylation' OR cvterm.name = 'gene_silenced_by_DNA_modification';

--- ************************************************
--- *** relation: gene_silenced_by_dna_methylation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is silenced by DNA methylati ***
--- *** on.                                      ***
--- ************************************************
---

CREATE VIEW gene_silenced_by_dna_methylation AS
  SELECT
    feature_id AS gene_silenced_by_dna_methylation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_silenced_by_DNA_methylation';

--- ************************************************
--- *** relation: post_translationally_regulated ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a gene that is r ***
--- *** egulated after it has been translated.   ***
--- ************************************************
---

CREATE VIEW post_translationally_regulated AS
  SELECT
    feature_id AS post_translationally_regulated_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'post_translationally_regulated_by_protein_stability' OR cvterm.name = 'post_translationally_regulated_by_protein_modification' OR cvterm.name = 'post_translationally_regulated';

--- ************************************************
--- *** relation: translationally_regulated ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a gene that is r ***
--- *** egulated as it is translated.            ***
--- ************************************************
---

CREATE VIEW translationally_regulated AS
  SELECT
    feature_id AS translationally_regulated_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'translationally_regulated';

--- ************************************************
--- *** relation: reverse_primer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A single stranded oligo used for polymer ***
--- *** ase chain reaction.                      ***
--- ************************************************
---

CREATE VIEW reverse_primer AS
  SELECT
    feature_id AS reverse_primer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'reverse_primer';

--- ************************************************
--- *** relation: epigenetically_modified ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** This attribute describes a gene where he ***
--- *** ritable changes other than those in the  ***
--- *** DNA sequence occur. These changes includ ***
--- *** e: modification to the DNA (such as DNA  ***
--- *** methylation, the covalent modification o ***
--- *** f cytosine), and post-translational modi ***
--- *** fication of histones.                    ***
--- ************************************************
---

CREATE VIEW epigenetically_modified AS
  SELECT
    feature_id AS epigenetically_modified_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'imprinted' OR cvterm.name = 'allelically_excluded' OR cvterm.name = 'rearranged_at_DNA_level' OR cvterm.name = 'maternally_imprinted' OR cvterm.name = 'paternally_imprinted' OR cvterm.name = 'epigenetically_modified';

--- ************************************************
--- *** relation: imprinted ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Imprinted genes are epigenetically modif ***
--- *** ied genes that are expressed monoallelic ***
--- *** ally according to their parent of origin ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW imprinted AS
  SELECT
    feature_id AS imprinted_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'maternally_imprinted' OR cvterm.name = 'paternally_imprinted' OR cvterm.name = 'imprinted';

--- ************************************************
--- *** relation: maternally_imprinted ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The maternal copy of the gene is modifie ***
--- *** d, rendering it transcriptionally silent ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW maternally_imprinted AS
  SELECT
    feature_id AS maternally_imprinted_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'maternally_imprinted';

--- ************************************************
--- *** relation: paternally_imprinted ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The paternal copy of the gene is modifie ***
--- *** d, rendering it transcriptionally silent ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW paternally_imprinted AS
  SELECT
    feature_id AS paternally_imprinted_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'paternally_imprinted';

--- ************************************************
--- *** relation: allelically_excluded ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Allelic exclusion is a process occurring ***
--- ***  in diploid organisms, where a gene is i ***
--- *** nactivated and not expressed in that cel ***
--- *** l.                                       ***
--- ************************************************
---

CREATE VIEW allelically_excluded AS
  SELECT
    feature_id AS allelically_excluded_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'allelically_excluded';

--- ************************************************
--- *** relation: gene_rearranged_at_dna_level ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An epigenetically modified gene, rearran ***
--- *** ged at the DNA level.                    ***
--- ************************************************
---

CREATE VIEW gene_rearranged_at_dna_level AS
  SELECT
    feature_id AS gene_rearranged_at_dna_level_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_rearranged_at_DNA_level';

--- ************************************************
--- *** relation: ribosome_entry_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Region in mRNA where ribosome assembles. ***
--- ************************************************
---

CREATE VIEW ribosome_entry_site AS
  SELECT
    feature_id AS ribosome_entry_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'internal_ribosome_entry_site' OR cvterm.name = 'Shine_Dalgarno_sequence' OR cvterm.name = 'kozak_sequence' OR cvterm.name = 'internal_Shine_Dalgarno_sequence' OR cvterm.name = 'ribosome_entry_site';

--- ************************************************
--- *** relation: attenuator ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence segment located within the fi ***
--- *** ve prime end of an mRNA that causes prem ***
--- *** ature termination of translation.        ***
--- ************************************************
---

CREATE VIEW attenuator AS
  SELECT
    feature_id AS attenuator_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'attenuator';

--- ************************************************
--- *** relation: terminator ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The sequence of DNA located either at th ***
--- *** e end of the transcript that causes RNA  ***
--- *** polymerase to terminate transcription.   ***
--- ************************************************
---

CREATE VIEW terminator AS
  SELECT
    feature_id AS terminator_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'bacterial_terminator' OR cvterm.name = 'eukaryotic_terminator' OR cvterm.name = 'rho_dependent_bacterial_terminator' OR cvterm.name = 'rho_independent_bacterial_terminator' OR cvterm.name = 'terminator_of_type_2_RNApol_III_promoter' OR cvterm.name = 'terminator';

--- ************************************************
--- *** relation: dna_sequence_secondary_structure ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A folded DNA sequence.                   ***
--- ************************************************
---

CREATE VIEW dna_sequence_secondary_structure AS
  SELECT
    feature_id AS dna_sequence_secondary_structure_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'i_motif' OR cvterm.name = 'DNA_sequence_secondary_structure';

--- ************************************************
--- *** relation: assembly_component ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of known length which may be us ***
--- *** ed to manufacture a longer region.       ***
--- ************************************************
---

CREATE VIEW assembly_component AS
  SELECT
    feature_id AS assembly_component_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'contig' OR cvterm.name = 'read' OR cvterm.name = 'restriction_fragment' OR cvterm.name = 'golden_path_fragment' OR cvterm.name = 'tiling_path_fragment' OR cvterm.name = 'gap' OR cvterm.name = 'sonicate_fragment' OR cvterm.name = 'paired_end_fragment' OR cvterm.name = 'read_pair' OR cvterm.name = 'contig_read' OR cvterm.name = 'BAC_end' OR cvterm.name = 'dye_terminator_read' OR cvterm.name = 'pyrosequenced_read' OR cvterm.name = 'ligation_based_read' OR cvterm.name = 'polymerase_synthesis_read' OR cvterm.name = 'PAC_end' OR cvterm.name = 'YAC_end' OR cvterm.name = 'clone_end' OR cvterm.name = 'RFLP_fragment' OR cvterm.name = 'tiling_path_clone' OR cvterm.name = 'assembly_component';

--- ************************************************
--- *** relation: recoded_codon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A codon that has been redefined at trans ***
--- *** lation. The redefinition may be as a res ***
--- *** ult of translational bypass, translation ***
--- *** al frameshifting or stop codon readthrou ***
--- *** gh.                                      ***
--- ************************************************
---

CREATE VIEW recoded_codon AS
  SELECT
    feature_id AS recoded_codon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'stop_codon_read_through' OR cvterm.name = 'stop_codon_redefined_as_pyrrolysine' OR cvterm.name = 'stop_codon_redefined_as_selenocysteine' OR cvterm.name = 'recoded_codon';

--- ************************************************
--- *** relation: capped ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing when a sequence, ***
--- ***  usually an mRNA is capped by the additi ***
--- *** on of a modified guanine nucleotide at t ***
--- *** he 5' end.                               ***
--- ************************************************
---

CREATE VIEW capped AS
  SELECT
    feature_id AS capped_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'capped';

--- ************************************************
--- *** relation: exon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of the transcript sequence with ***
--- *** in a gene which is not removed from the  ***
--- *** primary RNA transcript by RNA splicing.  ***
--- ************************************************
---

CREATE VIEW exon AS
  SELECT
    feature_id AS exon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'coding_exon' OR cvterm.name = 'noncoding_exon' OR cvterm.name = 'interior_exon' OR cvterm.name = 'exon_of_single_exon_gene' OR cvterm.name = 'interior_coding_exon' OR cvterm.name = 'five_prime_coding_exon' OR cvterm.name = 'three_prime_coding_exon' OR cvterm.name = 'three_prime_noncoding_exon' OR cvterm.name = 'five_prime_noncoding_exon' OR cvterm.name = 'exon';

--- ************************************************
--- *** relation: supercontig ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** One or more contigs that have been order ***
--- *** ed and oriented using end-read informati ***
--- *** on. Contains gaps that are filled with N ***
--- *** 's.                                      ***
--- ************************************************
---

CREATE VIEW supercontig AS
  SELECT
    feature_id AS supercontig_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'supercontig';

--- ************************************************
--- *** relation: contig ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A contiguous sequence derived from seque ***
--- *** nce assembly. Has no gaps, but may conta ***
--- *** in N's from unavailable bases.           ***
--- ************************************************
---

CREATE VIEW contig AS
  SELECT
    feature_id AS contig_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'contig';

--- ************************************************
--- *** relation: read ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence obtained from a single sequen ***
--- *** cing experiment. Typically a read is pro ***
--- *** duced when a base calling program interp ***
--- *** rets information from a chromatogram tra ***
--- *** ce file produced from a sequencing machi ***
--- *** ne.                                      ***
--- ************************************************
---

CREATE VIEW read AS
  SELECT
    feature_id AS read_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'read_pair' OR cvterm.name = 'contig_read' OR cvterm.name = 'BAC_end' OR cvterm.name = 'dye_terminator_read' OR cvterm.name = 'pyrosequenced_read' OR cvterm.name = 'ligation_based_read' OR cvterm.name = 'polymerase_synthesis_read' OR cvterm.name = 'PAC_end' OR cvterm.name = 'YAC_end' OR cvterm.name = 'clone_end' OR cvterm.name = 'read';

--- ************************************************
--- *** relation: clone ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A piece of DNA that has been inserted in ***
--- ***  a vector so that it can be propagated i ***
--- *** n a host bacterium or some other organis ***
--- *** m.                                       ***
--- ************************************************
---

CREATE VIEW clone AS
  SELECT
    feature_id AS clone_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'genomic_clone' OR cvterm.name = 'cDNA_clone' OR cvterm.name = 'tiling_path_clone' OR cvterm.name = 'validated_cDNA_clone' OR cvterm.name = 'invalidated_cDNA_clone' OR cvterm.name = 'three_prime_RACE_clone' OR cvterm.name = 'chimeric_cDNA_clone' OR cvterm.name = 'genomically_contaminated_cDNA_clone' OR cvterm.name = 'polyA_primed_cDNA_clone' OR cvterm.name = 'partially_processed_cDNA_clone' OR cvterm.name = 'clone';

--- ************************************************
--- *** relation: yac ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Yeast Artificial Chromosome, a vector co ***
--- *** nstructed from the telomeric, centromeri ***
--- *** c, and replication origin sequences need ***
--- *** ed for replication in yeast cells.       ***
--- ************************************************
---

CREATE VIEW yac AS
  SELECT
    feature_id AS yac_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'YAC';

--- ************************************************
--- *** relation: bac ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Bacterial Artificial Chromosome, a cloni ***
--- *** ng vector that can be propagated as mini ***
--- *** -chromosomes in a bacterial host.        ***
--- ************************************************
---

CREATE VIEW bac AS
  SELECT
    feature_id AS bac_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'BAC';

--- ************************************************
--- *** relation: pac ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The P1-derived artificial chromosome are ***
--- ***  DNA constructs that are derived from th ***
--- *** e DNA of P1 bacteriophage. They can carr ***
--- *** y large amounts (about 100-300 kilobases ***
--- *** ) of other sequences for a variety of bi ***
--- *** oengineering purposes. It is one type of ***
--- ***  vector used to clone DNA fragments (100 ***
--- *** - to 300-kb insert size; average, 150 kb ***
--- *** ) in Escherichia coli cells.             ***
--- ************************************************
---

CREATE VIEW pac AS
  SELECT
    feature_id AS pac_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'PAC';

--- ************************************************
--- *** relation: plasmid ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A self replicating, using the hosts cell ***
--- *** ular machinery, often circular nucleic a ***
--- *** cid molecule that is distinct from a chr ***
--- *** omosome in the organism.                 ***
--- ************************************************
---

CREATE VIEW plasmid AS
  SELECT
    feature_id AS plasmid_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'engineered_plasmid' OR cvterm.name = 'episome' OR cvterm.name = 'natural_plasmid' OR cvterm.name = 'engineered_episome' OR cvterm.name = 'gene_trap_construct' OR cvterm.name = 'promoter_trap_construct' OR cvterm.name = 'enhancer_trap_construct' OR cvterm.name = 'engineered_episome' OR cvterm.name = 'plasmid';

--- ************************************************
--- *** relation: cosmid ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A cloning vector that is a hybrid of lam ***
--- *** bda phages and a plasmid that can be pro ***
--- *** pagated as a plasmid or packaged as a ph ***
--- *** age,since they retain the lambda cos sit ***
--- *** es.                                      ***
--- ************************************************
---

CREATE VIEW cosmid AS
  SELECT
    feature_id AS cosmid_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cosmid';

--- ************************************************
--- *** relation: phagemid ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A plasmid which carries within its seque ***
--- *** nce a bacteriophage replication origin.  ***
--- *** When the host bacterium is infected with ***
--- ***  "helper" phage, a phagemid is replicate ***
--- *** d along with the phage DNA and packaged  ***
--- *** into phage capsids.                      ***
--- ************************************************
---

CREATE VIEW phagemid AS
  SELECT
    feature_id AS phagemid_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'phagemid';

--- ************************************************
--- *** relation: fosmid ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A cloning vector that utilizes the E. co ***
--- *** li F factor.                             ***
--- ************************************************
---

CREATE VIEW fosmid AS
  SELECT
    feature_id AS fosmid_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'fosmid';

--- ************************************************
--- *** relation: deletion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The point at which one or more contiguou ***
--- *** s nucleotides were excised.              ***
--- ************************************************
---

CREATE VIEW deletion AS
  SELECT
    feature_id AS deletion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'deletion';

--- ************************************************
--- *** relation: methylated_a ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A modified RNA base in which adenine has ***
--- ***  been methylated.                        ***
--- ************************************************
---

CREATE VIEW methylated_a AS
  SELECT
    feature_id AS methylated_a_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'methylated_A';

--- ************************************************
--- *** relation: splice_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Consensus region of primary transcript b ***
--- *** ordering junction of splicing. A region  ***
--- *** that overlaps exactly 2 base and adjacen ***
--- *** t_to splice_junction.                    ***
--- ************************************************
---

CREATE VIEW splice_site AS
  SELECT
    feature_id AS splice_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cis_splice_site' OR cvterm.name = 'trans_splice_site' OR cvterm.name = 'cryptic_splice_site' OR cvterm.name = 'five_prime_cis_splice_site' OR cvterm.name = 'three_prime_cis_splice_site' OR cvterm.name = 'recursive_splice_site' OR cvterm.name = 'canonical_five_prime_splice_site' OR cvterm.name = 'non_canonical_five_prime_splice_site' OR cvterm.name = 'canonical_three_prime_splice_site' OR cvterm.name = 'non_canonical_three_prime_splice_site' OR cvterm.name = 'trans_splice_acceptor_site' OR cvterm.name = 'trans_splice_donor_site' OR cvterm.name = 'SL1_acceptor_site' OR cvterm.name = 'SL2_acceptor_site' OR cvterm.name = 'SL3_acceptor_site' OR cvterm.name = 'SL4_acceptor_site' OR cvterm.name = 'SL5_acceptor_site' OR cvterm.name = 'SL6_acceptor_site' OR cvterm.name = 'SL7_acceptor_site' OR cvterm.name = 'SL8_acceptor_site' OR cvterm.name = 'SL9_acceptor_site' OR cvterm.name = 'SL10_accceptor_site' OR cvterm.name = 'SL11_acceptor_site' OR cvterm.name = 'SL12_acceptor_site' OR cvterm.name = 'splice_site';

--- ************************************************
--- *** relation: five_prime_cis_splice_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Intronic 2 bp region bordering the exon, ***
--- ***  at the 5' edge of the intron. A splice_ ***
--- *** site that is downstream_adjacent_to exon ***
--- ***  and starts intron.                      ***
--- ************************************************
---

CREATE VIEW five_prime_cis_splice_site AS
  SELECT
    feature_id AS five_prime_cis_splice_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'canonical_five_prime_splice_site' OR cvterm.name = 'non_canonical_five_prime_splice_site' OR cvterm.name = 'five_prime_cis_splice_site';

--- ************************************************
--- *** relation: three_prime_cis_splice_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Intronic 2 bp region bordering the exon, ***
--- ***  at the 3' edge of the intron. A splice_ ***
--- *** site that is upstream_adjacent_to exon a ***
--- *** nd finishes intron.                      ***
--- ************************************************
---

CREATE VIEW three_prime_cis_splice_site AS
  SELECT
    feature_id AS three_prime_cis_splice_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'canonical_three_prime_splice_site' OR cvterm.name = 'non_canonical_three_prime_splice_site' OR cvterm.name = 'three_prime_cis_splice_site';

--- ************************************************
--- *** relation: enhancer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A cis-acting sequence that increases the ***
--- ***  utilization of (some) eukaryotic promot ***
--- *** ers, and can function in either orientat ***
--- *** ion and in any location (upstream or dow ***
--- *** nstream) relative to the promoter.       ***
--- ************************************************
---

CREATE VIEW enhancer AS
  SELECT
    feature_id AS enhancer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'enhancer_bound_by_factor' OR cvterm.name = 'shadow_enhancer' OR cvterm.name = 'enhancer';

--- ************************************************
--- *** relation: enhancer_bound_by_factor ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An enhancer bound by a factor.           ***
--- ************************************************
---

CREATE VIEW enhancer_bound_by_factor AS
  SELECT
    feature_id AS enhancer_bound_by_factor_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'enhancer_bound_by_factor';

--- ************************************************
--- *** relation: promoter ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A regulatory_region composed of the TSS( ***
--- *** s) and binding sites for TF_complexes of ***
--- ***  the basal transcription machinery.      ***
--- ************************************************
---

CREATE VIEW promoter AS
  SELECT
    feature_id AS promoter_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'bidirectional_promoter' OR cvterm.name = 'RNA_polymerase_promoter' OR cvterm.name = 'RNApol_I_promoter' OR cvterm.name = 'RNApol_II_promoter' OR cvterm.name = 'RNApol_III_promoter' OR cvterm.name = 'bacterial_RNApol_promoter' OR cvterm.name = 'Phage_RNA_Polymerase_Promoter' OR cvterm.name = 'RNApol_II_core_promoter' OR cvterm.name = 'RNApol_III_promoter_type_1' OR cvterm.name = 'RNApol_III_promoter_type_2' OR cvterm.name = 'RNApol_III_promoter_type_3' OR cvterm.name = 'bacterial_RNApol_promoter_sigma_70' OR cvterm.name = 'bacterial_RNApol_promoter_sigma54' OR cvterm.name = 'SP6_RNA_Polymerase_Promoter' OR cvterm.name = 'T3_RNA_Polymerase_Promoter' OR cvterm.name = 'T7_RNA_Polymerase_Promoter' OR cvterm.name = 'promoter';

--- ************************************************
--- *** relation: rnapol_i_promoter ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A DNA sequence in eukaryotic DNA to whic ***
--- *** h RNA polymerase I binds, to begin trans ***
--- *** cription.                                ***
--- ************************************************
---

CREATE VIEW rnapol_i_promoter AS
  SELECT
    feature_id AS rnapol_i_promoter_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RNApol_I_promoter';

--- ************************************************
--- *** relation: rnapol_ii_promoter ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A DNA sequence in eukaryotic DNA to whic ***
--- *** h RNA polymerase II binds, to begin tran ***
--- *** scription.                               ***
--- ************************************************
---

CREATE VIEW rnapol_ii_promoter AS
  SELECT
    feature_id AS rnapol_ii_promoter_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RNApol_II_core_promoter' OR cvterm.name = 'RNApol_II_promoter';

--- ************************************************
--- *** relation: rnapol_iii_promoter ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A DNA sequence in eukaryotic DNA to whic ***
--- *** h RNA polymerase III binds, to begin tra ***
--- *** nscription.                              ***
--- ************************************************
---

CREATE VIEW rnapol_iii_promoter AS
  SELECT
    feature_id AS rnapol_iii_promoter_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RNApol_III_promoter_type_1' OR cvterm.name = 'RNApol_III_promoter_type_2' OR cvterm.name = 'RNApol_III_promoter_type_3' OR cvterm.name = 'RNApol_III_promoter';

--- ************************************************
--- *** relation: caat_signal ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Part of a conserved sequence located abo ***
--- *** ut 75-bp upstream of the start point of  ***
--- *** eukaryotic transcription units which may ***
--- ***  be involved in RNA polymerase binding;  ***
--- *** consensus=GG(C|T)CAATCT.                 ***
--- ************************************************
---

CREATE VIEW caat_signal AS
  SELECT
    feature_id AS caat_signal_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'CAAT_signal';

--- ************************************************
--- *** relation: gc_rich_promoter_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A conserved GC-rich region located upstr ***
--- *** eam of the start point of eukaryotic tra ***
--- *** nscription units which may occur in mult ***
--- *** iple copies or in either orientation; co ***
--- *** nsensus=GGGCGG.                          ***
--- ************************************************
---

CREATE VIEW gc_rich_promoter_region AS
  SELECT
    feature_id AS gc_rich_promoter_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'GC_rich_promoter_region';

--- ************************************************
--- *** relation: tata_box ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A conserved AT-rich septamer found about ***
--- ***  25-bp before the start point of many eu ***
--- *** karyotic RNA polymerase II transcript un ***
--- *** its; may be involved in positioning the  ***
--- *** enzyme for correct initiation; consensus ***
--- *** =TATA(A|T)A(A|T).                        ***
--- ************************************************
---

CREATE VIEW tata_box AS
  SELECT
    feature_id AS tata_box_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RNA_polymerase_II_TATA_box' OR cvterm.name = 'RNA_polymerase_III_TATA_box' OR cvterm.name = 'TATA_box';

--- ************************************************
--- *** relation: minus_10_signal ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A conserved region about 10-bp upstream  ***
--- *** of the start point of bacterial transcri ***
--- *** ption units which may be involved in bin ***
--- *** ding RNA polymerase; consensus=TAtAaT. T ***
--- *** his region is associated with sigma fact ***
--- *** or 70.                                   ***
--- ************************************************
---

CREATE VIEW minus_10_signal AS
  SELECT
    feature_id AS minus_10_signal_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'minus_10_signal';

--- ************************************************
--- *** relation: minus_35_signal ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A conserved hexamer about 35-bp upstream ***
--- ***  of the start point of bacterial transcr ***
--- *** iption units; consensus=TTGACa or TGTTGA ***
--- *** CA. This region is associated with sigma ***
--- ***  factor 70.                              ***
--- ************************************************
---

CREATE VIEW minus_35_signal AS
  SELECT
    feature_id AS minus_35_signal_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'minus_35_signal';

--- ************************************************
--- *** relation: cross_genome_match ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A nucleotide match against a sequence fr ***
--- *** om another organism.                     ***
--- ************************************************
---

CREATE VIEW cross_genome_match AS
  SELECT
    feature_id AS cross_genome_match_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cross_genome_match';

--- ************************************************
--- *** relation: operon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A group of contiguous genes transcribed  ***
--- *** as a single (polycistronic) mRNA from a  ***
--- *** single regulatory region.                ***
--- ************************************************
---

CREATE VIEW operon AS
  SELECT
    feature_id AS operon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'operon';

--- ************************************************
--- *** relation: clone_insert_start ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The start of the clone insert.           ***
--- ************************************************
---

CREATE VIEW clone_insert_start AS
  SELECT
    feature_id AS clone_insert_start_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'clone_insert_start';

--- ************************************************
--- *** relation: retrotransposon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transposable element that is incorpora ***
--- *** ted into a chromosome by a mechanism tha ***
--- *** t requires reverse transcriptase.        ***
--- ************************************************
---

CREATE VIEW retrotransposon AS
  SELECT
    feature_id AS retrotransposon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'LTR_retrotransposon' OR cvterm.name = 'non_LTR_retrotransposon' OR cvterm.name = 'LINE_element' OR cvterm.name = 'SINE_element' OR cvterm.name = 'retrotransposon';

--- ************************************************
--- *** relation: translated_nucleotide_match ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A match against a translated sequence.   ***
--- ************************************************
---

CREATE VIEW translated_nucleotide_match AS
  SELECT
    feature_id AS translated_nucleotide_match_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'translated_nucleotide_match';

--- ************************************************
--- *** relation: dna_transposon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transposon where the mechanism of tran ***
--- *** sposition is via a DNA intermediate.     ***
--- ************************************************
---

CREATE VIEW dna_transposon AS
  SELECT
    feature_id AS dna_transposon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'terminal_inverted_repeat_element' OR cvterm.name = 'foldback_element' OR cvterm.name = 'conjugative_transposon' OR cvterm.name = 'helitron' OR cvterm.name = 'p_element' OR cvterm.name = 'MITE' OR cvterm.name = 'insertion_sequence' OR cvterm.name = 'polinton' OR cvterm.name = 'DNA_transposon';

--- ************************************************
--- *** relation: non_transcribed_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of the gene which is not transc ***
--- *** ribed.                                   ***
--- ************************************************
---

CREATE VIEW non_transcribed_region AS
  SELECT
    feature_id AS non_transcribed_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'non_transcribed_region';

--- ************************************************
--- *** relation: u2_intron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A major type of spliceosomal intron spli ***
--- *** ced by the U2 spliceosome, that includes ***
--- ***  U1, U2, U4/U6 and U5 snRNAs.            ***
--- ************************************************
---

CREATE VIEW u2_intron AS
  SELECT
    feature_id AS u2_intron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'U2_intron';

--- ************************************************
--- *** relation: primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transcript that in its initial state r ***
--- *** equires modification to be functional.   ***
--- ************************************************
---

CREATE VIEW primary_transcript AS
  SELECT
    feature_id AS primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'protein_coding_primary_transcript' OR cvterm.name = 'nc_primary_transcript' OR cvterm.name = 'polycistronic_primary_transcript' OR cvterm.name = 'monocistronic_primary_transcript' OR cvterm.name = 'mini_exon_donor_RNA' OR cvterm.name = 'antisense_primary_transcript' OR cvterm.name = 'capped_primary_transcript' OR cvterm.name = 'pre_edited_mRNA' OR cvterm.name = 'scRNA_primary_transcript' OR cvterm.name = 'rRNA_primary_transcript' OR cvterm.name = 'tRNA_primary_transcript' OR cvterm.name = 'snRNA_primary_transcript' OR cvterm.name = 'snoRNA_primary_transcript' OR cvterm.name = 'tmRNA_primary_transcript' OR cvterm.name = 'SRP_RNA_primary_transcript' OR cvterm.name = 'miRNA_primary_transcript' OR cvterm.name = 'tasiRNA_primary_transcript' OR cvterm.name = 'rRNA_small_subunit_primary_transcript' OR cvterm.name = 'rRNA_large_subunit_primary_transcript' OR cvterm.name = 'alanine_tRNA_primary_transcript' OR cvterm.name = 'arginine_tRNA_primary_transcript' OR cvterm.name = 'asparagine_tRNA_primary_transcript' OR cvterm.name = 'aspartic_acid_tRNA_primary_transcript' OR cvterm.name = 'cysteine_tRNA_primary_transcript' OR cvterm.name = 'glutamic_acid_tRNA_primary_transcript' OR cvterm.name = 'glutamine_tRNA_primary_transcript' OR cvterm.name = 'glycine_tRNA_primary_transcript' OR cvterm.name = 'histidine_tRNA_primary_transcript' OR cvterm.name = 'isoleucine_tRNA_primary_transcript' OR cvterm.name = 'leucine_tRNA_primary_transcript' OR cvterm.name = 'lysine_tRNA_primary_transcript' OR cvterm.name = 'methionine_tRNA_primary_transcript' OR cvterm.name = 'phenylalanine_tRNA_primary_transcript' OR cvterm.name = 'proline_tRNA_primary_transcript' OR cvterm.name = 'serine_tRNA_primary_transcript' OR cvterm.name = 'threonine_tRNA_primary_transcript' OR cvterm.name = 'tryptophan_tRNA_primary_transcript' OR cvterm.name = 'tyrosine_tRNA_primary_transcript' OR cvterm.name = 'valine_tRNA_primary_transcript' OR cvterm.name = 'pyrrolysine_tRNA_primary_transcript' OR cvterm.name = 'selenocysteine_tRNA_primary_transcript' OR cvterm.name = 'methylation_guide_snoRNA_primary_transcript' OR cvterm.name = 'rRNA_cleavage_snoRNA_primary_transcript' OR cvterm.name = 'C_D_box_snoRNA_primary_transcript' OR cvterm.name = 'H_ACA_box_snoRNA_primary_transcript' OR cvterm.name = 'U14_snoRNA_primary_transcript' OR cvterm.name = 'stRNA_primary_transcript' OR cvterm.name = 'dicistronic_primary_transcript' OR cvterm.name = 'primary_transcript';

--- ************************************************
--- *** relation: ltr_retrotransposon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A retrotransposon flanked by long termin ***
--- *** al repeat sequences.                     ***
--- ************************************************
---

CREATE VIEW ltr_retrotransposon AS
  SELECT
    feature_id AS ltr_retrotransposon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'LTR_retrotransposon';

--- ************************************************
--- *** relation: intron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of a primary transcript that is ***
--- ***  transcribed, but removed from within th ***
--- *** e transcript by splicing together the se ***
--- *** quences (exons) on either side of it.    ***
--- ************************************************
---

CREATE VIEW intron AS
  SELECT
    feature_id AS intron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_intron' OR cvterm.name = 'interior_intron' OR cvterm.name = 'three_prime_intron' OR cvterm.name = 'twintron' OR cvterm.name = 'UTR_intron' OR cvterm.name = 'autocatalytically_spliced_intron' OR cvterm.name = 'spliceosomal_intron' OR cvterm.name = 'mobile_intron' OR cvterm.name = 'endonuclease_spliced_intron' OR cvterm.name = 'five_prime_UTR_intron' OR cvterm.name = 'three_prime_UTR_intron' OR cvterm.name = 'group_I_intron' OR cvterm.name = 'group_II_intron' OR cvterm.name = 'group_III_intron' OR cvterm.name = 'group_IIA_intron' OR cvterm.name = 'group_IIB_intron' OR cvterm.name = 'U2_intron' OR cvterm.name = 'U12_intron' OR cvterm.name = 'archaeal_intron' OR cvterm.name = 'tRNA_intron' OR cvterm.name = 'intron';

--- ************************************************
--- *** relation: non_ltr_retrotransposon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A retrotransposon without long terminal  ***
--- *** repeat sequences.                        ***
--- ************************************************
---

CREATE VIEW non_ltr_retrotransposon AS
  SELECT
    feature_id AS non_ltr_retrotransposon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'LINE_element' OR cvterm.name = 'SINE_element' OR cvterm.name = 'non_LTR_retrotransposon';

--- ************************************************
--- *** relation: five_prime_intron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW five_prime_intron AS
  SELECT
    feature_id AS five_prime_intron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_intron';

--- ************************************************
--- *** relation: interior_intron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW interior_intron AS
  SELECT
    feature_id AS interior_intron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'interior_intron';

--- ************************************************
--- *** relation: three_prime_intron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW three_prime_intron AS
  SELECT
    feature_id AS three_prime_intron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_intron';

--- ************************************************
--- *** relation: rflp_fragment ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A DNA fragment used as a reagent to dete ***
--- *** ct the polymorphic genomic loci by hybri ***
--- *** dizing against the genomic DNA digested  ***
--- *** with a given restriction enzyme.         ***
--- ************************************************
---

CREATE VIEW rflp_fragment AS
  SELECT
    feature_id AS rflp_fragment_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RFLP_fragment';

--- ************************************************
--- *** relation: line_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A dispersed repeat family with many copi ***
--- *** es, each from 1 to 6 kb long. New elemen ***
--- *** ts are generated by retroposition of a t ***
--- *** ranscribed copy. Typically the LINE cont ***
--- *** ains 2 ORF's one of which is reverse tra ***
--- *** nscriptase, and 3'and 5' direct repeats. ***
--- ************************************************
---

CREATE VIEW line_element AS
  SELECT
    feature_id AS line_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'LINE_element';

--- ************************************************
--- *** relation: coding_exon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An exon whereby at least one base is par ***
--- *** t of a codon (here, 'codon' is inclusive ***
--- ***  of the stop_codon).                     ***
--- ************************************************
---

CREATE VIEW coding_exon AS
  SELECT
    feature_id AS coding_exon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'interior_coding_exon' OR cvterm.name = 'five_prime_coding_exon' OR cvterm.name = 'three_prime_coding_exon' OR cvterm.name = 'coding_exon';

--- ************************************************
--- *** relation: five_prime_coding_exon_coding_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The sequence of the five_prime_coding_ex ***
--- *** on that codes for protein.               ***
--- ************************************************
---

CREATE VIEW five_prime_coding_exon_coding_region AS
  SELECT
    feature_id AS five_prime_coding_exon_coding_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_coding_exon_coding_region';

--- ************************************************
--- *** relation: three_prime_coding_exon_coding_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The sequence of the three_prime_coding_e ***
--- *** xon that codes for protein.              ***
--- ************************************************
---

CREATE VIEW three_prime_coding_exon_coding_region AS
  SELECT
    feature_id AS three_prime_coding_exon_coding_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_coding_exon_coding_region';

--- ************************************************
--- *** relation: noncoding_exon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An exon that does not contain any codons ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW noncoding_exon AS
  SELECT
    feature_id AS noncoding_exon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_noncoding_exon' OR cvterm.name = 'five_prime_noncoding_exon' OR cvterm.name = 'noncoding_exon';

--- ************************************************
--- *** relation: translocation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of nucleotide sequence that has ***
--- ***  translocated to a new position.         ***
--- ************************************************
---

CREATE VIEW translocation AS
  SELECT
    feature_id AS translocation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'translocation';

--- ************************************************
--- *** relation: five_prime_coding_exon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The 5' most coding exon.                 ***
--- ************************************************
---

CREATE VIEW five_prime_coding_exon AS
  SELECT
    feature_id AS five_prime_coding_exon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_coding_exon';

--- ************************************************
--- *** relation: interior_exon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An exon that is bounded by 5' and 3' spl ***
--- *** ice sites.                               ***
--- ************************************************
---

CREATE VIEW interior_exon AS
  SELECT
    feature_id AS interior_exon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'interior_exon';

--- ************************************************
--- *** relation: three_prime_coding_exon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The coding exon that is most 3-prime on  ***
--- *** a given transcript.                      ***
--- ************************************************
---

CREATE VIEW three_prime_coding_exon AS
  SELECT
    feature_id AS three_prime_coding_exon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_coding_exon';

--- ************************************************
--- *** relation: utr ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Messenger RNA sequences that are untrans ***
--- *** lated and lie five prime or three prime  ***
--- *** to sequences which are translated.       ***
--- ************************************************
---

CREATE VIEW utr AS
  SELECT
    feature_id AS utr_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_UTR' OR cvterm.name = 'three_prime_UTR' OR cvterm.name = 'internal_UTR' OR cvterm.name = 'untranslated_region_polycistronic_mRNA' OR cvterm.name = 'UTR';

--- ************************************************
--- *** relation: five_prime_utr ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region at the 5' end of a mature trans ***
--- *** cript (preceding the initiation codon) t ***
--- *** hat is not translated into a protein.    ***
--- ************************************************
---

CREATE VIEW five_prime_utr AS
  SELECT
    feature_id AS five_prime_utr_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_UTR';

--- ************************************************
--- *** relation: three_prime_utr ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region at the 3' end of a mature trans ***
--- *** cript (following the stop codon) that is ***
--- ***  not translated into a protein.          ***
--- ************************************************
---

CREATE VIEW three_prime_utr AS
  SELECT
    feature_id AS three_prime_utr_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_UTR';

--- ************************************************
--- *** relation: sine_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A repetitive element, a few hundred base ***
--- ***  pairs long, that is dispersed throughou ***
--- *** t the genome. A common human SINE is the ***
--- ***  Alu element.                            ***
--- ************************************************
---

CREATE VIEW sine_element AS
  SELECT
    feature_id AS sine_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'SINE_element';

--- ************************************************
--- *** relation: simple_sequence_length_variation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW simple_sequence_length_variation AS
  SELECT
    feature_id AS simple_sequence_length_variation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'simple_sequence_length_variation';

--- ************************************************
--- *** relation: terminal_inverted_repeat_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A DNA transposable element defined as ha ***
--- *** ving termini with perfect, or nearly per ***
--- *** fect short inverted repeats, generally 1 ***
--- *** 0 - 40 nucleotides long.                 ***
--- ************************************************
---

CREATE VIEW terminal_inverted_repeat_element AS
  SELECT
    feature_id AS terminal_inverted_repeat_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'MITE' OR cvterm.name = 'insertion_sequence' OR cvterm.name = 'polinton' OR cvterm.name = 'terminal_inverted_repeat_element';

--- ************************************************
--- *** relation: rrna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding a ribosoma ***
--- *** l RNA.                                   ***
--- ************************************************
---

CREATE VIEW rrna_primary_transcript AS
  SELECT
    feature_id AS rrna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rRNA_small_subunit_primary_transcript' OR cvterm.name = 'rRNA_large_subunit_primary_transcript' OR cvterm.name = 'rRNA_primary_transcript';

--- ************************************************
--- *** relation: trna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding a transfer ***
--- ***  RNA (SO:0000253).                       ***
--- ************************************************
---

CREATE VIEW trna_primary_transcript AS
  SELECT
    feature_id AS trna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'alanine_tRNA_primary_transcript' OR cvterm.name = 'arginine_tRNA_primary_transcript' OR cvterm.name = 'asparagine_tRNA_primary_transcript' OR cvterm.name = 'aspartic_acid_tRNA_primary_transcript' OR cvterm.name = 'cysteine_tRNA_primary_transcript' OR cvterm.name = 'glutamic_acid_tRNA_primary_transcript' OR cvterm.name = 'glutamine_tRNA_primary_transcript' OR cvterm.name = 'glycine_tRNA_primary_transcript' OR cvterm.name = 'histidine_tRNA_primary_transcript' OR cvterm.name = 'isoleucine_tRNA_primary_transcript' OR cvterm.name = 'leucine_tRNA_primary_transcript' OR cvterm.name = 'lysine_tRNA_primary_transcript' OR cvterm.name = 'methionine_tRNA_primary_transcript' OR cvterm.name = 'phenylalanine_tRNA_primary_transcript' OR cvterm.name = 'proline_tRNA_primary_transcript' OR cvterm.name = 'serine_tRNA_primary_transcript' OR cvterm.name = 'threonine_tRNA_primary_transcript' OR cvterm.name = 'tryptophan_tRNA_primary_transcript' OR cvterm.name = 'tyrosine_tRNA_primary_transcript' OR cvterm.name = 'valine_tRNA_primary_transcript' OR cvterm.name = 'pyrrolysine_tRNA_primary_transcript' OR cvterm.name = 'selenocysteine_tRNA_primary_transcript' OR cvterm.name = 'tRNA_primary_transcript';

--- ************************************************
--- *** relation: alanine_trna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding alanyl tRN ***
--- *** A.                                       ***
--- ************************************************
---

CREATE VIEW alanine_trna_primary_transcript AS
  SELECT
    feature_id AS alanine_trna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'alanine_tRNA_primary_transcript';

--- ************************************************
--- *** relation: arg_trna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding arginyl tR ***
--- *** NA (SO:0000255).                         ***
--- ************************************************
---

CREATE VIEW arg_trna_primary_transcript AS
  SELECT
    feature_id AS arg_trna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'arginine_tRNA_primary_transcript';

--- ************************************************
--- *** relation: asparagine_trna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding asparaginy ***
--- *** l tRNA (SO:0000256).                     ***
--- ************************************************
---

CREATE VIEW asparagine_trna_primary_transcript AS
  SELECT
    feature_id AS asparagine_trna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'asparagine_tRNA_primary_transcript';

--- ************************************************
--- *** relation: aspartic_acid_trna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding aspartyl t ***
--- *** RNA (SO:0000257).                        ***
--- ************************************************
---

CREATE VIEW aspartic_acid_trna_primary_transcript AS
  SELECT
    feature_id AS aspartic_acid_trna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'aspartic_acid_tRNA_primary_transcript';

--- ************************************************
--- *** relation: cysteine_trna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding cysteinyl  ***
--- *** tRNA (SO:0000258).                       ***
--- ************************************************
---

CREATE VIEW cysteine_trna_primary_transcript AS
  SELECT
    feature_id AS cysteine_trna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cysteine_tRNA_primary_transcript';

--- ************************************************
--- *** relation: glutamic_acid_trna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding glutaminyl ***
--- ***  tRNA (SO:0000260).                      ***
--- ************************************************
---

CREATE VIEW glutamic_acid_trna_primary_transcript AS
  SELECT
    feature_id AS glutamic_acid_trna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'glutamic_acid_tRNA_primary_transcript';

--- ************************************************
--- *** relation: glutamine_trna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding glutamyl t ***
--- *** RNA (SO:0000260).                        ***
--- ************************************************
---

CREATE VIEW glutamine_trna_primary_transcript AS
  SELECT
    feature_id AS glutamine_trna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'glutamine_tRNA_primary_transcript';

--- ************************************************
--- *** relation: glycine_trna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding glycyl tRN ***
--- *** A (SO:0000263).                          ***
--- ************************************************
---

CREATE VIEW glycine_trna_primary_transcript AS
  SELECT
    feature_id AS glycine_trna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'glycine_tRNA_primary_transcript';

--- ************************************************
--- *** relation: histidine_trna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding histidyl t ***
--- *** RNA (SO:0000262).                        ***
--- ************************************************
---

CREATE VIEW histidine_trna_primary_transcript AS
  SELECT
    feature_id AS histidine_trna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'histidine_tRNA_primary_transcript';

--- ************************************************
--- *** relation: isoleucine_trna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding isoleucyl  ***
--- *** tRNA (SO:0000263).                       ***
--- ************************************************
---

CREATE VIEW isoleucine_trna_primary_transcript AS
  SELECT
    feature_id AS isoleucine_trna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'isoleucine_tRNA_primary_transcript';

--- ************************************************
--- *** relation: leucine_trna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding leucyl tRN ***
--- *** A (SO:0000264).                          ***
--- ************************************************
---

CREATE VIEW leucine_trna_primary_transcript AS
  SELECT
    feature_id AS leucine_trna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'leucine_tRNA_primary_transcript';

--- ************************************************
--- *** relation: lysine_trna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding lysyl tRNA ***
--- ***  (SO:0000265).                           ***
--- ************************************************
---

CREATE VIEW lysine_trna_primary_transcript AS
  SELECT
    feature_id AS lysine_trna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'lysine_tRNA_primary_transcript';

--- ************************************************
--- *** relation: methionine_trna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding methionyl  ***
--- *** tRNA (SO:0000266).                       ***
--- ************************************************
---

CREATE VIEW methionine_trna_primary_transcript AS
  SELECT
    feature_id AS methionine_trna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'methionine_tRNA_primary_transcript';

--- ************************************************
--- *** relation: phe_trna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding phenylalan ***
--- *** yl tRNA (SO:0000267).                    ***
--- ************************************************
---

CREATE VIEW phe_trna_primary_transcript AS
  SELECT
    feature_id AS phe_trna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'phenylalanine_tRNA_primary_transcript';

--- ************************************************
--- *** relation: proline_trna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding prolyl tRN ***
--- *** A (SO:0000268).                          ***
--- ************************************************
---

CREATE VIEW proline_trna_primary_transcript AS
  SELECT
    feature_id AS proline_trna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'proline_tRNA_primary_transcript';

--- ************************************************
--- *** relation: serine_trna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding seryl tRNA ***
--- ***  (SO:000269).                            ***
--- ************************************************
---

CREATE VIEW serine_trna_primary_transcript AS
  SELECT
    feature_id AS serine_trna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'serine_tRNA_primary_transcript';

--- ************************************************
--- *** relation: thr_trna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding threonyl t ***
--- *** RNA (SO:000270).                         ***
--- ************************************************
---

CREATE VIEW thr_trna_primary_transcript AS
  SELECT
    feature_id AS thr_trna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'threonine_tRNA_primary_transcript';

--- ************************************************
--- *** relation: try_trna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding tryptophan ***
--- *** yl tRNA (SO:000271).                     ***
--- ************************************************
---

CREATE VIEW try_trna_primary_transcript AS
  SELECT
    feature_id AS try_trna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tryptophan_tRNA_primary_transcript';

--- ************************************************
--- *** relation: tyrosine_trna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding tyrosyl tR ***
--- *** NA (SO:000272).                          ***
--- ************************************************
---

CREATE VIEW tyrosine_trna_primary_transcript AS
  SELECT
    feature_id AS tyrosine_trna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tyrosine_tRNA_primary_transcript';

--- ************************************************
--- *** relation: valine_trna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding valyl tRNA ***
--- ***  (SO:000273).                            ***
--- ************************************************
---

CREATE VIEW valine_trna_primary_transcript AS
  SELECT
    feature_id AS valine_trna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'valine_tRNA_primary_transcript';

--- ************************************************
--- *** relation: snrna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding a small nu ***
--- *** clear RNA (SO:0000274).                  ***
--- ************************************************
---

CREATE VIEW snrna_primary_transcript AS
  SELECT
    feature_id AS snrna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'snRNA_primary_transcript';

--- ************************************************
--- *** relation: snorna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding a small nu ***
--- *** cleolar mRNA (SO:0000275).               ***
--- ************************************************
---

CREATE VIEW snorna_primary_transcript AS
  SELECT
    feature_id AS snorna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'methylation_guide_snoRNA_primary_transcript' OR cvterm.name = 'rRNA_cleavage_snoRNA_primary_transcript' OR cvterm.name = 'C_D_box_snoRNA_primary_transcript' OR cvterm.name = 'H_ACA_box_snoRNA_primary_transcript' OR cvterm.name = 'U14_snoRNA_primary_transcript' OR cvterm.name = 'snoRNA_primary_transcript';

--- ************************************************
--- *** relation: mature_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transcript which has undergone the nec ***
--- *** essary modifications, if any, for its fu ***
--- *** nction. In eukaryotes this includes, for ***
--- ***  example, processing of introns, cleavag ***
--- *** e, base modification, and modifications  ***
--- *** to the 5' and/or the 3' ends, other than ***
--- ***  addition of bases. In bacteria function ***
--- *** al mRNAs are usually not modified.       ***
--- ************************************************
---

CREATE VIEW mature_transcript AS
  SELECT
    feature_id AS mature_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mRNA' OR cvterm.name = 'ncRNA' OR cvterm.name = 'mRNA_with_frameshift' OR cvterm.name = 'monocistronic_mRNA' OR cvterm.name = 'polycistronic_mRNA' OR cvterm.name = 'exemplar_mRNA' OR cvterm.name = 'capped_mRNA' OR cvterm.name = 'polyadenylated_mRNA' OR cvterm.name = 'trans_spliced_mRNA' OR cvterm.name = 'edited_mRNA' OR cvterm.name = 'consensus_mRNA' OR cvterm.name = 'recoded_mRNA' OR cvterm.name = 'mRNA_with_minus_1_frameshift' OR cvterm.name = 'mRNA_with_plus_1_frameshift' OR cvterm.name = 'mRNA_with_plus_2_frameshift' OR cvterm.name = 'mRNA_with_minus_2_frameshift' OR cvterm.name = 'dicistronic_mRNA' OR cvterm.name = 'mRNA_recoded_by_translational_bypass' OR cvterm.name = 'mRNA_recoded_by_codon_redefinition' OR cvterm.name = 'scRNA' OR cvterm.name = 'rRNA' OR cvterm.name = 'tRNA' OR cvterm.name = 'snRNA' OR cvterm.name = 'snoRNA' OR cvterm.name = 'small_regulatory_ncRNA' OR cvterm.name = 'RNase_MRP_RNA' OR cvterm.name = 'RNase_P_RNA' OR cvterm.name = 'telomerase_RNA' OR cvterm.name = 'vault_RNA' OR cvterm.name = 'Y_RNA' OR cvterm.name = 'rasiRNA' OR cvterm.name = 'SRP_RNA' OR cvterm.name = 'guide_RNA' OR cvterm.name = 'antisense_RNA' OR cvterm.name = 'siRNA' OR cvterm.name = 'stRNA' OR cvterm.name = 'class_II_RNA' OR cvterm.name = 'class_I_RNA' OR cvterm.name = 'piRNA' OR cvterm.name = 'lincRNA' OR cvterm.name = 'tasiRNA' OR cvterm.name = 'rRNA_cleavage_RNA' OR cvterm.name = 'small_subunit_rRNA' OR cvterm.name = 'large_subunit_rRNA' OR cvterm.name = 'rRNA_18S' OR cvterm.name = 'rRNA_16S' OR cvterm.name = 'rRNA_5_8S' OR cvterm.name = 'rRNA_5S' OR cvterm.name = 'rRNA_28S' OR cvterm.name = 'rRNA_23S' OR cvterm.name = 'rRNA_25S' OR cvterm.name = 'rRNA_21S' OR cvterm.name = 'alanyl_tRNA' OR cvterm.name = 'asparaginyl_tRNA' OR cvterm.name = 'aspartyl_tRNA' OR cvterm.name = 'cysteinyl_tRNA' OR cvterm.name = 'glutaminyl_tRNA' OR cvterm.name = 'glutamyl_tRNA' OR cvterm.name = 'glycyl_tRNA' OR cvterm.name = 'histidyl_tRNA' OR cvterm.name = 'isoleucyl_tRNA' OR cvterm.name = 'leucyl_tRNA' OR cvterm.name = 'lysyl_tRNA' OR cvterm.name = 'methionyl_tRNA' OR cvterm.name = 'phenylalanyl_tRNA' OR cvterm.name = 'prolyl_tRNA' OR cvterm.name = 'seryl_tRNA' OR cvterm.name = 'threonyl_tRNA' OR cvterm.name = 'tryptophanyl_tRNA' OR cvterm.name = 'tyrosyl_tRNA' OR cvterm.name = 'valyl_tRNA' OR cvterm.name = 'pyrrolysyl_tRNA' OR cvterm.name = 'arginyl_tRNA' OR cvterm.name = 'selenocysteinyl_tRNA' OR cvterm.name = 'U1_snRNA' OR cvterm.name = 'U2_snRNA' OR cvterm.name = 'U4_snRNA' OR cvterm.name = 'U4atac_snRNA' OR cvterm.name = 'U5_snRNA' OR cvterm.name = 'U6_snRNA' OR cvterm.name = 'U6atac_snRNA' OR cvterm.name = 'U11_snRNA' OR cvterm.name = 'U12_snRNA' OR cvterm.name = 'C_D_box_snoRNA' OR cvterm.name = 'H_ACA_box_snoRNA' OR cvterm.name = 'U14_snoRNA' OR cvterm.name = 'U3_snoRNA' OR cvterm.name = 'methylation_guide_snoRNA' OR cvterm.name = 'pseudouridylation_guide_snoRNA' OR cvterm.name = 'miRNA' OR cvterm.name = 'RNA_6S' OR cvterm.name = 'CsrB_RsmB_RNA' OR cvterm.name = 'DsrA_RNA' OR cvterm.name = 'OxyS_RNA' OR cvterm.name = 'RprA_RNA' OR cvterm.name = 'RRE_RNA' OR cvterm.name = 'spot_42_RNA' OR cvterm.name = 'tmRNA' OR cvterm.name = 'GcvB_RNA' OR cvterm.name = 'MicF_RNA' OR cvterm.name = 'mature_transcript';

--- ************************************************
--- *** relation: mrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Messenger RNA is the intermediate molecu ***
--- *** le between DNA and protein. It includes  ***
--- *** UTR and coding sequences. It does not co ***
--- *** ntain introns.                           ***
--- ************************************************
---

CREATE VIEW mrna AS
  SELECT
    feature_id AS mrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mRNA_with_frameshift' OR cvterm.name = 'monocistronic_mRNA' OR cvterm.name = 'polycistronic_mRNA' OR cvterm.name = 'exemplar_mRNA' OR cvterm.name = 'capped_mRNA' OR cvterm.name = 'polyadenylated_mRNA' OR cvterm.name = 'trans_spliced_mRNA' OR cvterm.name = 'edited_mRNA' OR cvterm.name = 'consensus_mRNA' OR cvterm.name = 'recoded_mRNA' OR cvterm.name = 'mRNA_with_minus_1_frameshift' OR cvterm.name = 'mRNA_with_plus_1_frameshift' OR cvterm.name = 'mRNA_with_plus_2_frameshift' OR cvterm.name = 'mRNA_with_minus_2_frameshift' OR cvterm.name = 'dicistronic_mRNA' OR cvterm.name = 'mRNA_recoded_by_translational_bypass' OR cvterm.name = 'mRNA_recoded_by_codon_redefinition' OR cvterm.name = 'mRNA';

--- ************************************************
--- *** relation: tf_binding_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of a nucleotide molecule that b ***
--- *** inds a Transcription Factor or Transcrip ***
--- *** tion Factor complex [GO:0005667].        ***
--- ************************************************
---

CREATE VIEW tf_binding_site AS
  SELECT
    feature_id AS tf_binding_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'TF_binding_site';

--- ************************************************
--- *** relation: orf ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The in-frame interval between the stop c ***
--- *** odons of a reading frame which when read ***
--- ***  as sequential triplets, has the potenti ***
--- *** al of encoding a sequential string of am ***
--- *** ino acids. TER(NNN)nTER.                 ***
--- ************************************************
---

CREATE VIEW orf AS
  SELECT
    feature_id AS orf_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mini_gene' OR cvterm.name = 'rescue_mini_gene' OR cvterm.name = 'ORF';

--- ************************************************
--- *** relation: transcript_attribute ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW transcript_attribute AS
  SELECT
    feature_id AS transcript_attribute_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'edited' OR cvterm.name = 'capped' OR cvterm.name = 'mRNA_attribute' OR cvterm.name = 'trans_spliced' OR cvterm.name = 'alternatively_spliced' OR cvterm.name = 'monocistronic' OR cvterm.name = 'polycistronic' OR cvterm.name = 'polyadenylated' OR cvterm.name = 'exemplar' OR cvterm.name = 'frameshift' OR cvterm.name = 'recoded' OR cvterm.name = 'minus_1_frameshift' OR cvterm.name = 'minus_2_frameshift' OR cvterm.name = 'plus_1_frameshift' OR cvterm.name = 'plus_2_framshift' OR cvterm.name = 'codon_redefined' OR cvterm.name = 'recoded_by_translational_bypass' OR cvterm.name = 'translationally_frameshifted' OR cvterm.name = 'minus_1_translationally_frameshifted' OR cvterm.name = 'plus_1_translationally_frameshifted' OR cvterm.name = 'dicistronic' OR cvterm.name = 'transcript_attribute';

--- ************************************************
--- *** relation: foldback_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transposable element with extensive se ***
--- *** condary structure, characterized by larg ***
--- *** e modular imperfect long inverted repeat ***
--- *** s.                                       ***
--- ************************************************
---

CREATE VIEW foldback_element AS
  SELECT
    feature_id AS foldback_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'foldback_element';

--- ************************************************
--- *** relation: flanking_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The sequences extending on either side o ***
--- *** f a specific region.                     ***
--- ************************************************
---

CREATE VIEW flanking_region AS
  SELECT
    feature_id AS flanking_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'transposable_element_flanking_region' OR cvterm.name = 'five_prime_flanking_region' OR cvterm.name = 'three_prime_flanking_region' OR cvterm.name = 'flanking_region';

--- ************************************************
--- *** relation: chromosome_variation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW chromosome_variation AS
  SELECT
    feature_id AS chromosome_variation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'assortment_derived_variation' OR cvterm.name = 'chromosome_number_variation' OR cvterm.name = 'chromosome_structure_variation' OR cvterm.name = 'assortment_derived_duplication' OR cvterm.name = 'assortment_derived_deficiency_plus_duplication' OR cvterm.name = 'assortment_derived_deficiency' OR cvterm.name = 'assortment_derived_aneuploid' OR cvterm.name = 'aneuploid' OR cvterm.name = 'polyploid' OR cvterm.name = 'hyperploid' OR cvterm.name = 'hypoploid' OR cvterm.name = 'autopolyploid' OR cvterm.name = 'allopolyploid' OR cvterm.name = 'free_chromosome_arm' OR cvterm.name = 'chromosomal_transposition' OR cvterm.name = 'aneuploid_chromosome' OR cvterm.name = 'intrachromosomal_mutation' OR cvterm.name = 'interchromosomal_mutation' OR cvterm.name = 'chromosomal_duplication' OR cvterm.name = 'compound_chromosome' OR cvterm.name = 'autosynaptic_chromosome' OR cvterm.name = 'complex_chromosomal_mutation' OR cvterm.name = 'uncharacterised_chromosomal_mutation' OR cvterm.name = 'intrachromosomal_transposition' OR cvterm.name = 'interchromosomal_transposition' OR cvterm.name = 'deficient_intrachromosomal_transposition' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'uninverted_intrachromosomal_transposition' OR cvterm.name = 'unoriented_intrachromosomal_transposition' OR cvterm.name = 'deficient_interchromosomal_transposition' OR cvterm.name = 'inverted_interchromosomal_transposition' OR cvterm.name = 'uninverted_interchromosomal_transposition' OR cvterm.name = 'unoriented_interchromosomal_transposition' OR cvterm.name = 'inversion_derived_aneuploid_chromosome' OR cvterm.name = 'chromosomal_deletion' OR cvterm.name = 'chromosomal_inversion' OR cvterm.name = 'intrachromosomal_duplication' OR cvterm.name = 'ring_chromosome' OR cvterm.name = 'chromosome_fission' OR cvterm.name = 'deficient_intrachromosomal_transposition' OR cvterm.name = 'inversion_derived_bipartite_deficiency' OR cvterm.name = 'inversion_derived_deficiency_plus_duplication' OR cvterm.name = 'inversion_derived_deficiency_plus_aneuploid' OR cvterm.name = 'deficient_translocation' OR cvterm.name = 'deficient_inversion' OR cvterm.name = 'inverted_ring_chromosome' OR cvterm.name = 'pericentric_inversion' OR cvterm.name = 'paracentric_inversion' OR cvterm.name = 'inversion_cum_translocation' OR cvterm.name = 'bipartite_inversion' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'deficient_inversion' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'inversion_derived_deficiency_plus_duplication' OR cvterm.name = 'inversion_derived_bipartite_duplication' OR cvterm.name = 'inversion_derived_duplication_plus_aneuploid' OR cvterm.name = 'intrachromosomal_transposition' OR cvterm.name = 'bipartite_duplication' OR cvterm.name = 'deficient_intrachromosomal_transposition' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'uninverted_intrachromosomal_transposition' OR cvterm.name = 'unoriented_intrachromosomal_transposition' OR cvterm.name = 'inverted_ring_chromosome' OR cvterm.name = 'free_ring_duplication' OR cvterm.name = 'chromosomal_translocation' OR cvterm.name = 'bipartite_duplication' OR cvterm.name = 'interchromosomal_transposition' OR cvterm.name = 'translocation_element' OR cvterm.name = 'Robertsonian_fusion' OR cvterm.name = 'reciprocal_chromosomal_translocation' OR cvterm.name = 'deficient_translocation' OR cvterm.name = 'inversion_cum_translocation' OR cvterm.name = 'cyclic_translocation' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'deficient_interchromosomal_transposition' OR cvterm.name = 'inverted_interchromosomal_transposition' OR cvterm.name = 'uninverted_interchromosomal_transposition' OR cvterm.name = 'unoriented_interchromosomal_transposition' OR cvterm.name = 'interchromosomal_duplication' OR cvterm.name = 'intrachromosomal_duplication' OR cvterm.name = 'free_duplication' OR cvterm.name = 'insertional_duplication' OR cvterm.name = 'inversion_derived_deficiency_plus_duplication' OR cvterm.name = 'inversion_derived_bipartite_duplication' OR cvterm.name = 'inversion_derived_duplication_plus_aneuploid' OR cvterm.name = 'intrachromosomal_transposition' OR cvterm.name = 'bipartite_duplication' OR cvterm.name = 'deficient_intrachromosomal_transposition' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'uninverted_intrachromosomal_transposition' OR cvterm.name = 'unoriented_intrachromosomal_transposition' OR cvterm.name = 'free_ring_duplication' OR cvterm.name = 'uninverted_insertional_duplication' OR cvterm.name = 'inverted_insertional_duplication' OR cvterm.name = 'unoriented_insertional_duplication' OR cvterm.name = 'compound_chromosome_arm' OR cvterm.name = 'homo_compound_chromosome' OR cvterm.name = 'hetero_compound_chromosome' OR cvterm.name = 'dexstrosynaptic_chromosome' OR cvterm.name = 'laevosynaptic_chromosome' OR cvterm.name = 'partially_characterised_chromosomal_mutation' OR cvterm.name = 'chromosome_variation';

--- ************************************************
--- *** relation: internal_utr ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A UTR bordered by the terminal and initi ***
--- *** al codons of two CDSs in a polycistronic ***
--- ***  transcript. Every UTR is either 5', 3'  ***
--- *** or internal.                             ***
--- ************************************************
---

CREATE VIEW internal_utr AS
  SELECT
    feature_id AS internal_utr_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'internal_UTR';

--- ************************************************
--- *** relation: untranslated_region_polycistronic_mrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The untranslated sequence separating the ***
--- ***  'cistrons' of multicistronic mRNA.      ***
--- ************************************************
---

CREATE VIEW untranslated_region_polycistronic_mrna AS
  SELECT
    feature_id AS untranslated_region_polycistronic_mrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'untranslated_region_polycistronic_mRNA';

--- ************************************************
--- *** relation: internal_ribosome_entry_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Sequence element that recruits a ribosom ***
--- *** al subunit to internal mRNA for translat ***
--- *** ion initiation.                          ***
--- ************************************************
---

CREATE VIEW internal_ribosome_entry_site AS
  SELECT
    feature_id AS internal_ribosome_entry_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'internal_Shine_Dalgarno_sequence' OR cvterm.name = 'internal_ribosome_entry_site';

--- ************************************************
--- *** relation: polyadenylated ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A attribute describing the addition of a ***
--- ***  poly A tail to the 3' end of a mRNA mol ***
--- *** ecule.                                   ***
--- ************************************************
---

CREATE VIEW polyadenylated AS
  SELECT
    feature_id AS polyadenylated_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polyadenylated';

--- ************************************************
--- *** relation: sequence_length_variation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW sequence_length_variation AS
  SELECT
    feature_id AS sequence_length_variation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'simple_sequence_length_variation' OR cvterm.name = 'sequence_length_variation';

--- ************************************************
--- *** relation: modified_rna_base_feature ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A post_transcriptionally modified base.  ***
--- ************************************************
---

CREATE VIEW modified_rna_base_feature AS
  SELECT
    feature_id AS modified_rna_base_feature_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inosine' OR cvterm.name = 'seven_methylguanine' OR cvterm.name = 'ribothymidine' OR cvterm.name = 'modified_adenosine' OR cvterm.name = 'modified_cytidine' OR cvterm.name = 'modified_guanosine' OR cvterm.name = 'modified_uridine' OR cvterm.name = 'modified_inosine' OR cvterm.name = 'methylinosine' OR cvterm.name = 'one_methylinosine' OR cvterm.name = 'one_two_prime_O_dimethylinosine' OR cvterm.name = 'two_prime_O_methylinosine' OR cvterm.name = 'one_methyladenosine' OR cvterm.name = 'two_methyladenosine' OR cvterm.name = 'N6_methyladenosine' OR cvterm.name = 'two_prime_O_methyladenosine' OR cvterm.name = 'two_methylthio_N6_methyladenosine' OR cvterm.name = 'N6_isopentenyladenosine' OR cvterm.name = 'two_methylthio_N6_isopentenyladenosine' OR cvterm.name = 'N6_cis_hydroxyisopentenyl_adenosine' OR cvterm.name = 'two_methylthio_N6_cis_hydroxyisopentenyl_adenosine' OR cvterm.name = 'N6_glycinylcarbamoyladenosine' OR cvterm.name = 'N6_threonylcarbamoyladenosine' OR cvterm.name = 'two_methylthio_N6_threonyl_carbamoyladenosine' OR cvterm.name = 'N6_methyl_N6_threonylcarbamoyladenosine' OR cvterm.name = 'N6_hydroxynorvalylcarbamoyladenosine' OR cvterm.name = 'two_methylthio_N6_hydroxynorvalyl_carbamoyladenosine' OR cvterm.name = 'two_prime_O_ribosyladenosine_phosphate' OR cvterm.name = 'N6_N6_dimethyladenosine' OR cvterm.name = 'N6_2_prime_O_dimethyladenosine' OR cvterm.name = 'N6_N6_2_prime_O_trimethyladenosine' OR cvterm.name = 'one_two_prime_O_dimethyladenosine' OR cvterm.name = 'N6_acetyladenosine' OR cvterm.name = 'three_methylcytidine' OR cvterm.name = 'five_methylcytidine' OR cvterm.name = 'two_prime_O_methylcytidine' OR cvterm.name = 'two_thiocytidine' OR cvterm.name = 'N4_acetylcytidine' OR cvterm.name = 'five_formylcytidine' OR cvterm.name = 'five_two_prime_O_dimethylcytidine' OR cvterm.name = 'N4_acetyl_2_prime_O_methylcytidine' OR cvterm.name = 'lysidine' OR cvterm.name = 'N4_methylcytidine' OR cvterm.name = 'N4_2_prime_O_dimethylcytidine' OR cvterm.name = 'five_hydroxymethylcytidine' OR cvterm.name = 'five_formyl_two_prime_O_methylcytidine' OR cvterm.name = 'N4_N4_2_prime_O_trimethylcytidine' OR cvterm.name = 'seven_deazaguanosine' OR cvterm.name = 'one_methylguanosine' OR cvterm.name = 'N2_methylguanosine' OR cvterm.name = 'seven_methylguanosine' OR cvterm.name = 'two_prime_O_methylguanosine' OR cvterm.name = 'N2_N2_dimethylguanosine' OR cvterm.name = 'N2_2_prime_O_dimethylguanosine' OR cvterm.name = 'N2_N2_2_prime_O_trimethylguanosine' OR cvterm.name = 'two_prime_O_ribosylguanosine_phosphate' OR cvterm.name = 'wybutosine' OR cvterm.name = 'peroxywybutosine' OR cvterm.name = 'hydroxywybutosine' OR cvterm.name = 'undermodified_hydroxywybutosine' OR cvterm.name = 'wyosine' OR cvterm.name = 'methylwyosine' OR cvterm.name = 'N2_7_dimethylguanosine' OR cvterm.name = 'N2_N2_7_trimethylguanosine' OR cvterm.name = 'one_two_prime_O_dimethylguanosine' OR cvterm.name = 'four_demethylwyosine' OR cvterm.name = 'isowyosine' OR cvterm.name = 'N2_7_2prirme_O_trimethylguanosine' OR cvterm.name = 'queuosine' OR cvterm.name = 'epoxyqueuosine' OR cvterm.name = 'galactosyl_queuosine' OR cvterm.name = 'mannosyl_queuosine' OR cvterm.name = 'seven_cyano_seven_deazaguanosine' OR cvterm.name = 'seven_aminomethyl_seven_deazaguanosine' OR cvterm.name = 'archaeosine' OR cvterm.name = 'dihydrouridine' OR cvterm.name = 'pseudouridine' OR cvterm.name = 'five_methyluridine' OR cvterm.name = 'two_prime_O_methyluridine' OR cvterm.name = 'five_two_prime_O_dimethyluridine' OR cvterm.name = 'one_methylpseudouridine' OR cvterm.name = 'two_prime_O_methylpseudouridine' OR cvterm.name = 'two_thiouridine' OR cvterm.name = 'four_thiouridine' OR cvterm.name = 'five_methyl_2_thiouridine' OR cvterm.name = 'two_thio_two_prime_O_methyluridine' OR cvterm.name = 'three_three_amino_three_carboxypropyl_uridine' OR cvterm.name = 'five_hydroxyuridine' OR cvterm.name = 'five_methoxyuridine' OR cvterm.name = 'uridine_five_oxyacetic_acid' OR cvterm.name = 'uridine_five_oxyacetic_acid_methyl_ester' OR cvterm.name = 'five_carboxyhydroxymethyl_uridine' OR cvterm.name = 'five_carboxyhydroxymethyl_uridine_methyl_ester' OR cvterm.name = 'five_methoxycarbonylmethyluridine' OR cvterm.name = 'five_methoxycarbonylmethyl_two_prime_O_methyluridine' OR cvterm.name = 'five_methoxycarbonylmethyl_two_thiouridine' OR cvterm.name = 'five_aminomethyl_two_thiouridine' OR cvterm.name = 'five_methylaminomethyluridine' OR cvterm.name = 'five_methylaminomethyl_two_thiouridine' OR cvterm.name = 'five_methylaminomethyl_two_selenouridine' OR cvterm.name = 'five_carbamoylmethyluridine' OR cvterm.name = 'five_carbamoylmethyl_two_prime_O_methyluridine' OR cvterm.name = 'five_carboxymethylaminomethyluridine' OR cvterm.name = 'five_carboxymethylaminomethyl_two_prime_O_methyluridine' OR cvterm.name = 'five_carboxymethylaminomethyl_two_thiouridine' OR cvterm.name = 'three_methyluridine' OR cvterm.name = 'one_methyl_three_three_amino_three_carboxypropyl_pseudouridine' OR cvterm.name = 'five_carboxymethyluridine' OR cvterm.name = 'three_two_prime_O_dimethyluridine' OR cvterm.name = 'five_methyldihydrouridine' OR cvterm.name = 'three_methylpseudouridine' OR cvterm.name = 'five_taurinomethyluridine' OR cvterm.name = 'five_taurinomethyl_two_thiouridine' OR cvterm.name = 'five_isopentenylaminomethyl_uridine' OR cvterm.name = 'five_isopentenylaminomethyl_two_thiouridine' OR cvterm.name = 'five_isopentenylaminomethyl_two_prime_O_methyluridine' OR cvterm.name = 'modified_RNA_base_feature';

--- ************************************************
--- *** relation: rrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** RNA that comprises part of a ribosome, a ***
--- *** nd that can provide both structural scaf ***
--- *** folding and catalytic activity.          ***
--- ************************************************
---

CREATE VIEW rrna AS
  SELECT
    feature_id AS rrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'small_subunit_rRNA' OR cvterm.name = 'large_subunit_rRNA' OR cvterm.name = 'rRNA_18S' OR cvterm.name = 'rRNA_16S' OR cvterm.name = 'rRNA_5_8S' OR cvterm.name = 'rRNA_5S' OR cvterm.name = 'rRNA_28S' OR cvterm.name = 'rRNA_23S' OR cvterm.name = 'rRNA_25S' OR cvterm.name = 'rRNA_21S' OR cvterm.name = 'rRNA';

--- ************************************************
--- *** relation: trna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Transfer RNA (tRNA) molecules are approx ***
--- *** imately 80 nucleotides in length. Their  ***
--- *** secondary structure includes four short  ***
--- *** double-helical elements and three loops  ***
--- *** (D, anti-codon, and T loops). Further hy ***
--- *** drogen bonds mediate the characteristic  ***
--- *** L-shaped molecular structure. Transfer R ***
--- *** NAs have two regions of fundamental func ***
--- *** tional importance: the anti-codon, which ***
--- ***  is responsible for specific mRNA codon  ***
--- *** recognition, and the 3' end, to which th ***
--- *** e tRNA's corresponding amino acid is att ***
--- *** ached (by aminoacyl-tRNA synthetases). T ***
--- *** ransfer RNAs cope with the degeneracy of ***
--- ***  the genetic code in two manners: having ***
--- ***  more than one tRNA (with a specific ant ***
--- *** i-codon) for a particular amino acid; an ***
--- *** d 'wobble' base-pairing, i.e. permitting ***
--- ***  non-standard base-pairing at the 3rd an ***
--- *** ti-codon position.                       ***
--- ************************************************
---

CREATE VIEW trna AS
  SELECT
    feature_id AS trna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'alanyl_tRNA' OR cvterm.name = 'asparaginyl_tRNA' OR cvterm.name = 'aspartyl_tRNA' OR cvterm.name = 'cysteinyl_tRNA' OR cvterm.name = 'glutaminyl_tRNA' OR cvterm.name = 'glutamyl_tRNA' OR cvterm.name = 'glycyl_tRNA' OR cvterm.name = 'histidyl_tRNA' OR cvterm.name = 'isoleucyl_tRNA' OR cvterm.name = 'leucyl_tRNA' OR cvterm.name = 'lysyl_tRNA' OR cvterm.name = 'methionyl_tRNA' OR cvterm.name = 'phenylalanyl_tRNA' OR cvterm.name = 'prolyl_tRNA' OR cvterm.name = 'seryl_tRNA' OR cvterm.name = 'threonyl_tRNA' OR cvterm.name = 'tryptophanyl_tRNA' OR cvterm.name = 'tyrosyl_tRNA' OR cvterm.name = 'valyl_tRNA' OR cvterm.name = 'pyrrolysyl_tRNA' OR cvterm.name = 'arginyl_tRNA' OR cvterm.name = 'selenocysteinyl_tRNA' OR cvterm.name = 'tRNA';

--- ************************************************
--- *** relation: alanyl_trna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tRNA sequence that has an alanine anti ***
--- *** codon, and a 3' alanine binding region.  ***
--- ************************************************
---

CREATE VIEW alanyl_trna AS
  SELECT
    feature_id AS alanyl_trna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'alanyl_tRNA';

--- ************************************************
--- *** relation: rrna_small_subunit_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding a small ri ***
--- *** bosomal subunit RNA.                     ***
--- ************************************************
---

CREATE VIEW rrna_small_subunit_primary_transcript AS
  SELECT
    feature_id AS rrna_small_subunit_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rRNA_small_subunit_primary_transcript';

--- ************************************************
--- *** relation: asparaginyl_trna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tRNA sequence that has an asparagine a ***
--- *** nticodon, and a 3' asparagine binding re ***
--- *** gion.                                    ***
--- ************************************************
---

CREATE VIEW asparaginyl_trna AS
  SELECT
    feature_id AS asparaginyl_trna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'asparaginyl_tRNA';

--- ************************************************
--- *** relation: aspartyl_trna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tRNA sequence that has an aspartic aci ***
--- *** d anticodon, and a 3' aspartic acid bind ***
--- *** ing region.                              ***
--- ************************************************
---

CREATE VIEW aspartyl_trna AS
  SELECT
    feature_id AS aspartyl_trna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'aspartyl_tRNA';

--- ************************************************
--- *** relation: cysteinyl_trna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tRNA sequence that has a cysteine anti ***
--- *** codon, and a 3' cysteine binding region. ***
--- ************************************************
---

CREATE VIEW cysteinyl_trna AS
  SELECT
    feature_id AS cysteinyl_trna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cysteinyl_tRNA';

--- ************************************************
--- *** relation: glutaminyl_trna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tRNA sequence that has a glutamine ant ***
--- *** icodon, and a 3' glutamine binding regio ***
--- *** n.                                       ***
--- ************************************************
---

CREATE VIEW glutaminyl_trna AS
  SELECT
    feature_id AS glutaminyl_trna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'glutaminyl_tRNA';

--- ************************************************
--- *** relation: glutamyl_trna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tRNA sequence that has a glutamic acid ***
--- ***  anticodon, and a 3' glutamic acid bindi ***
--- *** ng region.                               ***
--- ************************************************
---

CREATE VIEW glutamyl_trna AS
  SELECT
    feature_id AS glutamyl_trna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'glutamyl_tRNA';

--- ************************************************
--- *** relation: glycyl_trna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tRNA sequence that has a glycine antic ***
--- *** odon, and a 3' glycine binding region.   ***
--- ************************************************
---

CREATE VIEW glycyl_trna AS
  SELECT
    feature_id AS glycyl_trna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'glycyl_tRNA';

--- ************************************************
--- *** relation: histidyl_trna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tRNA sequence that has a histidine ant ***
--- *** icodon, and a 3' histidine binding regio ***
--- *** n.                                       ***
--- ************************************************
---

CREATE VIEW histidyl_trna AS
  SELECT
    feature_id AS histidyl_trna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'histidyl_tRNA';

--- ************************************************
--- *** relation: isoleucyl_trna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tRNA sequence that has an isoleucine a ***
--- *** nticodon, and a 3' isoleucine binding re ***
--- *** gion.                                    ***
--- ************************************************
---

CREATE VIEW isoleucyl_trna AS
  SELECT
    feature_id AS isoleucyl_trna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'isoleucyl_tRNA';

--- ************************************************
--- *** relation: leucyl_trna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tRNA sequence that has a leucine antic ***
--- *** odon, and a 3' leucine binding region.   ***
--- ************************************************
---

CREATE VIEW leucyl_trna AS
  SELECT
    feature_id AS leucyl_trna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'leucyl_tRNA';

--- ************************************************
--- *** relation: lysyl_trna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tRNA sequence that has a lysine antico ***
--- *** don, and a 3' lysine binding region.     ***
--- ************************************************
---

CREATE VIEW lysyl_trna AS
  SELECT
    feature_id AS lysyl_trna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'lysyl_tRNA';

--- ************************************************
--- *** relation: methionyl_trna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tRNA sequence that has a methionine an ***
--- *** ticodon, and a 3' methionine binding reg ***
--- *** ion.                                     ***
--- ************************************************
---

CREATE VIEW methionyl_trna AS
  SELECT
    feature_id AS methionyl_trna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'methionyl_tRNA';

--- ************************************************
--- *** relation: phenylalanyl_trna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tRNA sequence that has a phenylalanine ***
--- ***  anticodon, and a 3' phenylalanine bindi ***
--- *** ng region.                               ***
--- ************************************************
---

CREATE VIEW phenylalanyl_trna AS
  SELECT
    feature_id AS phenylalanyl_trna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'phenylalanyl_tRNA';

--- ************************************************
--- *** relation: prolyl_trna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tRNA sequence that has a proline antic ***
--- *** odon, and a 3' proline binding region.   ***
--- ************************************************
---

CREATE VIEW prolyl_trna AS
  SELECT
    feature_id AS prolyl_trna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'prolyl_tRNA';

--- ************************************************
--- *** relation: seryl_trna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tRNA sequence that has a serine antico ***
--- *** don, and a 3' serine binding region.     ***
--- ************************************************
---

CREATE VIEW seryl_trna AS
  SELECT
    feature_id AS seryl_trna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'seryl_tRNA';

--- ************************************************
--- *** relation: threonyl_trna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tRNA sequence that has a threonine ant ***
--- *** icodon, and a 3' threonine binding regio ***
--- *** n.                                       ***
--- ************************************************
---

CREATE VIEW threonyl_trna AS
  SELECT
    feature_id AS threonyl_trna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'threonyl_tRNA';

--- ************************************************
--- *** relation: tryptophanyl_trna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tRNA sequence that has a tryptophan an ***
--- *** ticodon, and a 3' tryptophan binding reg ***
--- *** ion.                                     ***
--- ************************************************
---

CREATE VIEW tryptophanyl_trna AS
  SELECT
    feature_id AS tryptophanyl_trna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tryptophanyl_tRNA';

--- ************************************************
--- *** relation: tyrosyl_trna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tRNA sequence that has a tyrosine anti ***
--- *** codon, and a 3' tyrosine binding region. ***
--- ************************************************
---

CREATE VIEW tyrosyl_trna AS
  SELECT
    feature_id AS tyrosyl_trna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tyrosyl_tRNA';

--- ************************************************
--- *** relation: valyl_trna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tRNA sequence that has a valine antico ***
--- *** don, and a 3' valine binding region.     ***
--- ************************************************
---

CREATE VIEW valyl_trna AS
  SELECT
    feature_id AS valyl_trna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'valyl_tRNA';

--- ************************************************
--- *** relation: snrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A small nuclear RNA molecule involved in ***
--- ***  pre-mRNA splicing and processing.       ***
--- ************************************************
---

CREATE VIEW snrna AS
  SELECT
    feature_id AS snrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'U1_snRNA' OR cvterm.name = 'U2_snRNA' OR cvterm.name = 'U4_snRNA' OR cvterm.name = 'U4atac_snRNA' OR cvterm.name = 'U5_snRNA' OR cvterm.name = 'U6_snRNA' OR cvterm.name = 'U6atac_snRNA' OR cvterm.name = 'U11_snRNA' OR cvterm.name = 'U12_snRNA' OR cvterm.name = 'snRNA';

--- ************************************************
--- *** relation: snorna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A snoRNA (small nucleolar RNA) is any on ***
--- *** e of a class of small RNAs that are asso ***
--- *** ciated with the eukaryotic nucleus as co ***
--- *** mponents of small nucleolar ribonucleopr ***
--- *** oteins. They participate in the processi ***
--- *** ng or modifications of many RNAs, mostly ***
--- ***  ribosomal RNAs (rRNAs) though snoRNAs a ***
--- *** re also known to target other classes of ***
--- ***  RNA, including spliceosomal RNAs, tRNAs ***
--- *** , and mRNAs via a stretch of sequence th ***
--- *** at is complementary to a sequence in the ***
--- ***  targeted RNA.                           ***
--- ************************************************
---

CREATE VIEW snorna AS
  SELECT
    feature_id AS snorna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'C_D_box_snoRNA' OR cvterm.name = 'H_ACA_box_snoRNA' OR cvterm.name = 'U14_snoRNA' OR cvterm.name = 'U3_snoRNA' OR cvterm.name = 'methylation_guide_snoRNA' OR cvterm.name = 'pseudouridylation_guide_snoRNA' OR cvterm.name = 'snoRNA';

--- ************************************************
--- *** relation: mirna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Small, ~22-nt, RNA molecule that is the  ***
--- *** endogenous transcript of a miRNA gene. M ***
--- *** icro RNAs are produced from precursor mo ***
--- *** lecules (SO:0000647) that can form local ***
--- ***  hairpin structures, which ordinarily ar ***
--- *** e processed (via the Dicer pathway) such ***
--- ***  that a single miRNA molecule accumulate ***
--- *** s from one arm of a hairpin precursor mo ***
--- *** lecule. Micro RNAs may trigger the cleav ***
--- *** age of their target molecules or act as  ***
--- *** translational repressors.                ***
--- ************************************************
---

CREATE VIEW mirna AS
  SELECT
    feature_id AS mirna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'miRNA';

--- ************************************************
--- *** relation: bound_by_factor ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a sequence that  ***
--- *** is bound by another molecule.            ***
--- ************************************************
---

CREATE VIEW bound_by_factor AS
  SELECT
    feature_id AS bound_by_factor_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'bound_by_protein' OR cvterm.name = 'bound_by_nucleic_acid' OR cvterm.name = 'bound_by_factor';

--- ************************************************
--- *** relation: transcript_bound_by_nucleic_acid ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transcript that is bound by a nucleic  ***
--- *** acid.                                    ***
--- ************************************************
---

CREATE VIEW transcript_bound_by_nucleic_acid AS
  SELECT
    feature_id AS transcript_bound_by_nucleic_acid_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'transcript_bound_by_nucleic_acid';

--- ************************************************
--- *** relation: transcript_bound_by_protein ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transcript that is bound by a protein. ***
--- ************************************************
---

CREATE VIEW transcript_bound_by_protein AS
  SELECT
    feature_id AS transcript_bound_by_protein_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'transcript_bound_by_protein';

--- ************************************************
--- *** relation: engineered_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is engineered.               ***
--- ************************************************
---

CREATE VIEW engineered_gene AS
  SELECT
    feature_id AS engineered_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'engineered_foreign_gene' OR cvterm.name = 'engineered_fusion_gene' OR cvterm.name = 'engineered_foreign_transposable_element_gene' OR cvterm.name = 'engineered_gene';

--- ************************************************
--- *** relation: engineered_foreign_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is engineered and foreign.   ***
--- ************************************************
---

CREATE VIEW engineered_foreign_gene AS
  SELECT
    feature_id AS engineered_foreign_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'engineered_foreign_transposable_element_gene' OR cvterm.name = 'engineered_foreign_gene';

--- ************************************************
--- *** relation: mrna_with_minus_1_frameshift ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An mRNA with a minus 1 frameshift.       ***
--- ************************************************
---

CREATE VIEW mrna_with_minus_1_frameshift AS
  SELECT
    feature_id AS mrna_with_minus_1_frameshift_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mRNA_with_minus_1_frameshift';

--- ************************************************
--- *** relation: engineered_foreign_transposable_element_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transposable_element that is engineere ***
--- *** d and foreign.                           ***
--- ************************************************
---

CREATE VIEW engineered_foreign_transposable_element_gene AS
  SELECT
    feature_id AS engineered_foreign_transposable_element_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'engineered_foreign_transposable_element_gene';

--- ************************************************
--- *** relation: foreign_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is foreign.                  ***
--- ************************************************
---

CREATE VIEW foreign_gene AS
  SELECT
    feature_id AS foreign_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'engineered_foreign_gene' OR cvterm.name = 'engineered_foreign_transposable_element_gene' OR cvterm.name = 'foreign_gene';

--- ************************************************
--- *** relation: long_terminal_repeat ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence directly repeated at both end ***
--- *** s of a defined sequence, of the sort typ ***
--- *** ically found in retroviruses.            ***
--- ************************************************
---

CREATE VIEW long_terminal_repeat AS
  SELECT
    feature_id AS long_terminal_repeat_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_LTR' OR cvterm.name = 'three_prime_LTR' OR cvterm.name = 'solo_LTR' OR cvterm.name = 'long_terminal_repeat';

--- ************************************************
--- *** relation: fusion_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is a fusion.                 ***
--- ************************************************
---

CREATE VIEW fusion_gene AS
  SELECT
    feature_id AS fusion_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'engineered_fusion_gene' OR cvterm.name = 'fusion_gene';

--- ************************************************
--- *** relation: engineered_fusion_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A fusion gene that is engineered.        ***
--- ************************************************
---

CREATE VIEW engineered_fusion_gene AS
  SELECT
    feature_id AS engineered_fusion_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'engineered_fusion_gene';

--- ************************************************
--- *** relation: microsatellite ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A repeat_region containing repeat_units  ***
--- *** (2 to 4 bp) that is repeated multiple ti ***
--- *** mes in tandem.                           ***
--- ************************************************
---

CREATE VIEW microsatellite AS
  SELECT
    feature_id AS microsatellite_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'dinucleotide_repeat_microsatellite_feature' OR cvterm.name = 'trinucleotide_repeat_microsatellite_feature' OR cvterm.name = 'tetranucleotide_repeat_microsatellite_feature' OR cvterm.name = 'microsatellite';

--- ************************************************
--- *** relation: dinucleotide_repeat_microsatellite_feature ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW dinucleotide_repeat_microsatellite_feature AS
  SELECT
    feature_id AS dinucleotide_repeat_microsatellite_feature_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'dinucleotide_repeat_microsatellite_feature';

--- ************************************************
--- *** relation: trinuc_repeat_microsat ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW trinuc_repeat_microsat AS
  SELECT
    feature_id AS trinuc_repeat_microsat_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'trinucleotide_repeat_microsatellite_feature';

--- ************************************************
--- *** relation: engineered_foreign_repetitive_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A repetitive element that is engineered  ***
--- *** and foreign.                             ***
--- ************************************************
---

CREATE VIEW engineered_foreign_repetitive_element AS
  SELECT
    feature_id AS engineered_foreign_repetitive_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'engineered_foreign_repetitive_element';

--- ************************************************
--- *** relation: inverted_repeat ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The sequence is complementarily repeated ***
--- ***  on the opposite strand. It is a palindr ***
--- *** ome, and it may, or may not be hyphenate ***
--- *** d. Examples: GCTGATCAGC, or GCTGA-----TC ***
--- *** AGC.                                     ***
--- ************************************************
---

CREATE VIEW inverted_repeat AS
  SELECT
    feature_id AS inverted_repeat_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'terminal_inverted_repeat' OR cvterm.name = 'five_prime_terminal_inverted_repeat' OR cvterm.name = 'three_prime_terminal_inverted_repeat' OR cvterm.name = 'inverted_repeat';

--- ************************************************
--- *** relation: u12_intron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A type of spliceosomal intron spliced by ***
--- ***  the U12 spliceosome, that includes U11, ***
--- ***  U12, U4atac/U6atac and U5 snRNAs.       ***
--- ************************************************
---

CREATE VIEW u12_intron AS
  SELECT
    feature_id AS u12_intron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'U12_intron';

--- ************************************************
--- *** relation: origin_of_replication ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The origin of replication; starting site ***
--- ***  for duplication of a nucleic acid molec ***
--- *** ule to give two identical copies.        ***
--- ************************************************
---

CREATE VIEW origin_of_replication AS
  SELECT
    feature_id AS origin_of_replication_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'D_loop' OR cvterm.name = 'ARS' OR cvterm.name = 'oriT' OR cvterm.name = 'amplification_origin' OR cvterm.name = 'oriV' OR cvterm.name = 'oriC' OR cvterm.name = 'origin_of_replication';

--- ************************************************
--- *** relation: d_loop ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Displacement loop; a region within mitoc ***
--- *** hondrial DNA in which a short stretch of ***
--- ***  RNA is paired with one strand of DNA, d ***
--- *** isplacing the original partner DNA stran ***
--- *** d in this region; also used to describe  ***
--- *** the displacement of a region of one stra ***
--- *** nd of duplex DNA by a single stranded in ***
--- *** vader in the reaction catalyzed by RecA  ***
--- *** protein.                                 ***
--- ************************************************
---

CREATE VIEW d_loop AS
  SELECT
    feature_id AS d_loop_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'D_loop';

--- ************************************************
--- *** relation: recombination_feature ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW recombination_feature AS
  SELECT
    feature_id AS recombination_feature_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'recombination_hotspot' OR cvterm.name = 'haplotype_block' OR cvterm.name = 'sequence_rearrangement_feature' OR cvterm.name = 'iDNA' OR cvterm.name = 'specific_recombination_site' OR cvterm.name = 'chromosome_breakage_sequence' OR cvterm.name = 'internal_eliminated_sequence' OR cvterm.name = 'macronucleus_destined_segment' OR cvterm.name = 'recombination_feature_of_rearranged_gene' OR cvterm.name = 'site_specific_recombination_target_region' OR cvterm.name = 'recombination_signal_sequence' OR cvterm.name = 'vertebrate_immune_system_gene_recombination_feature' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_segment' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_gene_cluster' OR cvterm.name = 'vertebrate_immune_system_gene_recombination_spacer' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_rearranged_segment' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster' OR cvterm.name = 'vertebrate_immune_system_gene_recombination_signal_feature' OR cvterm.name = 'D_gene' OR cvterm.name = 'V_gene' OR cvterm.name = 'J_gene' OR cvterm.name = 'C_gene' OR cvterm.name = 'D_J_C_cluster' OR cvterm.name = 'J_C_cluster' OR cvterm.name = 'J_cluster' OR cvterm.name = 'V_cluster' OR cvterm.name = 'V_J_cluster' OR cvterm.name = 'V_J_C_cluster' OR cvterm.name = 'C_cluster' OR cvterm.name = 'D_cluster' OR cvterm.name = 'D_J_cluster' OR cvterm.name = 'three_prime_D_spacer' OR cvterm.name = 'five_prime_D_spacer' OR cvterm.name = 'J_spacer' OR cvterm.name = 'V_spacer' OR cvterm.name = 'VD_gene' OR cvterm.name = 'DJ_gene' OR cvterm.name = 'VDJ_gene' OR cvterm.name = 'VJ_gene' OR cvterm.name = 'DJ_J_cluster' OR cvterm.name = 'VDJ_J_C_cluster' OR cvterm.name = 'VDJ_J_cluster' OR cvterm.name = 'VJ_C_cluster' OR cvterm.name = 'VJ_J_C_cluster' OR cvterm.name = 'VJ_J_cluster' OR cvterm.name = 'D_DJ_C_cluster' OR cvterm.name = 'D_DJ_cluster' OR cvterm.name = 'D_DJ_J_C_cluster' OR cvterm.name = 'D_DJ_J_cluster' OR cvterm.name = 'V_DJ_cluster' OR cvterm.name = 'V_DJ_J_cluster' OR cvterm.name = 'V_VDJ_C_cluster' OR cvterm.name = 'V_VDJ_cluster' OR cvterm.name = 'V_VDJ_J_cluster' OR cvterm.name = 'V_VJ_C_cluster' OR cvterm.name = 'V_VJ_cluster' OR cvterm.name = 'V_VJ_J_cluster' OR cvterm.name = 'V_D_DJ_C_cluster' OR cvterm.name = 'V_D_DJ_cluster' OR cvterm.name = 'V_D_DJ_J_C_cluster' OR cvterm.name = 'V_D_DJ_J_cluster' OR cvterm.name = 'V_D_J_C_cluster' OR cvterm.name = 'V_D_J_cluster' OR cvterm.name = 'DJ_C_cluster' OR cvterm.name = 'DJ_J_C_cluster' OR cvterm.name = 'VDJ_C_cluster' OR cvterm.name = 'V_DJ_C_cluster' OR cvterm.name = 'V_DJ_J_C_cluster' OR cvterm.name = 'V_VDJ_J_C_cluster' OR cvterm.name = 'V_VJ_J_C_cluster' OR cvterm.name = 'J_gene_recombination_feature' OR cvterm.name = 'D_gene_recombination_feature' OR cvterm.name = 'V_gene_recombination_feature' OR cvterm.name = 'heptamer_of_recombination_feature_of_vertebrate_immune_system_gene' OR cvterm.name = 'nonamer_of_recombination_feature_of_vertebrate_immune_system_gene' OR cvterm.name = 'five_prime_D_recombination_signal_sequence' OR cvterm.name = 'three_prime_D_recombination_signal_sequence' OR cvterm.name = 'three_prime_D_heptamer' OR cvterm.name = 'five_prime_D_heptamer' OR cvterm.name = 'J_heptamer' OR cvterm.name = 'V_heptamer' OR cvterm.name = 'three_prime_D_nonamer' OR cvterm.name = 'five_prime_D_nonamer' OR cvterm.name = 'J_nonamer' OR cvterm.name = 'V_nonamer' OR cvterm.name = 'integration_excision_site' OR cvterm.name = 'resolution_site' OR cvterm.name = 'inversion_site' OR cvterm.name = 'inversion_site_part' OR cvterm.name = 'attI_site' OR cvterm.name = 'attP_site' OR cvterm.name = 'attB_site' OR cvterm.name = 'attL_site' OR cvterm.name = 'attR_site' OR cvterm.name = 'attC_site' OR cvterm.name = 'attCtn_site' OR cvterm.name = 'loxP_site' OR cvterm.name = 'dif_site' OR cvterm.name = 'FRT_site' OR cvterm.name = 'IRLinv_site' OR cvterm.name = 'IRRinv_site' OR cvterm.name = 'recombination_feature';

--- ************************************************
--- *** relation: specific_recombination_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW specific_recombination_site AS
  SELECT
    feature_id AS specific_recombination_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'recombination_feature_of_rearranged_gene' OR cvterm.name = 'site_specific_recombination_target_region' OR cvterm.name = 'recombination_signal_sequence' OR cvterm.name = 'vertebrate_immune_system_gene_recombination_feature' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_segment' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_gene_cluster' OR cvterm.name = 'vertebrate_immune_system_gene_recombination_spacer' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_rearranged_segment' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster' OR cvterm.name = 'vertebrate_immune_system_gene_recombination_signal_feature' OR cvterm.name = 'D_gene' OR cvterm.name = 'V_gene' OR cvterm.name = 'J_gene' OR cvterm.name = 'C_gene' OR cvterm.name = 'D_J_C_cluster' OR cvterm.name = 'J_C_cluster' OR cvterm.name = 'J_cluster' OR cvterm.name = 'V_cluster' OR cvterm.name = 'V_J_cluster' OR cvterm.name = 'V_J_C_cluster' OR cvterm.name = 'C_cluster' OR cvterm.name = 'D_cluster' OR cvterm.name = 'D_J_cluster' OR cvterm.name = 'three_prime_D_spacer' OR cvterm.name = 'five_prime_D_spacer' OR cvterm.name = 'J_spacer' OR cvterm.name = 'V_spacer' OR cvterm.name = 'VD_gene' OR cvterm.name = 'DJ_gene' OR cvterm.name = 'VDJ_gene' OR cvterm.name = 'VJ_gene' OR cvterm.name = 'DJ_J_cluster' OR cvterm.name = 'VDJ_J_C_cluster' OR cvterm.name = 'VDJ_J_cluster' OR cvterm.name = 'VJ_C_cluster' OR cvterm.name = 'VJ_J_C_cluster' OR cvterm.name = 'VJ_J_cluster' OR cvterm.name = 'D_DJ_C_cluster' OR cvterm.name = 'D_DJ_cluster' OR cvterm.name = 'D_DJ_J_C_cluster' OR cvterm.name = 'D_DJ_J_cluster' OR cvterm.name = 'V_DJ_cluster' OR cvterm.name = 'V_DJ_J_cluster' OR cvterm.name = 'V_VDJ_C_cluster' OR cvterm.name = 'V_VDJ_cluster' OR cvterm.name = 'V_VDJ_J_cluster' OR cvterm.name = 'V_VJ_C_cluster' OR cvterm.name = 'V_VJ_cluster' OR cvterm.name = 'V_VJ_J_cluster' OR cvterm.name = 'V_D_DJ_C_cluster' OR cvterm.name = 'V_D_DJ_cluster' OR cvterm.name = 'V_D_DJ_J_C_cluster' OR cvterm.name = 'V_D_DJ_J_cluster' OR cvterm.name = 'V_D_J_C_cluster' OR cvterm.name = 'V_D_J_cluster' OR cvterm.name = 'DJ_C_cluster' OR cvterm.name = 'DJ_J_C_cluster' OR cvterm.name = 'VDJ_C_cluster' OR cvterm.name = 'V_DJ_C_cluster' OR cvterm.name = 'V_DJ_J_C_cluster' OR cvterm.name = 'V_VDJ_J_C_cluster' OR cvterm.name = 'V_VJ_J_C_cluster' OR cvterm.name = 'J_gene_recombination_feature' OR cvterm.name = 'D_gene_recombination_feature' OR cvterm.name = 'V_gene_recombination_feature' OR cvterm.name = 'heptamer_of_recombination_feature_of_vertebrate_immune_system_gene' OR cvterm.name = 'nonamer_of_recombination_feature_of_vertebrate_immune_system_gene' OR cvterm.name = 'five_prime_D_recombination_signal_sequence' OR cvterm.name = 'three_prime_D_recombination_signal_sequence' OR cvterm.name = 'three_prime_D_heptamer' OR cvterm.name = 'five_prime_D_heptamer' OR cvterm.name = 'J_heptamer' OR cvterm.name = 'V_heptamer' OR cvterm.name = 'three_prime_D_nonamer' OR cvterm.name = 'five_prime_D_nonamer' OR cvterm.name = 'J_nonamer' OR cvterm.name = 'V_nonamer' OR cvterm.name = 'integration_excision_site' OR cvterm.name = 'resolution_site' OR cvterm.name = 'inversion_site' OR cvterm.name = 'inversion_site_part' OR cvterm.name = 'attI_site' OR cvterm.name = 'attP_site' OR cvterm.name = 'attB_site' OR cvterm.name = 'attL_site' OR cvterm.name = 'attR_site' OR cvterm.name = 'attC_site' OR cvterm.name = 'attCtn_site' OR cvterm.name = 'loxP_site' OR cvterm.name = 'dif_site' OR cvterm.name = 'FRT_site' OR cvterm.name = 'IRLinv_site' OR cvterm.name = 'IRRinv_site' OR cvterm.name = 'specific_recombination_site';

--- ************************************************
--- *** relation: recombination_feature_of_rearranged_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW recombination_feature_of_rearranged_gene AS
  SELECT
    feature_id AS recombination_feature_of_rearranged_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'vertebrate_immune_system_gene_recombination_feature' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_segment' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_gene_cluster' OR cvterm.name = 'vertebrate_immune_system_gene_recombination_spacer' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_rearranged_segment' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster' OR cvterm.name = 'vertebrate_immune_system_gene_recombination_signal_feature' OR cvterm.name = 'D_gene' OR cvterm.name = 'V_gene' OR cvterm.name = 'J_gene' OR cvterm.name = 'C_gene' OR cvterm.name = 'D_J_C_cluster' OR cvterm.name = 'J_C_cluster' OR cvterm.name = 'J_cluster' OR cvterm.name = 'V_cluster' OR cvterm.name = 'V_J_cluster' OR cvterm.name = 'V_J_C_cluster' OR cvterm.name = 'C_cluster' OR cvterm.name = 'D_cluster' OR cvterm.name = 'D_J_cluster' OR cvterm.name = 'three_prime_D_spacer' OR cvterm.name = 'five_prime_D_spacer' OR cvterm.name = 'J_spacer' OR cvterm.name = 'V_spacer' OR cvterm.name = 'VD_gene' OR cvterm.name = 'DJ_gene' OR cvterm.name = 'VDJ_gene' OR cvterm.name = 'VJ_gene' OR cvterm.name = 'DJ_J_cluster' OR cvterm.name = 'VDJ_J_C_cluster' OR cvterm.name = 'VDJ_J_cluster' OR cvterm.name = 'VJ_C_cluster' OR cvterm.name = 'VJ_J_C_cluster' OR cvterm.name = 'VJ_J_cluster' OR cvterm.name = 'D_DJ_C_cluster' OR cvterm.name = 'D_DJ_cluster' OR cvterm.name = 'D_DJ_J_C_cluster' OR cvterm.name = 'D_DJ_J_cluster' OR cvterm.name = 'V_DJ_cluster' OR cvterm.name = 'V_DJ_J_cluster' OR cvterm.name = 'V_VDJ_C_cluster' OR cvterm.name = 'V_VDJ_cluster' OR cvterm.name = 'V_VDJ_J_cluster' OR cvterm.name = 'V_VJ_C_cluster' OR cvterm.name = 'V_VJ_cluster' OR cvterm.name = 'V_VJ_J_cluster' OR cvterm.name = 'V_D_DJ_C_cluster' OR cvterm.name = 'V_D_DJ_cluster' OR cvterm.name = 'V_D_DJ_J_C_cluster' OR cvterm.name = 'V_D_DJ_J_cluster' OR cvterm.name = 'V_D_J_C_cluster' OR cvterm.name = 'V_D_J_cluster' OR cvterm.name = 'DJ_C_cluster' OR cvterm.name = 'DJ_J_C_cluster' OR cvterm.name = 'VDJ_C_cluster' OR cvterm.name = 'V_DJ_C_cluster' OR cvterm.name = 'V_DJ_J_C_cluster' OR cvterm.name = 'V_VDJ_J_C_cluster' OR cvterm.name = 'V_VJ_J_C_cluster' OR cvterm.name = 'J_gene_recombination_feature' OR cvterm.name = 'D_gene_recombination_feature' OR cvterm.name = 'V_gene_recombination_feature' OR cvterm.name = 'heptamer_of_recombination_feature_of_vertebrate_immune_system_gene' OR cvterm.name = 'nonamer_of_recombination_feature_of_vertebrate_immune_system_gene' OR cvterm.name = 'five_prime_D_recombination_signal_sequence' OR cvterm.name = 'three_prime_D_recombination_signal_sequence' OR cvterm.name = 'three_prime_D_heptamer' OR cvterm.name = 'five_prime_D_heptamer' OR cvterm.name = 'J_heptamer' OR cvterm.name = 'V_heptamer' OR cvterm.name = 'three_prime_D_nonamer' OR cvterm.name = 'five_prime_D_nonamer' OR cvterm.name = 'J_nonamer' OR cvterm.name = 'V_nonamer' OR cvterm.name = 'recombination_feature_of_rearranged_gene';

--- ************************************************
--- *** relation: vertebrate_immune_system_gene_recombination_feature ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW vertebrate_immune_system_gene_recombination_feature AS
  SELECT
    feature_id AS vertebrate_immune_system_gene_recombination_feature_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_segment' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_gene_cluster' OR cvterm.name = 'vertebrate_immune_system_gene_recombination_spacer' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_rearranged_segment' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster' OR cvterm.name = 'vertebrate_immune_system_gene_recombination_signal_feature' OR cvterm.name = 'D_gene' OR cvterm.name = 'V_gene' OR cvterm.name = 'J_gene' OR cvterm.name = 'C_gene' OR cvterm.name = 'D_J_C_cluster' OR cvterm.name = 'J_C_cluster' OR cvterm.name = 'J_cluster' OR cvterm.name = 'V_cluster' OR cvterm.name = 'V_J_cluster' OR cvterm.name = 'V_J_C_cluster' OR cvterm.name = 'C_cluster' OR cvterm.name = 'D_cluster' OR cvterm.name = 'D_J_cluster' OR cvterm.name = 'three_prime_D_spacer' OR cvterm.name = 'five_prime_D_spacer' OR cvterm.name = 'J_spacer' OR cvterm.name = 'V_spacer' OR cvterm.name = 'VD_gene' OR cvterm.name = 'DJ_gene' OR cvterm.name = 'VDJ_gene' OR cvterm.name = 'VJ_gene' OR cvterm.name = 'DJ_J_cluster' OR cvterm.name = 'VDJ_J_C_cluster' OR cvterm.name = 'VDJ_J_cluster' OR cvterm.name = 'VJ_C_cluster' OR cvterm.name = 'VJ_J_C_cluster' OR cvterm.name = 'VJ_J_cluster' OR cvterm.name = 'D_DJ_C_cluster' OR cvterm.name = 'D_DJ_cluster' OR cvterm.name = 'D_DJ_J_C_cluster' OR cvterm.name = 'D_DJ_J_cluster' OR cvterm.name = 'V_DJ_cluster' OR cvterm.name = 'V_DJ_J_cluster' OR cvterm.name = 'V_VDJ_C_cluster' OR cvterm.name = 'V_VDJ_cluster' OR cvterm.name = 'V_VDJ_J_cluster' OR cvterm.name = 'V_VJ_C_cluster' OR cvterm.name = 'V_VJ_cluster' OR cvterm.name = 'V_VJ_J_cluster' OR cvterm.name = 'V_D_DJ_C_cluster' OR cvterm.name = 'V_D_DJ_cluster' OR cvterm.name = 'V_D_DJ_J_C_cluster' OR cvterm.name = 'V_D_DJ_J_cluster' OR cvterm.name = 'V_D_J_C_cluster' OR cvterm.name = 'V_D_J_cluster' OR cvterm.name = 'DJ_C_cluster' OR cvterm.name = 'DJ_J_C_cluster' OR cvterm.name = 'VDJ_C_cluster' OR cvterm.name = 'V_DJ_C_cluster' OR cvterm.name = 'V_DJ_J_C_cluster' OR cvterm.name = 'V_VDJ_J_C_cluster' OR cvterm.name = 'V_VJ_J_C_cluster' OR cvterm.name = 'J_gene_recombination_feature' OR cvterm.name = 'D_gene_recombination_feature' OR cvterm.name = 'V_gene_recombination_feature' OR cvterm.name = 'heptamer_of_recombination_feature_of_vertebrate_immune_system_gene' OR cvterm.name = 'nonamer_of_recombination_feature_of_vertebrate_immune_system_gene' OR cvterm.name = 'five_prime_D_recombination_signal_sequence' OR cvterm.name = 'three_prime_D_recombination_signal_sequence' OR cvterm.name = 'three_prime_D_heptamer' OR cvterm.name = 'five_prime_D_heptamer' OR cvterm.name = 'J_heptamer' OR cvterm.name = 'V_heptamer' OR cvterm.name = 'three_prime_D_nonamer' OR cvterm.name = 'five_prime_D_nonamer' OR cvterm.name = 'J_nonamer' OR cvterm.name = 'V_nonamer' OR cvterm.name = 'vertebrate_immune_system_gene_recombination_feature';

--- ************************************************
--- *** relation: j_gene_recombination_feature ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Recombination signal including J-heptame ***
--- *** r, J-spacer and J-nonamer in 5' of J-reg ***
--- *** ion of a J-gene or J-sequence.           ***
--- ************************************************
---

CREATE VIEW j_gene_recombination_feature AS
  SELECT
    feature_id AS j_gene_recombination_feature_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'J_gene_recombination_feature';

--- ************************************************
--- *** relation: clip ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Part of the primary transcript that is c ***
--- *** lipped off during processing.            ***
--- ************************************************
---

CREATE VIEW clip AS
  SELECT
    feature_id AS clip_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_clip' OR cvterm.name = 'three_prime_clip' OR cvterm.name = 'clip';

--- ************************************************
--- *** relation: modified_base ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A modified nucleotide, i.e. a nucleotide ***
--- ***  other than A, T, C. G.                  ***
--- ************************************************
---

CREATE VIEW modified_base AS
  SELECT
    feature_id AS modified_base_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'methylated_base_feature' OR cvterm.name = 'methylated_C' OR cvterm.name = 'methylated_A' OR cvterm.name = 'modified_base';

--- ************************************************
--- *** relation: methylated_base_feature ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A nucleotide modified by methylation.    ***
--- ************************************************
---

CREATE VIEW methylated_base_feature AS
  SELECT
    feature_id AS methylated_base_feature_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'methylated_C' OR cvterm.name = 'methylated_A' OR cvterm.name = 'methylated_base_feature';

--- ************************************************
--- *** relation: cpg_island ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Regions of a few hundred to a few thousa ***
--- *** nd bases in vertebrate genomes that are  ***
--- *** relatively GC and CpG rich; they are typ ***
--- *** ically unmethylated and often found near ***
--- ***  the 5' ends of genes.                   ***
--- ************************************************
---

CREATE VIEW cpg_island AS
  SELECT
    feature_id AS cpg_island_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'CpG_island';

--- ************************************************
--- *** relation: experimentally_determined ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Attribute to describe a feature that has ***
--- ***  been experimentally verified.           ***
--- ************************************************
---

CREATE VIEW experimentally_determined AS
  SELECT
    feature_id AS experimentally_determined_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'experimentally_determined';

--- ************************************************
--- *** relation: stem_loop ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A double-helical region of nucleic acid  ***
--- *** formed by base-pairing between adjacent  ***
--- *** (inverted) complementary sequences.      ***
--- ************************************************
---

CREATE VIEW stem_loop AS
  SELECT
    feature_id AS stem_loop_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tetraloop' OR cvterm.name = 'stem_loop';

--- ************************************************
--- *** relation: direct_repeat ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A repeat where the same sequence is repe ***
--- *** ated in the same direction. Example: GCT ***
--- *** GA-----GCTGA.                            ***
--- ************************************************
---

CREATE VIEW direct_repeat AS
  SELECT
    feature_id AS direct_repeat_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'target_site_duplication' OR cvterm.name = 'CRISPR' OR cvterm.name = 'direct_repeat';

--- ************************************************
--- *** relation: tss ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The first base where RNA polymerase begi ***
--- *** ns to synthesize the RNA transcript.     ***
--- ************************************************
---

CREATE VIEW tss AS
  SELECT
    feature_id AS tss_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'major_TSS' OR cvterm.name = 'minor_TSS' OR cvterm.name = 'TSS';

--- ************************************************
--- *** relation: cds ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A contiguous sequence which begins with, ***
--- ***  and includes, a start codon and ends wi ***
--- *** th, and includes, a stop codon.          ***
--- ************************************************
---

CREATE VIEW cds AS
  SELECT
    feature_id AS cds_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'edited_CDS' OR cvterm.name = 'CDS_fragment' OR cvterm.name = 'CDS_independently_known' OR cvterm.name = 'CDS_predicted' OR cvterm.name = 'orphan_CDS' OR cvterm.name = 'CDS_supported_by_sequence_similarity_data' OR cvterm.name = 'CDS_supported_by_domain_match_data' OR cvterm.name = 'CDS_supported_by_EST_or_cDNA_data' OR cvterm.name = 'CDS';

--- ************************************************
--- *** relation: cdna_clone ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Complementary DNA; A piece of DNA copied ***
--- ***  from an mRNA and spliced into a vector  ***
--- *** for propagation in a suitable host.      ***
--- ************************************************
---

CREATE VIEW cdna_clone AS
  SELECT
    feature_id AS cdna_clone_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'validated_cDNA_clone' OR cvterm.name = 'invalidated_cDNA_clone' OR cvterm.name = 'three_prime_RACE_clone' OR cvterm.name = 'chimeric_cDNA_clone' OR cvterm.name = 'genomically_contaminated_cDNA_clone' OR cvterm.name = 'polyA_primed_cDNA_clone' OR cvterm.name = 'partially_processed_cDNA_clone' OR cvterm.name = 'cDNA_clone';

--- ************************************************
--- *** relation: start_codon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** First codon to be translated by a riboso ***
--- *** me.                                      ***
--- ************************************************
---

CREATE VIEW start_codon AS
  SELECT
    feature_id AS start_codon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'non_canonical_start_codon' OR cvterm.name = 'four_bp_start_codon' OR cvterm.name = 'CTG_start_codon' OR cvterm.name = 'start_codon';

--- ************************************************
--- *** relation: stop_codon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** In mRNA, a set of three nucleotides that ***
--- ***  indicates the end of information for pr ***
--- *** otein synthesis.                         ***
--- ************************************************
---

CREATE VIEW stop_codon AS
  SELECT
    feature_id AS stop_codon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'stop_codon';

--- ************************************************
--- *** relation: intronic_splice_enhancer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Sequences within the intron that modulat ***
--- *** e splice site selection for some introns ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW intronic_splice_enhancer AS
  SELECT
    feature_id AS intronic_splice_enhancer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'intronic_splice_enhancer';

--- ************************************************
--- *** relation: mrna_with_plus_1_frameshift ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An mRNA with a plus 1 frameshift.        ***
--- ************************************************
---

CREATE VIEW mrna_with_plus_1_frameshift AS
  SELECT
    feature_id AS mrna_with_plus_1_frameshift_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mRNA_with_plus_1_frameshift';

--- ************************************************
--- *** relation: nuclease_hypersensitive_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW nuclease_hypersensitive_site AS
  SELECT
    feature_id AS nuclease_hypersensitive_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DNAseI_hypersensitive_site' OR cvterm.name = 'nuclease_hypersensitive_site';

--- ************************************************
--- *** relation: coding_start ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The first base to be translated into pro ***
--- *** tein.                                    ***
--- ************************************************
---

CREATE VIEW coding_start AS
  SELECT
    feature_id AS coding_start_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'coding_start';

--- ************************************************
--- *** relation: tag ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A nucleotide sequence that may be used t ***
--- *** o identify a larger sequence.            ***
--- ************************************************
---

CREATE VIEW tag AS
  SELECT
    feature_id AS tag_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'SAGE_tag' OR cvterm.name = 'STS' OR cvterm.name = 'EST' OR cvterm.name = 'engineered_tag' OR cvterm.name = 'five_prime_EST' OR cvterm.name = 'three_prime_EST' OR cvterm.name = 'UST' OR cvterm.name = 'RST' OR cvterm.name = 'three_prime_UST' OR cvterm.name = 'five_prime_UST' OR cvterm.name = 'three_prime_RST' OR cvterm.name = 'five_prime_RST' OR cvterm.name = 'tag';

--- ************************************************
--- *** relation: rrna_large_subunit_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding a large ri ***
--- *** bosomal subunit RNA.                     ***
--- ************************************************
---

CREATE VIEW rrna_large_subunit_primary_transcript AS
  SELECT
    feature_id AS rrna_large_subunit_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rRNA_large_subunit_primary_transcript';

--- ************************************************
--- *** relation: sage_tag ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A short diagnostic sequence tag, serial  ***
--- *** analysis of gene expression (SAGE), that ***
--- ***  allows the quantitative and simultaneou ***
--- *** s analysis of a large number of transcri ***
--- *** pts.                                     ***
--- ************************************************
---

CREATE VIEW sage_tag AS
  SELECT
    feature_id AS sage_tag_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'SAGE_tag';

--- ************************************************
--- *** relation: coding_end ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The last base to be translated into prot ***
--- *** ein. It does not include the stop codon. ***
--- ************************************************
---

CREATE VIEW coding_end AS
  SELECT
    feature_id AS coding_end_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'coding_end';

--- ************************************************
--- *** relation: microarray_oligo ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW microarray_oligo AS
  SELECT
    feature_id AS microarray_oligo_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'microarray_oligo';

--- ************************************************
--- *** relation: mrna_with_plus_2_frameshift ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An mRNA with a plus 2 frameshift.        ***
--- ************************************************
---

CREATE VIEW mrna_with_plus_2_frameshift AS
  SELECT
    feature_id AS mrna_with_plus_2_frameshift_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mRNA_with_plus_2_frameshift';

--- ************************************************
--- *** relation: conserved_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Region of sequence similarity by descent ***
--- ***  from a common ancestor.                 ***
--- ************************************************
---

CREATE VIEW conserved_region AS
  SELECT
    feature_id AS conserved_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'coding_conserved_region' OR cvterm.name = 'nc_conserved_region' OR cvterm.name = 'RR_tract' OR cvterm.name = 'homologous_region' OR cvterm.name = 'centromere_DNA_Element_I' OR cvterm.name = 'centromere_DNA_Element_II' OR cvterm.name = 'centromere_DNA_Element_III' OR cvterm.name = 'X_element' OR cvterm.name = 'U_box' OR cvterm.name = 'regional_centromere_central_core' OR cvterm.name = 'syntenic_region' OR cvterm.name = 'paralogous_region' OR cvterm.name = 'orthologous_region' OR cvterm.name = 'conserved_region';

--- ************************************************
--- *** relation: sts ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Short (typically a few hundred base pair ***
--- *** s) DNA sequence that has a single occurr ***
--- *** ence in a genome and whose location and  ***
--- *** base sequence are known.                 ***
--- ************************************************
---

CREATE VIEW sts AS
  SELECT
    feature_id AS sts_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'STS';

--- ************************************************
--- *** relation: coding_conserved_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Coding region of sequence similarity by  ***
--- *** descent from a common ancestor.          ***
--- ************************************************
---

CREATE VIEW coding_conserved_region AS
  SELECT
    feature_id AS coding_conserved_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'coding_conserved_region';

--- ************************************************
--- *** relation: exon_junction ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The boundary between two exons in a proc ***
--- *** essed transcript.                        ***
--- ************************************************
---

CREATE VIEW exon_junction AS
  SELECT
    feature_id AS exon_junction_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'exon_junction';

--- ************************************************
--- *** relation: nc_conserved_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Non-coding region of sequence similarity ***
--- ***  by descent from a common ancestor.      ***
--- ************************************************
---

CREATE VIEW nc_conserved_region AS
  SELECT
    feature_id AS nc_conserved_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'nc_conserved_region';

--- ************************************************
--- *** relation: mrna_with_minus_2_frameshift ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A mRNA with a minus 2 frameshift.        ***
--- ************************************************
---

CREATE VIEW mrna_with_minus_2_frameshift AS
  SELECT
    feature_id AS mrna_with_minus_2_frameshift_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mRNA_with_minus_2_frameshift';

--- ************************************************
--- *** relation: pseudogene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence that closely resembles a know ***
--- *** n functional gene, at another locus with ***
--- *** in a genome, that is non-functional as a ***
--- ***  consequence of (usually several) mutati ***
--- *** ons that prevent either its transcriptio ***
--- *** n or translation (or both). In general,  ***
--- *** pseudogenes result from either reverse t ***
--- *** ranscription of a transcript of their "n ***
--- *** ormal" paralog (SO:0000043) (in which ca ***
--- *** se the pseudogene typically lacks intron ***
--- *** s and includes a poly(A) tail) or from r ***
--- *** ecombination (SO:0000044) (in which case ***
--- ***  the pseudogene is typically a tandem du ***
--- *** plication of its "normal" paralog).      ***
--- ************************************************
---

CREATE VIEW pseudogene AS
  SELECT
    feature_id AS pseudogene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'processed_pseudogene' OR cvterm.name = 'non_processed_pseudogene' OR cvterm.name = 'pseudogene_by_unequal_crossing_over' OR cvterm.name = 'nuclear_mt_pseudogene' OR cvterm.name = 'cassette_pseudogene' OR cvterm.name = 'duplicated_pseudogene' OR cvterm.name = 'unitary_pseudogene' OR cvterm.name = 'pseudogene';

--- ************************************************
--- *** relation: rnai_reagent ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A double stranded RNA duplex, at least 2 ***
--- *** 0bp long, used experimentally to inhibit ***
--- ***  gene function by RNA interference.      ***
--- ************************************************
---

CREATE VIEW rnai_reagent AS
  SELECT
    feature_id AS rnai_reagent_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RNAi_reagent';

--- ************************************************
--- *** relation: mite ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A highly repetitive and short (100-500 b ***
--- *** ase pair) transposable element with term ***
--- *** inal inverted repeats (TIR) and target s ***
--- *** ite duplication (TSD). MITEs do not enco ***
--- *** de proteins.                             ***
--- ************************************************
---

CREATE VIEW mite AS
  SELECT
    feature_id AS mite_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'MITE';

--- ************************************************
--- *** relation: recombination_hotspot ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region in a genome which promotes reco ***
--- *** mbination.                               ***
--- ************************************************
---

CREATE VIEW recombination_hotspot AS
  SELECT
    feature_id AS recombination_hotspot_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'recombination_hotspot';

--- ************************************************
--- *** relation: chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Structural unit composed of a nucleic ac ***
--- *** id molecule which controls its own repli ***
--- *** cation through the interaction of specif ***
--- *** ic proteins at one or more origins of re ***
--- *** plication.                               ***
--- ************************************************
---

CREATE VIEW chromosome AS
  SELECT
    feature_id AS chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mitochondrial_chromosome' OR cvterm.name = 'chloroplast_chromosome' OR cvterm.name = 'chromoplast_chromosome' OR cvterm.name = 'cyanelle_chromosome' OR cvterm.name = 'leucoplast_chromosome' OR cvterm.name = 'macronuclear_chromosome' OR cvterm.name = 'micronuclear_chromosome' OR cvterm.name = 'nuclear_chromosome' OR cvterm.name = 'nucleomorphic_chromosome' OR cvterm.name = 'DNA_chromosome' OR cvterm.name = 'RNA_chromosome' OR cvterm.name = 'apicoplast_chromosome' OR cvterm.name = 'double_stranded_DNA_chromosome' OR cvterm.name = 'single_stranded_DNA_chromosome' OR cvterm.name = 'linear_double_stranded_DNA_chromosome' OR cvterm.name = 'circular_double_stranded_DNA_chromosome' OR cvterm.name = 'linear_single_stranded_DNA_chromosome' OR cvterm.name = 'circular_single_stranded_DNA_chromosome' OR cvterm.name = 'single_stranded_RNA_chromosome' OR cvterm.name = 'double_stranded_RNA_chromosome' OR cvterm.name = 'linear_single_stranded_RNA_chromosome' OR cvterm.name = 'circular_single_stranded_RNA_chromosome' OR cvterm.name = 'linear_double_stranded_RNA_chromosome' OR cvterm.name = 'circular_double_stranded_RNA_chromosome' OR cvterm.name = 'chromosome';

--- ************************************************
--- *** relation: chromosome_band ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A cytologically distinguishable feature  ***
--- *** of a chromosome, often made visible by s ***
--- *** taining, and usually alternating light a ***
--- *** nd dark.                                 ***
--- ************************************************
---

CREATE VIEW chromosome_band AS
  SELECT
    feature_id AS chromosome_band_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'chromosome_band';

--- ************************************************
--- *** relation: site_specific_recombination_target_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW site_specific_recombination_target_region AS
  SELECT
    feature_id AS site_specific_recombination_target_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'integration_excision_site' OR cvterm.name = 'resolution_site' OR cvterm.name = 'inversion_site' OR cvterm.name = 'inversion_site_part' OR cvterm.name = 'attI_site' OR cvterm.name = 'attP_site' OR cvterm.name = 'attB_site' OR cvterm.name = 'attL_site' OR cvterm.name = 'attR_site' OR cvterm.name = 'attC_site' OR cvterm.name = 'attCtn_site' OR cvterm.name = 'loxP_site' OR cvterm.name = 'dif_site' OR cvterm.name = 'FRT_site' OR cvterm.name = 'IRLinv_site' OR cvterm.name = 'IRRinv_site' OR cvterm.name = 'site_specific_recombination_target_region';

--- ************************************************
--- *** relation: match ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of sequence, aligned to another ***
--- ***  sequence with some statistical signific ***
--- *** ance, using an algorithm such as BLAST o ***
--- *** r SIM4.                                  ***
--- ************************************************
---

CREATE VIEW match AS
  SELECT
    feature_id AS match_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'nucleotide_match' OR cvterm.name = 'protein_match' OR cvterm.name = 'expressed_sequence_match' OR cvterm.name = 'cross_genome_match' OR cvterm.name = 'translated_nucleotide_match' OR cvterm.name = 'primer_match' OR cvterm.name = 'EST_match' OR cvterm.name = 'cDNA_match' OR cvterm.name = 'UST_match' OR cvterm.name = 'RST_match' OR cvterm.name = 'match';

--- ************************************************
--- *** relation: splice_enhancer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Region of a transcript that regulates sp ***
--- *** licing.                                  ***
--- ************************************************
---

CREATE VIEW splice_enhancer AS
  SELECT
    feature_id AS splice_enhancer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'intronic_splice_enhancer' OR cvterm.name = 'exonic_splice_enhancer' OR cvterm.name = 'splice_enhancer';

--- ************************************************
--- *** relation: est ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tag produced from a single sequencing  ***
--- *** read from a cDNA clone or PCR product; t ***
--- *** ypically a few hundred base pairs long.  ***
--- ************************************************
---

CREATE VIEW est AS
  SELECT
    feature_id AS est_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_EST' OR cvterm.name = 'three_prime_EST' OR cvterm.name = 'UST' OR cvterm.name = 'RST' OR cvterm.name = 'three_prime_UST' OR cvterm.name = 'five_prime_UST' OR cvterm.name = 'three_prime_RST' OR cvterm.name = 'five_prime_RST' OR cvterm.name = 'EST';

--- ************************************************
--- *** relation: loxp_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW loxp_site AS
  SELECT
    feature_id AS loxp_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'loxP_site';

--- ************************************************
--- *** relation: nucleotide_match ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A match against a nucleotide sequence.   ***
--- ************************************************
---

CREATE VIEW nucleotide_match AS
  SELECT
    feature_id AS nucleotide_match_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'expressed_sequence_match' OR cvterm.name = 'cross_genome_match' OR cvterm.name = 'translated_nucleotide_match' OR cvterm.name = 'primer_match' OR cvterm.name = 'EST_match' OR cvterm.name = 'cDNA_match' OR cvterm.name = 'UST_match' OR cvterm.name = 'RST_match' OR cvterm.name = 'nucleotide_match';

--- ************************************************
--- *** relation: nucleic_acid ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a sequence consi ***
--- *** sting of nucleobases bound to repeating  ***
--- *** units. The forms found in nature are deo ***
--- *** xyribonucleic acid (DNA), where the repe ***
--- *** ating units are 2-deoxy-D-ribose rings c ***
--- *** onnected to a phosphate backbone, and ri ***
--- *** bonucleic acid (RNA), where the repeatin ***
--- *** g units are D-ribose rings connected to  ***
--- *** a phosphate backbone.                    ***
--- ************************************************
---

CREATE VIEW nucleic_acid AS
  SELECT
    feature_id AS nucleic_acid_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DNA' OR cvterm.name = 'RNA' OR cvterm.name = 'morpholino_backbone' OR cvterm.name = 'PNA' OR cvterm.name = 'LNA' OR cvterm.name = 'TNA' OR cvterm.name = 'GNA' OR cvterm.name = 'cDNA' OR cvterm.name = 'genomic_DNA' OR cvterm.name = 'single_stranded_cDNA' OR cvterm.name = 'double_stranded_cDNA' OR cvterm.name = 'R_GNA' OR cvterm.name = 'S_GNA' OR cvterm.name = 'nucleic_acid';

--- ************************************************
--- *** relation: protein_match ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A match against a protein sequence.      ***
--- ************************************************
---

CREATE VIEW protein_match AS
  SELECT
    feature_id AS protein_match_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'protein_match';

--- ************************************************
--- *** relation: frt_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An inversion site found on the Saccharom ***
--- *** yces cerevisiae 2 micron plasmid.        ***
--- ************************************************
---

CREATE VIEW frt_site AS
  SELECT
    feature_id AS frt_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'FRT_site';

--- ************************************************
--- *** relation: synthetic_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute to decide a sequence of nuc ***
--- *** leotides, nucleotide analogs, or amino a ***
--- *** cids that has been designed by an experi ***
--- *** menter and which may, or may not, corres ***
--- *** pond with any natural sequence.          ***
--- ************************************************
---

CREATE VIEW synthetic_sequence AS
  SELECT
    feature_id AS synthetic_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'random_sequence' OR cvterm.name = 'designed_sequence' OR cvterm.name = 'synthetic_sequence';

--- ************************************************
--- *** relation: dna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a sequence consi ***
--- *** sting of nucleobases bound to a repeatin ***
--- *** g unit made of a 2-deoxy-D-ribose ring c ***
--- *** onnected to a phosphate backbone.        ***
--- ************************************************
---

CREATE VIEW dna AS
  SELECT
    feature_id AS dna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cDNA' OR cvterm.name = 'genomic_DNA' OR cvterm.name = 'single_stranded_cDNA' OR cvterm.name = 'double_stranded_cDNA' OR cvterm.name = 'DNA';

--- ************************************************
--- *** relation: sequence_assembly ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence of nucleotides that has been  ***
--- *** algorithmically derived from an alignmen ***
--- *** t of two or more different sequences.    ***
--- ************************************************
---

CREATE VIEW sequence_assembly AS
  SELECT
    feature_id AS sequence_assembly_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'supercontig' OR cvterm.name = 'contig' OR cvterm.name = 'tiling_path' OR cvterm.name = 'virtual_sequence' OR cvterm.name = 'golden_path' OR cvterm.name = 'ultracontig' OR cvterm.name = 'expressed_sequence_assembly' OR cvterm.name = 'sequence_assembly';

--- ************************************************
--- *** relation: group_1_intron_homing_endonuclease_target_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of intronic nucleotide sequence ***
--- ***  targeted by a nuclease enzyme.          ***
--- ************************************************
---

CREATE VIEW group_1_intron_homing_endonuclease_target_region AS
  SELECT
    feature_id AS group_1_intron_homing_endonuclease_target_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'group_1_intron_homing_endonuclease_target_region';

--- ************************************************
--- *** relation: haplotype_block ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of the genome which is co-inher ***
--- *** ited as the result of the lack of histor ***
--- *** ic recombination within it.              ***
--- ************************************************
---

CREATE VIEW haplotype_block AS
  SELECT
    feature_id AS haplotype_block_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'haplotype_block';

--- ************************************************
--- *** relation: rna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a sequence consi ***
--- *** sting of nucleobases bound to a repeatin ***
--- *** g unit made of a D-ribose ring connected ***
--- ***  to a phosphate backbone.                ***
--- ************************************************
---

CREATE VIEW rna AS
  SELECT
    feature_id AS rna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RNA';

--- ************************************************
--- *** relation: flanked ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a region that is ***
--- ***  bounded either side by a particular kin ***
--- *** d of region.                             ***
--- ************************************************
---

CREATE VIEW flanked AS
  SELECT
    feature_id AS flanked_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'floxed' OR cvterm.name = 'FRT_flanked' OR cvterm.name = 'flanked';

--- ************************************************
--- *** relation: floxed ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing sequence that is ***
--- ***  flanked by Lox-P sites.                 ***
--- ************************************************
---

CREATE VIEW floxed AS
  SELECT
    feature_id AS floxed_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'floxed';

--- ************************************************
--- *** relation: codon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A set of (usually) three nucleotide base ***
--- *** s in a DNA or RNA sequence, which togeth ***
--- *** er code for a unique amino acid or the t ***
--- *** ermination of translation and are contai ***
--- *** ned within the CDS.                      ***
--- ************************************************
---

CREATE VIEW codon AS
  SELECT
    feature_id AS codon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'recoded_codon' OR cvterm.name = 'start_codon' OR cvterm.name = 'stop_codon' OR cvterm.name = 'stop_codon_read_through' OR cvterm.name = 'stop_codon_redefined_as_pyrrolysine' OR cvterm.name = 'stop_codon_redefined_as_selenocysteine' OR cvterm.name = 'non_canonical_start_codon' OR cvterm.name = 'four_bp_start_codon' OR cvterm.name = 'CTG_start_codon' OR cvterm.name = 'codon';

--- ************************************************
--- *** relation: frt_flanked ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute to describe sequence that i ***
--- *** s flanked by the FLP recombinase recogni ***
--- *** tion site, FRT.                          ***
--- ************************************************
---

CREATE VIEW frt_flanked AS
  SELECT
    feature_id AS frt_flanked_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'FRT_flanked';

--- ************************************************
--- *** relation: invalidated_by_chimeric_cdna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A cDNA clone constructed from more than  ***
--- *** one mRNA. Usually an experimental artifa ***
--- *** ct.                                      ***
--- ************************************************
---

CREATE VIEW invalidated_by_chimeric_cdna AS
  SELECT
    feature_id AS invalidated_by_chimeric_cdna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'invalidated_by_chimeric_cDNA';

--- ************************************************
--- *** relation: floxed_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transgene that is floxed.              ***
--- ************************************************
---

CREATE VIEW floxed_gene AS
  SELECT
    feature_id AS floxed_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'floxed_gene';

--- ************************************************
--- *** relation: transposable_element_flanking_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The region of sequence surrounding a tra ***
--- *** nsposable element.                       ***
--- ************************************************
---

CREATE VIEW transposable_element_flanking_region AS
  SELECT
    feature_id AS transposable_element_flanking_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'transposable_element_flanking_region';

--- ************************************************
--- *** relation: integron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region encoding an integrase which act ***
--- *** s at a site adjacent to it (attI_site) t ***
--- *** o insert DNA which must include but is n ***
--- *** ot limited to an attC_site.              ***
--- ************************************************
---

CREATE VIEW integron AS
  SELECT
    feature_id AS integron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'integron';

--- ************************************************
--- *** relation: insertion_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The junction where an insertion occurred ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW insertion_site AS
  SELECT
    feature_id AS insertion_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'transposable_element_insertion_site' OR cvterm.name = 'insertion_site';

--- ************************************************
--- *** relation: atti_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region within an integron, adjacent to ***
--- ***  an integrase, at which site specific re ***
--- *** combination involving an attC_site takes ***
--- ***  place.                                  ***
--- ************************************************
---

CREATE VIEW atti_site AS
  SELECT
    feature_id AS atti_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'attI_site';

--- ************************************************
--- *** relation: transposable_element_insertion_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The junction in a genome where a transpo ***
--- *** sable_element has inserted.              ***
--- ************************************************
---

CREATE VIEW transposable_element_insertion_site AS
  SELECT
    feature_id AS transposable_element_insertion_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'transposable_element_insertion_site';

--- ************************************************
--- *** relation: small_regulatory_ncrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A non-coding RNA, usually with a specifi ***
--- *** c secondary structure, that acts to regu ***
--- *** late gene expression.                    ***
--- ************************************************
---

CREATE VIEW small_regulatory_ncrna AS
  SELECT
    feature_id AS small_regulatory_ncrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'miRNA' OR cvterm.name = 'RNA_6S' OR cvterm.name = 'CsrB_RsmB_RNA' OR cvterm.name = 'DsrA_RNA' OR cvterm.name = 'OxyS_RNA' OR cvterm.name = 'RprA_RNA' OR cvterm.name = 'RRE_RNA' OR cvterm.name = 'spot_42_RNA' OR cvterm.name = 'tmRNA' OR cvterm.name = 'GcvB_RNA' OR cvterm.name = 'small_regulatory_ncRNA';

--- ************************************************
--- *** relation: conjugative_transposon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transposon that encodes function requi ***
--- *** red for conjugation.                     ***
--- ************************************************
---

CREATE VIEW conjugative_transposon AS
  SELECT
    feature_id AS conjugative_transposon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'conjugative_transposon';

--- ************************************************
--- *** relation: enzymatic_rna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An RNA sequence that has catalytic activ ***
--- *** ity with or without an associated ribonu ***
--- *** cleoprotein.                             ***
--- ************************************************
---

CREATE VIEW enzymatic_rna AS
  SELECT
    feature_id AS enzymatic_rna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'ribozyme' OR cvterm.name = 'enzymatic_RNA';

--- ************************************************
--- *** relation: recombinationally_inverted_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A recombinationally rearranged gene by i ***
--- *** nversion.                                ***
--- ************************************************
---

CREATE VIEW recombinationally_inverted_gene AS
  SELECT
    feature_id AS recombinationally_inverted_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'recombinationally_inverted_gene';

--- ************************************************
--- *** relation: ribozyme ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An RNA with catalytic activity.          ***
--- ************************************************
---

CREATE VIEW ribozyme AS
  SELECT
    feature_id AS ribozyme_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'ribozyme';

--- ************************************************
--- *** relation: rrna_5_8s ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5_8S ribosomal RNA (5. 8S rRNA) is a com ***
--- *** ponent of the large subunit of the eukar ***
--- *** yotic ribosome. It is transcribed by RNA ***
--- ***  polymerase I as part of the 45S precurs ***
--- *** or that also contains 18S and 28S rRNA.  ***
--- *** Functionally, it is thought that 5.8S rR ***
--- *** NA may be involved in ribosome transloca ***
--- *** tion. It is also known to form covalent  ***
--- *** linkage to the p53 tumour suppressor pro ***
--- *** tein. 5_8S rRNA is also found in archaea ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW rrna_5_8s AS
  SELECT
    feature_id AS rrna_5_8s_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rRNA_5_8S';

--- ************************************************
--- *** relation: rna_6s ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A small (184-nt in E. coli) RNA that for ***
--- *** ms a hairpin type structure. 6S RNA asso ***
--- *** ciates with RNA polymerase in a highly s ***
--- *** pecific manner. 6S RNA represses express ***
--- *** ion from a sigma70-dependent promoter du ***
--- *** ring stationary phase.                   ***
--- ************************************************
---

CREATE VIEW rna_6s AS
  SELECT
    feature_id AS rna_6s_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RNA_6S';

--- ************************************************
--- *** relation: csrb_rsmb_rna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An enterobacterial RNA that binds the Cs ***
--- *** rA protein. The CsrB RNAs contain a cons ***
--- *** erved motif CAGGXXG that is found in up  ***
--- *** to 18 copies and has been suggested to b ***
--- *** ind CsrA. The Csr regulatory system has  ***
--- *** a strong negative regulatory effect on g ***
--- *** lycogen biosynthesis, glyconeogenesis an ***
--- *** d glycogen catabolism and a positive reg ***
--- *** ulatory effect on glycolysis. In other b ***
--- *** acteria such as Erwinia caratovara the R ***
--- *** smA protein has been shown to regulate t ***
--- *** he production of virulence determinants, ***
--- ***  such extracellular enzymes. RsmA binds  ***
--- *** to RsmB regulatory RNA which is also a m ***
--- *** ember of this family.                    ***
--- ************************************************
---

CREATE VIEW csrb_rsmb_rna AS
  SELECT
    feature_id AS csrb_rsmb_rna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'CsrB_RsmB_RNA';

--- ************************************************
--- *** relation: dsra_rna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** DsrA RNA regulates both transcription, b ***
--- *** y overcoming transcriptional silencing b ***
--- *** y the nucleoid-associated H-NS protein,  ***
--- *** and translation, by promoting efficient  ***
--- *** translation of the stress sigma factor,  ***
--- *** RpoS. These two activities of DsrA can b ***
--- *** e separated by mutation: the first of th ***
--- *** ree stem-loops of the 85 nucleotide RNA  ***
--- *** is necessary for RpoS translation but no ***
--- *** t for anti-H-NS action, while the second ***
--- ***  stem-loop is essential for antisilencin ***
--- *** g and less critical for RpoS translation ***
--- *** . The third stem-loop, which behaves as  ***
--- *** a transcription terminator, can be subst ***
--- *** ituted by the trp transcription terminat ***
--- *** or without loss of either DsrA function. ***
--- ***  The sequence of the first stem-loop of  ***
--- *** DsrA is complementary with the upstream  ***
--- *** leader portion of RpoS messenger RNA, su ***
--- *** ggesting that pairing of DsrA with the R ***
--- *** poS message might be important for trans ***
--- *** lational regulation.                     ***
--- ************************************************
---

CREATE VIEW dsra_rna AS
  SELECT
    feature_id AS dsra_rna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'GcvB_RNA' OR cvterm.name = 'DsrA_RNA';

--- ************************************************
--- *** relation: gcvb_rna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A small untranslated RNA involved in exp ***
--- *** ression of the dipeptide and oligopeptid ***
--- *** e transport systems in Escherichia coli. ***
--- ************************************************
---

CREATE VIEW gcvb_rna AS
  SELECT
    feature_id AS gcvb_rna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'GcvB_RNA';

--- ************************************************
--- *** relation: hammerhead_ribozyme ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A small catalytic RNA motif that catalyz ***
--- *** es self-cleavage reaction. Its name come ***
--- *** s from its secondary structure which res ***
--- *** embles a carpenter's hammer. The hammerh ***
--- *** ead ribozyme is involved in the replicat ***
--- *** ion of some viroid and some satellite RN ***
--- *** As.                                      ***
--- ************************************************
---

CREATE VIEW hammerhead_ribozyme AS
  SELECT
    feature_id AS hammerhead_ribozyme_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'hammerhead_ribozyme';

--- ************************************************
--- *** relation: group_iia_intron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW group_iia_intron AS
  SELECT
    feature_id AS group_iia_intron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'group_IIA_intron';

--- ************************************************
--- *** relation: group_iib_intron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW group_iib_intron AS
  SELECT
    feature_id AS group_iib_intron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'group_IIB_intron';

--- ************************************************
--- *** relation: micf_rna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A non-translated 93 nt antisense RNA tha ***
--- *** t binds its target ompF mRNA and regulat ***
--- *** es ompF expression by inhibiting transla ***
--- *** tion and inducing degradation of the mes ***
--- *** sage.                                    ***
--- ************************************************
---

CREATE VIEW micf_rna AS
  SELECT
    feature_id AS micf_rna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'MicF_RNA';

--- ************************************************
--- *** relation: oxys_rna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A small untranslated RNA which is induce ***
--- *** d in response to oxidative stress in Esc ***
--- *** herichia coli. Acts as a global regulato ***
--- *** r to activate or repress the expression  ***
--- *** of as many as 40 genes, including the fh ***
--- *** lA-encoded transcriptional activator and ***
--- ***  the rpoS-encoded sigma(s) subunit of RN ***
--- *** A polymerase. OxyS is bound by the Hfq p ***
--- *** rotein, that increases the OxyS RNA inte ***
--- *** raction with its target messages.        ***
--- ************************************************
---

CREATE VIEW oxys_rna AS
  SELECT
    feature_id AS oxys_rna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'OxyS_RNA';

--- ************************************************
--- *** relation: rnase_mrp_rna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The RNA molecule essential for the catal ***
--- *** ytic activity of RNase MRP, an enzymatic ***
--- *** ally active ribonucleoprotein with two d ***
--- *** istinct roles in eukaryotes. In mitochon ***
--- *** dria it plays a direct role in the initi ***
--- *** ation of mitochondrial DNA replication.  ***
--- *** In the nucleus it is involved in precurs ***
--- *** or rRNA processing, where it cleaves the ***
--- ***  internal transcribed spacer 1 between 1 ***
--- *** 8S and 5.8S rRNAs.                       ***
--- ************************************************
---

CREATE VIEW rnase_mrp_rna AS
  SELECT
    feature_id AS rnase_mrp_rna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RNase_MRP_RNA';

--- ************************************************
--- *** relation: rnase_p_rna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The RNA component of Ribonuclease P (RNa ***
--- *** se P), a ubiquitous endoribonuclease, fo ***
--- *** und in archaea, bacteria and eukarya as  ***
--- *** well as chloroplasts and mitochondria. I ***
--- *** ts best characterized activity is the ge ***
--- *** neration of mature 5 prime ends of tRNAs ***
--- ***  by cleaving the 5 prime leader elements ***
--- ***  of precursor-tRNAs. Cellular RNase Ps a ***
--- *** re ribonucleoproteins. RNA from bacteria ***
--- *** l RNase Ps retains its catalytic activit ***
--- *** y in the absence of the protein subunit, ***
--- ***  i.e. it is a ribozyme. Isolated eukaryo ***
--- *** tic and archaeal RNase P RNA has not bee ***
--- *** n shown to retain its catalytic function ***
--- *** , but is still essential for the catalyt ***
--- *** ic activity of the holoenzyme. Although  ***
--- *** the archaeal and eukaryotic holoenzymes  ***
--- *** have a much greater protein content than ***
--- ***  the bacterial ones, the RNA cores from  ***
--- *** all the three lineages are homologous. H ***
--- *** elices corresponding to P1, P2, P3, P4,  ***
--- *** and P10/11 are common to all cellular RN ***
--- *** ase P RNAs. Yet, there is considerable s ***
--- *** equence variation, particularly among th ***
--- *** e eukaryotic RNAs.                       ***
--- ************************************************
---

CREATE VIEW rnase_p_rna AS
  SELECT
    feature_id AS rnase_p_rna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RNase_P_RNA';

--- ************************************************
--- *** relation: rpra_rna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Translational regulation of the stationa ***
--- *** ry phase sigma factor RpoS is mediated b ***
--- *** y the formation of a double-stranded RNA ***
--- ***  stem-loop structure in the upstream reg ***
--- *** ion of the rpoS messenger RNA, occluding ***
--- ***  the translation initiation site. Clones ***
--- ***  carrying rprA (RpoS regulator RNA) incr ***
--- *** eased the translation of RpoS. The rprA  ***
--- *** gene encodes a 106 nucleotide regulatory ***
--- ***  RNA. As with DsrA Rfam:RF00014, RprA is ***
--- ***  predicted to form three stem-loops. Thu ***
--- *** s, at least two small RNAs, DsrA and Rpr ***
--- *** A, participate in the positive regulatio ***
--- *** n of RpoS translation. Unlike DsrA, RprA ***
--- ***  does not have an extensive region of co ***
--- *** mplementarity to the RpoS leader, leavin ***
--- *** g its mechanism of action unclear. RprA  ***
--- *** is non-essential.                        ***
--- ************************************************
---

CREATE VIEW rpra_rna AS
  SELECT
    feature_id AS rpra_rna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RprA_RNA';

--- ************************************************
--- *** relation: rre_rna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The Rev response element (RRE) is encode ***
--- *** d within the HIV-env gene. Rev is an ess ***
--- *** ential regulatory protein of HIV that bi ***
--- *** nds an internal loop of the RRE leading, ***
--- ***  encouraging further Rev-RRE binding. Th ***
--- *** is RNP complex is critical for mRNA expo ***
--- *** rt and hence for expression of the HIV s ***
--- *** tructural proteins.                      ***
--- ************************************************
---

CREATE VIEW rre_rna AS
  SELECT
    feature_id AS rre_rna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RRE_RNA';

--- ************************************************
--- *** relation: spot_42_rna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A 109-nucleotide RNA of E. coli that see ***
--- *** ms to have a regulatory role on the gala ***
--- *** ctose operon. Changes in Spot 42 levels  ***
--- *** are implicated in affecting DNA polymera ***
--- *** se I levels.                             ***
--- ************************************************
---

CREATE VIEW spot_42_rna AS
  SELECT
    feature_id AS spot_42_rna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'spot_42_RNA';

--- ************************************************
--- *** relation: telomerase_rna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The RNA component of telomerase, a rever ***
--- *** se transcriptase that synthesizes telome ***
--- *** ric DNA.                                 ***
--- ************************************************
---

CREATE VIEW telomerase_rna AS
  SELECT
    feature_id AS telomerase_rna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'telomerase_RNA';

--- ************************************************
--- *** relation: u1_snrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** U1 is a small nuclear RNA (snRNA) compon ***
--- *** ent of the spliceosome (involved in pre- ***
--- *** mRNA splicing). Its 5' end forms complem ***
--- *** entary base pairs with the 5' splice jun ***
--- *** ction, thus defining the 5' donor site o ***
--- *** f an intron. There are significant diffe ***
--- *** rences in sequence and secondary structu ***
--- *** re between metazoan and yeast U1 snRNAs, ***
--- ***  the latter being much longer (568 nucle ***
--- *** otides as compared to 164 nucleotides in ***
--- ***  human). Nevertheless, secondary structu ***
--- *** re predictions suggest that all U1 snRNA ***
--- *** s share a 'common core' consisting of he ***
--- *** lices I, II, the proximal region of III, ***
--- ***  and IV.                                 ***
--- ************************************************
---

CREATE VIEW u1_snrna AS
  SELECT
    feature_id AS u1_snrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'U1_snRNA';

--- ************************************************
--- *** relation: u2_snrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** U2 is a small nuclear RNA (snRNA) compon ***
--- *** ent of the spliceosome (involved in pre- ***
--- *** mRNA splicing). Complementary binding be ***
--- *** tween U2 snRNA (in an area lying towards ***
--- ***  the 5' end but 3' to hairpin I) and the ***
--- ***  branchpoint sequence (BPS) of the intro ***
--- *** n results in the bulging out of an unpai ***
--- *** red adenine, on the BPS, which initiates ***
--- ***  a nucleophilic attack at the intronic 5 ***
--- *** ' splice site, thus starting the first o ***
--- *** f two transesterification reactions that ***
--- ***  mediate splicing.                       ***
--- ************************************************
---

CREATE VIEW u2_snrna AS
  SELECT
    feature_id AS u2_snrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'U2_snRNA';

--- ************************************************
--- *** relation: u4_snrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** U4 small nuclear RNA (U4 snRNA) is a com ***
--- *** ponent of the major U2-dependent spliceo ***
--- *** some. It forms a duplex with U6, and wit ***
--- *** h each splicing round, it is displaced f ***
--- *** rom U6 (and the spliceosome) in an ATP-d ***
--- *** ependent manner, allowing U6 to refold a ***
--- *** nd create the active site for splicing c ***
--- *** atalysis. A recycling process involving  ***
--- *** protein Prp24 re-anneals U4 and U6.      ***
--- ************************************************
---

CREATE VIEW u4_snrna AS
  SELECT
    feature_id AS u4_snrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'U4_snRNA';

--- ************************************************
--- *** relation: u4atac_snrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An snRNA required for the splicing of th ***
--- *** e minor U12-dependent class of eukaryoti ***
--- *** c nuclear introns. It forms a base paire ***
--- *** d complex with U6atac_snRNA (SO:0000397) ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW u4atac_snrna AS
  SELECT
    feature_id AS u4atac_snrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'U4atac_snRNA';

--- ************************************************
--- *** relation: u5_snrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** U5 RNA is a component of both types of k ***
--- *** nown spliceosome. The precise function o ***
--- *** f this molecule is unknown, though it is ***
--- ***  known that the 5' loop is required for  ***
--- *** splice site selection and p220 binding,  ***
--- *** and that both the 3' stem-loop and the S ***
--- *** m site are important for Sm protein bind ***
--- *** ing and cap methylation.                 ***
--- ************************************************
---

CREATE VIEW u5_snrna AS
  SELECT
    feature_id AS u5_snrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'U5_snRNA';

--- ************************************************
--- *** relation: u6_snrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** U6 snRNA is a component of the spliceoso ***
--- *** me which is involved in splicing pre-mRN ***
--- *** A. The putative secondary structure cons ***
--- *** ensus base pairing is confined to a shor ***
--- *** t 5' stem loop, but U6 snRNA is thought  ***
--- *** to form extensive base-pair interactions ***
--- ***  with U4 snRNA.                          ***
--- ************************************************
---

CREATE VIEW u6_snrna AS
  SELECT
    feature_id AS u6_snrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'U6_snRNA';

--- ************************************************
--- *** relation: u6atac_snrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** U6atac_snRNA is an snRNA required for th ***
--- *** e splicing of the minor U12-dependent cl ***
--- *** ass of eukaryotic nuclear introns. It fo ***
--- *** rms a base paired complex with U4atac_sn ***
--- *** RNA (SO:0000394).                        ***
--- ************************************************
---

CREATE VIEW u6atac_snrna AS
  SELECT
    feature_id AS u6atac_snrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'U6atac_snRNA';

--- ************************************************
--- *** relation: u11_snrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** U11 snRNA plays a role in splicing of th ***
--- *** e minor U12-dependent class of eukaryoti ***
--- *** c nuclear introns, similar to U1 snRNA i ***
--- *** n the major class spliceosome it base pa ***
--- *** irs to the conserved 5' splice site sequ ***
--- *** ence.                                    ***
--- ************************************************
---

CREATE VIEW u11_snrna AS
  SELECT
    feature_id AS u11_snrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'U11_snRNA';

--- ************************************************
--- *** relation: u12_snrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The U12 small nuclear (snRNA), together  ***
--- *** with U4atac/U6atac, U5, and U11 snRNAs a ***
--- *** nd associated proteins, forms a spliceos ***
--- *** ome that cleaves a divergent class of lo ***
--- *** w-abundance pre-mRNA introns.            ***
--- ************************************************
---

CREATE VIEW u12_snrna AS
  SELECT
    feature_id AS u12_snrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'U12_snRNA';

--- ************************************************
--- *** relation: sequence_attribute ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describes a quality of sequ ***
--- *** ence.                                    ***
--- ************************************************
---

CREATE VIEW sequence_attribute AS
  SELECT
    feature_id AS sequence_attribute_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polymer_attribute' OR cvterm.name = 'feature_attribute' OR cvterm.name = 'sequence_location' OR cvterm.name = 'variant_quality' OR cvterm.name = 'nucleic_acid' OR cvterm.name = 'synthetic_sequence' OR cvterm.name = 'topology_attribute' OR cvterm.name = 'peptidyl' OR cvterm.name = 'DNA' OR cvterm.name = 'RNA' OR cvterm.name = 'morpholino_backbone' OR cvterm.name = 'PNA' OR cvterm.name = 'LNA' OR cvterm.name = 'TNA' OR cvterm.name = 'GNA' OR cvterm.name = 'cDNA' OR cvterm.name = 'genomic_DNA' OR cvterm.name = 'single_stranded_cDNA' OR cvterm.name = 'double_stranded_cDNA' OR cvterm.name = 'R_GNA' OR cvterm.name = 'S_GNA' OR cvterm.name = 'random_sequence' OR cvterm.name = 'designed_sequence' OR cvterm.name = 'linear' OR cvterm.name = 'circular' OR cvterm.name = 'transcript_attribute' OR cvterm.name = 'bound_by_factor' OR cvterm.name = 'flanked' OR cvterm.name = 'gene_attribute' OR cvterm.name = 'retrotransposed' OR cvterm.name = 'transgenic' OR cvterm.name = 'natural' OR cvterm.name = 'engineered' OR cvterm.name = 'foreign' OR cvterm.name = 'fusion' OR cvterm.name = 'rescue' OR cvterm.name = 'wild_type' OR cvterm.name = 'conserved' OR cvterm.name = 'status' OR cvterm.name = 'intermediate' OR cvterm.name = 'recombinationally_rearranged' OR cvterm.name = 'cryptic' OR cvterm.name = 'strand_attribute' OR cvterm.name = 'direction_attribute' OR cvterm.name = 'enzymatic' OR cvterm.name = 'mobile' OR cvterm.name = 'alteration_attribute' OR cvterm.name = 'experimental_feature_attribute' OR cvterm.name = 'edited' OR cvterm.name = 'capped' OR cvterm.name = 'mRNA_attribute' OR cvterm.name = 'trans_spliced' OR cvterm.name = 'alternatively_spliced' OR cvterm.name = 'monocistronic' OR cvterm.name = 'polycistronic' OR cvterm.name = 'polyadenylated' OR cvterm.name = 'exemplar' OR cvterm.name = 'frameshift' OR cvterm.name = 'recoded' OR cvterm.name = 'minus_1_frameshift' OR cvterm.name = 'minus_2_frameshift' OR cvterm.name = 'plus_1_frameshift' OR cvterm.name = 'plus_2_framshift' OR cvterm.name = 'codon_redefined' OR cvterm.name = 'recoded_by_translational_bypass' OR cvterm.name = 'translationally_frameshifted' OR cvterm.name = 'minus_1_translationally_frameshifted' OR cvterm.name = 'plus_1_translationally_frameshifted' OR cvterm.name = 'dicistronic' OR cvterm.name = 'bound_by_protein' OR cvterm.name = 'bound_by_nucleic_acid' OR cvterm.name = 'floxed' OR cvterm.name = 'FRT_flanked' OR cvterm.name = 'protein_coding' OR cvterm.name = 'non_protein_coding' OR cvterm.name = 'gene_to_gene_feature' OR cvterm.name = 'gene_array_member' OR cvterm.name = 'regulated' OR cvterm.name = 'epigenetically_modified' OR cvterm.name = 'encodes_alternately_spliced_transcripts' OR cvterm.name = 'encodes_alternate_transcription_start_sites' OR cvterm.name = 'intein_containing' OR cvterm.name = 'miRNA_encoding' OR cvterm.name = 'rRNA_encoding' OR cvterm.name = 'scRNA_encoding' OR cvterm.name = 'snoRNA_encoding' OR cvterm.name = 'snRNA_encoding' OR cvterm.name = 'SRP_RNA_encoding' OR cvterm.name = 'stRNA_encoding' OR cvterm.name = 'tmRNA_encoding' OR cvterm.name = 'tRNA_encoding' OR cvterm.name = 'gRNA_encoding' OR cvterm.name = 'C_D_box_snoRNA_encoding' OR cvterm.name = 'H_ACA_box_snoRNA_encoding' OR cvterm.name = 'overlapping' OR cvterm.name = 'inside_intron' OR cvterm.name = 'five_prime_three_prime_overlap' OR cvterm.name = 'five_prime_five_prime_overlap' OR cvterm.name = 'three_prime_three_prime_overlap' OR cvterm.name = 'three_prime_five_prime_overlap' OR cvterm.name = 'antisense' OR cvterm.name = 'inside_intron_antiparallel' OR cvterm.name = 'inside_intron_parallel' OR cvterm.name = 'operon_member' OR cvterm.name = 'gene_cassette_member' OR cvterm.name = 'gene_subarray_member' OR cvterm.name = 'member_of_regulon' OR cvterm.name = 'cassette_array_member' OR cvterm.name = 'transcriptionally_regulated' OR cvterm.name = 'post_translationally_regulated' OR cvterm.name = 'translationally_regulated' OR cvterm.name = 'imprinted' OR cvterm.name = 'transcriptionally_constitutive' OR cvterm.name = 'transcriptionally_induced' OR cvterm.name = 'transcriptionally_repressed' OR cvterm.name = 'autoregulated' OR cvterm.name = 'positively_autoregulated' OR cvterm.name = 'negatively_autoregulated' OR cvterm.name = 'silenced' OR cvterm.name = 'silenced_by_DNA_modification' OR cvterm.name = 'silenced_by_RNA_interference' OR cvterm.name = 'silenced_by_histone_modification' OR cvterm.name = 'silenced_by_DNA_methylation' OR cvterm.name = 'silenced_by_histone_methylation' OR cvterm.name = 'silenced_by_histone_deacetylation' OR cvterm.name = 'negatively_autoregulated' OR cvterm.name = 'positively_autoregulated' OR cvterm.name = 'post_translationally_regulated_by_protein_stability' OR cvterm.name = 'post_translationally_regulated_by_protein_modification' OR cvterm.name = 'maternally_imprinted' OR cvterm.name = 'paternally_imprinted' OR cvterm.name = 'imprinted' OR cvterm.name = 'allelically_excluded' OR cvterm.name = 'rearranged_at_DNA_level' OR cvterm.name = 'maternally_imprinted' OR cvterm.name = 'paternally_imprinted' OR cvterm.name = 'encodes_1_polypeptide' OR cvterm.name = 'encodes_greater_than_1_polypeptide' OR cvterm.name = 'encodes_disjoint_polypeptides' OR cvterm.name = 'encodes_overlapping_peptides' OR cvterm.name = 'encodes_different_polypeptides_different_stop' OR cvterm.name = 'encodes_overlapping_peptides_different_start' OR cvterm.name = 'encodes_overlapping_polypeptides_different_start_and_stop' OR cvterm.name = 'homologous' OR cvterm.name = 'syntenic' OR cvterm.name = 'orthologous' OR cvterm.name = 'paralogous' OR cvterm.name = 'fragmentary' OR cvterm.name = 'predicted' OR cvterm.name = 'validated' OR cvterm.name = 'invalidated' OR cvterm.name = 'independently_known' OR cvterm.name = 'consensus' OR cvterm.name = 'low_complexity' OR cvterm.name = 'whole_genome_sequence_status' OR cvterm.name = 'supported_by_sequence_similarity' OR cvterm.name = 'orphan' OR cvterm.name = 'predicted_by_ab_initio_computation' OR cvterm.name = 'supported_by_domain_match' OR cvterm.name = 'supported_by_EST_or_cDNA' OR cvterm.name = 'experimentally_determined' OR cvterm.name = 'invalidated_by_chimeric_cDNA' OR cvterm.name = 'invalidated_by_genomic_contamination' OR cvterm.name = 'invalidated_by_genomic_polyA_primed_cDNA' OR cvterm.name = 'invalidated_by_partial_processing' OR cvterm.name = 'standard_draft' OR cvterm.name = 'high_quality_draft' OR cvterm.name = 'improved_high_quality_draft' OR cvterm.name = 'annotation_directed_improved_draft' OR cvterm.name = 'noncontiguous_finished' OR cvterm.name = 'finished_genome' OR cvterm.name = 'single' OR cvterm.name = 'double' OR cvterm.name = 'forward' OR cvterm.name = 'reverse' OR cvterm.name = 'ribozymic' OR cvterm.name = 'chromosomal_variation_attribute' OR cvterm.name = 'insertion_attribute' OR cvterm.name = 'inversion_attribute' OR cvterm.name = 'translocaton_attribute' OR cvterm.name = 'duplication_attribute' OR cvterm.name = 'intrachromosomal' OR cvterm.name = 'interchromosomal' OR cvterm.name = 'tandem' OR cvterm.name = 'direct' OR cvterm.name = 'inverted' OR cvterm.name = 'pericentric' OR cvterm.name = 'paracentric' OR cvterm.name = 'reciprocal' OR cvterm.name = 'insertional' OR cvterm.name = 'free' OR cvterm.name = 'score' OR cvterm.name = 'quality_value' OR cvterm.name = 'organelle_sequence' OR cvterm.name = 'plasmid_location' OR cvterm.name = 'proviral_location' OR cvterm.name = 'macronuclear_sequence' OR cvterm.name = 'micronuclear_sequence' OR cvterm.name = 'mitochondrial_sequence' OR cvterm.name = 'nuclear_sequence' OR cvterm.name = 'nucleomorphic_sequence' OR cvterm.name = 'plastid_sequence' OR cvterm.name = 'mitochondrial_DNA' OR cvterm.name = 'apicoplast_sequence' OR cvterm.name = 'chromoplast_sequence' OR cvterm.name = 'chloroplast_sequence' OR cvterm.name = 'cyanelle_sequence' OR cvterm.name = 'leucoplast_sequence' OR cvterm.name = 'proplastid_sequence' OR cvterm.name = 'chloroplast_DNA' OR cvterm.name = 'endogenous_retroviral_sequence' OR cvterm.name = 'variant_origin' OR cvterm.name = 'variant_frequency' OR cvterm.name = 'variant_phenotype' OR cvterm.name = 'maternal_variant' OR cvterm.name = 'paternal_variant' OR cvterm.name = 'somatic_variant' OR cvterm.name = 'germline_variant' OR cvterm.name = 'pedigree_specific_variant' OR cvterm.name = 'population_specific_variant' OR cvterm.name = 'de_novo_variant' OR cvterm.name = 'unique_variant' OR cvterm.name = 'rare_variant' OR cvterm.name = 'polymorphic_variant' OR cvterm.name = 'common_variant' OR cvterm.name = 'fixed_variant' OR cvterm.name = 'benign_variant' OR cvterm.name = 'disease_associated_variant' OR cvterm.name = 'disease_causing_variant' OR cvterm.name = 'lethal_variant' OR cvterm.name = 'quantitative_variant' OR cvterm.name = 'sequence_attribute';

--- ************************************************
--- *** relation: gene_attribute ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW gene_attribute AS
  SELECT
    feature_id AS gene_attribute_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'protein_coding' OR cvterm.name = 'non_protein_coding' OR cvterm.name = 'gene_to_gene_feature' OR cvterm.name = 'gene_array_member' OR cvterm.name = 'regulated' OR cvterm.name = 'epigenetically_modified' OR cvterm.name = 'encodes_alternately_spliced_transcripts' OR cvterm.name = 'encodes_alternate_transcription_start_sites' OR cvterm.name = 'intein_containing' OR cvterm.name = 'miRNA_encoding' OR cvterm.name = 'rRNA_encoding' OR cvterm.name = 'scRNA_encoding' OR cvterm.name = 'snoRNA_encoding' OR cvterm.name = 'snRNA_encoding' OR cvterm.name = 'SRP_RNA_encoding' OR cvterm.name = 'stRNA_encoding' OR cvterm.name = 'tmRNA_encoding' OR cvterm.name = 'tRNA_encoding' OR cvterm.name = 'gRNA_encoding' OR cvterm.name = 'C_D_box_snoRNA_encoding' OR cvterm.name = 'H_ACA_box_snoRNA_encoding' OR cvterm.name = 'overlapping' OR cvterm.name = 'inside_intron' OR cvterm.name = 'five_prime_three_prime_overlap' OR cvterm.name = 'five_prime_five_prime_overlap' OR cvterm.name = 'three_prime_three_prime_overlap' OR cvterm.name = 'three_prime_five_prime_overlap' OR cvterm.name = 'antisense' OR cvterm.name = 'inside_intron_antiparallel' OR cvterm.name = 'inside_intron_parallel' OR cvterm.name = 'operon_member' OR cvterm.name = 'gene_cassette_member' OR cvterm.name = 'gene_subarray_member' OR cvterm.name = 'member_of_regulon' OR cvterm.name = 'cassette_array_member' OR cvterm.name = 'transcriptionally_regulated' OR cvterm.name = 'post_translationally_regulated' OR cvterm.name = 'translationally_regulated' OR cvterm.name = 'imprinted' OR cvterm.name = 'transcriptionally_constitutive' OR cvterm.name = 'transcriptionally_induced' OR cvterm.name = 'transcriptionally_repressed' OR cvterm.name = 'autoregulated' OR cvterm.name = 'positively_autoregulated' OR cvterm.name = 'negatively_autoregulated' OR cvterm.name = 'silenced' OR cvterm.name = 'silenced_by_DNA_modification' OR cvterm.name = 'silenced_by_RNA_interference' OR cvterm.name = 'silenced_by_histone_modification' OR cvterm.name = 'silenced_by_DNA_methylation' OR cvterm.name = 'silenced_by_histone_methylation' OR cvterm.name = 'silenced_by_histone_deacetylation' OR cvterm.name = 'negatively_autoregulated' OR cvterm.name = 'positively_autoregulated' OR cvterm.name = 'post_translationally_regulated_by_protein_stability' OR cvterm.name = 'post_translationally_regulated_by_protein_modification' OR cvterm.name = 'maternally_imprinted' OR cvterm.name = 'paternally_imprinted' OR cvterm.name = 'imprinted' OR cvterm.name = 'allelically_excluded' OR cvterm.name = 'rearranged_at_DNA_level' OR cvterm.name = 'maternally_imprinted' OR cvterm.name = 'paternally_imprinted' OR cvterm.name = 'encodes_1_polypeptide' OR cvterm.name = 'encodes_greater_than_1_polypeptide' OR cvterm.name = 'encodes_disjoint_polypeptides' OR cvterm.name = 'encodes_overlapping_peptides' OR cvterm.name = 'encodes_different_polypeptides_different_stop' OR cvterm.name = 'encodes_overlapping_peptides_different_start' OR cvterm.name = 'encodes_overlapping_polypeptides_different_start_and_stop' OR cvterm.name = 'gene_attribute';

--- ************************************************
--- *** relation: u14_snorna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** U14 small nucleolar RNA (U14 snoRNA) is  ***
--- *** required for early cleavages of eukaryot ***
--- *** ic precursor rRNAs. In yeasts, this mole ***
--- *** cule possess a stem-loop region (known a ***
--- *** s the Y-domain) which is essential for f ***
--- *** unction. A similar structure, but with a ***
--- ***  different consensus sequence, is found  ***
--- *** in plants, but is absent in vertebrates. ***
--- ************************************************
---

CREATE VIEW u14_snorna AS
  SELECT
    feature_id AS u14_snorna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'U14_snoRNA';

--- ************************************************
--- *** relation: vault_rna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A family of RNAs are found as part of th ***
--- *** e enigmatic vault ribonucleoprotein comp ***
--- *** lex. The complex consists of a major vau ***
--- *** lt protein (MVP), two minor vault protei ***
--- *** ns (VPARP and TEP1), and several small u ***
--- *** ntranslated RNA molecules. It has been s ***
--- *** uggested that the vault complex is invol ***
--- *** ved in drug resistance.                  ***
--- ************************************************
---

CREATE VIEW vault_rna AS
  SELECT
    feature_id AS vault_rna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'vault_RNA';

--- ************************************************
--- *** relation: y_rna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Y RNAs are components of the Ro ribonucl ***
--- *** eoprotein particle (Ro RNP), in associat ***
--- *** ion with Ro60 and La proteins. The Y RNA ***
--- *** s and Ro60 and La proteins are well cons ***
--- *** erved, but the function of the Ro RNP is ***
--- ***  not known. In humans the RNA component  ***
--- *** can be one of four small RNAs: hY1, hY3, ***
--- ***  hY4 and hY5. These small RNAs are predi ***
--- *** cted to fold into a conserved secondary  ***
--- *** structure containing three stem structur ***
--- *** es. The largest of the four, hY1, contai ***
--- *** ns an additional hairpin.                ***
--- ************************************************
---

CREATE VIEW y_rna AS
  SELECT
    feature_id AS y_rna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'Y_RNA';

--- ************************************************
--- *** relation: twintron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An intron within an intron. Twintrons ar ***
--- *** e group II or III introns, into which an ***
--- *** other group II or III intron has been tr ***
--- *** ansposed.                                ***
--- ************************************************
---

CREATE VIEW twintron AS
  SELECT
    feature_id AS twintron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'twintron';

--- ************************************************
--- *** relation: rrna_18s ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A large polynucleotide in eukaryotes, wh ***
--- *** ich functions as the small subunit of th ***
--- *** e ribosome.                              ***
--- ************************************************
---

CREATE VIEW rrna_18s AS
  SELECT
    feature_id AS rrna_18s_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rRNA_18S';

--- ************************************************
--- *** relation: binding_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A biological_region of sequence that, in ***
--- ***  the molecule, interacts selectively and ***
--- ***  non-covalently with other molecules. A  ***
--- *** region on the surface of a molecule that ***
--- ***  may interact with another molecule. Whe ***
--- *** n applied to polypeptides: Amino acids i ***
--- *** nvolved in binding or interactions. It c ***
--- *** an also apply to an amino acid bond whic ***
--- *** h is represented by the positions of the ***
--- ***  two flanking amino acids.               ***
--- ************************************************
---

CREATE VIEW binding_site AS
  SELECT
    feature_id AS binding_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'protein_binding_site' OR cvterm.name = 'epitope' OR cvterm.name = 'nucleotide_binding_site' OR cvterm.name = 'metal_binding_site' OR cvterm.name = 'ligand_binding_site' OR cvterm.name = 'protein_protein_contact' OR cvterm.name = 'nucleotide_to_protein_binding_site' OR cvterm.name = 'nuclease_binding_site' OR cvterm.name = 'TF_binding_site' OR cvterm.name = 'histone_binding_site' OR cvterm.name = 'insulator_binding_site' OR cvterm.name = 'enhancer_binding_site' OR cvterm.name = 'restriction_enzyme_binding_site' OR cvterm.name = 'nuclease_sensitive_site' OR cvterm.name = 'homing_endonuclease_binding_site' OR cvterm.name = 'nuclease_hypersensitive_site' OR cvterm.name = 'group_1_intron_homing_endonuclease_target_region' OR cvterm.name = 'DNAseI_hypersensitive_site' OR cvterm.name = 'miRNA_target_site' OR cvterm.name = 'DNA_binding_site' OR cvterm.name = 'primer_binding_site' OR cvterm.name = 'polypeptide_DNA_contact' OR cvterm.name = 'polypeptide_metal_contact' OR cvterm.name = 'polypeptide_calcium_ion_contact_site' OR cvterm.name = 'polypeptide_cobalt_ion_contact_site' OR cvterm.name = 'polypeptide_copper_ion_contact_site' OR cvterm.name = 'polypeptide_iron_ion_contact_site' OR cvterm.name = 'polypeptide_magnesium_ion_contact_site' OR cvterm.name = 'polypeptide_manganese_ion_contact_site' OR cvterm.name = 'polypeptide_molybdenum_ion_contact_site' OR cvterm.name = 'polypeptide_nickel_ion_contact_site' OR cvterm.name = 'polypeptide_tungsten_ion_contact_site' OR cvterm.name = 'polypeptide_zinc_ion_contact_site' OR cvterm.name = 'polypeptide_ligand_contact' OR cvterm.name = 'binding_site';

--- ************************************************
--- *** relation: protein_binding_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A binding site that, in the molecule, in ***
--- *** teracts selectively and non-covalently w ***
--- *** ith polypeptide molecules.               ***
--- ************************************************
---

CREATE VIEW protein_binding_site AS
  SELECT
    feature_id AS protein_binding_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'protein_protein_contact' OR cvterm.name = 'nucleotide_to_protein_binding_site' OR cvterm.name = 'nuclease_binding_site' OR cvterm.name = 'TF_binding_site' OR cvterm.name = 'histone_binding_site' OR cvterm.name = 'insulator_binding_site' OR cvterm.name = 'enhancer_binding_site' OR cvterm.name = 'restriction_enzyme_binding_site' OR cvterm.name = 'nuclease_sensitive_site' OR cvterm.name = 'homing_endonuclease_binding_site' OR cvterm.name = 'nuclease_hypersensitive_site' OR cvterm.name = 'group_1_intron_homing_endonuclease_target_region' OR cvterm.name = 'DNAseI_hypersensitive_site' OR cvterm.name = 'protein_binding_site';

--- ************************************************
--- *** relation: rescue_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region that rescues.                   ***
--- ************************************************
---

CREATE VIEW rescue_region AS
  SELECT
    feature_id AS rescue_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'engineered_rescue_region' OR cvterm.name = 'rescue_region';

--- ************************************************
--- *** relation: restriction_fragment ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of polynucleotide sequence prod ***
--- *** uced by digestion with a restriction end ***
--- *** onuclease.                               ***
--- ************************************************
---

CREATE VIEW restriction_fragment AS
  SELECT
    feature_id AS restriction_fragment_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RFLP_fragment' OR cvterm.name = 'restriction_fragment';

--- ************************************************
--- *** relation: sequence_difference ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region where the sequence differs from ***
--- ***  that of a specified sequence.           ***
--- ************************************************
---

CREATE VIEW sequence_difference AS
  SELECT
    feature_id AS sequence_difference_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'possible_base_call_error' OR cvterm.name = 'possible_assembly_error' OR cvterm.name = 'assembly_error_correction' OR cvterm.name = 'base_call_error_correction' OR cvterm.name = 'sequence_difference';

--- ************************************************
--- *** relation: invalidated_by_genomic_contamination ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute to describe a feature that  ***
--- *** is invalidated due to genomic contaminat ***
--- *** ion.                                     ***
--- ************************************************
---

CREATE VIEW invalidated_by_genomic_contamination AS
  SELECT
    feature_id AS invalidated_by_genomic_contamination_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'invalidated_by_genomic_contamination';

--- ************************************************
--- *** relation: invalidated_by_genomic_polya_primed_cdna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute to describe a feature that  ***
--- *** is invalidated due to polyA priming.     ***
--- ************************************************
---

CREATE VIEW invalidated_by_genomic_polya_primed_cdna AS
  SELECT
    feature_id AS invalidated_by_genomic_polya_primed_cdna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'invalidated_by_genomic_polyA_primed_cDNA';

--- ************************************************
--- *** relation: invalidated_by_partial_processing ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute to describe a feature that  ***
--- *** is invalidated due to partial processing ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW invalidated_by_partial_processing AS
  SELECT
    feature_id AS invalidated_by_partial_processing_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'invalidated_by_partial_processing';

--- ************************************************
--- *** relation: polypeptide_domain ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A structurally or functionally defined p ***
--- *** rotein region. In proteins with multiple ***
--- ***  domains, the combination of the domains ***
--- ***  determines the function of the protein. ***
--- ***  A region which has been shown to recur  ***
--- *** throughout evolution.                    ***
--- ************************************************
---

CREATE VIEW polypeptide_domain AS
  SELECT
    feature_id AS polypeptide_domain_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_domain';

--- ************************************************
--- *** relation: signal_peptide ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The signal_peptide is a short region of  ***
--- *** the peptide located at the N-terminus th ***
--- *** at directs the protein to be secreted or ***
--- ***  part of membrane components.            ***
--- ************************************************
---

CREATE VIEW signal_peptide AS
  SELECT
    feature_id AS signal_peptide_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'signal_peptide';

--- ************************************************
--- *** relation: mature_protein_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The polypeptide sequence that remains wh ***
--- *** en the cleaved peptide regions have been ***
--- ***  cleaved from the immature peptide.      ***
--- ************************************************
---

CREATE VIEW mature_protein_region AS
  SELECT
    feature_id AS mature_protein_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'active_peptide' OR cvterm.name = 'mature_protein_region';

--- ************************************************
--- *** relation: five_prime_terminal_inverted_repeat ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW five_prime_terminal_inverted_repeat AS
  SELECT
    feature_id AS five_prime_terminal_inverted_repeat_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_terminal_inverted_repeat';

--- ************************************************
--- *** relation: three_prime_terminal_inverted_repeat ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW three_prime_terminal_inverted_repeat AS
  SELECT
    feature_id AS three_prime_terminal_inverted_repeat_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_terminal_inverted_repeat';

--- ************************************************
--- *** relation: u5_ltr_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW u5_ltr_region AS
  SELECT
    feature_id AS u5_ltr_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'U5_five_prime_LTR_region' OR cvterm.name = 'U5_LTR_region';

--- ************************************************
--- *** relation: r_ltr_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW r_ltr_region AS
  SELECT
    feature_id AS r_ltr_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'R_five_prime_LTR_region' OR cvterm.name = 'R_LTR_region';

--- ************************************************
--- *** relation: u3_ltr_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW u3_ltr_region AS
  SELECT
    feature_id AS u3_ltr_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'U3_five_prime_LTR_region' OR cvterm.name = 'U3_LTR_region';

--- ************************************************
--- *** relation: five_prime_ltr ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW five_prime_ltr AS
  SELECT
    feature_id AS five_prime_ltr_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_LTR';

--- ************************************************
--- *** relation: three_prime_ltr ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW three_prime_ltr AS
  SELECT
    feature_id AS three_prime_ltr_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_LTR';

--- ************************************************
--- *** relation: r_five_prime_ltr_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW r_five_prime_ltr_region AS
  SELECT
    feature_id AS r_five_prime_ltr_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'R_five_prime_LTR_region';

--- ************************************************
--- *** relation: u5_five_prime_ltr_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW u5_five_prime_ltr_region AS
  SELECT
    feature_id AS u5_five_prime_ltr_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'U5_five_prime_LTR_region';

--- ************************************************
--- *** relation: u3_five_prime_ltr_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW u3_five_prime_ltr_region AS
  SELECT
    feature_id AS u3_five_prime_ltr_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'U3_five_prime_LTR_region';

--- ************************************************
--- *** relation: r_three_prime_ltr_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW r_three_prime_ltr_region AS
  SELECT
    feature_id AS r_three_prime_ltr_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'R_three_prime_LTR_region';

--- ************************************************
--- *** relation: u3_three_prime_ltr_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW u3_three_prime_ltr_region AS
  SELECT
    feature_id AS u3_three_prime_ltr_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'U3_three_prime_LTR_region';

--- ************************************************
--- *** relation: u5_three_prime_ltr_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW u5_three_prime_ltr_region AS
  SELECT
    feature_id AS u5_three_prime_ltr_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'U5_three_prime_LTR_region';

--- ************************************************
--- *** relation: non_ltr_retrotransposon_polymeric_tract ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A polymeric tract, such as poly(dA), wit ***
--- *** hin a non_LTR_retrotransposon.           ***
--- ************************************************
---

CREATE VIEW non_ltr_retrotransposon_polymeric_tract AS
  SELECT
    feature_id AS non_ltr_retrotransposon_polymeric_tract_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'non_LTR_retrotransposon_polymeric_tract';

--- ************************************************
--- *** relation: target_site_duplication ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence of the target DNA that is dup ***
--- *** licated when a transposable element or p ***
--- *** hage inserts; usually found at each end  ***
--- *** the insertion.                           ***
--- ************************************************
---

CREATE VIEW target_site_duplication AS
  SELECT
    feature_id AS target_site_duplication_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'target_site_duplication';

--- ************************************************
--- *** relation: rr_tract ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A polypurine tract within an LTR_retrotr ***
--- *** ansposon.                                ***
--- ************************************************
---

CREATE VIEW rr_tract AS
  SELECT
    feature_id AS rr_tract_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RR_tract';

--- ************************************************
--- *** relation: ars ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence that can autonomously replica ***
--- *** te, as a plasmid, when transformed into  ***
--- *** a bacterial host.                        ***
--- ************************************************
---

CREATE VIEW ars AS
  SELECT
    feature_id AS ars_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'ARS';

--- ************************************************
--- *** relation: inverted_ring_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW inverted_ring_chromosome AS
  SELECT
    feature_id AS inverted_ring_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inverted_ring_chromosome';

--- ************************************************
--- *** relation: vector_replicon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A replicon that has been modified to act ***
--- ***  as a vector for foreign sequence.       ***
--- ************************************************
---

CREATE VIEW vector_replicon AS
  SELECT
    feature_id AS vector_replicon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'YAC' OR cvterm.name = 'BAC' OR cvterm.name = 'PAC' OR cvterm.name = 'cosmid' OR cvterm.name = 'phagemid' OR cvterm.name = 'fosmid' OR cvterm.name = 'lambda_vector' OR cvterm.name = 'plasmid_vector' OR cvterm.name = 'targeting_vector' OR cvterm.name = 'vector_replicon';

--- ************************************************
--- *** relation: ss_oligo ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A single stranded oligonucleotide.       ***
--- ************************************************
---

CREATE VIEW ss_oligo AS
  SELECT
    feature_id AS ss_oligo_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'primer' OR cvterm.name = 'sequencing_primer' OR cvterm.name = 'forward_primer' OR cvterm.name = 'reverse_primer' OR cvterm.name = 'ASPE_primer' OR cvterm.name = 'dCAPS_primer' OR cvterm.name = 'ss_oligo';

--- ************************************************
--- *** relation: ds_oligo ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A double stranded oligonucleotide.       ***
--- ************************************************
---

CREATE VIEW ds_oligo AS
  SELECT
    feature_id AS ds_oligo_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RNAi_reagent' OR cvterm.name = 'DNA_constraint_sequence' OR cvterm.name = 'ds_oligo';

--- ************************************************
--- *** relation: polymer_attribute ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute to describe the kind of bio ***
--- *** logical sequence.                        ***
--- ************************************************
---

CREATE VIEW polymer_attribute AS
  SELECT
    feature_id AS polymer_attribute_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'nucleic_acid' OR cvterm.name = 'synthetic_sequence' OR cvterm.name = 'topology_attribute' OR cvterm.name = 'peptidyl' OR cvterm.name = 'DNA' OR cvterm.name = 'RNA' OR cvterm.name = 'morpholino_backbone' OR cvterm.name = 'PNA' OR cvterm.name = 'LNA' OR cvterm.name = 'TNA' OR cvterm.name = 'GNA' OR cvterm.name = 'cDNA' OR cvterm.name = 'genomic_DNA' OR cvterm.name = 'single_stranded_cDNA' OR cvterm.name = 'double_stranded_cDNA' OR cvterm.name = 'R_GNA' OR cvterm.name = 'S_GNA' OR cvterm.name = 'random_sequence' OR cvterm.name = 'designed_sequence' OR cvterm.name = 'linear' OR cvterm.name = 'circular' OR cvterm.name = 'polymer_attribute';

--- ************************************************
--- *** relation: three_prime_noncoding_exon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Non-coding exon in the 3' UTR.           ***
--- ************************************************
---

CREATE VIEW three_prime_noncoding_exon AS
  SELECT
    feature_id AS three_prime_noncoding_exon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_noncoding_exon';

--- ************************************************
--- *** relation: five_prime_noncoding_exon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Non-coding exon in the 5' UTR.           ***
--- ************************************************
---

CREATE VIEW five_prime_noncoding_exon AS
  SELECT
    feature_id AS five_prime_noncoding_exon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_noncoding_exon';

--- ************************************************
--- *** relation: utr_intron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Intron located in the untranslated regio ***
--- *** n.                                       ***
--- ************************************************
---

CREATE VIEW utr_intron AS
  SELECT
    feature_id AS utr_intron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_UTR_intron' OR cvterm.name = 'three_prime_UTR_intron' OR cvterm.name = 'UTR_intron';

--- ************************************************
--- *** relation: five_prime_utr_intron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An intron located in the 5' UTR.         ***
--- ************************************************
---

CREATE VIEW five_prime_utr_intron AS
  SELECT
    feature_id AS five_prime_utr_intron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_UTR_intron';

--- ************************************************
--- *** relation: three_prime_utr_intron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An intron located in the 3' UTR.         ***
--- ************************************************
---

CREATE VIEW three_prime_utr_intron AS
  SELECT
    feature_id AS three_prime_utr_intron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_UTR_intron';

--- ************************************************
--- *** relation: random_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence of nucleotides or amino acids ***
--- ***  which, by design, has a "random" order  ***
--- *** of components, given a predetermined inp ***
--- *** ut frequency of these components.        ***
--- ************************************************
---

CREATE VIEW random_sequence AS
  SELECT
    feature_id AS random_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'random_sequence';

--- ************************************************
--- *** relation: interband ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A light region between two darkly staini ***
--- *** ng bands in a polytene chromosome.       ***
--- ************************************************
---

CREATE VIEW interband AS
  SELECT
    feature_id AS interband_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'interband';

--- ************************************************
--- *** relation: gene_with_polyadenylated_mrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that encodes a polyadenylated mRN ***
--- *** A.                                       ***
--- ************************************************
---

CREATE VIEW gene_with_polyadenylated_mrna AS
  SELECT
    feature_id AS gene_with_polyadenylated_mrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_with_polyadenylated_mRNA';

--- ************************************************
--- *** relation: chromosomal_transposition ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosome structure variant whereby a ***
--- ***  region of a chromosome has been transfe ***
--- *** rred to another position. Among interchr ***
--- *** omosomal rearrangements, the term transp ***
--- *** osition is reserved for that class in wh ***
--- *** ich the telomeres of the chromosomes inv ***
--- *** olved are coupled (that is to say, form  ***
--- *** the two ends of a single DNA molecule) a ***
--- *** s in wild-type.                          ***
--- ************************************************
---

CREATE VIEW chromosomal_transposition AS
  SELECT
    feature_id AS chromosomal_transposition_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'intrachromosomal_transposition' OR cvterm.name = 'interchromosomal_transposition' OR cvterm.name = 'deficient_intrachromosomal_transposition' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'uninverted_intrachromosomal_transposition' OR cvterm.name = 'unoriented_intrachromosomal_transposition' OR cvterm.name = 'deficient_interchromosomal_transposition' OR cvterm.name = 'inverted_interchromosomal_transposition' OR cvterm.name = 'uninverted_interchromosomal_transposition' OR cvterm.name = 'unoriented_interchromosomal_transposition' OR cvterm.name = 'chromosomal_transposition';

--- ************************************************
--- *** relation: rasirna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A 17-28-nt, small interfering RNA derive ***
--- *** d from transcripts of repetitive element ***
--- *** s.                                       ***
--- ************************************************
---

CREATE VIEW rasirna AS
  SELECT
    feature_id AS rasirna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rasiRNA';

--- ************************************************
--- *** relation: gene_with_mrna_with_frameshift ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that encodes an mRNA with a frame ***
--- *** shift.                                   ***
--- ************************************************
---

CREATE VIEW gene_with_mrna_with_frameshift AS
  SELECT
    feature_id AS gene_with_mrna_with_frameshift_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_with_mRNA_with_frameshift';

--- ************************************************
--- *** relation: recombinationally_rearranged_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is recombinationally rearran ***
--- *** ged.                                     ***
--- ************************************************
---

CREATE VIEW recombinationally_rearranged_gene AS
  SELECT
    feature_id AS recombinationally_rearranged_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'recombinationally_inverted_gene' OR cvterm.name = 'recombinationally_rearranged_vertebrate_immune_system_gene' OR cvterm.name = 'recombinationally_rearranged_gene';

--- ************************************************
--- *** relation: interchromosomal_duplication ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosome duplication involving an in ***
--- *** sertion from another chromosome.         ***
--- ************************************************
---

CREATE VIEW interchromosomal_duplication AS
  SELECT
    feature_id AS interchromosomal_duplication_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'interchromosomal_duplication';

--- ************************************************
--- *** relation: d_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Germline genomic DNA including D-region  ***
--- *** with 5' UTR and 3' UTR, also designated  ***
--- *** as D-segment.                            ***
--- ************************************************
---

CREATE VIEW d_gene AS
  SELECT
    feature_id AS d_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'D_gene';

--- ************************************************
--- *** relation: gene_with_trans_spliced_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene with a transcript that is trans-s ***
--- *** pliced.                                  ***
--- ************************************************
---

CREATE VIEW gene_with_trans_spliced_transcript AS
  SELECT
    feature_id AS gene_with_trans_spliced_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_with_trans_spliced_transcript';

--- ************************************************
--- *** relation: vertebrate_immunoglobulin_t_cell_receptor_segment ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW vertebrate_immunoglobulin_t_cell_receptor_segment AS
  SELECT
    feature_id AS vertebrate_immunoglobulin_t_cell_receptor_segment_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'D_gene' OR cvterm.name = 'V_gene' OR cvterm.name = 'J_gene' OR cvterm.name = 'C_gene' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_segment';

--- ************************************************
--- *** relation: inversion_derived_bipartite_deficiency ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosomal deletion whereby a chromos ***
--- *** ome generated by recombination between t ***
--- *** wo inversions; has a deficiency at each  ***
--- *** end of the inversion.                    ***
--- ************************************************
---

CREATE VIEW inversion_derived_bipartite_deficiency AS
  SELECT
    feature_id AS inversion_derived_bipartite_deficiency_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inversion_derived_bipartite_deficiency';

--- ************************************************
--- *** relation: pseudogenic_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A non-functional descendent of a functio ***
--- *** nal entity.                              ***
--- ************************************************
---

CREATE VIEW pseudogenic_region AS
  SELECT
    feature_id AS pseudogenic_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'decayed_exon' OR cvterm.name = 'pseudogenic_exon' OR cvterm.name = 'pseudogenic_transcript' OR cvterm.name = 'pseudogenic_rRNA' OR cvterm.name = 'pseudogenic_tRNA' OR cvterm.name = 'pseudogenic_region';

--- ************************************************
--- *** relation: encodes_alternately_spliced_transcripts ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that encodes more than one transc ***
--- *** ript.                                    ***
--- ************************************************
---

CREATE VIEW encodes_alternately_spliced_transcripts AS
  SELECT
    feature_id AS encodes_alternately_spliced_transcripts_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'encodes_1_polypeptide' OR cvterm.name = 'encodes_greater_than_1_polypeptide' OR cvterm.name = 'encodes_disjoint_polypeptides' OR cvterm.name = 'encodes_overlapping_peptides' OR cvterm.name = 'encodes_different_polypeptides_different_stop' OR cvterm.name = 'encodes_overlapping_peptides_different_start' OR cvterm.name = 'encodes_overlapping_polypeptides_different_start_and_stop' OR cvterm.name = 'encodes_alternately_spliced_transcripts';

--- ************************************************
--- *** relation: decayed_exon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A non-functional descendant of an exon.  ***
--- ************************************************
---

CREATE VIEW decayed_exon AS
  SELECT
    feature_id AS decayed_exon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'decayed_exon';

--- ************************************************
--- *** relation: inversion_derived_deficiency_plus_duplication ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosome deletion whereby a chromoso ***
--- *** me is generated by recombination between ***
--- ***  two inversions; there is a deficiency a ***
--- *** t one end of the inversion and a duplica ***
--- *** tion at the other end of the inversion.  ***
--- ************************************************
---

CREATE VIEW inversion_derived_deficiency_plus_duplication AS
  SELECT
    feature_id AS inversion_derived_deficiency_plus_duplication_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inversion_derived_deficiency_plus_duplication';

--- ************************************************
--- *** relation: v_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Germline genomic DNA including L-part1,  ***
--- *** V-intron and V-exon, with the 5' UTR and ***
--- ***  3' UTR.                                 ***
--- ************************************************
---

CREATE VIEW v_gene AS
  SELECT
    feature_id AS v_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'V_gene';

--- ************************************************
--- *** relation: post_translationally_regulated_by_protein_stability ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a gene sequence  ***
--- *** where the resulting protein is regulated ***
--- ***  by the stability of the resulting prote ***
--- *** in.                                      ***
--- ************************************************
---

CREATE VIEW post_translationally_regulated_by_protein_stability AS
  SELECT
    feature_id AS post_translationally_regulated_by_protein_stability_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'post_translationally_regulated_by_protein_stability';

--- ************************************************
--- *** relation: golden_path_fragment ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** One of the pieces of sequence that make  ***
--- *** up a golden path.                        ***
--- ************************************************
---

CREATE VIEW golden_path_fragment AS
  SELECT
    feature_id AS golden_path_fragment_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'golden_path_fragment';

--- ************************************************
--- *** relation: post_translationally_regulated_by_protein_modification ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a gene sequence  ***
--- *** where the resulting protein is modified  ***
--- *** to regulate it.                          ***
--- ************************************************
---

CREATE VIEW post_translationally_regulated_by_protein_modification AS
  SELECT
    feature_id AS post_translationally_regulated_by_protein_modification_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'post_translationally_regulated_by_protein_modification';

--- ************************************************
--- *** relation: j_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Germline genomic DNA of an immunoglobuli ***
--- *** n/T-cell receptor gene including J-regio ***
--- *** n with 5' UTR (SO:0000204) and 3' UTR (S ***
--- *** O:0000205), also designated as J-segment ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW j_gene AS
  SELECT
    feature_id AS j_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'J_gene';

--- ************************************************
--- *** relation: autoregulated ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The gene product is involved in its own  ***
--- *** transcriptional regulation.              ***
--- ************************************************
---

CREATE VIEW autoregulated AS
  SELECT
    feature_id AS autoregulated_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'negatively_autoregulated' OR cvterm.name = 'positively_autoregulated' OR cvterm.name = 'autoregulated';

--- ************************************************
--- *** relation: tiling_path ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A set of regions which overlap with mini ***
--- *** mal polymorphism to form a linear sequen ***
--- *** ce.                                      ***
--- ************************************************
---

CREATE VIEW tiling_path AS
  SELECT
    feature_id AS tiling_path_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tiling_path';

--- ************************************************
--- *** relation: negatively_autoregulated ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The gene product is involved in its own  ***
--- *** transcriptional regulation where it decr ***
--- *** eases transcription.                     ***
--- ************************************************
---

CREATE VIEW negatively_autoregulated AS
  SELECT
    feature_id AS negatively_autoregulated_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'negatively_autoregulated';

--- ************************************************
--- *** relation: tiling_path_fragment ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A piece of sequence that makes up a tili ***
--- *** ng_path (SO:0000472).                    ***
--- ************************************************
---

CREATE VIEW tiling_path_fragment AS
  SELECT
    feature_id AS tiling_path_fragment_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tiling_path_clone' OR cvterm.name = 'tiling_path_fragment';

--- ************************************************
--- *** relation: positively_autoregulated ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The gene product is involved in its own  ***
--- *** transcriptional regulation, where it inc ***
--- *** reases transcription.                    ***
--- ************************************************
---

CREATE VIEW positively_autoregulated AS
  SELECT
    feature_id AS positively_autoregulated_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'positively_autoregulated';

--- ************************************************
--- *** relation: contig_read ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A DNA sequencer read which is part of a  ***
--- *** contig.                                  ***
--- ************************************************
---

CREATE VIEW contig_read AS
  SELECT
    feature_id AS contig_read_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'contig_read';

--- ************************************************
--- *** relation: c_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene including C-region (and intro ***
--- *** ns if present) with 5' UTR (SO:0000204)  ***
--- *** and 3' UTR (SO:0000205).                 ***
--- ************************************************
---

CREATE VIEW c_gene AS
  SELECT
    feature_id AS c_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'C_gene';

--- ************************************************
--- *** relation: trans_spliced_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transcript that is trans-spliced.      ***
--- ************************************************
---

CREATE VIEW trans_spliced_transcript AS
  SELECT
    feature_id AS trans_spliced_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'trans_spliced_mRNA' OR cvterm.name = 'trans_spliced_transcript';

--- ************************************************
--- *** relation: tiling_path_clone ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A clone which is part of a tiling path.  ***
--- *** A tiling path is a set of sequencing sub ***
--- *** strates, typically clones, which have be ***
--- *** en selected in order to efficiently cove ***
--- *** r a region of the genome in preparation  ***
--- *** for sequencing and assembly.             ***
--- ************************************************
---

CREATE VIEW tiling_path_clone AS
  SELECT
    feature_id AS tiling_path_clone_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tiling_path_clone';

--- ************************************************
--- *** relation: terminal_inverted_repeat ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An inverted repeat (SO:0000294) occurrin ***
--- *** g at the termini of a DNA transposon.    ***
--- ************************************************
---

CREATE VIEW terminal_inverted_repeat AS
  SELECT
    feature_id AS terminal_inverted_repeat_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_terminal_inverted_repeat' OR cvterm.name = 'three_prime_terminal_inverted_repeat' OR cvterm.name = 'terminal_inverted_repeat';

--- ************************************************
--- *** relation: vertebrate_immunoglobulin_t_cell_receptor_gene_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW vertebrate_immunoglobulin_t_cell_receptor_gene_cluster AS
  SELECT
    feature_id AS vertebrate_immunoglobulin_t_cell_receptor_gene_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'D_J_C_cluster' OR cvterm.name = 'J_C_cluster' OR cvterm.name = 'J_cluster' OR cvterm.name = 'V_cluster' OR cvterm.name = 'V_J_cluster' OR cvterm.name = 'V_J_C_cluster' OR cvterm.name = 'C_cluster' OR cvterm.name = 'D_cluster' OR cvterm.name = 'D_J_cluster' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_gene_cluster';

--- ************************************************
--- *** relation: nc_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript that is never trans ***
--- *** lated into a protein.                    ***
--- ************************************************
---

CREATE VIEW nc_primary_transcript AS
  SELECT
    feature_id AS nc_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'scRNA_primary_transcript' OR cvterm.name = 'rRNA_primary_transcript' OR cvterm.name = 'tRNA_primary_transcript' OR cvterm.name = 'snRNA_primary_transcript' OR cvterm.name = 'snoRNA_primary_transcript' OR cvterm.name = 'tmRNA_primary_transcript' OR cvterm.name = 'SRP_RNA_primary_transcript' OR cvterm.name = 'miRNA_primary_transcript' OR cvterm.name = 'tasiRNA_primary_transcript' OR cvterm.name = 'rRNA_small_subunit_primary_transcript' OR cvterm.name = 'rRNA_large_subunit_primary_transcript' OR cvterm.name = 'alanine_tRNA_primary_transcript' OR cvterm.name = 'arginine_tRNA_primary_transcript' OR cvterm.name = 'asparagine_tRNA_primary_transcript' OR cvterm.name = 'aspartic_acid_tRNA_primary_transcript' OR cvterm.name = 'cysteine_tRNA_primary_transcript' OR cvterm.name = 'glutamic_acid_tRNA_primary_transcript' OR cvterm.name = 'glutamine_tRNA_primary_transcript' OR cvterm.name = 'glycine_tRNA_primary_transcript' OR cvterm.name = 'histidine_tRNA_primary_transcript' OR cvterm.name = 'isoleucine_tRNA_primary_transcript' OR cvterm.name = 'leucine_tRNA_primary_transcript' OR cvterm.name = 'lysine_tRNA_primary_transcript' OR cvterm.name = 'methionine_tRNA_primary_transcript' OR cvterm.name = 'phenylalanine_tRNA_primary_transcript' OR cvterm.name = 'proline_tRNA_primary_transcript' OR cvterm.name = 'serine_tRNA_primary_transcript' OR cvterm.name = 'threonine_tRNA_primary_transcript' OR cvterm.name = 'tryptophan_tRNA_primary_transcript' OR cvterm.name = 'tyrosine_tRNA_primary_transcript' OR cvterm.name = 'valine_tRNA_primary_transcript' OR cvterm.name = 'pyrrolysine_tRNA_primary_transcript' OR cvterm.name = 'selenocysteine_tRNA_primary_transcript' OR cvterm.name = 'methylation_guide_snoRNA_primary_transcript' OR cvterm.name = 'rRNA_cleavage_snoRNA_primary_transcript' OR cvterm.name = 'C_D_box_snoRNA_primary_transcript' OR cvterm.name = 'H_ACA_box_snoRNA_primary_transcript' OR cvterm.name = 'U14_snoRNA_primary_transcript' OR cvterm.name = 'stRNA_primary_transcript' OR cvterm.name = 'nc_primary_transcript';

--- ************************************************
--- *** relation: three_prime_coding_exon_noncoding_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The sequence of the 3' exon that is not  ***
--- *** coding.                                  ***
--- ************************************************
---

CREATE VIEW three_prime_coding_exon_noncoding_region AS
  SELECT
    feature_id AS three_prime_coding_exon_noncoding_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_coding_exon_noncoding_region';

--- ************************************************
--- *** relation: dj_j_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one DJ-gene, and one J ***
--- *** -gene.                                   ***
--- ************************************************
---

CREATE VIEW dj_j_cluster AS
  SELECT
    feature_id AS dj_j_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DJ_J_cluster';

--- ************************************************
--- *** relation: five_prime_coding_exon_noncoding_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The sequence of the 5' exon preceding th ***
--- *** e start codon.                           ***
--- ************************************************
---

CREATE VIEW five_prime_coding_exon_noncoding_region AS
  SELECT
    feature_id AS five_prime_coding_exon_noncoding_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_coding_exon_noncoding_region';

--- ************************************************
--- *** relation: vdj_j_c_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one VDJ-gene, one J-ge ***
--- *** ne and one C-gene.                       ***
--- ************************************************
---

CREATE VIEW vdj_j_c_cluster AS
  SELECT
    feature_id AS vdj_j_c_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'VDJ_J_C_cluster';

--- ************************************************
--- *** relation: vdj_j_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one VDJ-gene and one J ***
--- *** -gene.                                   ***
--- ************************************************
---

CREATE VIEW vdj_j_cluster AS
  SELECT
    feature_id AS vdj_j_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'VDJ_J_cluster';

--- ************************************************
--- *** relation: vj_c_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one VJ-gene and one C- ***
--- *** gene.                                    ***
--- ************************************************
---

CREATE VIEW vj_c_cluster AS
  SELECT
    feature_id AS vj_c_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'VJ_C_cluster';

--- ************************************************
--- *** relation: vj_j_c_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one VJ-gene, one J-gen ***
--- *** e and one C-gene.                        ***
--- ************************************************
---

CREATE VIEW vj_j_c_cluster AS
  SELECT
    feature_id AS vj_j_c_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'VJ_J_C_cluster';

--- ************************************************
--- *** relation: vj_j_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one VJ-gene and one J- ***
--- *** gene.                                    ***
--- ************************************************
---

CREATE VIEW vj_j_cluster AS
  SELECT
    feature_id AS vj_j_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'VJ_J_cluster';

--- ************************************************
--- *** relation: d_gene_recombination_feature ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW d_gene_recombination_feature AS
  SELECT
    feature_id AS d_gene_recombination_feature_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_D_recombination_signal_sequence' OR cvterm.name = 'three_prime_D_recombination_signal_sequence' OR cvterm.name = 'D_gene_recombination_feature';

--- ************************************************
--- *** relation: three_prime_d_heptamer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 7 nucleotide recombination site like CAC ***
--- *** AGTG, part of a 3' D-recombination signa ***
--- *** l sequence of an immunoglobulin/T-cell r ***
--- *** eceptor gene.                            ***
--- ************************************************
---

CREATE VIEW three_prime_d_heptamer AS
  SELECT
    feature_id AS three_prime_d_heptamer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_D_heptamer';

--- ************************************************
--- *** relation: three_prime_d_nonamer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A 9 nucleotide recombination site (e.g.  ***
--- *** ACAAAAACC), part of a 3' D-recombination ***
--- ***  signal sequence of an immunoglobulin/T- ***
--- *** cell receptor gene.                      ***
--- ************************************************
---

CREATE VIEW three_prime_d_nonamer AS
  SELECT
    feature_id AS three_prime_d_nonamer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_D_nonamer';

--- ************************************************
--- *** relation: three_prime_d_spacer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A 12 or 23 nucleotide spacer between the ***
--- ***  3'D-HEPTAMER and 3'D-NONAMER of a 3'D-R ***
--- *** S.                                       ***
--- ************************************************
---

CREATE VIEW three_prime_d_spacer AS
  SELECT
    feature_id AS three_prime_d_spacer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_D_spacer';

--- ************************************************
--- *** relation: five_prime_d_heptamer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 7 nucleotide recombination site (e.g. CA ***
--- *** CTGTG), part of a 5' D-recombination sig ***
--- *** nal sequence (SO:0000556) of an immunogl ***
--- *** obulin/T-cell receptor gene.             ***
--- ************************************************
---

CREATE VIEW five_prime_d_heptamer AS
  SELECT
    feature_id AS five_prime_d_heptamer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_D_heptamer';

--- ************************************************
--- *** relation: five_prime_d_nonamer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 9 nucleotide recombination site (e.g. GG ***
--- *** TTTTTGT), part of a five_prime_D-recombi ***
--- *** nation signal sequence (SO:0000556) of a ***
--- *** n immunoglobulin/T-cell receptor gene.   ***
--- ************************************************
---

CREATE VIEW five_prime_d_nonamer AS
  SELECT
    feature_id AS five_prime_d_nonamer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_D_nonamer';

--- ************************************************
--- *** relation: five_prime_d_spacer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 12 or 23 nucleotide spacer between the 5 ***
--- *** ' D-heptamer (SO:0000496) and 5' D-nonam ***
--- *** er (SO:0000497) of a 5' D-recombination  ***
--- *** signal sequence (SO:0000556) of an immun ***
--- *** oglobulin/T-cell receptor gene.          ***
--- ************************************************
---

CREATE VIEW five_prime_d_spacer AS
  SELECT
    feature_id AS five_prime_d_spacer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_D_spacer';

--- ************************************************
--- *** relation: virtual_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A continuous piece of sequence similar t ***
--- *** o the 'virtual contig' concept of the En ***
--- *** sembl database.                          ***
--- ************************************************
---

CREATE VIEW virtual_sequence AS
  SELECT
    feature_id AS virtual_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'virtual_sequence';

--- ************************************************
--- *** relation: hoogsteen_base_pair ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A type of non-canonical base-pairing. Th ***
--- *** is is less energetically favourable than ***
--- ***  watson crick base pairing. Hoogsteen GC ***
--- ***  base pairs only have two hydrogen bonds ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW hoogsteen_base_pair AS
  SELECT
    feature_id AS hoogsteen_base_pair_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'Hoogsteen_base_pair';

--- ************************************************
--- *** relation: reverse_hoogsteen_base_pair ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A type of non-canonical base-pairing.    ***
--- ************************************************
---

CREATE VIEW reverse_hoogsteen_base_pair AS
  SELECT
    feature_id AS reverse_hoogsteen_base_pair_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'reverse_Hoogsteen_base_pair';

--- ************************************************
--- *** relation: d_dj_c_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one D-gene, one DJ-gen ***
--- *** e and one C-gene.                        ***
--- ************************************************
---

CREATE VIEW d_dj_c_cluster AS
  SELECT
    feature_id AS d_dj_c_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'D_DJ_C_cluster';

--- ************************************************
--- *** relation: d_dj_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one D-gene and one DJ- ***
--- *** gene.                                    ***
--- ************************************************
---

CREATE VIEW d_dj_cluster AS
  SELECT
    feature_id AS d_dj_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'D_DJ_cluster';

--- ************************************************
--- *** relation: d_dj_j_c_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one D-gene, one DJ-gen ***
--- *** e, one J-gene and one C-gene.            ***
--- ************************************************
---

CREATE VIEW d_dj_j_c_cluster AS
  SELECT
    feature_id AS d_dj_j_c_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'D_DJ_J_C_cluster';

--- ************************************************
--- *** relation: pseudogenic_exon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A non functional descendant of an exon,  ***
--- *** part of a pseudogene.                    ***
--- ************************************************
---

CREATE VIEW pseudogenic_exon AS
  SELECT
    feature_id AS pseudogenic_exon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pseudogenic_exon';

--- ************************************************
--- *** relation: d_dj_j_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one D-gene, one DJ-gen ***
--- *** e, and one J-gene.                       ***
--- ************************************************
---

CREATE VIEW d_dj_j_cluster AS
  SELECT
    feature_id AS d_dj_j_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'D_DJ_J_cluster';

--- ************************************************
--- *** relation: d_j_c_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in germline configuration inc ***
--- *** luding at least one D-gene, one J-gene a ***
--- *** nd one C-gene.                           ***
--- ************************************************
---

CREATE VIEW d_j_c_cluster AS
  SELECT
    feature_id AS d_j_c_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'D_J_C_cluster';

--- ************************************************
--- *** relation: vd_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in partially rearranged genom ***
--- *** ic DNA including L-part1, V-intron and V ***
--- *** -D-exon, with the 5' UTR (SO:0000204) an ***
--- *** d 3' UTR (SO:0000205).                   ***
--- ************************************************
---

CREATE VIEW vd_gene AS
  SELECT
    feature_id AS vd_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'VD_gene';

--- ************************************************
--- *** relation: j_c_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in germline configuration inc ***
--- *** luding at least one J-gene and one C-gen ***
--- *** e.                                       ***
--- ************************************************
---

CREATE VIEW j_c_cluster AS
  SELECT
    feature_id AS j_c_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'J_C_cluster';

--- ************************************************
--- *** relation: inversion_derived_deficiency_plus_aneuploid ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosomal deletion whereby a chromos ***
--- *** ome generated by recombination between t ***
--- *** wo inversions; has a deficiency at one e ***
--- *** nd and presumed to have a deficiency or  ***
--- *** duplication at the other end of the inve ***
--- *** rsion.                                   ***
--- ************************************************
---

CREATE VIEW inversion_derived_deficiency_plus_aneuploid AS
  SELECT
    feature_id AS inversion_derived_deficiency_plus_aneuploid_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inversion_derived_deficiency_plus_aneuploid';

--- ************************************************
--- *** relation: j_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in germline configuration inc ***
--- *** luding more than one J-gene.             ***
--- ************************************************
---

CREATE VIEW j_cluster AS
  SELECT
    feature_id AS j_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'J_cluster';

--- ************************************************
--- *** relation: j_nonamer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 9 nucleotide recombination site (e.g. GG ***
--- *** TTTTTGT), part of a J-gene recombination ***
--- ***  feature of an immunoglobulin/T-cell rec ***
--- *** eptor gene.                              ***
--- ************************************************
---

CREATE VIEW j_nonamer AS
  SELECT
    feature_id AS j_nonamer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'J_nonamer';

--- ************************************************
--- *** relation: j_heptamer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 7 nucleotide recombination site (e.g. CA ***
--- *** CAGTG), part of a J-gene recombination f ***
--- *** eature of an immunoglobulin/T-cell recep ***
--- *** tor gene.                                ***
--- ************************************************
---

CREATE VIEW j_heptamer AS
  SELECT
    feature_id AS j_heptamer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'J_heptamer';

--- ************************************************
--- *** relation: pseudogenic_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A non functional descendant of a transcr ***
--- *** ipt, part of a pseudogene.               ***
--- ************************************************
---

CREATE VIEW pseudogenic_transcript AS
  SELECT
    feature_id AS pseudogenic_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pseudogenic_transcript';

--- ************************************************
--- *** relation: j_spacer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 12 or 23 nucleotide spacer between the J ***
--- *** -nonamer and the J-heptamer of a J-gene  ***
--- *** recombination feature of an immunoglobul ***
--- *** in/T-cell receptor gene.                 ***
--- ************************************************
---

CREATE VIEW j_spacer AS
  SELECT
    feature_id AS j_spacer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'J_spacer';

--- ************************************************
--- *** relation: v_dj_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one V-gene and one DJ- ***
--- *** gene.                                    ***
--- ************************************************
---

CREATE VIEW v_dj_cluster AS
  SELECT
    feature_id AS v_dj_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'V_DJ_cluster';

--- ************************************************
--- *** relation: v_dj_j_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one V-gene, one DJ-gen ***
--- *** e and one J-gene.                        ***
--- ************************************************
---

CREATE VIEW v_dj_j_cluster AS
  SELECT
    feature_id AS v_dj_j_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'V_DJ_J_cluster';

--- ************************************************
--- *** relation: v_vdj_c_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one V-gene, one VDJ-ge ***
--- *** ne and one C-gene.                       ***
--- ************************************************
---

CREATE VIEW v_vdj_c_cluster AS
  SELECT
    feature_id AS v_vdj_c_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'V_VDJ_C_cluster';

--- ************************************************
--- *** relation: v_vdj_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one V-gene and one VDJ ***
--- *** -gene.                                   ***
--- ************************************************
---

CREATE VIEW v_vdj_cluster AS
  SELECT
    feature_id AS v_vdj_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'V_VDJ_cluster';

--- ************************************************
--- *** relation: v_vdj_j_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one V-gene, one VDJ-ge ***
--- *** ne and one J-gene.                       ***
--- ************************************************
---

CREATE VIEW v_vdj_j_cluster AS
  SELECT
    feature_id AS v_vdj_j_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'V_VDJ_J_cluster';

--- ************************************************
--- *** relation: v_vj_c_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one V-gene, one VJ-gen ***
--- *** e and one C-gene.                        ***
--- ************************************************
---

CREATE VIEW v_vj_c_cluster AS
  SELECT
    feature_id AS v_vj_c_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'V_VJ_C_cluster';

--- ************************************************
--- *** relation: v_vj_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one V-gene and one VJ- ***
--- *** gene.                                    ***
--- ************************************************
---

CREATE VIEW v_vj_cluster AS
  SELECT
    feature_id AS v_vj_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'V_VJ_cluster';

--- ************************************************
--- *** relation: v_vj_j_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one V-gene, one VJ-gen ***
--- *** e and one J-gene.                        ***
--- ************************************************
---

CREATE VIEW v_vj_j_cluster AS
  SELECT
    feature_id AS v_vj_j_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'V_VJ_J_cluster';

--- ************************************************
--- *** relation: v_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in germline configuration inc ***
--- *** luding more than one V-gene.             ***
--- ************************************************
---

CREATE VIEW v_cluster AS
  SELECT
    feature_id AS v_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'V_cluster';

--- ************************************************
--- *** relation: v_d_dj_c_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one V-gene, one D-gene ***
--- *** , one DJ-gene and one C-gene.            ***
--- ************************************************
---

CREATE VIEW v_d_dj_c_cluster AS
  SELECT
    feature_id AS v_d_dj_c_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'V_D_DJ_C_cluster';

--- ************************************************
--- *** relation: v_d_dj_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one V-gene, one D-gene ***
--- *** , one DJ-gene.                           ***
--- ************************************************
---

CREATE VIEW v_d_dj_cluster AS
  SELECT
    feature_id AS v_d_dj_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'V_D_DJ_cluster';

--- ************************************************
--- *** relation: v_d_dj_j_c_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one V-gene, one D-gene ***
--- *** , one DJ-gene, one J-gene and one C-gene ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW v_d_dj_j_c_cluster AS
  SELECT
    feature_id AS v_d_dj_j_c_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'V_D_DJ_J_C_cluster';

--- ************************************************
--- *** relation: v_d_dj_j_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one V-gene, one D-gene ***
--- *** , one DJ-gene and one J-gene.            ***
--- ************************************************
---

CREATE VIEW v_d_dj_j_cluster AS
  SELECT
    feature_id AS v_d_dj_j_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'V_D_DJ_J_cluster';

--- ************************************************
--- *** relation: v_d_j_c_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in germline configuration inc ***
--- *** luding at least one V-gene, one D-gene a ***
--- *** nd one J-gene and one C-gene.            ***
--- ************************************************
---

CREATE VIEW v_d_j_c_cluster AS
  SELECT
    feature_id AS v_d_j_c_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'V_D_J_C_cluster';

--- ************************************************
--- *** relation: v_d_j_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in germline configuration inc ***
--- *** luding at least one V-gene, one D-gene a ***
--- *** nd one J-gene.                           ***
--- ************************************************
---

CREATE VIEW v_d_j_cluster AS
  SELECT
    feature_id AS v_d_j_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'V_D_J_cluster';

--- ************************************************
--- *** relation: v_heptamer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 7 nucleotide recombination site (e.g. CA ***
--- *** CAGTG), part of V-gene recombination fea ***
--- *** ture of an immunoglobulin/T-cell recepto ***
--- *** r gene.                                  ***
--- ************************************************
---

CREATE VIEW v_heptamer AS
  SELECT
    feature_id AS v_heptamer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'V_heptamer';

--- ************************************************
--- *** relation: v_j_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in germline configuration inc ***
--- *** luding at least one V-gene and one J-gen ***
--- *** e.                                       ***
--- ************************************************
---

CREATE VIEW v_j_cluster AS
  SELECT
    feature_id AS v_j_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'V_J_cluster';

--- ************************************************
--- *** relation: v_j_c_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in germline configuration inc ***
--- *** luding at least one V-gene, one J-gene a ***
--- *** nd one C-gene.                           ***
--- ************************************************
---

CREATE VIEW v_j_c_cluster AS
  SELECT
    feature_id AS v_j_c_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'V_J_C_cluster';

--- ************************************************
--- *** relation: v_nonamer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 9 nucleotide recombination site (e.g. AC ***
--- *** AAAAACC), part of V-gene recombination f ***
--- *** eature of an immunoglobulin/T-cell recep ***
--- *** tor gene.                                ***
--- ************************************************
---

CREATE VIEW v_nonamer AS
  SELECT
    feature_id AS v_nonamer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'V_nonamer';

--- ************************************************
--- *** relation: v_spacer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 12 or 23 nucleotide spacer between the V ***
--- *** -heptamer and the V-nonamer of a V-gene  ***
--- *** recombination feature of an immunoglobul ***
--- *** in/T-cell receptor gene.                 ***
--- ************************************************
---

CREATE VIEW v_spacer AS
  SELECT
    feature_id AS v_spacer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'V_spacer';

--- ************************************************
--- *** relation: v_gene_recombination_feature ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Recombination signal including V-heptame ***
--- *** r, V-spacer and V-nonamer in 3' of V-reg ***
--- *** ion of a V-gene or V-sequence of an immu ***
--- *** noglobulin/T-cell receptor gene.         ***
--- ************************************************
---

CREATE VIEW v_gene_recombination_feature AS
  SELECT
    feature_id AS v_gene_recombination_feature_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'V_gene_recombination_feature';

--- ************************************************
--- *** relation: dj_c_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one DJ-gene and one C- ***
--- *** gene.                                    ***
--- ************************************************
---

CREATE VIEW dj_c_cluster AS
  SELECT
    feature_id AS dj_c_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DJ_C_cluster';

--- ************************************************
--- *** relation: dj_j_c_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA in rearranged configuration  ***
--- *** including at least one D-J-GENE, one J-G ***
--- *** ENE and one C-GENE.                      ***
--- ************************************************
---

CREATE VIEW dj_j_c_cluster AS
  SELECT
    feature_id AS dj_j_c_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DJ_J_C_cluster';

--- ************************************************
--- *** relation: vdj_c_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one VDJ-gene and one C ***
--- *** -gene.                                   ***
--- ************************************************
---

CREATE VIEW vdj_c_cluster AS
  SELECT
    feature_id AS vdj_c_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'VDJ_C_cluster';

--- ************************************************
--- *** relation: v_dj_c_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one V-gene, one DJ-gen ***
--- *** e and one C-gene.                        ***
--- ************************************************
---

CREATE VIEW v_dj_c_cluster AS
  SELECT
    feature_id AS v_dj_c_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'V_DJ_C_cluster';

--- ************************************************
--- *** relation: helitron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A rolling circle transposon. Autonomous  ***
--- *** helitrons encode a 5'-to-3' DNA helicase ***
--- ***  and nuclease/ligase similar to those en ***
--- *** coded by known rolling-circle replicons. ***
--- ************************************************
---

CREATE VIEW helitron AS
  SELECT
    feature_id AS helitron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'helitron';

--- ************************************************
--- *** relation: recoding_pseudoknot ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The pseudoknots involved in recoding are ***
--- ***  unique in that, as they play their role ***
--- ***  as a structure, they are immediately un ***
--- *** folded and their now linear sequence ser ***
--- *** ves as a template for decoding.          ***
--- ************************************************
---

CREATE VIEW recoding_pseudoknot AS
  SELECT
    feature_id AS recoding_pseudoknot_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'recoding_pseudoknot';

--- ************************************************
--- *** relation: designed_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW designed_sequence AS
  SELECT
    feature_id AS designed_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'designed_sequence';

--- ************************************************
--- *** relation: inversion_derived_bipartite_duplication ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosome generated by recombination  ***
--- *** between two inversions; there is a dupli ***
--- *** cation at each end of the inversion.     ***
--- ************************************************
---

CREATE VIEW inversion_derived_bipartite_duplication AS
  SELECT
    feature_id AS inversion_derived_bipartite_duplication_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inversion_derived_bipartite_duplication';

--- ************************************************
--- *** relation: gene_with_edited_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that encodes a transcript that is ***
--- ***  edited.                                 ***
--- ************************************************
---

CREATE VIEW gene_with_edited_transcript AS
  SELECT
    feature_id AS gene_with_edited_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_with_edited_transcript';

--- ************************************************
--- *** relation: inversion_derived_duplication_plus_aneuploid ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosome generated by recombination  ***
--- *** between two inversions; has a duplicatio ***
--- *** n at one end and presumed to have a defi ***
--- *** ciency or duplication at the other end o ***
--- *** f the inversion.                         ***
--- ************************************************
---

CREATE VIEW inversion_derived_duplication_plus_aneuploid AS
  SELECT
    feature_id AS inversion_derived_duplication_plus_aneuploid_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inversion_derived_duplication_plus_aneuploid';

--- ************************************************
--- *** relation: aneuploid_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosome structural variation whereb ***
--- *** y either a chromosome exists in addition ***
--- ***  to the normal chromosome complement or  ***
--- *** is lacking.                              ***
--- ************************************************
---

CREATE VIEW aneuploid_chromosome AS
  SELECT
    feature_id AS aneuploid_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inversion_derived_aneuploid_chromosome' OR cvterm.name = 'aneuploid_chromosome';

--- ************************************************
--- *** relation: polya_signal_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The recognition sequence necessary for e ***
--- *** ndonuclease cleavage of an RNA transcrip ***
--- *** t that is followed by polyadenylation; c ***
--- *** onsensus=AATAAA.                         ***
--- ************************************************
---

CREATE VIEW polya_signal_sequence AS
  SELECT
    feature_id AS polya_signal_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polyA_signal_sequence';

--- ************************************************
--- *** relation: shine_dalgarno_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region in the 5' UTR that pairs with t ***
--- *** he 16S rRNA during formation of the prei ***
--- *** nitiation complex.                       ***
--- ************************************************
---

CREATE VIEW shine_dalgarno_sequence AS
  SELECT
    feature_id AS shine_dalgarno_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'Shine_Dalgarno_sequence';

--- ************************************************
--- *** relation: polya_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The site on an RNA transcript to which w ***
--- *** ill be added adenine residues by post-tr ***
--- *** anscriptional polyadenylation. The bound ***
--- *** ary between the UTR and the polyA sequen ***
--- *** ce.                                      ***
--- ************************************************
---

CREATE VIEW polya_site AS
  SELECT
    feature_id AS polya_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polyA_site';

--- ************************************************
--- *** relation: five_prime_clip ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5' most region of a precursor transcript ***
--- ***  that is clipped off during processing.  ***
--- ************************************************
---

CREATE VIEW five_prime_clip AS
  SELECT
    feature_id AS five_prime_clip_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_clip';

--- ************************************************
--- *** relation: five_prime_d_recombination_signal_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Recombination signal of an immunoglobuli ***
--- *** n/T-cell receptor gene, including the 5' ***
--- ***  D-nonamer (SO:0000497), 5' D-spacer (SO ***
--- *** :0000498), and 5' D-heptamer (SO:0000396 ***
--- *** ) in 5' of the D-region of a D-gene, or  ***
--- *** in 5' of the D-region of DJ-gene.        ***
--- ************************************************
---

CREATE VIEW five_prime_d_recombination_signal_sequence AS
  SELECT
    feature_id AS five_prime_d_recombination_signal_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_D_recombination_signal_sequence';

--- ************************************************
--- *** relation: three_prime_clip ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 3'-most region of a precursor transcript ***
--- ***  that is clipped off during processing.  ***
--- ************************************************
---

CREATE VIEW three_prime_clip AS
  SELECT
    feature_id AS three_prime_clip_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_clip';

--- ************************************************
--- *** relation: c_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene including more than one C-gen ***
--- *** e.                                       ***
--- ************************************************
---

CREATE VIEW c_cluster AS
  SELECT
    feature_id AS c_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'C_cluster';

--- ************************************************
--- *** relation: d_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in germline configuration inc ***
--- *** luding more than one D-gene.             ***
--- ************************************************
---

CREATE VIEW d_cluster AS
  SELECT
    feature_id AS d_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'D_cluster';

--- ************************************************
--- *** relation: d_j_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in germline configuration inc ***
--- *** luding at least one D-gene and one J-gen ***
--- *** e.                                       ***
--- ************************************************
---

CREATE VIEW d_j_cluster AS
  SELECT
    feature_id AS d_j_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'D_J_cluster';

--- ************************************************
--- *** relation: heptamer_of_recombination_feature_of_vertebrate_im_sys_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Seven nucleotide recombination site (e.g ***
--- *** . CACAGTG), part of V-gene, D-gene or J- ***
--- *** gene recombination feature of an immunog ***
--- *** lobulin or T-cell receptor gene.         ***
--- ************************************************
---

CREATE VIEW heptamer_of_recombination_feature_of_vertebrate_im_sys_gene AS
  SELECT
    feature_id AS heptamer_of_recombination_feature_of_vertebrate_im_sys_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_D_heptamer' OR cvterm.name = 'five_prime_D_heptamer' OR cvterm.name = 'J_heptamer' OR cvterm.name = 'V_heptamer' OR cvterm.name = 'heptamer_of_recombination_feature_of_vertebrate_immune_system_gene';

--- ************************************************
--- *** relation: nonamer_of_recombination_feature_of_vertebrate_im_sys_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW nonamer_of_recombination_feature_of_vertebrate_im_sys_gene AS
  SELECT
    feature_id AS nonamer_of_recombination_feature_of_vertebrate_im_sys_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_D_nonamer' OR cvterm.name = 'five_prime_D_nonamer' OR cvterm.name = 'J_nonamer' OR cvterm.name = 'V_nonamer' OR cvterm.name = 'nonamer_of_recombination_feature_of_vertebrate_immune_system_gene';

--- ************************************************
--- *** relation: vertebrate_immune_system_gene_recombination_spacer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW vertebrate_immune_system_gene_recombination_spacer AS
  SELECT
    feature_id AS vertebrate_immune_system_gene_recombination_spacer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_D_spacer' OR cvterm.name = 'five_prime_D_spacer' OR cvterm.name = 'J_spacer' OR cvterm.name = 'V_spacer' OR cvterm.name = 'vertebrate_immune_system_gene_recombination_spacer';

--- ************************************************
--- *** relation: v_dj_j_c_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one V-gene, one DJ-gen ***
--- *** e, one J-gene and one C-gene.            ***
--- ************************************************
---

CREATE VIEW v_dj_j_c_cluster AS
  SELECT
    feature_id AS v_dj_j_c_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'V_DJ_J_C_cluster';

--- ************************************************
--- *** relation: v_vdj_j_c_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one V-gene, one VDJ-ge ***
--- *** ne, one J-gene and one C-gene.           ***
--- ************************************************
---

CREATE VIEW v_vdj_j_c_cluster AS
  SELECT
    feature_id AS v_vdj_j_c_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'V_VDJ_J_C_cluster';

--- ************************************************
--- *** relation: v_vj_j_c_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in rearranged configuration i ***
--- *** ncluding at least one V-gene, one VJ-gen ***
--- *** e, one J-gene and one C-gene.            ***
--- ************************************************
---

CREATE VIEW v_vj_j_c_cluster AS
  SELECT
    feature_id AS v_vj_j_c_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'V_VJ_J_C_cluster';

--- ************************************************
--- *** relation: inversion_derived_aneuploid_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosome may be generated by recombi ***
--- *** nation between two inversions; presumed  ***
--- *** to have a deficiency or duplication at e ***
--- *** ach end of the inversion.                ***
--- ************************************************
---

CREATE VIEW inversion_derived_aneuploid_chromosome AS
  SELECT
    feature_id AS inversion_derived_aneuploid_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inversion_derived_aneuploid_chromosome';

--- ************************************************
--- *** relation: bidirectional_promoter ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW bidirectional_promoter AS
  SELECT
    feature_id AS bidirectional_promoter_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'bidirectional_promoter';

--- ************************************************
--- *** relation: retrotransposed ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute of a feature that occurred  ***
--- *** as the product of a reverse transcriptas ***
--- *** e mediated event.                        ***
--- ************************************************
---

CREATE VIEW retrotransposed AS
  SELECT
    feature_id AS retrotransposed_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'retrotransposed';

--- ************************************************
--- *** relation: three_prime_d_recombination_signal_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Recombination signal of an immunoglobuli ***
--- *** n/T-cell receptor gene, including the 3' ***
--- ***  D-heptamer (SO:0000493), 3' D-spacer, a ***
--- *** nd 3' D-nonamer (SO:0000494) in 3' of th ***
--- *** e D-region of a D-gene.                  ***
--- ************************************************
---

CREATE VIEW three_prime_d_recombination_signal_sequence AS
  SELECT
    feature_id AS three_prime_d_recombination_signal_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_D_recombination_signal_sequence';

--- ************************************************
--- *** relation: mirna_encoding ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW mirna_encoding AS
  SELECT
    feature_id AS mirna_encoding_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'miRNA_encoding';

--- ************************************************
--- *** relation: dj_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic DNA of immunoglobulin/T-cell rec ***
--- *** eptor gene in partially rearranged genom ***
--- *** ic DNA including D-J-region with 5' UTR  ***
--- *** and 3' UTR, also designated as D-J-segme ***
--- *** nt.                                      ***
--- ************************************************
---

CREATE VIEW dj_gene AS
  SELECT
    feature_id AS dj_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DJ_gene';

--- ************************************************
--- *** relation: rrna_encoding ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW rrna_encoding AS
  SELECT
    feature_id AS rrna_encoding_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rRNA_encoding';

--- ************************************************
--- *** relation: vdj_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Rearranged genomic DNA of immunoglobulin ***
--- *** /T-cell receptor gene including L-part1, ***
--- ***  V-intron and V-D-J-exon, with the 5'UTR ***
--- ***  (SO:0000204) and 3'UTR (SO:0000205).    ***
--- ************************************************
---

CREATE VIEW vdj_gene AS
  SELECT
    feature_id AS vdj_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'VDJ_gene';

--- ************************************************
--- *** relation: scrna_encoding ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW scrna_encoding AS
  SELECT
    feature_id AS scrna_encoding_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'scRNA_encoding';

--- ************************************************
--- *** relation: vj_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Rearranged genomic DNA of immunoglobulin ***
--- *** /T-cell receptor gene including L-part1, ***
--- ***  V-intron and V-J-exon, with the 5'UTR ( ***
--- *** SO:0000204) and 3'UTR (SO:0000205).      ***
--- ************************************************
---

CREATE VIEW vj_gene AS
  SELECT
    feature_id AS vj_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'VJ_gene';

--- ************************************************
--- *** relation: centromere ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of chromosome where the spindle ***
--- ***  fibers attach during mitosis and meiosi ***
--- *** s.                                       ***
--- ************************************************
---

CREATE VIEW centromere AS
  SELECT
    feature_id AS centromere_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'point_centromere' OR cvterm.name = 'regional_centromere' OR cvterm.name = 'centromere';

--- ************************************************
--- *** relation: snorna_encoding ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW snorna_encoding AS
  SELECT
    feature_id AS snorna_encoding_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'C_D_box_snoRNA_encoding' OR cvterm.name = 'H_ACA_box_snoRNA_encoding' OR cvterm.name = 'snoRNA_encoding';

--- ************************************************
--- *** relation: edited_transcript_feature ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A locatable feature on a transcript that ***
--- ***  is edited.                              ***
--- ************************************************
---

CREATE VIEW edited_transcript_feature AS
  SELECT
    feature_id AS edited_transcript_feature_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pre_edited_region' OR cvterm.name = 'editing_block' OR cvterm.name = 'editing_domain' OR cvterm.name = 'unedited_region' OR cvterm.name = 'edited_transcript_feature';

--- ************************************************
--- *** relation: methylation_guide_snorna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding a methylat ***
--- *** ion guide small nucleolar RNA.           ***
--- ************************************************
---

CREATE VIEW methylation_guide_snorna_primary_transcript AS
  SELECT
    feature_id AS methylation_guide_snorna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'methylation_guide_snoRNA_primary_transcript';

--- ************************************************
--- *** relation: cap ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A structure consisting of a 7-methylguan ***
--- *** osine in 5'-5' triphosphate linkage with ***
--- ***  the first nucleotide of an mRNA. It is  ***
--- *** added post-transcriptionally, and is not ***
--- ***  encoded in the DNA.                     ***
--- ************************************************
---

CREATE VIEW cap AS
  SELECT
    feature_id AS cap_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cap';

--- ************************************************
--- *** relation: rrna_cleavage_snorna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding an rRNA cl ***
--- *** eavage snoRNA.                           ***
--- ************************************************
---

CREATE VIEW rrna_cleavage_snorna_primary_transcript AS
  SELECT
    feature_id AS rrna_cleavage_snorna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rRNA_cleavage_snoRNA_primary_transcript';

--- ************************************************
--- *** relation: pre_edited_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The region of a transcript that will be  ***
--- *** edited.                                  ***
--- ************************************************
---

CREATE VIEW pre_edited_region AS
  SELECT
    feature_id AS pre_edited_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pre_edited_region';

--- ************************************************
--- *** relation: tmrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tmRNA liberates a mRNA from a stalled  ***
--- *** ribosome. To accomplish this part of the ***
--- ***  tmRNA is used as a reading frame that e ***
--- *** nds in a translation stop signal. The br ***
--- *** oken mRNA is replaced in the ribosome by ***
--- ***  the tmRNA and translation of the tmRNA  ***
--- *** leads to addition of a proteolysis tag t ***
--- *** o the incomplete protein enabling recogn ***
--- *** ition by a protease. Recently a number o ***
--- *** f permuted tmRNAs genes have been found  ***
--- *** encoded in two parts. TmRNAs have been i ***
--- *** dentified in eubacteria and some chlorop ***
--- *** lasts but are absent from archeal and Eu ***
--- *** karyote nuclear genomes.                 ***
--- ************************************************
---

CREATE VIEW tmrna AS
  SELECT
    feature_id AS tmrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tmRNA';

--- ************************************************
--- *** relation: c_d_box_snorna_encoding ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW c_d_box_snorna_encoding AS
  SELECT
    feature_id AS c_d_box_snorna_encoding_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'C_D_box_snoRNA_encoding';

--- ************************************************
--- *** relation: tmrna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding a tmRNA (S ***
--- *** O:0000584).                              ***
--- ************************************************
---

CREATE VIEW tmrna_primary_transcript AS
  SELECT
    feature_id AS tmrna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tmRNA_primary_transcript';

--- ************************************************
--- *** relation: group_i_intron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Group I catalytic introns are large self ***
--- *** -splicing ribozymes. They catalyze their ***
--- ***  own excision from mRNA, tRNA and rRNA p ***
--- *** recursors in a wide range of organisms.  ***
--- *** The core secondary structure consists of ***
--- ***  9 paired regions (P1-P9). These fold to ***
--- ***  essentially two domains, the P4-P6 doma ***
--- *** in (formed from the stacking of P5, P4,  ***
--- *** P6 and P6a helices) and the P3-P9 domain ***
--- ***  (formed from the P8, P3, P7 and P9 heli ***
--- *** ces). Group I catalytic introns often ha ***
--- *** ve long ORFs inserted in loop regions.   ***
--- ************************************************
---

CREATE VIEW group_i_intron AS
  SELECT
    feature_id AS group_i_intron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'group_I_intron';

--- ************************************************
--- *** relation: autocatalytically_spliced_intron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A self spliced intron.                   ***
--- ************************************************
---

CREATE VIEW autocatalytically_spliced_intron AS
  SELECT
    feature_id AS autocatalytically_spliced_intron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'group_I_intron' OR cvterm.name = 'group_II_intron' OR cvterm.name = 'group_III_intron' OR cvterm.name = 'group_IIA_intron' OR cvterm.name = 'group_IIB_intron' OR cvterm.name = 'autocatalytically_spliced_intron';

--- ************************************************
--- *** relation: srp_rna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding a signal r ***
--- *** ecognition particle RNA.                 ***
--- ************************************************
---

CREATE VIEW srp_rna_primary_transcript AS
  SELECT
    feature_id AS srp_rna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'SRP_RNA_primary_transcript';

--- ************************************************
--- *** relation: srp_rna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The signal recognition particle (SRP) is ***
--- ***  a universally conserved ribonucleoprote ***
--- *** in. It is involved in the co-translation ***
--- *** al targeting of proteins to membranes. T ***
--- *** he eukaryotic SRP consists of a 300-nucl ***
--- *** eotide 7S RNA and six proteins: SRPs 72, ***
--- ***  68, 54, 19, 14, and 9. Archaeal SRP con ***
--- *** sists of a 7S RNA and homologues of the  ***
--- *** eukaryotic SRP19 and SRP54 proteins. In  ***
--- *** most eubacteria, the SRP consists of a 4 ***
--- *** .5S RNA and the Ffh protein (a homologue ***
--- ***  of the eukaryotic SRP54 protein). Eukar ***
--- *** yotic and archaeal 7S RNAs have very sim ***
--- *** ilar secondary structures, with eight he ***
--- *** lical elements. These fold into the Alu  ***
--- *** and S domains, separated by a long linke ***
--- *** r region. Eubacterial SRP is generally a ***
--- ***  simpler structure, with the M domain of ***
--- ***  Ffh bound to a region of the 4.5S RNA t ***
--- *** hat corresponds to helix 8 of the eukary ***
--- *** otic and archaeal SRP S domain. Some Gra ***
--- *** m-positive bacteria (e.g. Bacillus subti ***
--- *** lis), however, have a larger SRP RNA tha ***
--- *** t also has an Alu domain. The Alu domain ***
--- ***  is thought to mediate the peptide chain ***
--- ***  elongation retardation function of the  ***
--- *** SRP. The universally conserved helix whi ***
--- *** ch interacts with the SRP54/Ffh M domain ***
--- ***  mediates signal sequence recognition. I ***
--- *** n eukaryotes and archaea, the SRP19-heli ***
--- *** x 6 complex is thought to be involved in ***
--- ***  SRP assembly and stabilizes helix 8 for ***
--- ***  SRP54 binding.                          ***
--- ************************************************
---

CREATE VIEW srp_rna AS
  SELECT
    feature_id AS srp_rna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'SRP_RNA';

--- ************************************************
--- *** relation: pseudoknot ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tertiary structure in RNA where nucleo ***
--- *** tides in a loop form base pairs with a r ***
--- *** egion of RNA downstream of the loop.     ***
--- ************************************************
---

CREATE VIEW pseudoknot AS
  SELECT
    feature_id AS pseudoknot_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'recoding_pseudoknot' OR cvterm.name = 'H_pseudoknot' OR cvterm.name = 'pseudoknot';

--- ************************************************
--- *** relation: h_pseudoknot ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A pseudoknot which contains two stems an ***
--- *** d at least two loops.                    ***
--- ************************************************
---

CREATE VIEW h_pseudoknot AS
  SELECT
    feature_id AS h_pseudoknot_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H_pseudoknot';

--- ************************************************
--- *** relation: c_d_box_snorna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Most box C/D snoRNAs also contain long ( ***
--- *** >10 nt) sequences complementary to rRNA. ***
--- ***  Boxes C and D, as well as boxes C' and  ***
--- *** D', are usually located in close proximi ***
--- *** ty, and form a structure known as the bo ***
--- *** x C/D motif. This motif is important for ***
--- ***  snoRNA stability, processing, nucleolar ***
--- ***  targeting and function. A small number  ***
--- *** of box C/D snoRNAs are involved in rRNA  ***
--- *** processing; most, however, are known or  ***
--- *** predicted to serve as guide RNAs in ribo ***
--- *** se methylation of rRNA. Targeting involv ***
--- *** es direct base pairing of the snoRNA at  ***
--- *** the rRNA site to be modified and selecti ***
--- *** on of a rRNA nucleotide a fixed distance ***
--- ***  from box D or D'.                       ***
--- ************************************************
---

CREATE VIEW c_d_box_snorna AS
  SELECT
    feature_id AS c_d_box_snorna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'U14_snoRNA' OR cvterm.name = 'U3_snoRNA' OR cvterm.name = 'methylation_guide_snoRNA' OR cvterm.name = 'C_D_box_snoRNA';

--- ************************************************
--- *** relation: h_aca_box_snorna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Members of the box H/ACA family contain  ***
--- *** an ACA triplet, exactly 3 nt upstream fr ***
--- *** om the 3' end and an H-box in a hinge re ***
--- *** gion that links two structurally similar ***
--- ***  functional domains of the molecule. Bot ***
--- *** h boxes are important for snoRNA biosynt ***
--- *** hesis and function. A few box H/ACA snoR ***
--- *** NAs are involved in rRNA processing; mos ***
--- *** t others are known or predicted to parti ***
--- *** cipate in selection of uridine nucleosid ***
--- *** es in rRNA to be converted to pseudourid ***
--- *** ines. Site selection is mediated by dire ***
--- *** ct base pairing of the snoRNA with rRNA  ***
--- *** through one or both targeting domains.   ***
--- ************************************************
---

CREATE VIEW h_aca_box_snorna AS
  SELECT
    feature_id AS h_aca_box_snorna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pseudouridylation_guide_snoRNA' OR cvterm.name = 'H_ACA_box_snoRNA';

--- ************************************************
--- *** relation: c_d_box_snorna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding a small nu ***
--- *** cleolar RNA of the box C/D family.       ***
--- ************************************************
---

CREATE VIEW c_d_box_snorna_primary_transcript AS
  SELECT
    feature_id AS c_d_box_snorna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'C_D_box_snoRNA_primary_transcript';

--- ************************************************
--- *** relation: h_aca_box_snorna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding a small nu ***
--- *** cleolar RNA of the box H/ACA family.     ***
--- ************************************************
---

CREATE VIEW h_aca_box_snorna_primary_transcript AS
  SELECT
    feature_id AS h_aca_box_snorna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H_ACA_box_snoRNA_primary_transcript';

--- ************************************************
--- *** relation: guide_rna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A short 3'-uridylated RNA that can form  ***
--- *** a duplex (except for its post-transcript ***
--- *** ionally added oligo_U tail (SO:0000609)) ***
--- ***  with a stretch of mature edited mRNA.   ***
--- ************************************************
---

CREATE VIEW guide_rna AS
  SELECT
    feature_id AS guide_rna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'guide_RNA';

--- ************************************************
--- *** relation: group_ii_intron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Group II introns are found in rRNA, tRNA ***
--- ***  and mRNA of organelles in fungi, plants ***
--- ***  and protists, and also in mRNA in bacte ***
--- *** ria. They are large self-splicing ribozy ***
--- *** mes and have 6 structural domains (usual ***
--- *** ly designated dI to dVI). A subset of gr ***
--- *** oup II introns also encode essential spl ***
--- *** icing proteins in intronic ORFs. The len ***
--- *** gth of these introns can therefore be up ***
--- ***  to 3kb. Splicing occurs in almost ident ***
--- *** ical fashion to nuclear pre-mRNA splicin ***
--- *** g with two transesterification steps. Th ***
--- *** e 2' hydroxyl of a bulged adenosine in d ***
--- *** omain VI attacks the 5' splice site, fol ***
--- *** lowed by nucleophilic attack on the 3' s ***
--- *** plice site by the 3' OH of the upstream  ***
--- *** exon. Protein machinery is required for  ***
--- *** splicing in vivo, and long range intron- ***
--- *** intron and intron-exon interactions are  ***
--- *** important for splice site positioning. G ***
--- *** roup II introns are further sub-classifi ***
--- *** ed into groups IIA and IIB which differ  ***
--- *** in splice site consensus, distance of bu ***
--- *** lged A from 3' splice site, some tertiar ***
--- *** y interactions, and intronic ORF phyloge ***
--- *** ny.                                      ***
--- ************************************************
---

CREATE VIEW group_ii_intron AS
  SELECT
    feature_id AS group_ii_intron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'group_IIA_intron' OR cvterm.name = 'group_IIB_intron' OR cvterm.name = 'group_II_intron';

--- ************************************************
--- *** relation: editing_block ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Edited mRNA sequence mediated by a singl ***
--- *** e guide RNA (SO:0000602).                ***
--- ************************************************
---

CREATE VIEW editing_block AS
  SELECT
    feature_id AS editing_block_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'editing_block';

--- ************************************************
--- *** relation: intergenic_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region containing or overlapping no ge ***
--- *** nes that is bounded on either side by a  ***
--- *** gene, or bounded by a gene and the end o ***
--- *** f the chromosome.                        ***
--- ************************************************
---

CREATE VIEW intergenic_region AS
  SELECT
    feature_id AS intergenic_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'intergenic_region';

--- ************************************************
--- *** relation: editing_domain ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Edited mRNA sequence mediated by two or  ***
--- *** more overlapping guide RNAs (SO:0000602) ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW editing_domain AS
  SELECT
    feature_id AS editing_domain_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'editing_domain';

--- ************************************************
--- *** relation: unedited_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The region of an edited transcript that  ***
--- *** will not be edited.                      ***
--- ************************************************
---

CREATE VIEW unedited_region AS
  SELECT
    feature_id AS unedited_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'unedited_region';

--- ************************************************
--- *** relation: h_aca_box_snorna_encoding ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW h_aca_box_snorna_encoding AS
  SELECT
    feature_id AS h_aca_box_snorna_encoding_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H_ACA_box_snoRNA_encoding';

--- ************************************************
--- *** relation: oligo_u_tail ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The string of non-encoded U's at the 3'  ***
--- *** end of a guide RNA (SO:0000602).         ***
--- ************************************************
---

CREATE VIEW oligo_u_tail AS
  SELECT
    feature_id AS oligo_u_tail_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'oligo_U_tail';

--- ************************************************
--- *** relation: polya_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Sequence of about 100 nucleotides of A a ***
--- *** dded to the 3' end of most eukaryotic mR ***
--- *** NAs.                                     ***
--- ************************************************
---

CREATE VIEW polya_sequence AS
  SELECT
    feature_id AS polya_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polyA_sequence';

--- ************************************************
--- *** relation: branch_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A pyrimidine rich sequence near the 3' e ***
--- *** nd of an intron to which the 5'end becom ***
--- *** es covalently bound during nuclear splic ***
--- *** ing. The resulting structure resembles a ***
--- ***  lariat.                                 ***
--- ************************************************
---

CREATE VIEW branch_site AS
  SELECT
    feature_id AS branch_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'branch_site';

--- ************************************************
--- *** relation: polypyrimidine_tract ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The polypyrimidine tract is one of the c ***
--- *** is-acting sequence elements directing in ***
--- *** tron removal in pre-mRNA splicing.       ***
--- ************************************************
---

CREATE VIEW polypyrimidine_tract AS
  SELECT
    feature_id AS polypyrimidine_tract_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypyrimidine_tract';

--- ************************************************
--- *** relation: bacterial_rnapol_promoter ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A DNA sequence to which bacterial RNA po ***
--- *** lymerase binds, to begin transcription.  ***
--- ************************************************
---

CREATE VIEW bacterial_rnapol_promoter AS
  SELECT
    feature_id AS bacterial_rnapol_promoter_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'bacterial_RNApol_promoter_sigma_70' OR cvterm.name = 'bacterial_RNApol_promoter_sigma54' OR cvterm.name = 'bacterial_RNApol_promoter';

--- ************************************************
--- *** relation: bacterial_terminator ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A terminator signal for bacterial transc ***
--- *** ription.                                 ***
--- ************************************************
---

CREATE VIEW bacterial_terminator AS
  SELECT
    feature_id AS bacterial_terminator_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rho_dependent_bacterial_terminator' OR cvterm.name = 'rho_independent_bacterial_terminator' OR cvterm.name = 'bacterial_terminator';

--- ************************************************
--- *** relation: terminator_of_type_2_rnapol_iii_promoter ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A terminator signal for RNA polymerase I ***
--- *** II transcription.                        ***
--- ************************************************
---

CREATE VIEW terminator_of_type_2_rnapol_iii_promoter AS
  SELECT
    feature_id AS terminator_of_type_2_rnapol_iii_promoter_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'terminator_of_type_2_RNApol_III_promoter';

--- ************************************************
--- *** relation: transcription_end_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The base where transcription ends.       ***
--- ************************************************
---

CREATE VIEW transcription_end_site AS
  SELECT
    feature_id AS transcription_end_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'transcription_end_site';

--- ************************************************
--- *** relation: rnapol_iii_promoter_type_1 ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW rnapol_iii_promoter_type_1 AS
  SELECT
    feature_id AS rnapol_iii_promoter_type_1_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RNApol_III_promoter_type_1';

--- ************************************************
--- *** relation: rnapol_iii_promoter_type_2 ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW rnapol_iii_promoter_type_2 AS
  SELECT
    feature_id AS rnapol_iii_promoter_type_2_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RNApol_III_promoter_type_2';

--- ************************************************
--- *** relation: a_box ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A variably distant linear promoter regio ***
--- *** n recognized by TFIIIC, with consensus s ***
--- *** equence TGGCnnAGTGG.                     ***
--- ************************************************
---

CREATE VIEW a_box AS
  SELECT
    feature_id AS a_box_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'A_box_type_1' OR cvterm.name = 'A_box_type_2' OR cvterm.name = 'A_box';

--- ************************************************
--- *** relation: b_box ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A variably distant linear promoter regio ***
--- *** n recognized by TFIIIC, with consensus s ***
--- *** equence AGGTTCCAnnCC.                    ***
--- ************************************************
---

CREATE VIEW b_box AS
  SELECT
    feature_id AS b_box_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'B_box';

--- ************************************************
--- *** relation: rnapol_iii_promoter_type_3 ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW rnapol_iii_promoter_type_3 AS
  SELECT
    feature_id AS rnapol_iii_promoter_type_3_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RNApol_III_promoter_type_3';

--- ************************************************
--- *** relation: c_box ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An RNA polymerase III type 1 promoter wi ***
--- *** th consensus sequence CAnnCCn.           ***
--- ************************************************
---

CREATE VIEW c_box AS
  SELECT
    feature_id AS c_box_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'C_box';

--- ************************************************
--- *** relation: snrna_encoding ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW snrna_encoding AS
  SELECT
    feature_id AS snrna_encoding_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'snRNA_encoding';

--- ************************************************
--- *** relation: telomere ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A specific structure at the end of a lin ***
--- *** ear chromosome, required for the integri ***
--- *** ty and maintenance of the end.           ***
--- ************************************************
---

CREATE VIEW telomere AS
  SELECT
    feature_id AS telomere_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'telomere';

--- ************************************************
--- *** relation: silencer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A regulatory region which upon binding o ***
--- *** f transcription factors, suppress the tr ***
--- *** anscription of the gene or genes they co ***
--- *** ntrol.                                   ***
--- ************************************************
---

CREATE VIEW silencer AS
  SELECT
    feature_id AS silencer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'silencer';

--- ************************************************
--- *** relation: chromosomal_regulatory_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW chromosomal_regulatory_element AS
  SELECT
    feature_id AS chromosomal_regulatory_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'matrix_attachment_site' OR cvterm.name = 'chromosomal_regulatory_element';

--- ************************************************
--- *** relation: insulator ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transcriptional cis regulatory region  ***
--- *** that when located between a CM and a gen ***
--- *** e's promoter prevents the CRM from modul ***
--- *** ating that genes expression.             ***
--- ************************************************
---

CREATE VIEW insulator AS
  SELECT
    feature_id AS insulator_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'insulator';

--- ************************************************
--- *** relation: chromosomal_structural_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW chromosomal_structural_element AS
  SELECT
    feature_id AS chromosomal_structural_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'centromere' OR cvterm.name = 'telomere' OR cvterm.name = 'point_centromere' OR cvterm.name = 'regional_centromere' OR cvterm.name = 'chromosomal_structural_element';

--- ************************************************
--- *** relation: five_prime_open_reading_frame ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW five_prime_open_reading_frame AS
  SELECT
    feature_id AS five_prime_open_reading_frame_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_open_reading_frame';

--- ************************************************
--- *** relation: upstream_aug_codon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A start codon upstream of the ORF.       ***
--- ************************************************
---

CREATE VIEW upstream_aug_codon AS
  SELECT
    feature_id AS upstream_aug_codon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'upstream_AUG_codon';

--- ************************************************
--- *** relation: polycistronic_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding for more t ***
--- *** han one gene product.                    ***
--- ************************************************
---

CREATE VIEW polycistronic_primary_transcript AS
  SELECT
    feature_id AS polycistronic_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'dicistronic_primary_transcript' OR cvterm.name = 'polycistronic_primary_transcript';

--- ************************************************
--- *** relation: monocistronic_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding for one ge ***
--- *** ne product.                              ***
--- ************************************************
---

CREATE VIEW monocistronic_primary_transcript AS
  SELECT
    feature_id AS monocistronic_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'monocistronic_primary_transcript';

--- ************************************************
--- *** relation: monocistronic_mrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An mRNA with either a single protein pro ***
--- *** duct, or for which the regions encoding  ***
--- *** all its protein products overlap.        ***
--- ************************************************
---

CREATE VIEW monocistronic_mrna AS
  SELECT
    feature_id AS monocistronic_mrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'monocistronic_mRNA';

--- ************************************************
--- *** relation: polycistronic_mrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An mRNA that encodes multiple proteins f ***
--- *** rom at least two non-overlapping regions ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW polycistronic_mrna AS
  SELECT
    feature_id AS polycistronic_mrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'dicistronic_mRNA' OR cvterm.name = 'polycistronic_mRNA';

--- ************************************************
--- *** relation: mini_exon_donor_rna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript that donates the sp ***
--- *** liced leader to other mRNA.              ***
--- ************************************************
---

CREATE VIEW mini_exon_donor_rna AS
  SELECT
    feature_id AS mini_exon_donor_rna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mini_exon_donor_RNA';

--- ************************************************
--- *** relation: spliced_leader_rna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW spliced_leader_rna AS
  SELECT
    feature_id AS spliced_leader_rna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'spliced_leader_RNA';

--- ************************************************
--- *** relation: engineered_plasmid ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A plasmid that is engineered.            ***
--- ************************************************
---

CREATE VIEW engineered_plasmid AS
  SELECT
    feature_id AS engineered_plasmid_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'engineered_episome' OR cvterm.name = 'gene_trap_construct' OR cvterm.name = 'promoter_trap_construct' OR cvterm.name = 'enhancer_trap_construct' OR cvterm.name = 'engineered_plasmid';

--- ************************************************
--- *** relation: transcribed_spacer_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Part of an rRNA transcription unit that  ***
--- *** is transcribed but discarded during matu ***
--- *** ration, not giving rise to any part of r ***
--- *** RNA.                                     ***
--- ************************************************
---

CREATE VIEW transcribed_spacer_region AS
  SELECT
    feature_id AS transcribed_spacer_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'internal_transcribed_spacer_region' OR cvterm.name = 'external_transcribed_spacer_region' OR cvterm.name = 'transcribed_spacer_region';

--- ************************************************
--- *** relation: internal_transcribed_spacer_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Non-coding regions of DNA sequence that  ***
--- *** separate genes coding for the 28S, 5.8S, ***
--- ***  and 18S ribosomal RNAs.                 ***
--- ************************************************
---

CREATE VIEW internal_transcribed_spacer_region AS
  SELECT
    feature_id AS internal_transcribed_spacer_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'internal_transcribed_spacer_region';

--- ************************************************
--- *** relation: external_transcribed_spacer_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Non-coding regions of DNA that precede t ***
--- *** he sequence that codes for the ribosomal ***
--- ***  RNA.                                    ***
--- ************************************************
---

CREATE VIEW external_transcribed_spacer_region AS
  SELECT
    feature_id AS external_transcribed_spacer_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'external_transcribed_spacer_region';

--- ************************************************
--- *** relation: tetranuc_repeat_microsat ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW tetranuc_repeat_microsat AS
  SELECT
    feature_id AS tetranuc_repeat_microsat_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tetranucleotide_repeat_microsatellite_feature';

--- ************************************************
--- *** relation: srp_rna_encoding ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW srp_rna_encoding AS
  SELECT
    feature_id AS srp_rna_encoding_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'SRP_RNA_encoding';

--- ************************************************
--- *** relation: minisatellite ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A repeat region containing tandemly repe ***
--- *** ated sequences having a unit length of 1 ***
--- *** 0 to 40 bp.                              ***
--- ************************************************
---

CREATE VIEW minisatellite AS
  SELECT
    feature_id AS minisatellite_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'minisatellite';

--- ************************************************
--- *** relation: antisense_rna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Antisense RNA is RNA that is transcribed ***
--- ***  from the coding, rather than the templa ***
--- *** te, strand of DNA. It is therefore compl ***
--- *** ementary to mRNA.                        ***
--- ************************************************
---

CREATE VIEW antisense_rna AS
  SELECT
    feature_id AS antisense_rna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'MicF_RNA' OR cvterm.name = 'antisense_RNA';

--- ************************************************
--- *** relation: antisense_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The reverse complement of the primary tr ***
--- *** anscript.                                ***
--- ************************************************
---

CREATE VIEW antisense_primary_transcript AS
  SELECT
    feature_id AS antisense_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'antisense_primary_transcript';

--- ************************************************
--- *** relation: sirna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A small RNA molecule that is the product ***
--- ***  of a longer exogenous or endogenous dsR ***
--- *** NA, which is either a bimolecular duplex ***
--- ***  or very long hairpin, processed (via th ***
--- *** e Dicer pathway) such that numerous siRN ***
--- *** As accumulate from both strands of the d ***
--- *** sRNA. SRNAs trigger the cleavage of thei ***
--- *** r target molecules.                      ***
--- ************************************************
---

CREATE VIEW sirna AS
  SELECT
    feature_id AS sirna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'siRNA';

--- ************************************************
--- *** relation: mirna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding a micro RN ***
--- *** A.                                       ***
--- ************************************************
---

CREATE VIEW mirna_primary_transcript AS
  SELECT
    feature_id AS mirna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'stRNA_primary_transcript' OR cvterm.name = 'miRNA_primary_transcript';

--- ************************************************
--- *** relation: strna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding a small te ***
--- *** mporal mRNA (SO:0000649).                ***
--- ************************************************
---

CREATE VIEW strna_primary_transcript AS
  SELECT
    feature_id AS strna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'stRNA_primary_transcript';

--- ************************************************
--- *** relation: strna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Non-coding RNAs of about 21 nucleotides  ***
--- *** in length that regulate temporal develop ***
--- *** ment; first discovered in C. elegans.    ***
--- ************************************************
---

CREATE VIEW strna AS
  SELECT
    feature_id AS strna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'stRNA';

--- ************************************************
--- *** relation: small_subunit_rrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Ribosomal RNA transcript that structures ***
--- ***  the small subunit of the ribosome.      ***
--- ************************************************
---

CREATE VIEW small_subunit_rrna AS
  SELECT
    feature_id AS small_subunit_rrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rRNA_18S' OR cvterm.name = 'rRNA_16S' OR cvterm.name = 'small_subunit_rRNA';

--- ************************************************
--- *** relation: large_subunit_rrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Ribosomal RNA transcript that structures ***
--- ***  the large subunit of the ribosome.      ***
--- ************************************************
---

CREATE VIEW large_subunit_rrna AS
  SELECT
    feature_id AS large_subunit_rrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rRNA_5_8S' OR cvterm.name = 'rRNA_5S' OR cvterm.name = 'rRNA_28S' OR cvterm.name = 'rRNA_23S' OR cvterm.name = 'rRNA_25S' OR cvterm.name = 'rRNA_21S' OR cvterm.name = 'large_subunit_rRNA';

--- ************************************************
--- *** relation: rrna_5s ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5S ribosomal RNA (5S rRNA) is a componen ***
--- *** t of the large ribosomal subunit in both ***
--- ***  prokaryotes and eukaryotes. In eukaryot ***
--- *** es, it is synthesised by RNA polymerase  ***
--- *** III (the other eukaryotic rRNAs are clea ***
--- *** ved from a 45S precursor synthesised by  ***
--- *** RNA polymerase I). In Xenopus oocytes, i ***
--- *** t has been shown that fingers 4-7 of the ***
--- ***  nine-zinc finger transcription factor T ***
--- *** FIIIA can bind to the central region of  ***
--- *** 5S RNA. Thus, in addition to positively  ***
--- *** regulating 5S rRNA transcription, TFIIIA ***
--- ***  also stabilizes 5S rRNA until it is req ***
--- *** uired for transcription.                 ***
--- ************************************************
---

CREATE VIEW rrna_5s AS
  SELECT
    feature_id AS rrna_5s_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rRNA_5S';

--- ************************************************
--- *** relation: rrna_28s ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A component of the large ribosomal subun ***
--- *** it.                                      ***
--- ************************************************
---

CREATE VIEW rrna_28s AS
  SELECT
    feature_id AS rrna_28s_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rRNA_28S';

--- ************************************************
--- *** relation: maxicircle_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A mitochondrial gene located in a maxici ***
--- *** rcle.                                    ***
--- ************************************************
---

CREATE VIEW maxicircle_gene AS
  SELECT
    feature_id AS maxicircle_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cryptogene' OR cvterm.name = 'maxicircle_gene';

--- ************************************************
--- *** relation: ncrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An RNA transcript that does not encode f ***
--- *** or a protein rather the RNA molecule is  ***
--- *** the gene product.                        ***
--- ************************************************
---

CREATE VIEW ncrna AS
  SELECT
    feature_id AS ncrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'scRNA' OR cvterm.name = 'rRNA' OR cvterm.name = 'tRNA' OR cvterm.name = 'snRNA' OR cvterm.name = 'snoRNA' OR cvterm.name = 'small_regulatory_ncRNA' OR cvterm.name = 'RNase_MRP_RNA' OR cvterm.name = 'RNase_P_RNA' OR cvterm.name = 'telomerase_RNA' OR cvterm.name = 'vault_RNA' OR cvterm.name = 'Y_RNA' OR cvterm.name = 'rasiRNA' OR cvterm.name = 'SRP_RNA' OR cvterm.name = 'guide_RNA' OR cvterm.name = 'antisense_RNA' OR cvterm.name = 'siRNA' OR cvterm.name = 'stRNA' OR cvterm.name = 'class_II_RNA' OR cvterm.name = 'class_I_RNA' OR cvterm.name = 'piRNA' OR cvterm.name = 'lincRNA' OR cvterm.name = 'tasiRNA' OR cvterm.name = 'rRNA_cleavage_RNA' OR cvterm.name = 'small_subunit_rRNA' OR cvterm.name = 'large_subunit_rRNA' OR cvterm.name = 'rRNA_18S' OR cvterm.name = 'rRNA_16S' OR cvterm.name = 'rRNA_5_8S' OR cvterm.name = 'rRNA_5S' OR cvterm.name = 'rRNA_28S' OR cvterm.name = 'rRNA_23S' OR cvterm.name = 'rRNA_25S' OR cvterm.name = 'rRNA_21S' OR cvterm.name = 'alanyl_tRNA' OR cvterm.name = 'asparaginyl_tRNA' OR cvterm.name = 'aspartyl_tRNA' OR cvterm.name = 'cysteinyl_tRNA' OR cvterm.name = 'glutaminyl_tRNA' OR cvterm.name = 'glutamyl_tRNA' OR cvterm.name = 'glycyl_tRNA' OR cvterm.name = 'histidyl_tRNA' OR cvterm.name = 'isoleucyl_tRNA' OR cvterm.name = 'leucyl_tRNA' OR cvterm.name = 'lysyl_tRNA' OR cvterm.name = 'methionyl_tRNA' OR cvterm.name = 'phenylalanyl_tRNA' OR cvterm.name = 'prolyl_tRNA' OR cvterm.name = 'seryl_tRNA' OR cvterm.name = 'threonyl_tRNA' OR cvterm.name = 'tryptophanyl_tRNA' OR cvterm.name = 'tyrosyl_tRNA' OR cvterm.name = 'valyl_tRNA' OR cvterm.name = 'pyrrolysyl_tRNA' OR cvterm.name = 'arginyl_tRNA' OR cvterm.name = 'selenocysteinyl_tRNA' OR cvterm.name = 'U1_snRNA' OR cvterm.name = 'U2_snRNA' OR cvterm.name = 'U4_snRNA' OR cvterm.name = 'U4atac_snRNA' OR cvterm.name = 'U5_snRNA' OR cvterm.name = 'U6_snRNA' OR cvterm.name = 'U6atac_snRNA' OR cvterm.name = 'U11_snRNA' OR cvterm.name = 'U12_snRNA' OR cvterm.name = 'C_D_box_snoRNA' OR cvterm.name = 'H_ACA_box_snoRNA' OR cvterm.name = 'U14_snoRNA' OR cvterm.name = 'U3_snoRNA' OR cvterm.name = 'methylation_guide_snoRNA' OR cvterm.name = 'pseudouridylation_guide_snoRNA' OR cvterm.name = 'miRNA' OR cvterm.name = 'RNA_6S' OR cvterm.name = 'CsrB_RsmB_RNA' OR cvterm.name = 'DsrA_RNA' OR cvterm.name = 'OxyS_RNA' OR cvterm.name = 'RprA_RNA' OR cvterm.name = 'RRE_RNA' OR cvterm.name = 'spot_42_RNA' OR cvterm.name = 'tmRNA' OR cvterm.name = 'GcvB_RNA' OR cvterm.name = 'MicF_RNA' OR cvterm.name = 'ncRNA';

--- ************************************************
--- *** relation: strna_encoding ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW strna_encoding AS
  SELECT
    feature_id AS strna_encoding_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'stRNA_encoding';

--- ************************************************
--- *** relation: repeat_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of sequence containing one or m ***
--- *** ore repeat units.                        ***
--- ************************************************
---

CREATE VIEW repeat_region AS
  SELECT
    feature_id AS repeat_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'long_terminal_repeat' OR cvterm.name = 'engineered_foreign_repetitive_element' OR cvterm.name = 'inverted_repeat' OR cvterm.name = 'direct_repeat' OR cvterm.name = 'non_LTR_retrotransposon_polymeric_tract' OR cvterm.name = 'dispersed_repeat' OR cvterm.name = 'tandem_repeat' OR cvterm.name = 'X_element_combinatorial_repeat' OR cvterm.name = 'Y_prime_element' OR cvterm.name = 'telomeric_repeat' OR cvterm.name = 'nested_repeat' OR cvterm.name = 'centromeric_repeat' OR cvterm.name = 'five_prime_LTR' OR cvterm.name = 'three_prime_LTR' OR cvterm.name = 'solo_LTR' OR cvterm.name = 'terminal_inverted_repeat' OR cvterm.name = 'five_prime_terminal_inverted_repeat' OR cvterm.name = 'three_prime_terminal_inverted_repeat' OR cvterm.name = 'target_site_duplication' OR cvterm.name = 'CRISPR' OR cvterm.name = 'satellite_DNA' OR cvterm.name = 'microsatellite' OR cvterm.name = 'minisatellite' OR cvterm.name = 'dinucleotide_repeat_microsatellite_feature' OR cvterm.name = 'trinucleotide_repeat_microsatellite_feature' OR cvterm.name = 'tetranucleotide_repeat_microsatellite_feature' OR cvterm.name = 'nested_tandem_repeat' OR cvterm.name = 'regional_centromere_inner_repeat_region' OR cvterm.name = 'regional_centromere_outer_repeat_region' OR cvterm.name = 'repeat_region';

--- ************************************************
--- *** relation: dispersed_repeat ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A repeat that is located at dispersed si ***
--- *** tes in the genome.                       ***
--- ************************************************
---

CREATE VIEW dispersed_repeat AS
  SELECT
    feature_id AS dispersed_repeat_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'dispersed_repeat';

--- ************************************************
--- *** relation: tmrna_encoding ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW tmrna_encoding AS
  SELECT
    feature_id AS tmrna_encoding_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tmRNA_encoding';

--- ************************************************
--- *** relation: spliceosomal_intron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An intron which is spliced by the splice ***
--- *** osome.                                   ***
--- ************************************************
---

CREATE VIEW spliceosomal_intron AS
  SELECT
    feature_id AS spliceosomal_intron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'U2_intron' OR cvterm.name = 'U12_intron' OR cvterm.name = 'spliceosomal_intron';

--- ************************************************
--- *** relation: trna_encoding ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW trna_encoding AS
  SELECT
    feature_id AS trna_encoding_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tRNA_encoding';

--- ************************************************
--- *** relation: introgressed_chromosome_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW introgressed_chromosome_region AS
  SELECT
    feature_id AS introgressed_chromosome_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'introgressed_chromosome_region';

--- ************************************************
--- *** relation: monocistronic_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transcript that is monocistronic.      ***
--- ************************************************
---

CREATE VIEW monocistronic_transcript AS
  SELECT
    feature_id AS monocistronic_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'monocistronic_primary_transcript' OR cvterm.name = 'monocistronic_mRNA' OR cvterm.name = 'monocistronic_transcript';

--- ************************************************
--- *** relation: mobile_intron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An intron (mitochondrial, chloroplast, n ***
--- *** uclear or prokaryotic) that encodes a do ***
--- *** uble strand sequence specific endonuclea ***
--- *** se allowing for mobility.                ***
--- ************************************************
---

CREATE VIEW mobile_intron AS
  SELECT
    feature_id AS mobile_intron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mobile_intron';

--- ************************************************
--- *** relation: insertion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The sequence of one or more nucleotides  ***
--- *** added between two adjacent nucleotides i ***
--- *** n the sequence.                          ***
--- ************************************************
---

CREATE VIEW insertion AS
  SELECT
    feature_id AS insertion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'transgenic_insertion' OR cvterm.name = 'duplication' OR cvterm.name = 'tandem_duplication' OR cvterm.name = 'direct_tandem_duplication' OR cvterm.name = 'inverted_tandem_duplication' OR cvterm.name = 'insertion';

--- ************************************************
--- *** relation: est_match ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A match against an EST sequence.         ***
--- ************************************************
---

CREATE VIEW est_match AS
  SELECT
    feature_id AS est_match_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'EST_match';

--- ************************************************
--- *** relation: sequence_rearrangement_feature ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW sequence_rearrangement_feature AS
  SELECT
    feature_id AS sequence_rearrangement_feature_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'specific_recombination_site' OR cvterm.name = 'chromosome_breakage_sequence' OR cvterm.name = 'internal_eliminated_sequence' OR cvterm.name = 'macronucleus_destined_segment' OR cvterm.name = 'recombination_feature_of_rearranged_gene' OR cvterm.name = 'site_specific_recombination_target_region' OR cvterm.name = 'recombination_signal_sequence' OR cvterm.name = 'vertebrate_immune_system_gene_recombination_feature' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_segment' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_gene_cluster' OR cvterm.name = 'vertebrate_immune_system_gene_recombination_spacer' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_rearranged_segment' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster' OR cvterm.name = 'vertebrate_immune_system_gene_recombination_signal_feature' OR cvterm.name = 'D_gene' OR cvterm.name = 'V_gene' OR cvterm.name = 'J_gene' OR cvterm.name = 'C_gene' OR cvterm.name = 'D_J_C_cluster' OR cvterm.name = 'J_C_cluster' OR cvterm.name = 'J_cluster' OR cvterm.name = 'V_cluster' OR cvterm.name = 'V_J_cluster' OR cvterm.name = 'V_J_C_cluster' OR cvterm.name = 'C_cluster' OR cvterm.name = 'D_cluster' OR cvterm.name = 'D_J_cluster' OR cvterm.name = 'three_prime_D_spacer' OR cvterm.name = 'five_prime_D_spacer' OR cvterm.name = 'J_spacer' OR cvterm.name = 'V_spacer' OR cvterm.name = 'VD_gene' OR cvterm.name = 'DJ_gene' OR cvterm.name = 'VDJ_gene' OR cvterm.name = 'VJ_gene' OR cvterm.name = 'DJ_J_cluster' OR cvterm.name = 'VDJ_J_C_cluster' OR cvterm.name = 'VDJ_J_cluster' OR cvterm.name = 'VJ_C_cluster' OR cvterm.name = 'VJ_J_C_cluster' OR cvterm.name = 'VJ_J_cluster' OR cvterm.name = 'D_DJ_C_cluster' OR cvterm.name = 'D_DJ_cluster' OR cvterm.name = 'D_DJ_J_C_cluster' OR cvterm.name = 'D_DJ_J_cluster' OR cvterm.name = 'V_DJ_cluster' OR cvterm.name = 'V_DJ_J_cluster' OR cvterm.name = 'V_VDJ_C_cluster' OR cvterm.name = 'V_VDJ_cluster' OR cvterm.name = 'V_VDJ_J_cluster' OR cvterm.name = 'V_VJ_C_cluster' OR cvterm.name = 'V_VJ_cluster' OR cvterm.name = 'V_VJ_J_cluster' OR cvterm.name = 'V_D_DJ_C_cluster' OR cvterm.name = 'V_D_DJ_cluster' OR cvterm.name = 'V_D_DJ_J_C_cluster' OR cvterm.name = 'V_D_DJ_J_cluster' OR cvterm.name = 'V_D_J_C_cluster' OR cvterm.name = 'V_D_J_cluster' OR cvterm.name = 'DJ_C_cluster' OR cvterm.name = 'DJ_J_C_cluster' OR cvterm.name = 'VDJ_C_cluster' OR cvterm.name = 'V_DJ_C_cluster' OR cvterm.name = 'V_DJ_J_C_cluster' OR cvterm.name = 'V_VDJ_J_C_cluster' OR cvterm.name = 'V_VJ_J_C_cluster' OR cvterm.name = 'J_gene_recombination_feature' OR cvterm.name = 'D_gene_recombination_feature' OR cvterm.name = 'V_gene_recombination_feature' OR cvterm.name = 'heptamer_of_recombination_feature_of_vertebrate_immune_system_gene' OR cvterm.name = 'nonamer_of_recombination_feature_of_vertebrate_immune_system_gene' OR cvterm.name = 'five_prime_D_recombination_signal_sequence' OR cvterm.name = 'three_prime_D_recombination_signal_sequence' OR cvterm.name = 'three_prime_D_heptamer' OR cvterm.name = 'five_prime_D_heptamer' OR cvterm.name = 'J_heptamer' OR cvterm.name = 'V_heptamer' OR cvterm.name = 'three_prime_D_nonamer' OR cvterm.name = 'five_prime_D_nonamer' OR cvterm.name = 'J_nonamer' OR cvterm.name = 'V_nonamer' OR cvterm.name = 'integration_excision_site' OR cvterm.name = 'resolution_site' OR cvterm.name = 'inversion_site' OR cvterm.name = 'inversion_site_part' OR cvterm.name = 'attI_site' OR cvterm.name = 'attP_site' OR cvterm.name = 'attB_site' OR cvterm.name = 'attL_site' OR cvterm.name = 'attR_site' OR cvterm.name = 'attC_site' OR cvterm.name = 'attCtn_site' OR cvterm.name = 'loxP_site' OR cvterm.name = 'dif_site' OR cvterm.name = 'FRT_site' OR cvterm.name = 'IRLinv_site' OR cvterm.name = 'IRRinv_site' OR cvterm.name = 'sequence_rearrangement_feature';

--- ************************************************
--- *** relation: chromosome_breakage_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence within the micronuclear DNA o ***
--- *** f ciliates at which chromosome breakage  ***
--- *** and telomere addition occurs during nucl ***
--- *** ear differentiation.                     ***
--- ************************************************
---

CREATE VIEW chromosome_breakage_sequence AS
  SELECT
    feature_id AS chromosome_breakage_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'chromosome_breakage_sequence';

--- ************************************************
--- *** relation: internal_eliminated_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence eliminated from the genome of ***
--- ***  ciliates during nuclear differentiation ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW internal_eliminated_sequence AS
  SELECT
    feature_id AS internal_eliminated_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'internal_eliminated_sequence';

--- ************************************************
--- *** relation: macronucleus_destined_segment ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence that is conserved, although r ***
--- *** earranged relative to the micronucleus,  ***
--- *** in the macronucleus of a ciliate genome. ***
--- ************************************************
---

CREATE VIEW macronucleus_destined_segment AS
  SELECT
    feature_id AS macronucleus_destined_segment_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'macronucleus_destined_segment';

--- ************************************************
--- *** relation: transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An RNA synthesized on a DNA or RNA templ ***
--- *** ate by an RNA polymerase.                ***
--- ************************************************
---

CREATE VIEW transcript AS
  SELECT
    feature_id AS transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polycistronic_transcript' OR cvterm.name = 'transcript_with_translational_frameshift' OR cvterm.name = 'primary_transcript' OR cvterm.name = 'mature_transcript' OR cvterm.name = 'transcript_bound_by_nucleic_acid' OR cvterm.name = 'transcript_bound_by_protein' OR cvterm.name = 'enzymatic_RNA' OR cvterm.name = 'trans_spliced_transcript' OR cvterm.name = 'monocistronic_transcript' OR cvterm.name = 'aberrant_processed_transcript' OR cvterm.name = 'edited_transcript' OR cvterm.name = 'processed_transcript' OR cvterm.name = 'alternatively_spliced_transcript' OR cvterm.name = 'dicistronic_transcript' OR cvterm.name = 'polycistronic_primary_transcript' OR cvterm.name = 'polycistronic_mRNA' OR cvterm.name = 'dicistronic_mRNA' OR cvterm.name = 'dicistronic_primary_transcript' OR cvterm.name = 'dicistronic_primary_transcript' OR cvterm.name = 'dicistronic_mRNA' OR cvterm.name = 'protein_coding_primary_transcript' OR cvterm.name = 'nc_primary_transcript' OR cvterm.name = 'polycistronic_primary_transcript' OR cvterm.name = 'monocistronic_primary_transcript' OR cvterm.name = 'mini_exon_donor_RNA' OR cvterm.name = 'antisense_primary_transcript' OR cvterm.name = 'capped_primary_transcript' OR cvterm.name = 'pre_edited_mRNA' OR cvterm.name = 'scRNA_primary_transcript' OR cvterm.name = 'rRNA_primary_transcript' OR cvterm.name = 'tRNA_primary_transcript' OR cvterm.name = 'snRNA_primary_transcript' OR cvterm.name = 'snoRNA_primary_transcript' OR cvterm.name = 'tmRNA_primary_transcript' OR cvterm.name = 'SRP_RNA_primary_transcript' OR cvterm.name = 'miRNA_primary_transcript' OR cvterm.name = 'tasiRNA_primary_transcript' OR cvterm.name = 'rRNA_small_subunit_primary_transcript' OR cvterm.name = 'rRNA_large_subunit_primary_transcript' OR cvterm.name = 'alanine_tRNA_primary_transcript' OR cvterm.name = 'arginine_tRNA_primary_transcript' OR cvterm.name = 'asparagine_tRNA_primary_transcript' OR cvterm.name = 'aspartic_acid_tRNA_primary_transcript' OR cvterm.name = 'cysteine_tRNA_primary_transcript' OR cvterm.name = 'glutamic_acid_tRNA_primary_transcript' OR cvterm.name = 'glutamine_tRNA_primary_transcript' OR cvterm.name = 'glycine_tRNA_primary_transcript' OR cvterm.name = 'histidine_tRNA_primary_transcript' OR cvterm.name = 'isoleucine_tRNA_primary_transcript' OR cvterm.name = 'leucine_tRNA_primary_transcript' OR cvterm.name = 'lysine_tRNA_primary_transcript' OR cvterm.name = 'methionine_tRNA_primary_transcript' OR cvterm.name = 'phenylalanine_tRNA_primary_transcript' OR cvterm.name = 'proline_tRNA_primary_transcript' OR cvterm.name = 'serine_tRNA_primary_transcript' OR cvterm.name = 'threonine_tRNA_primary_transcript' OR cvterm.name = 'tryptophan_tRNA_primary_transcript' OR cvterm.name = 'tyrosine_tRNA_primary_transcript' OR cvterm.name = 'valine_tRNA_primary_transcript' OR cvterm.name = 'pyrrolysine_tRNA_primary_transcript' OR cvterm.name = 'selenocysteine_tRNA_primary_transcript' OR cvterm.name = 'methylation_guide_snoRNA_primary_transcript' OR cvterm.name = 'rRNA_cleavage_snoRNA_primary_transcript' OR cvterm.name = 'C_D_box_snoRNA_primary_transcript' OR cvterm.name = 'H_ACA_box_snoRNA_primary_transcript' OR cvterm.name = 'U14_snoRNA_primary_transcript' OR cvterm.name = 'stRNA_primary_transcript' OR cvterm.name = 'dicistronic_primary_transcript' OR cvterm.name = 'mRNA' OR cvterm.name = 'ncRNA' OR cvterm.name = 'mRNA_with_frameshift' OR cvterm.name = 'monocistronic_mRNA' OR cvterm.name = 'polycistronic_mRNA' OR cvterm.name = 'exemplar_mRNA' OR cvterm.name = 'capped_mRNA' OR cvterm.name = 'polyadenylated_mRNA' OR cvterm.name = 'trans_spliced_mRNA' OR cvterm.name = 'edited_mRNA' OR cvterm.name = 'consensus_mRNA' OR cvterm.name = 'recoded_mRNA' OR cvterm.name = 'mRNA_with_minus_1_frameshift' OR cvterm.name = 'mRNA_with_plus_1_frameshift' OR cvterm.name = 'mRNA_with_plus_2_frameshift' OR cvterm.name = 'mRNA_with_minus_2_frameshift' OR cvterm.name = 'dicistronic_mRNA' OR cvterm.name = 'mRNA_recoded_by_translational_bypass' OR cvterm.name = 'mRNA_recoded_by_codon_redefinition' OR cvterm.name = 'scRNA' OR cvterm.name = 'rRNA' OR cvterm.name = 'tRNA' OR cvterm.name = 'snRNA' OR cvterm.name = 'snoRNA' OR cvterm.name = 'small_regulatory_ncRNA' OR cvterm.name = 'RNase_MRP_RNA' OR cvterm.name = 'RNase_P_RNA' OR cvterm.name = 'telomerase_RNA' OR cvterm.name = 'vault_RNA' OR cvterm.name = 'Y_RNA' OR cvterm.name = 'rasiRNA' OR cvterm.name = 'SRP_RNA' OR cvterm.name = 'guide_RNA' OR cvterm.name = 'antisense_RNA' OR cvterm.name = 'siRNA' OR cvterm.name = 'stRNA' OR cvterm.name = 'class_II_RNA' OR cvterm.name = 'class_I_RNA' OR cvterm.name = 'piRNA' OR cvterm.name = 'lincRNA' OR cvterm.name = 'tasiRNA' OR cvterm.name = 'rRNA_cleavage_RNA' OR cvterm.name = 'small_subunit_rRNA' OR cvterm.name = 'large_subunit_rRNA' OR cvterm.name = 'rRNA_18S' OR cvterm.name = 'rRNA_16S' OR cvterm.name = 'rRNA_5_8S' OR cvterm.name = 'rRNA_5S' OR cvterm.name = 'rRNA_28S' OR cvterm.name = 'rRNA_23S' OR cvterm.name = 'rRNA_25S' OR cvterm.name = 'rRNA_21S' OR cvterm.name = 'alanyl_tRNA' OR cvterm.name = 'asparaginyl_tRNA' OR cvterm.name = 'aspartyl_tRNA' OR cvterm.name = 'cysteinyl_tRNA' OR cvterm.name = 'glutaminyl_tRNA' OR cvterm.name = 'glutamyl_tRNA' OR cvterm.name = 'glycyl_tRNA' OR cvterm.name = 'histidyl_tRNA' OR cvterm.name = 'isoleucyl_tRNA' OR cvterm.name = 'leucyl_tRNA' OR cvterm.name = 'lysyl_tRNA' OR cvterm.name = 'methionyl_tRNA' OR cvterm.name = 'phenylalanyl_tRNA' OR cvterm.name = 'prolyl_tRNA' OR cvterm.name = 'seryl_tRNA' OR cvterm.name = 'threonyl_tRNA' OR cvterm.name = 'tryptophanyl_tRNA' OR cvterm.name = 'tyrosyl_tRNA' OR cvterm.name = 'valyl_tRNA' OR cvterm.name = 'pyrrolysyl_tRNA' OR cvterm.name = 'arginyl_tRNA' OR cvterm.name = 'selenocysteinyl_tRNA' OR cvterm.name = 'U1_snRNA' OR cvterm.name = 'U2_snRNA' OR cvterm.name = 'U4_snRNA' OR cvterm.name = 'U4atac_snRNA' OR cvterm.name = 'U5_snRNA' OR cvterm.name = 'U6_snRNA' OR cvterm.name = 'U6atac_snRNA' OR cvterm.name = 'U11_snRNA' OR cvterm.name = 'U12_snRNA' OR cvterm.name = 'C_D_box_snoRNA' OR cvterm.name = 'H_ACA_box_snoRNA' OR cvterm.name = 'U14_snoRNA' OR cvterm.name = 'U3_snoRNA' OR cvterm.name = 'methylation_guide_snoRNA' OR cvterm.name = 'pseudouridylation_guide_snoRNA' OR cvterm.name = 'miRNA' OR cvterm.name = 'RNA_6S' OR cvterm.name = 'CsrB_RsmB_RNA' OR cvterm.name = 'DsrA_RNA' OR cvterm.name = 'OxyS_RNA' OR cvterm.name = 'RprA_RNA' OR cvterm.name = 'RRE_RNA' OR cvterm.name = 'spot_42_RNA' OR cvterm.name = 'tmRNA' OR cvterm.name = 'GcvB_RNA' OR cvterm.name = 'MicF_RNA' OR cvterm.name = 'ribozyme' OR cvterm.name = 'trans_spliced_mRNA' OR cvterm.name = 'monocistronic_primary_transcript' OR cvterm.name = 'monocistronic_mRNA' OR cvterm.name = 'edited_transcript_by_A_to_I_substitution' OR cvterm.name = 'edited_mRNA' OR cvterm.name = 'transcript';

--- ************************************************
--- *** relation: canonical_three_prime_splice_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The canonical 3' splice site has the seq ***
--- *** uence "AG".                              ***
--- ************************************************
---

CREATE VIEW canonical_three_prime_splice_site AS
  SELECT
    feature_id AS canonical_three_prime_splice_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'canonical_three_prime_splice_site';

--- ************************************************
--- *** relation: canonical_five_prime_splice_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The canonical 5' splice site has the seq ***
--- *** uence "GT".                              ***
--- ************************************************
---

CREATE VIEW canonical_five_prime_splice_site AS
  SELECT
    feature_id AS canonical_five_prime_splice_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'canonical_five_prime_splice_site';

--- ************************************************
--- *** relation: non_canonical_three_prime_splice_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A 3' splice site that does not have the  ***
--- *** sequence "AG".                           ***
--- ************************************************
---

CREATE VIEW non_canonical_three_prime_splice_site AS
  SELECT
    feature_id AS non_canonical_three_prime_splice_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'non_canonical_three_prime_splice_site';

--- ************************************************
--- *** relation: non_canonical_five_prime_splice_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A 5' splice site which does not have the ***
--- ***  sequence "GT".                          ***
--- ************************************************
---

CREATE VIEW non_canonical_five_prime_splice_site AS
  SELECT
    feature_id AS non_canonical_five_prime_splice_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'non_canonical_five_prime_splice_site';

--- ************************************************
--- *** relation: non_canonical_start_codon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A start codon that is not the usual AUG  ***
--- *** sequence.                                ***
--- ************************************************
---

CREATE VIEW non_canonical_start_codon AS
  SELECT
    feature_id AS non_canonical_start_codon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'four_bp_start_codon' OR cvterm.name = 'CTG_start_codon' OR cvterm.name = 'non_canonical_start_codon';

--- ************************************************
--- *** relation: aberrant_processed_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transcript that has been processed "in ***
--- *** correctly", for example by the failure o ***
--- *** f splicing of one or more exons.         ***
--- ************************************************
---

CREATE VIEW aberrant_processed_transcript AS
  SELECT
    feature_id AS aberrant_processed_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'aberrant_processed_transcript';

--- ************************************************
--- *** relation: exonic_splice_enhancer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Exonic splicing enhancers (ESEs) facilit ***
--- *** ate exon definition by assisting in the  ***
--- *** recruitment of splicing factors to the a ***
--- *** djacent intron.                          ***
--- ************************************************
---

CREATE VIEW exonic_splice_enhancer AS
  SELECT
    feature_id AS exonic_splice_enhancer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'exonic_splice_enhancer';

--- ************************************************
--- *** relation: nuclease_sensitive_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of nucleotide sequence targeted ***
--- ***  by a nuclease enzyme.                   ***
--- ************************************************
---

CREATE VIEW nuclease_sensitive_site AS
  SELECT
    feature_id AS nuclease_sensitive_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'nuclease_hypersensitive_site' OR cvterm.name = 'group_1_intron_homing_endonuclease_target_region' OR cvterm.name = 'DNAseI_hypersensitive_site' OR cvterm.name = 'nuclease_sensitive_site';

--- ************************************************
--- *** relation: dnasei_hypersensitive_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW dnasei_hypersensitive_site AS
  SELECT
    feature_id AS dnasei_hypersensitive_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DNAseI_hypersensitive_site';

--- ************************************************
--- *** relation: translocation_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosomal translocation whereby the  ***
--- *** chromosomes carrying non-homologous cent ***
--- *** romeres may be recovered independently.  ***
--- *** These chromosomes are described as trans ***
--- *** location elements. This occurs for some  ***
--- *** translocations, particularly but not exc ***
--- *** lusively, reciprocal translocations.     ***
--- ************************************************
---

CREATE VIEW translocation_element AS
  SELECT
    feature_id AS translocation_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'translocation_element';

--- ************************************************
--- *** relation: deletion_junction ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The space between two bases in a sequenc ***
--- *** e which marks the position where a delet ***
--- *** ion has occurred.                        ***
--- ************************************************
---

CREATE VIEW deletion_junction AS
  SELECT
    feature_id AS deletion_junction_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'deletion_junction';

--- ************************************************
--- *** relation: golden_path ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A set of subregions selected from sequen ***
--- *** ce contigs which when concatenated form  ***
--- *** a nonredundant linear sequence.          ***
--- ************************************************
---

CREATE VIEW golden_path AS
  SELECT
    feature_id AS golden_path_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'golden_path';

--- ************************************************
--- *** relation: cdna_match ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A match against cDNA sequence.           ***
--- ************************************************
---

CREATE VIEW cdna_match AS
  SELECT
    feature_id AS cdna_match_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cDNA_match';

--- ************************************************
--- *** relation: gene_with_polycistronic_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that encodes a polycistronic tran ***
--- *** script.                                  ***
--- ************************************************
---

CREATE VIEW gene_with_polycistronic_transcript AS
  SELECT
    feature_id AS gene_with_polycistronic_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_with_dicistronic_transcript' OR cvterm.name = 'gene_with_dicistronic_primary_transcript' OR cvterm.name = 'gene_with_dicistronic_mRNA' OR cvterm.name = 'gene_with_polycistronic_transcript';

--- ************************************************
--- *** relation: cleaved_initiator_methionine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The initiator methionine that has been c ***
--- *** leaved from a mature polypeptide sequenc ***
--- *** e.                                       ***
--- ************************************************
---

CREATE VIEW cleaved_initiator_methionine AS
  SELECT
    feature_id AS cleaved_initiator_methionine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cleaved_initiator_methionine';

--- ************************************************
--- *** relation: gene_with_dicistronic_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that encodes a dicistronic transc ***
--- *** ript.                                    ***
--- ************************************************
---

CREATE VIEW gene_with_dicistronic_transcript AS
  SELECT
    feature_id AS gene_with_dicistronic_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_with_dicistronic_primary_transcript' OR cvterm.name = 'gene_with_dicistronic_mRNA' OR cvterm.name = 'gene_with_dicistronic_transcript';

--- ************************************************
--- *** relation: gene_with_recoded_mrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that encodes an mRNA that is reco ***
--- *** ded.                                     ***
--- ************************************************
---

CREATE VIEW gene_with_recoded_mrna AS
  SELECT
    feature_id AS gene_with_recoded_mrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_with_stop_codon_read_through' OR cvterm.name = 'gene_with_mRNA_recoded_by_translational_bypass' OR cvterm.name = 'gene_with_transcript_with_translational_frameshift' OR cvterm.name = 'gene_with_stop_codon_redefined_as_pyrrolysine' OR cvterm.name = 'gene_with_stop_codon_redefined_as_selenocysteine' OR cvterm.name = 'gene_with_recoded_mRNA';

--- ************************************************
--- *** relation: snp ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** SNPs are single base pair positions in g ***
--- *** enomic DNA at which different sequence a ***
--- *** lternatives exist in normal individuals  ***
--- *** in some population(s), wherein the least ***
--- ***  frequent variant has an abundance of 1% ***
--- ***  or greater.                             ***
--- ************************************************
---

CREATE VIEW snp AS
  SELECT
    feature_id AS snp_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'SNP';

--- ************************************************
--- *** relation: reagent ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence used in experiment.           ***
--- ************************************************
---

CREATE VIEW reagent AS
  SELECT
    feature_id AS reagent_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'PCR_product' OR cvterm.name = 'clone' OR cvterm.name = 'rescue_region' OR cvterm.name = 'oligo' OR cvterm.name = 'clone_insert' OR cvterm.name = 'cloned_region' OR cvterm.name = 'databank_entry' OR cvterm.name = 'RAPD' OR cvterm.name = 'genomic_clone' OR cvterm.name = 'cDNA_clone' OR cvterm.name = 'tiling_path_clone' OR cvterm.name = 'validated_cDNA_clone' OR cvterm.name = 'invalidated_cDNA_clone' OR cvterm.name = 'three_prime_RACE_clone' OR cvterm.name = 'chimeric_cDNA_clone' OR cvterm.name = 'genomically_contaminated_cDNA_clone' OR cvterm.name = 'polyA_primed_cDNA_clone' OR cvterm.name = 'partially_processed_cDNA_clone' OR cvterm.name = 'engineered_rescue_region' OR cvterm.name = 'aptamer' OR cvterm.name = 'probe' OR cvterm.name = 'tag' OR cvterm.name = 'ss_oligo' OR cvterm.name = 'ds_oligo' OR cvterm.name = 'DNAzyme' OR cvterm.name = 'synthetic_oligo' OR cvterm.name = 'DNA_aptamer' OR cvterm.name = 'RNA_aptamer' OR cvterm.name = 'microarray_oligo' OR cvterm.name = 'SAGE_tag' OR cvterm.name = 'STS' OR cvterm.name = 'EST' OR cvterm.name = 'engineered_tag' OR cvterm.name = 'five_prime_EST' OR cvterm.name = 'three_prime_EST' OR cvterm.name = 'UST' OR cvterm.name = 'RST' OR cvterm.name = 'three_prime_UST' OR cvterm.name = 'five_prime_UST' OR cvterm.name = 'three_prime_RST' OR cvterm.name = 'five_prime_RST' OR cvterm.name = 'primer' OR cvterm.name = 'sequencing_primer' OR cvterm.name = 'forward_primer' OR cvterm.name = 'reverse_primer' OR cvterm.name = 'ASPE_primer' OR cvterm.name = 'dCAPS_primer' OR cvterm.name = 'RNAi_reagent' OR cvterm.name = 'DNA_constraint_sequence' OR cvterm.name = 'morpholino_oligo' OR cvterm.name = 'PNA_oligo' OR cvterm.name = 'LNA_oligo' OR cvterm.name = 'TNA_oligo' OR cvterm.name = 'GNA_oligo' OR cvterm.name = 'R_GNA_oligo' OR cvterm.name = 'S_GNA_oligo' OR cvterm.name = 'cloned_cDNA_insert' OR cvterm.name = 'cloned_genomic_insert' OR cvterm.name = 'engineered_insert' OR cvterm.name = 'BAC_cloned_genomic_insert' OR cvterm.name = 'reagent';

--- ************************************************
--- *** relation: oligo ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A short oligonucleotide sequence, of len ***
--- *** gth on the order of 10's of bases; eithe ***
--- *** r single or double stranded.             ***
--- ************************************************
---

CREATE VIEW oligo AS
  SELECT
    feature_id AS oligo_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'aptamer' OR cvterm.name = 'probe' OR cvterm.name = 'tag' OR cvterm.name = 'ss_oligo' OR cvterm.name = 'ds_oligo' OR cvterm.name = 'DNAzyme' OR cvterm.name = 'synthetic_oligo' OR cvterm.name = 'DNA_aptamer' OR cvterm.name = 'RNA_aptamer' OR cvterm.name = 'microarray_oligo' OR cvterm.name = 'SAGE_tag' OR cvterm.name = 'STS' OR cvterm.name = 'EST' OR cvterm.name = 'engineered_tag' OR cvterm.name = 'five_prime_EST' OR cvterm.name = 'three_prime_EST' OR cvterm.name = 'UST' OR cvterm.name = 'RST' OR cvterm.name = 'three_prime_UST' OR cvterm.name = 'five_prime_UST' OR cvterm.name = 'three_prime_RST' OR cvterm.name = 'five_prime_RST' OR cvterm.name = 'primer' OR cvterm.name = 'sequencing_primer' OR cvterm.name = 'forward_primer' OR cvterm.name = 'reverse_primer' OR cvterm.name = 'ASPE_primer' OR cvterm.name = 'dCAPS_primer' OR cvterm.name = 'RNAi_reagent' OR cvterm.name = 'DNA_constraint_sequence' OR cvterm.name = 'morpholino_oligo' OR cvterm.name = 'PNA_oligo' OR cvterm.name = 'LNA_oligo' OR cvterm.name = 'TNA_oligo' OR cvterm.name = 'GNA_oligo' OR cvterm.name = 'R_GNA_oligo' OR cvterm.name = 'S_GNA_oligo' OR cvterm.name = 'oligo';

--- ************************************************
--- *** relation: gene_with_stop_codon_read_through ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that encodes a transcript with st ***
--- *** op codon readthrough.                    ***
--- ************************************************
---

CREATE VIEW gene_with_stop_codon_read_through AS
  SELECT
    feature_id AS gene_with_stop_codon_read_through_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_with_stop_codon_redefined_as_pyrrolysine' OR cvterm.name = 'gene_with_stop_codon_redefined_as_selenocysteine' OR cvterm.name = 'gene_with_stop_codon_read_through';

--- ************************************************
--- *** relation: gene_with_stop_codon_redefined_as_pyrrolysine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene encoding an mRNA that has the sto ***
--- *** p codon redefined as pyrrolysine.        ***
--- ************************************************
---

CREATE VIEW gene_with_stop_codon_redefined_as_pyrrolysine AS
  SELECT
    feature_id AS gene_with_stop_codon_redefined_as_pyrrolysine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_with_stop_codon_redefined_as_pyrrolysine';

--- ************************************************
--- *** relation: junction ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence_feature with an extent of zer ***
--- *** o.                                       ***
--- ************************************************
---

CREATE VIEW junction AS
  SELECT
    feature_id AS junction_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'clone_insert_end' OR cvterm.name = 'clone_insert_start' OR cvterm.name = 'exon_junction' OR cvterm.name = 'insertion_site' OR cvterm.name = 'polyA_site' OR cvterm.name = 'deletion_junction' OR cvterm.name = 'chromosome_breakpoint' OR cvterm.name = 'splice_junction' OR cvterm.name = 'trans_splice_junction' OR cvterm.name = 'restriction_enzyme_cleavage_junction' OR cvterm.name = 'transposable_element_insertion_site' OR cvterm.name = 'inversion_breakpoint' OR cvterm.name = 'translocation_breakpoint' OR cvterm.name = 'insertion_breakpoint' OR cvterm.name = 'deletion_breakpoint' OR cvterm.name = 'blunt_end_restriction_enzyme_cleavage_junction' OR cvterm.name = 'single_strand_restriction_enzyme_cleavage_site' OR cvterm.name = 'five_prime_restriction_enzyme_junction' OR cvterm.name = 'three_prime_restriction_enzyme_junction' OR cvterm.name = 'junction';

--- ************************************************
--- *** relation: remark ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A comment about the sequence.            ***
--- ************************************************
---

CREATE VIEW remark AS
  SELECT
    feature_id AS remark_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'sequence_difference' OR cvterm.name = 'experimental_result_region' OR cvterm.name = 'polypeptide_sequencing_information' OR cvterm.name = 'possible_base_call_error' OR cvterm.name = 'possible_assembly_error' OR cvterm.name = 'assembly_error_correction' OR cvterm.name = 'base_call_error_correction' OR cvterm.name = 'overlapping_feature_set' OR cvterm.name = 'no_output' OR cvterm.name = 'overlapping_EST_set' OR cvterm.name = 'non_adjacent_residues' OR cvterm.name = 'non_terminal_residue' OR cvterm.name = 'sequence_conflict' OR cvterm.name = 'sequence_uncertainty' OR cvterm.name = 'contig_collection' OR cvterm.name = 'remark';

--- ************************************************
--- *** relation: possible_base_call_error ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of sequence where the validity  ***
--- *** of the base calling is questionable.     ***
--- ************************************************
---

CREATE VIEW possible_base_call_error AS
  SELECT
    feature_id AS possible_base_call_error_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'possible_base_call_error';

--- ************************************************
--- *** relation: possible_assembly_error ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of sequence where there may hav ***
--- *** e been an error in the assembly.         ***
--- ************************************************
---

CREATE VIEW possible_assembly_error AS
  SELECT
    feature_id AS possible_assembly_error_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'possible_assembly_error';

--- ************************************************
--- *** relation: experimental_result_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of sequence implicated in an ex ***
--- *** perimental result.                       ***
--- ************************************************
---

CREATE VIEW experimental_result_region AS
  SELECT
    feature_id AS experimental_result_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'overlapping_feature_set' OR cvterm.name = 'no_output' OR cvterm.name = 'overlapping_EST_set' OR cvterm.name = 'experimental_result_region';

--- ************************************************
--- *** relation: gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region (or regions) that includes all  ***
--- *** of the sequence elements necessary to en ***
--- *** code a functional transcript. A gene may ***
--- ***  include regulatory regions, transcribed ***
--- ***  regions and/or other functional sequenc ***
--- *** e regions.                               ***
--- ************************************************
---

CREATE VIEW gene AS
  SELECT
    feature_id AS gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'nuclear_gene' OR cvterm.name = 'mt_gene' OR cvterm.name = 'plastid_gene' OR cvterm.name = 'nucleomorph_gene' OR cvterm.name = 'plasmid_gene' OR cvterm.name = 'proviral_gene' OR cvterm.name = 'transposable_element_gene' OR cvterm.name = 'silenced_gene' OR cvterm.name = 'engineered_gene' OR cvterm.name = 'foreign_gene' OR cvterm.name = 'fusion_gene' OR cvterm.name = 'recombinationally_rearranged_gene' OR cvterm.name = 'gene_with_trans_spliced_transcript' OR cvterm.name = 'gene_with_polycistronic_transcript' OR cvterm.name = 'rescue_gene' OR cvterm.name = 'post_translationally_regulated_gene' OR cvterm.name = 'negatively_autoregulated_gene' OR cvterm.name = 'positively_autoregulated_gene' OR cvterm.name = 'translationally_regulated_gene' OR cvterm.name = 'epigenetically_modified_gene' OR cvterm.name = 'transgene' OR cvterm.name = 'predicted_gene' OR cvterm.name = 'protein_coding_gene' OR cvterm.name = 'retrogene' OR cvterm.name = 'ncRNA_gene' OR cvterm.name = 'cryptic_gene' OR cvterm.name = 'gene_with_non_canonical_start_codon' OR cvterm.name = 'gene_cassette' OR cvterm.name = 'kinetoplast_gene' OR cvterm.name = 'maxicircle_gene' OR cvterm.name = 'minicircle_gene' OR cvterm.name = 'cryptogene' OR cvterm.name = 'apicoplast_gene' OR cvterm.name = 'ct_gene' OR cvterm.name = 'chromoplast_gene' OR cvterm.name = 'cyanelle_gene' OR cvterm.name = 'leucoplast_gene' OR cvterm.name = 'proplastid_gene' OR cvterm.name = 'endogenous_retroviral_gene' OR cvterm.name = 'engineered_foreign_transposable_element_gene' OR cvterm.name = 'gene_silenced_by_DNA_modification' OR cvterm.name = 'gene_silenced_by_RNA_interference' OR cvterm.name = 'gene_silenced_by_histone_modification' OR cvterm.name = 'gene_silenced_by_DNA_methylation' OR cvterm.name = 'gene_silenced_by_histone_methylation' OR cvterm.name = 'gene_silenced_by_histone_deacetylation' OR cvterm.name = 'engineered_foreign_gene' OR cvterm.name = 'engineered_fusion_gene' OR cvterm.name = 'engineered_foreign_transposable_element_gene' OR cvterm.name = 'engineered_foreign_gene' OR cvterm.name = 'engineered_foreign_transposable_element_gene' OR cvterm.name = 'engineered_fusion_gene' OR cvterm.name = 'recombinationally_inverted_gene' OR cvterm.name = 'recombinationally_rearranged_vertebrate_immune_system_gene' OR cvterm.name = 'gene_with_dicistronic_transcript' OR cvterm.name = 'gene_with_dicistronic_primary_transcript' OR cvterm.name = 'gene_with_dicistronic_mRNA' OR cvterm.name = 'wild_type_rescue_gene' OR cvterm.name = 'gene_rearranged_at_DNA_level' OR cvterm.name = 'maternally_imprinted_gene' OR cvterm.name = 'paternally_imprinted_gene' OR cvterm.name = 'allelically_excluded_gene' OR cvterm.name = 'floxed_gene' OR cvterm.name = 'gene_with_polyadenylated_mRNA' OR cvterm.name = 'gene_with_mRNA_with_frameshift' OR cvterm.name = 'gene_with_edited_transcript' OR cvterm.name = 'gene_with_recoded_mRNA' OR cvterm.name = 'gene_with_stop_codon_read_through' OR cvterm.name = 'gene_with_mRNA_recoded_by_translational_bypass' OR cvterm.name = 'gene_with_transcript_with_translational_frameshift' OR cvterm.name = 'gene_with_stop_codon_redefined_as_pyrrolysine' OR cvterm.name = 'gene_with_stop_codon_redefined_as_selenocysteine' OR cvterm.name = 'gRNA_gene' OR cvterm.name = 'miRNA_gene' OR cvterm.name = 'scRNA_gene' OR cvterm.name = 'snoRNA_gene' OR cvterm.name = 'snRNA_gene' OR cvterm.name = 'SRP_RNA_gene' OR cvterm.name = 'stRNA_gene' OR cvterm.name = 'tmRNA_gene' OR cvterm.name = 'tRNA_gene' OR cvterm.name = 'rRNA_gene' OR cvterm.name = 'piRNA_gene' OR cvterm.name = 'RNase_P_RNA_gene' OR cvterm.name = 'RNase_MRP_RNA_gene' OR cvterm.name = 'lincRNA_gene' OR cvterm.name = 'telomerase_RNA_gene' OR cvterm.name = 'cryptogene' OR cvterm.name = 'gene_with_start_codon_CUG' OR cvterm.name = 'gene';

--- ************************************************
--- *** relation: tandem_repeat ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Two or more adjcent copies of a region ( ***
--- *** of length greater than 1).               ***
--- ************************************************
---

CREATE VIEW tandem_repeat AS
  SELECT
    feature_id AS tandem_repeat_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'satellite_DNA' OR cvterm.name = 'microsatellite' OR cvterm.name = 'minisatellite' OR cvterm.name = 'dinucleotide_repeat_microsatellite_feature' OR cvterm.name = 'trinucleotide_repeat_microsatellite_feature' OR cvterm.name = 'tetranucleotide_repeat_microsatellite_feature' OR cvterm.name = 'tandem_repeat';

--- ************************************************
--- *** relation: trans_splice_acceptor_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The 3' splice site of the acceptor prima ***
--- *** ry transcript.                           ***
--- ************************************************
---

CREATE VIEW trans_splice_acceptor_site AS
  SELECT
    feature_id AS trans_splice_acceptor_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'SL1_acceptor_site' OR cvterm.name = 'SL2_acceptor_site' OR cvterm.name = 'SL3_acceptor_site' OR cvterm.name = 'SL4_acceptor_site' OR cvterm.name = 'SL5_acceptor_site' OR cvterm.name = 'SL6_acceptor_site' OR cvterm.name = 'SL7_acceptor_site' OR cvterm.name = 'SL8_acceptor_site' OR cvterm.name = 'SL9_acceptor_site' OR cvterm.name = 'SL10_accceptor_site' OR cvterm.name = 'SL11_acceptor_site' OR cvterm.name = 'SL12_acceptor_site' OR cvterm.name = 'trans_splice_acceptor_site';

--- ************************************************
--- *** relation: trans_splice_donor_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The 5' five prime splice site region of  ***
--- *** the donor RNA.                           ***
--- ************************************************
---

CREATE VIEW trans_splice_donor_site AS
  SELECT
    feature_id AS trans_splice_donor_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'trans_splice_donor_site';

--- ************************************************
--- *** relation: sl1_acceptor_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A trans_splicing_acceptor_site which app ***
--- *** ends the 22nt SL1 RNA leader sequence to ***
--- ***  the 5' end of most mRNAs.               ***
--- ************************************************
---

CREATE VIEW sl1_acceptor_site AS
  SELECT
    feature_id AS sl1_acceptor_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'SL1_acceptor_site';

--- ************************************************
--- *** relation: sl2_acceptor_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A trans_splicing_acceptor_site which app ***
--- *** ends the 22nt SL2 RNA leader sequence to ***
--- ***  the 5' end of mRNAs. SL2 acceptor sites ***
--- ***  occur in genes in internal segments of  ***
--- *** polycistronic transcripts.               ***
--- ************************************************
---

CREATE VIEW sl2_acceptor_site AS
  SELECT
    feature_id AS sl2_acceptor_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'SL3_acceptor_site' OR cvterm.name = 'SL4_acceptor_site' OR cvterm.name = 'SL5_acceptor_site' OR cvterm.name = 'SL6_acceptor_site' OR cvterm.name = 'SL7_acceptor_site' OR cvterm.name = 'SL8_acceptor_site' OR cvterm.name = 'SL9_acceptor_site' OR cvterm.name = 'SL10_accceptor_site' OR cvterm.name = 'SL11_acceptor_site' OR cvterm.name = 'SL12_acceptor_site' OR cvterm.name = 'SL2_acceptor_site';

--- ************************************************
--- *** relation: gene_with_stop_codon_redefined_as_selenocysteine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene encoding an mRNA that has the sto ***
--- *** p codon redefined as selenocysteine.     ***
--- ************************************************
---

CREATE VIEW gene_with_stop_codon_redefined_as_selenocysteine AS
  SELECT
    feature_id AS gene_with_stop_codon_redefined_as_selenocysteine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_with_stop_codon_redefined_as_selenocysteine';

--- ************************************************
--- *** relation: gene_with_mrna_recoded_by_translational_bypass ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene with mRNA recoded by translationa ***
--- *** l bypass.                                ***
--- ************************************************
---

CREATE VIEW gene_with_mrna_recoded_by_translational_bypass AS
  SELECT
    feature_id AS gene_with_mrna_recoded_by_translational_bypass_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_with_mRNA_recoded_by_translational_bypass';

--- ************************************************
--- *** relation: gene_with_transcript_with_translational_frameshift ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene encoding a transcript that has a  ***
--- *** translational frameshift.                ***
--- ************************************************
---

CREATE VIEW gene_with_transcript_with_translational_frameshift AS
  SELECT
    feature_id AS gene_with_transcript_with_translational_frameshift_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_with_transcript_with_translational_frameshift';

--- ************************************************
--- *** relation: dna_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A motif that is active in the DNA form o ***
--- *** f the sequence.                          ***
--- ************************************************
---

CREATE VIEW dna_motif AS
  SELECT
    feature_id AS dna_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'PSE_motif' OR cvterm.name = 'CAAT_signal' OR cvterm.name = 'minus_10_signal' OR cvterm.name = 'minus_35_signal' OR cvterm.name = 'DRE_motif' OR cvterm.name = 'E_box_motif' OR cvterm.name = 'INR1_motif' OR cvterm.name = 'GAGA_motif' OR cvterm.name = 'octamer_motif' OR cvterm.name = 'retinoic_acid_responsive_element' OR cvterm.name = 'promoter_element' OR cvterm.name = 'DCE_SI' OR cvterm.name = 'DCE_SII' OR cvterm.name = 'DCE_SIII' OR cvterm.name = 'minus_12_signal' OR cvterm.name = 'minus_24_signal' OR cvterm.name = 'GC_rich_promoter_region' OR cvterm.name = 'DMv4_motif' OR cvterm.name = 'DMv5_motif' OR cvterm.name = 'DMv3_motif' OR cvterm.name = 'DMv2_motif' OR cvterm.name = 'DPE1_motif' OR cvterm.name = 'DMv1_motif' OR cvterm.name = 'NDM2_motif' OR cvterm.name = 'NDM3_motif' OR cvterm.name = 'core_promoter_element' OR cvterm.name = 'regulatory_promoter_element' OR cvterm.name = 'INR_motif' OR cvterm.name = 'DPE_motif' OR cvterm.name = 'BREu_motif' OR cvterm.name = 'TATA_box' OR cvterm.name = 'A_box' OR cvterm.name = 'B_box' OR cvterm.name = 'C_box' OR cvterm.name = 'MTE' OR cvterm.name = 'BREd_motif' OR cvterm.name = 'DCE' OR cvterm.name = 'intermediate_element' OR cvterm.name = 'RNA_polymerase_II_TATA_box' OR cvterm.name = 'RNA_polymerase_III_TATA_box' OR cvterm.name = 'A_box_type_1' OR cvterm.name = 'A_box_type_2' OR cvterm.name = 'proximal_promoter_element' OR cvterm.name = 'distal_promoter_element' OR cvterm.name = 'DNA_motif';

--- ************************************************
--- *** relation: nucleotide_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of nucleotide sequence correspo ***
--- *** nding to a known motif.                  ***
--- ************************************************
---

CREATE VIEW nucleotide_motif AS
  SELECT
    feature_id AS nucleotide_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DNA_motif' OR cvterm.name = 'RNA_motif' OR cvterm.name = 'PSE_motif' OR cvterm.name = 'CAAT_signal' OR cvterm.name = 'minus_10_signal' OR cvterm.name = 'minus_35_signal' OR cvterm.name = 'DRE_motif' OR cvterm.name = 'E_box_motif' OR cvterm.name = 'INR1_motif' OR cvterm.name = 'GAGA_motif' OR cvterm.name = 'octamer_motif' OR cvterm.name = 'retinoic_acid_responsive_element' OR cvterm.name = 'promoter_element' OR cvterm.name = 'DCE_SI' OR cvterm.name = 'DCE_SII' OR cvterm.name = 'DCE_SIII' OR cvterm.name = 'minus_12_signal' OR cvterm.name = 'minus_24_signal' OR cvterm.name = 'GC_rich_promoter_region' OR cvterm.name = 'DMv4_motif' OR cvterm.name = 'DMv5_motif' OR cvterm.name = 'DMv3_motif' OR cvterm.name = 'DMv2_motif' OR cvterm.name = 'DPE1_motif' OR cvterm.name = 'DMv1_motif' OR cvterm.name = 'NDM2_motif' OR cvterm.name = 'NDM3_motif' OR cvterm.name = 'core_promoter_element' OR cvterm.name = 'regulatory_promoter_element' OR cvterm.name = 'INR_motif' OR cvterm.name = 'DPE_motif' OR cvterm.name = 'BREu_motif' OR cvterm.name = 'TATA_box' OR cvterm.name = 'A_box' OR cvterm.name = 'B_box' OR cvterm.name = 'C_box' OR cvterm.name = 'MTE' OR cvterm.name = 'BREd_motif' OR cvterm.name = 'DCE' OR cvterm.name = 'intermediate_element' OR cvterm.name = 'RNA_polymerase_II_TATA_box' OR cvterm.name = 'RNA_polymerase_III_TATA_box' OR cvterm.name = 'A_box_type_1' OR cvterm.name = 'A_box_type_2' OR cvterm.name = 'proximal_promoter_element' OR cvterm.name = 'distal_promoter_element' OR cvterm.name = 'RNA_internal_loop' OR cvterm.name = 'A_minor_RNA_motif' OR cvterm.name = 'RNA_junction_loop' OR cvterm.name = 'hammerhead_ribozyme' OR cvterm.name = 'asymmetric_RNA_internal_loop' OR cvterm.name = 'symmetric_RNA_internal_loop' OR cvterm.name = 'K_turn_RNA_motif' OR cvterm.name = 'sarcin_like_RNA_motif' OR cvterm.name = 'RNA_hook_turn' OR cvterm.name = 'nucleotide_motif';

--- ************************************************
--- *** relation: rna_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A motif that is active in RNA sequence.  ***
--- ************************************************
---

CREATE VIEW rna_motif AS
  SELECT
    feature_id AS rna_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RNA_internal_loop' OR cvterm.name = 'A_minor_RNA_motif' OR cvterm.name = 'RNA_junction_loop' OR cvterm.name = 'hammerhead_ribozyme' OR cvterm.name = 'asymmetric_RNA_internal_loop' OR cvterm.name = 'symmetric_RNA_internal_loop' OR cvterm.name = 'K_turn_RNA_motif' OR cvterm.name = 'sarcin_like_RNA_motif' OR cvterm.name = 'RNA_hook_turn' OR cvterm.name = 'RNA_motif';

--- ************************************************
--- *** relation: dicistronic_mrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An mRNA that has the quality dicistronic ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW dicistronic_mrna AS
  SELECT
    feature_id AS dicistronic_mrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'dicistronic_mRNA';

--- ************************************************
--- *** relation: reading_frame ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A nucleic acid sequence that when read a ***
--- *** s sequential triplets, has the potential ***
--- ***  of encoding a sequential string of amin ***
--- *** o acids. It need not contain the start o ***
--- *** r stop codon.                            ***
--- ************************************************
---

CREATE VIEW reading_frame AS
  SELECT
    feature_id AS reading_frame_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'ORF' OR cvterm.name = 'blocked_reading_frame' OR cvterm.name = 'mini_gene' OR cvterm.name = 'rescue_mini_gene' OR cvterm.name = 'reading_frame';

--- ************************************************
--- *** relation: blocked_reading_frame ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A reading_frame that is interrupted by o ***
--- *** ne or more stop codons; usually identifi ***
--- *** ed through intergenomic sequence compari ***
--- *** sons.                                    ***
--- ************************************************
---

CREATE VIEW blocked_reading_frame AS
  SELECT
    feature_id AS blocked_reading_frame_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'blocked_reading_frame';

--- ************************************************
--- *** relation: ultracontig ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An ordered and oriented set of scaffolds ***
--- ***  based on somewhat weaker sets of infere ***
--- *** ntial evidence such as one set of mate p ***
--- *** air reads together with supporting evide ***
--- *** nce from ESTs or location of markers fro ***
--- *** m SNP or microsatellite maps, or cytogen ***
--- *** etic localization of contained markers.  ***
--- ************************************************
---

CREATE VIEW ultracontig AS
  SELECT
    feature_id AS ultracontig_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'ultracontig';

--- ************************************************
--- *** relation: foreign_transposable_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transposable element that is foreign.  ***
--- ************************************************
---

CREATE VIEW foreign_transposable_element AS
  SELECT
    feature_id AS foreign_transposable_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'engineered_foreign_transposable_element' OR cvterm.name = 'foreign_transposable_element';

--- ************************************************
--- *** relation: gene_with_dicistronic_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that encodes a dicistronic primar ***
--- *** y transcript.                            ***
--- ************************************************
---

CREATE VIEW gene_with_dicistronic_primary_transcript AS
  SELECT
    feature_id AS gene_with_dicistronic_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_with_dicistronic_primary_transcript';

--- ************************************************
--- *** relation: gene_with_dicistronic_mrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that encodes a polycistronic mRNA ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW gene_with_dicistronic_mrna AS
  SELECT
    feature_id AS gene_with_dicistronic_mrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_with_dicistronic_mRNA';

--- ************************************************
--- *** relation: idna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Genomic sequence removed from the genome ***
--- *** , as a normal event, by a process of rec ***
--- *** ombination.                              ***
--- ************************************************
---

CREATE VIEW idna AS
  SELECT
    feature_id AS idna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'iDNA';

--- ************************************************
--- *** relation: orit ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of a DNA molecule where transfe ***
--- *** r is initiated during the process of con ***
--- *** jugation or mobilization.                ***
--- ************************************************
---

CREATE VIEW orit AS
  SELECT
    feature_id AS orit_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'oriT';

--- ************************************************
--- *** relation: transit_peptide ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The transit_peptide is a short region at ***
--- ***  the N-terminus of the peptide that dire ***
--- *** cts the protein to an organelle (chlorop ***
--- *** last, mitochondrion, microbody or cyanel ***
--- *** le).                                     ***
--- ************************************************
---

CREATE VIEW transit_peptide AS
  SELECT
    feature_id AS transit_peptide_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'transit_peptide';

--- ************************************************
--- *** relation: repeat_unit ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The simplest repeated component of a rep ***
--- *** eat region. A single repeat.             ***
--- ************************************************
---

CREATE VIEW repeat_unit AS
  SELECT
    feature_id AS repeat_unit_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'repeat_unit';

--- ************************************************
--- *** relation: crm ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A regulatory_region where more than 1 TF ***
--- *** _binding_site together are regulatorily  ***
--- *** active.                                  ***
--- ************************************************
---

CREATE VIEW crm AS
  SELECT
    feature_id AS crm_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'locus_control_region' OR cvterm.name = 'enhancer' OR cvterm.name = 'silencer' OR cvterm.name = 'enhancer_bound_by_factor' OR cvterm.name = 'shadow_enhancer' OR cvterm.name = 'CRM';

--- ************************************************
--- *** relation: intein ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of a peptide that is able to ex ***
--- *** cise itself and rejoin the remaining por ***
--- *** tions with a peptide bond.               ***
--- ************************************************
---

CREATE VIEW intein AS
  SELECT
    feature_id AS intein_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'intein';

--- ************************************************
--- *** relation: intein_containing ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute of protein-coding genes whe ***
--- *** re the initial protein product contains  ***
--- *** an intein.                               ***
--- ************************************************
---

CREATE VIEW intein_containing AS
  SELECT
    feature_id AS intein_containing_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'intein_containing';

--- ************************************************
--- *** relation: gap ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gap in the sequence of known length. T ***
--- *** he unknown bases are filled in with N's. ***
--- ************************************************
---

CREATE VIEW gap AS
  SELECT
    feature_id AS gap_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gap';

--- ************************************************
--- *** relation: fragmentary ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute to describe a feature that  ***
--- *** is incomplete.                           ***
--- ************************************************
---

CREATE VIEW fragmentary AS
  SELECT
    feature_id AS fragmentary_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'fragmentary';

--- ************************************************
--- *** relation: predicted ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing an unverified re ***
--- *** gion.                                    ***
--- ************************************************
---

CREATE VIEW predicted AS
  SELECT
    feature_id AS predicted_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'supported_by_sequence_similarity' OR cvterm.name = 'orphan' OR cvterm.name = 'predicted_by_ab_initio_computation' OR cvterm.name = 'supported_by_domain_match' OR cvterm.name = 'supported_by_EST_or_cDNA' OR cvterm.name = 'predicted';

--- ************************************************
--- *** relation: feature_attribute ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a located_sequen ***
--- *** ce_feature.                              ***
--- ************************************************
---

CREATE VIEW feature_attribute AS
  SELECT
    feature_id AS feature_attribute_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'transcript_attribute' OR cvterm.name = 'bound_by_factor' OR cvterm.name = 'flanked' OR cvterm.name = 'gene_attribute' OR cvterm.name = 'retrotransposed' OR cvterm.name = 'transgenic' OR cvterm.name = 'natural' OR cvterm.name = 'engineered' OR cvterm.name = 'foreign' OR cvterm.name = 'fusion' OR cvterm.name = 'rescue' OR cvterm.name = 'wild_type' OR cvterm.name = 'conserved' OR cvterm.name = 'status' OR cvterm.name = 'intermediate' OR cvterm.name = 'recombinationally_rearranged' OR cvterm.name = 'cryptic' OR cvterm.name = 'strand_attribute' OR cvterm.name = 'direction_attribute' OR cvterm.name = 'enzymatic' OR cvterm.name = 'mobile' OR cvterm.name = 'alteration_attribute' OR cvterm.name = 'experimental_feature_attribute' OR cvterm.name = 'edited' OR cvterm.name = 'capped' OR cvterm.name = 'mRNA_attribute' OR cvterm.name = 'trans_spliced' OR cvterm.name = 'alternatively_spliced' OR cvterm.name = 'monocistronic' OR cvterm.name = 'polycistronic' OR cvterm.name = 'polyadenylated' OR cvterm.name = 'exemplar' OR cvterm.name = 'frameshift' OR cvterm.name = 'recoded' OR cvterm.name = 'minus_1_frameshift' OR cvterm.name = 'minus_2_frameshift' OR cvterm.name = 'plus_1_frameshift' OR cvterm.name = 'plus_2_framshift' OR cvterm.name = 'codon_redefined' OR cvterm.name = 'recoded_by_translational_bypass' OR cvterm.name = 'translationally_frameshifted' OR cvterm.name = 'minus_1_translationally_frameshifted' OR cvterm.name = 'plus_1_translationally_frameshifted' OR cvterm.name = 'dicistronic' OR cvterm.name = 'bound_by_protein' OR cvterm.name = 'bound_by_nucleic_acid' OR cvterm.name = 'floxed' OR cvterm.name = 'FRT_flanked' OR cvterm.name = 'protein_coding' OR cvterm.name = 'non_protein_coding' OR cvterm.name = 'gene_to_gene_feature' OR cvterm.name = 'gene_array_member' OR cvterm.name = 'regulated' OR cvterm.name = 'epigenetically_modified' OR cvterm.name = 'encodes_alternately_spliced_transcripts' OR cvterm.name = 'encodes_alternate_transcription_start_sites' OR cvterm.name = 'intein_containing' OR cvterm.name = 'miRNA_encoding' OR cvterm.name = 'rRNA_encoding' OR cvterm.name = 'scRNA_encoding' OR cvterm.name = 'snoRNA_encoding' OR cvterm.name = 'snRNA_encoding' OR cvterm.name = 'SRP_RNA_encoding' OR cvterm.name = 'stRNA_encoding' OR cvterm.name = 'tmRNA_encoding' OR cvterm.name = 'tRNA_encoding' OR cvterm.name = 'gRNA_encoding' OR cvterm.name = 'C_D_box_snoRNA_encoding' OR cvterm.name = 'H_ACA_box_snoRNA_encoding' OR cvterm.name = 'overlapping' OR cvterm.name = 'inside_intron' OR cvterm.name = 'five_prime_three_prime_overlap' OR cvterm.name = 'five_prime_five_prime_overlap' OR cvterm.name = 'three_prime_three_prime_overlap' OR cvterm.name = 'three_prime_five_prime_overlap' OR cvterm.name = 'antisense' OR cvterm.name = 'inside_intron_antiparallel' OR cvterm.name = 'inside_intron_parallel' OR cvterm.name = 'operon_member' OR cvterm.name = 'gene_cassette_member' OR cvterm.name = 'gene_subarray_member' OR cvterm.name = 'member_of_regulon' OR cvterm.name = 'cassette_array_member' OR cvterm.name = 'transcriptionally_regulated' OR cvterm.name = 'post_translationally_regulated' OR cvterm.name = 'translationally_regulated' OR cvterm.name = 'imprinted' OR cvterm.name = 'transcriptionally_constitutive' OR cvterm.name = 'transcriptionally_induced' OR cvterm.name = 'transcriptionally_repressed' OR cvterm.name = 'autoregulated' OR cvterm.name = 'positively_autoregulated' OR cvterm.name = 'negatively_autoregulated' OR cvterm.name = 'silenced' OR cvterm.name = 'silenced_by_DNA_modification' OR cvterm.name = 'silenced_by_RNA_interference' OR cvterm.name = 'silenced_by_histone_modification' OR cvterm.name = 'silenced_by_DNA_methylation' OR cvterm.name = 'silenced_by_histone_methylation' OR cvterm.name = 'silenced_by_histone_deacetylation' OR cvterm.name = 'negatively_autoregulated' OR cvterm.name = 'positively_autoregulated' OR cvterm.name = 'post_translationally_regulated_by_protein_stability' OR cvterm.name = 'post_translationally_regulated_by_protein_modification' OR cvterm.name = 'maternally_imprinted' OR cvterm.name = 'paternally_imprinted' OR cvterm.name = 'imprinted' OR cvterm.name = 'allelically_excluded' OR cvterm.name = 'rearranged_at_DNA_level' OR cvterm.name = 'maternally_imprinted' OR cvterm.name = 'paternally_imprinted' OR cvterm.name = 'encodes_1_polypeptide' OR cvterm.name = 'encodes_greater_than_1_polypeptide' OR cvterm.name = 'encodes_disjoint_polypeptides' OR cvterm.name = 'encodes_overlapping_peptides' OR cvterm.name = 'encodes_different_polypeptides_different_stop' OR cvterm.name = 'encodes_overlapping_peptides_different_start' OR cvterm.name = 'encodes_overlapping_polypeptides_different_start_and_stop' OR cvterm.name = 'homologous' OR cvterm.name = 'syntenic' OR cvterm.name = 'orthologous' OR cvterm.name = 'paralogous' OR cvterm.name = 'fragmentary' OR cvterm.name = 'predicted' OR cvterm.name = 'validated' OR cvterm.name = 'invalidated' OR cvterm.name = 'independently_known' OR cvterm.name = 'consensus' OR cvterm.name = 'low_complexity' OR cvterm.name = 'whole_genome_sequence_status' OR cvterm.name = 'supported_by_sequence_similarity' OR cvterm.name = 'orphan' OR cvterm.name = 'predicted_by_ab_initio_computation' OR cvterm.name = 'supported_by_domain_match' OR cvterm.name = 'supported_by_EST_or_cDNA' OR cvterm.name = 'experimentally_determined' OR cvterm.name = 'invalidated_by_chimeric_cDNA' OR cvterm.name = 'invalidated_by_genomic_contamination' OR cvterm.name = 'invalidated_by_genomic_polyA_primed_cDNA' OR cvterm.name = 'invalidated_by_partial_processing' OR cvterm.name = 'standard_draft' OR cvterm.name = 'high_quality_draft' OR cvterm.name = 'improved_high_quality_draft' OR cvterm.name = 'annotation_directed_improved_draft' OR cvterm.name = 'noncontiguous_finished' OR cvterm.name = 'finished_genome' OR cvterm.name = 'single' OR cvterm.name = 'double' OR cvterm.name = 'forward' OR cvterm.name = 'reverse' OR cvterm.name = 'ribozymic' OR cvterm.name = 'chromosomal_variation_attribute' OR cvterm.name = 'insertion_attribute' OR cvterm.name = 'inversion_attribute' OR cvterm.name = 'translocaton_attribute' OR cvterm.name = 'duplication_attribute' OR cvterm.name = 'intrachromosomal' OR cvterm.name = 'interchromosomal' OR cvterm.name = 'tandem' OR cvterm.name = 'direct' OR cvterm.name = 'inverted' OR cvterm.name = 'pericentric' OR cvterm.name = 'paracentric' OR cvterm.name = 'reciprocal' OR cvterm.name = 'insertional' OR cvterm.name = 'free' OR cvterm.name = 'score' OR cvterm.name = 'quality_value' OR cvterm.name = 'feature_attribute';

--- ************************************************
--- *** relation: exemplar_mrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An exemplar is a representative cDNA seq ***
--- *** uence for each gene. The exemplar approa ***
--- *** ch is a method that usually involves som ***
--- *** e initial clustering into gene groups an ***
--- *** d the subsequent selection of a represen ***
--- *** tative from each gene group.             ***
--- ************************************************
---

CREATE VIEW exemplar_mrna AS
  SELECT
    feature_id AS exemplar_mrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'exemplar_mRNA';

--- ************************************************
--- *** relation: sequence_location ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW sequence_location AS
  SELECT
    feature_id AS sequence_location_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'organelle_sequence' OR cvterm.name = 'plasmid_location' OR cvterm.name = 'proviral_location' OR cvterm.name = 'macronuclear_sequence' OR cvterm.name = 'micronuclear_sequence' OR cvterm.name = 'mitochondrial_sequence' OR cvterm.name = 'nuclear_sequence' OR cvterm.name = 'nucleomorphic_sequence' OR cvterm.name = 'plastid_sequence' OR cvterm.name = 'mitochondrial_DNA' OR cvterm.name = 'apicoplast_sequence' OR cvterm.name = 'chromoplast_sequence' OR cvterm.name = 'chloroplast_sequence' OR cvterm.name = 'cyanelle_sequence' OR cvterm.name = 'leucoplast_sequence' OR cvterm.name = 'proplastid_sequence' OR cvterm.name = 'chloroplast_DNA' OR cvterm.name = 'endogenous_retroviral_sequence' OR cvterm.name = 'sequence_location';

--- ************************************************
--- *** relation: organelle_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW organelle_sequence AS
  SELECT
    feature_id AS organelle_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'macronuclear_sequence' OR cvterm.name = 'micronuclear_sequence' OR cvterm.name = 'mitochondrial_sequence' OR cvterm.name = 'nuclear_sequence' OR cvterm.name = 'nucleomorphic_sequence' OR cvterm.name = 'plastid_sequence' OR cvterm.name = 'mitochondrial_DNA' OR cvterm.name = 'apicoplast_sequence' OR cvterm.name = 'chromoplast_sequence' OR cvterm.name = 'chloroplast_sequence' OR cvterm.name = 'cyanelle_sequence' OR cvterm.name = 'leucoplast_sequence' OR cvterm.name = 'proplastid_sequence' OR cvterm.name = 'chloroplast_DNA' OR cvterm.name = 'organelle_sequence';

--- ************************************************
--- *** relation: mitochondrial_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW mitochondrial_sequence AS
  SELECT
    feature_id AS mitochondrial_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mitochondrial_DNA' OR cvterm.name = 'mitochondrial_sequence';

--- ************************************************
--- *** relation: nuclear_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW nuclear_sequence AS
  SELECT
    feature_id AS nuclear_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'nuclear_sequence';

--- ************************************************
--- *** relation: nucleomorphic_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW nucleomorphic_sequence AS
  SELECT
    feature_id AS nucleomorphic_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'nucleomorphic_sequence';

--- ************************************************
--- *** relation: plastid_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW plastid_sequence AS
  SELECT
    feature_id AS plastid_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'apicoplast_sequence' OR cvterm.name = 'chromoplast_sequence' OR cvterm.name = 'chloroplast_sequence' OR cvterm.name = 'cyanelle_sequence' OR cvterm.name = 'leucoplast_sequence' OR cvterm.name = 'proplastid_sequence' OR cvterm.name = 'chloroplast_DNA' OR cvterm.name = 'plastid_sequence';

--- ************************************************
--- *** relation: kinetoplast ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kinetoplast is an interlocked network  ***
--- *** of thousands of minicircles and tens of  ***
--- *** maxi circles, located near the base of t ***
--- *** he flagellum of some protozoan species.  ***
--- ************************************************
---

CREATE VIEW kinetoplast AS
  SELECT
    feature_id AS kinetoplast_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'kinetoplast';

--- ************************************************
--- *** relation: maxicircle ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A maxicircle is a replicon, part of a ki ***
--- *** netoplast, that contains open reading fr ***
--- *** ames and replicates via a rolling circle ***
--- ***  method.                                 ***
--- ************************************************
---

CREATE VIEW maxicircle AS
  SELECT
    feature_id AS maxicircle_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'maxicircle';

--- ************************************************
--- *** relation: apicoplast_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW apicoplast_sequence AS
  SELECT
    feature_id AS apicoplast_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'apicoplast_sequence';

--- ************************************************
--- *** relation: chromoplast_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW chromoplast_sequence AS
  SELECT
    feature_id AS chromoplast_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'chromoplast_sequence';

--- ************************************************
--- *** relation: chloroplast_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW chloroplast_sequence AS
  SELECT
    feature_id AS chloroplast_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'chloroplast_DNA' OR cvterm.name = 'chloroplast_sequence';

--- ************************************************
--- *** relation: cyanelle_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW cyanelle_sequence AS
  SELECT
    feature_id AS cyanelle_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cyanelle_sequence';

--- ************************************************
--- *** relation: leucoplast_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW leucoplast_sequence AS
  SELECT
    feature_id AS leucoplast_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'leucoplast_sequence';

--- ************************************************
--- *** relation: proplastid_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW proplastid_sequence AS
  SELECT
    feature_id AS proplastid_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'proplastid_sequence';

--- ************************************************
--- *** relation: plasmid_location ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW plasmid_location AS
  SELECT
    feature_id AS plasmid_location_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'plasmid_location';

--- ************************************************
--- *** relation: amplification_origin ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An origin_of_replication that is used fo ***
--- *** r the amplification of a chromosomal nuc ***
--- *** leic acid sequence.                      ***
--- ************************************************
---

CREATE VIEW amplification_origin AS
  SELECT
    feature_id AS amplification_origin_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'amplification_origin';

--- ************************************************
--- *** relation: proviral_location ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW proviral_location AS
  SELECT
    feature_id AS proviral_location_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'endogenous_retroviral_sequence' OR cvterm.name = 'proviral_location';

--- ************************************************
--- *** relation: gene_group_regulatory_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW gene_group_regulatory_region AS
  SELECT
    feature_id AS gene_group_regulatory_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'operator' OR cvterm.name = 'bacterial_RNApol_promoter' OR cvterm.name = 'bacterial_terminator' OR cvterm.name = 'bacterial_RNApol_promoter_sigma_70' OR cvterm.name = 'bacterial_RNApol_promoter_sigma54' OR cvterm.name = 'rho_dependent_bacterial_terminator' OR cvterm.name = 'rho_independent_bacterial_terminator' OR cvterm.name = 'gene_group_regulatory_region';

--- ************************************************
--- *** relation: clone_insert ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The region of sequence that has been ins ***
--- *** erted and is being propagated by the clo ***
--- *** ne.                                      ***
--- ************************************************
---

CREATE VIEW clone_insert AS
  SELECT
    feature_id AS clone_insert_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cloned_cDNA_insert' OR cvterm.name = 'cloned_genomic_insert' OR cvterm.name = 'engineered_insert' OR cvterm.name = 'BAC_cloned_genomic_insert' OR cvterm.name = 'clone_insert';

--- ************************************************
--- *** relation: lambda_vector ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The lambda bacteriophage is the vector f ***
--- *** or the linear lambda clone. The genes in ***
--- *** volved in the lysogenic pathway are remo ***
--- *** ved from the from the viral DNA. Up to 2 ***
--- *** 5 kb of foreign DNA can then be inserted ***
--- ***  into the lambda genome.                 ***
--- ************************************************
---

CREATE VIEW lambda_vector AS
  SELECT
    feature_id AS lambda_vector_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'lambda_vector';

--- ************************************************
--- *** relation: plasmid_vector ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW plasmid_vector AS
  SELECT
    feature_id AS plasmid_vector_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'plasmid_vector';

--- ************************************************
--- *** relation: cdna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** DNA synthesized by reverse transcriptase ***
--- ***  using RNA as a template.                ***
--- ************************************************
---

CREATE VIEW cdna AS
  SELECT
    feature_id AS cdna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'single_stranded_cDNA' OR cvterm.name = 'double_stranded_cDNA' OR cvterm.name = 'cDNA';

--- ************************************************
--- *** relation: single_stranded_cdna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW single_stranded_cdna AS
  SELECT
    feature_id AS single_stranded_cdna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'single_stranded_cDNA';

--- ************************************************
--- *** relation: double_stranded_cdna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW double_stranded_cdna AS
  SELECT
    feature_id AS double_stranded_cdna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'double_stranded_cDNA';

--- ************************************************
--- *** relation: pyrrolysyl_trna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tRNA sequence that has a pyrrolysine a ***
--- *** nticodon, and a 3' pyrrolysine binding r ***
--- *** egion.                                   ***
--- ************************************************
---

CREATE VIEW pyrrolysyl_trna AS
  SELECT
    feature_id AS pyrrolysyl_trna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pyrrolysyl_tRNA';

--- ************************************************
--- *** relation: episome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A plasmid that may integrate with a chro ***
--- *** mosome.                                  ***
--- ************************************************
---

CREATE VIEW episome AS
  SELECT
    feature_id AS episome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'engineered_episome' OR cvterm.name = 'episome';

--- ************************************************
--- *** relation: tmrna_coding_piece ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The region of a two-piece tmRNA that bea ***
--- *** rs the reading frame encoding the proteo ***
--- *** lysis tag. The tmRNA gene undergoes circ ***
--- *** ular permutation in some groups of bacte ***
--- *** ria. Processing of the transcripts from  ***
--- *** such a gene leaves the mature tmRNA in t ***
--- *** wo pieces, base-paired together.         ***
--- ************************************************
---

CREATE VIEW tmrna_coding_piece AS
  SELECT
    feature_id AS tmrna_coding_piece_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tmRNA_coding_piece';

--- ************************************************
--- *** relation: tmrna_acceptor_piece ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The acceptor region of a two-piece tmRNA ***
--- ***  that when mature is charged at its 3' e ***
--- *** nd with alanine. The tmRNA gene undergoe ***
--- *** s circular permutation in some groups of ***
--- ***  bacteria; processing of the transcripts ***
--- ***  from such a gene leaves the mature tmRN ***
--- *** A in two pieces, base-paired together.   ***
--- ************************************************
---

CREATE VIEW tmrna_acceptor_piece AS
  SELECT
    feature_id AS tmrna_acceptor_piece_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tmRNA_acceptor_piece';

--- ************************************************
--- *** relation: qtl ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A quantitative trait locus (QTL) is a po ***
--- *** lymorphic locus which contains alleles t ***
--- *** hat differentially affect the expression ***
--- ***  of a continuously distributed phenotypi ***
--- *** c trait. Usually it is a marker describe ***
--- *** d by statistical association to quantita ***
--- *** tive variation in the particular phenoty ***
--- *** pic trait that is thought to be controll ***
--- *** ed by the cumulative action of alleles a ***
--- *** t multiple loci.                         ***
--- ************************************************
---

CREATE VIEW qtl AS
  SELECT
    feature_id AS qtl_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'QTL';

--- ************************************************
--- *** relation: genomic_island ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A genomic island is an integrated mobile ***
--- ***  genetic element, characterized by size  ***
--- *** (over 10 Kb). It that has features that  ***
--- *** suggest a foreign origin. These can incl ***
--- *** ude nucleotide distribution (oligonucleo ***
--- *** tides signature, CG content etc.) that d ***
--- *** iffers from the bulk of the chromosome a ***
--- *** nd/or genes suggesting DNA mobility.     ***
--- ************************************************
---

CREATE VIEW genomic_island AS
  SELECT
    feature_id AS genomic_island_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pathogenic_island' OR cvterm.name = 'metabolic_island' OR cvterm.name = 'adaptive_island' OR cvterm.name = 'symbiosis_island' OR cvterm.name = 'cryptic_prophage' OR cvterm.name = 'defective_conjugative_transposon' OR cvterm.name = 'genomic_island';

--- ************************************************
--- *** relation: pathogenic_island ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Mobile genetic elements that contribute  ***
--- *** to rapid changes in virulence potential. ***
--- ***  They are present on the genomes of path ***
--- *** ogenic strains but absent from the genom ***
--- *** es of non pathogenic members of the same ***
--- ***  or related species.                     ***
--- ************************************************
---

CREATE VIEW pathogenic_island AS
  SELECT
    feature_id AS pathogenic_island_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pathogenic_island';

--- ************************************************
--- *** relation: metabolic_island ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transmissible element containing genes ***
--- ***  involved in metabolism, analogous to th ***
--- *** e pathogenicity islands of gram negative ***
--- ***  bacteria.                               ***
--- ************************************************
---

CREATE VIEW metabolic_island AS
  SELECT
    feature_id AS metabolic_island_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'metabolic_island';

--- ************************************************
--- *** relation: adaptive_island ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An adaptive island is a genomic island t ***
--- *** hat provides an adaptive advantage to th ***
--- *** e host.                                  ***
--- ************************************************
---

CREATE VIEW adaptive_island AS
  SELECT
    feature_id AS adaptive_island_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'adaptive_island';

--- ************************************************
--- *** relation: symbiosis_island ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transmissible element containing genes ***
--- ***  involved in symbiosis, analogous to the ***
--- ***  pathogenicity islands of gram negative  ***
--- *** bacteria.                                ***
--- ************************************************
---

CREATE VIEW symbiosis_island AS
  SELECT
    feature_id AS symbiosis_island_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'symbiosis_island';

--- ************************************************
--- *** relation: pseudogenic_rrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A non functional descendent of an rRNA.  ***
--- ************************************************
---

CREATE VIEW pseudogenic_rrna AS
  SELECT
    feature_id AS pseudogenic_rrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pseudogenic_rRNA';

--- ************************************************
--- *** relation: pseudogenic_trna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A non functional descendent of a tRNA.   ***
--- ************************************************
---

CREATE VIEW pseudogenic_trna AS
  SELECT
    feature_id AS pseudogenic_trna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pseudogenic_tRNA';

--- ************************************************
--- *** relation: engineered_episome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An episome that is engineered.           ***
--- ************************************************
---

CREATE VIEW engineered_episome AS
  SELECT
    feature_id AS engineered_episome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'engineered_episome';

--- ************************************************
--- *** relation: transgenic ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Attribute describing sequence that has b ***
--- *** een integrated with foreign sequence.    ***
--- ************************************************
---

CREATE VIEW transgenic AS
  SELECT
    feature_id AS transgenic_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'transgenic';

--- ************************************************
--- *** relation: so_natural ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a feature that o ***
--- *** ccurs in nature.                         ***
--- ************************************************
---

CREATE VIEW so_natural AS
  SELECT
    feature_id AS so_natural_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'natural';

--- ************************************************
--- *** relation: engineered ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute to describe a region that w ***
--- *** as modified in vitro.                    ***
--- ************************************************
---

CREATE VIEW engineered AS
  SELECT
    feature_id AS engineered_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'engineered';

--- ************************************************
--- *** relation: so_foreign ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute to describe a region from a ***
--- *** nother species.                          ***
--- ************************************************
---

CREATE VIEW so_foreign AS
  SELECT
    feature_id AS so_foreign_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'foreign';

--- ************************************************
--- *** relation: cloned_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW cloned_region AS
  SELECT
    feature_id AS cloned_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cloned_region';

--- ************************************************
--- *** relation: validated ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute to describe a feature that  ***
--- *** has been proven.                         ***
--- ************************************************
---

CREATE VIEW validated AS
  SELECT
    feature_id AS validated_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'experimentally_determined' OR cvterm.name = 'validated';

--- ************************************************
--- *** relation: invalidated ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a feature that i ***
--- *** s invalidated.                           ***
--- ************************************************
---

CREATE VIEW invalidated AS
  SELECT
    feature_id AS invalidated_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'invalidated_by_chimeric_cDNA' OR cvterm.name = 'invalidated_by_genomic_contamination' OR cvterm.name = 'invalidated_by_genomic_polyA_primed_cDNA' OR cvterm.name = 'invalidated_by_partial_processing' OR cvterm.name = 'invalidated';

--- ************************************************
--- *** relation: engineered_rescue_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A rescue region that is engineered.      ***
--- ************************************************
---

CREATE VIEW engineered_rescue_region AS
  SELECT
    feature_id AS engineered_rescue_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'engineered_rescue_region';

--- ************************************************
--- *** relation: rescue_mini_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A mini_gene that rescues.                ***
--- ************************************************
---

CREATE VIEW rescue_mini_gene AS
  SELECT
    feature_id AS rescue_mini_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rescue_mini_gene';

--- ************************************************
--- *** relation: transgenic_transposable_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** TE that has been modified in vitro, incl ***
--- *** uding insertion of DNA derived from a so ***
--- *** urce other than the originating TE.      ***
--- ************************************************
---

CREATE VIEW transgenic_transposable_element AS
  SELECT
    feature_id AS transgenic_transposable_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'transgenic_transposable_element';

--- ************************************************
--- *** relation: natural_transposable_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** TE that exists (or existed) in nature.   ***
--- ************************************************
---

CREATE VIEW natural_transposable_element AS
  SELECT
    feature_id AS natural_transposable_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'natural_transposable_element';

--- ************************************************
--- *** relation: engineered_transposable_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** TE that has been modified by manipulatio ***
--- *** ns in vitro.                             ***
--- ************************************************
---

CREATE VIEW engineered_transposable_element AS
  SELECT
    feature_id AS engineered_transposable_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'engineered_foreign_transposable_element' OR cvterm.name = 'engineered_transposable_element';

--- ************************************************
--- *** relation: engineered_foreign_transposable_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transposable_element that is engineere ***
--- *** d and foreign.                           ***
--- ************************************************
---

CREATE VIEW engineered_foreign_transposable_element AS
  SELECT
    feature_id AS engineered_foreign_transposable_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'engineered_foreign_transposable_element';

--- ************************************************
--- *** relation: assortment_derived_duplication ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A multi-chromosome duplication aberratio ***
--- *** n generated by reassortment of other abe ***
--- *** rration components.                      ***
--- ************************************************
---

CREATE VIEW assortment_derived_duplication AS
  SELECT
    feature_id AS assortment_derived_duplication_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'assortment_derived_duplication';

--- ************************************************
--- *** relation: assortment_derived_deficiency_plus_duplication ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A multi-chromosome aberration generated  ***
--- *** by reassortment of other aberration comp ***
--- *** onents; presumed to have a deficiency an ***
--- *** d a duplication.                         ***
--- ************************************************
---

CREATE VIEW assortment_derived_deficiency_plus_duplication AS
  SELECT
    feature_id AS assortment_derived_deficiency_plus_duplication_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'assortment_derived_deficiency_plus_duplication';

--- ************************************************
--- *** relation: assortment_derived_deficiency ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A multi-chromosome deficiency aberration ***
--- ***  generated by reassortment of other aber ***
--- *** ration components.                       ***
--- ************************************************
---

CREATE VIEW assortment_derived_deficiency AS
  SELECT
    feature_id AS assortment_derived_deficiency_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'assortment_derived_deficiency';

--- ************************************************
--- *** relation: assortment_derived_aneuploid ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A multi-chromosome aberration generated  ***
--- *** by reassortment of other aberration comp ***
--- *** onents; presumed to have a deficiency or ***
--- ***  a duplication.                          ***
--- ************************************************
---

CREATE VIEW assortment_derived_aneuploid AS
  SELECT
    feature_id AS assortment_derived_aneuploid_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'assortment_derived_aneuploid';

--- ************************************************
--- *** relation: engineered_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region that is engineered.             ***
--- ************************************************
---

CREATE VIEW engineered_region AS
  SELECT
    feature_id AS engineered_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'engineered_gene' OR cvterm.name = 'engineered_plasmid' OR cvterm.name = 'engineered_rescue_region' OR cvterm.name = 'engineered_transposable_element' OR cvterm.name = 'engineered_foreign_region' OR cvterm.name = 'engineered_tag' OR cvterm.name = 'engineered_insert' OR cvterm.name = 'targeting_vector' OR cvterm.name = 'engineered_foreign_gene' OR cvterm.name = 'engineered_fusion_gene' OR cvterm.name = 'engineered_foreign_transposable_element_gene' OR cvterm.name = 'engineered_episome' OR cvterm.name = 'gene_trap_construct' OR cvterm.name = 'promoter_trap_construct' OR cvterm.name = 'enhancer_trap_construct' OR cvterm.name = 'engineered_foreign_transposable_element' OR cvterm.name = 'engineered_foreign_gene' OR cvterm.name = 'engineered_foreign_repetitive_element' OR cvterm.name = 'engineered_foreign_transposable_element' OR cvterm.name = 'engineered_foreign_transposable_element_gene' OR cvterm.name = 'engineered_region';

--- ************************************************
--- *** relation: engineered_foreign_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region that is engineered and foreign. ***
--- ************************************************
---

CREATE VIEW engineered_foreign_region AS
  SELECT
    feature_id AS engineered_foreign_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'engineered_foreign_gene' OR cvterm.name = 'engineered_foreign_repetitive_element' OR cvterm.name = 'engineered_foreign_transposable_element' OR cvterm.name = 'engineered_foreign_transposable_element_gene' OR cvterm.name = 'engineered_foreign_region';

--- ************************************************
--- *** relation: fusion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW fusion AS
  SELECT
    feature_id AS fusion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'fusion';

--- ************************************************
--- *** relation: engineered_tag ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tag that is engineered.                ***
--- ************************************************
---

CREATE VIEW engineered_tag AS
  SELECT
    feature_id AS engineered_tag_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'engineered_tag';

--- ************************************************
--- *** relation: validated_cdna_clone ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A cDNA clone that has been validated.    ***
--- ************************************************
---

CREATE VIEW validated_cdna_clone AS
  SELECT
    feature_id AS validated_cdna_clone_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'validated_cDNA_clone';

--- ************************************************
--- *** relation: invalidated_cdna_clone ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A cDNA clone that is invalid.            ***
--- ************************************************
---

CREATE VIEW invalidated_cdna_clone AS
  SELECT
    feature_id AS invalidated_cdna_clone_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'chimeric_cDNA_clone' OR cvterm.name = 'genomically_contaminated_cDNA_clone' OR cvterm.name = 'polyA_primed_cDNA_clone' OR cvterm.name = 'partially_processed_cDNA_clone' OR cvterm.name = 'invalidated_cDNA_clone';

--- ************************************************
--- *** relation: chimeric_cdna_clone ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A cDNA clone invalidated because it is c ***
--- *** himeric.                                 ***
--- ************************************************
---

CREATE VIEW chimeric_cdna_clone AS
  SELECT
    feature_id AS chimeric_cdna_clone_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'chimeric_cDNA_clone';

--- ************************************************
--- *** relation: genomically_contaminated_cdna_clone ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A cDNA clone invalidated by genomic cont ***
--- *** amination.                               ***
--- ************************************************
---

CREATE VIEW genomically_contaminated_cdna_clone AS
  SELECT
    feature_id AS genomically_contaminated_cdna_clone_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'genomically_contaminated_cDNA_clone';

--- ************************************************
--- *** relation: polya_primed_cdna_clone ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A cDNA clone invalidated by polyA primin ***
--- *** g.                                       ***
--- ************************************************
---

CREATE VIEW polya_primed_cdna_clone AS
  SELECT
    feature_id AS polya_primed_cdna_clone_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polyA_primed_cDNA_clone';

--- ************************************************
--- *** relation: partially_processed_cdna_clone ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A cDNA invalidated clone by partial proc ***
--- *** essing.                                  ***
--- ************************************************
---

CREATE VIEW partially_processed_cdna_clone AS
  SELECT
    feature_id AS partially_processed_cdna_clone_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'partially_processed_cDNA_clone';

--- ************************************************
--- *** relation: rescue ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a region's abili ***
--- *** ty, when introduced to a mutant organism ***
--- *** , to re-establish (rescue) a phenotype.  ***
--- ************************************************
---

CREATE VIEW rescue AS
  SELECT
    feature_id AS rescue_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rescue';

--- ************************************************
--- *** relation: mini_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** By definition, minigenes are short open- ***
--- *** reading frames (ORF), usually encoding a ***
--- *** pproximately 9 to 20 amino acids, which  ***
--- *** are expressed in vivo (as distinct from  ***
--- *** being synthesized as peptide or protein  ***
--- *** ex vivo and subsequently injected). The  ***
--- *** in vivo synthesis confers a distinct adv ***
--- *** antage: the expressed sequences can ente ***
--- *** r both antigen presentation pathways, MH ***
--- *** C I (inducing CD8+ T- cells, which are u ***
--- *** sually cytotoxic T-lymphocytes (CTL)) an ***
--- *** d MHC II (inducing CD4+ T-cells, usually ***
--- ***  'T-helpers' (Th)); and can encounter B- ***
--- *** cells, inducing antibody responses. Thre ***
--- *** e main vector approaches have been used  ***
--- *** to deliver minigenes: viral vectors, bac ***
--- *** terial vectors and plasmid DNA.          ***
--- ************************************************
---

CREATE VIEW mini_gene AS
  SELECT
    feature_id AS mini_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rescue_mini_gene' OR cvterm.name = 'mini_gene';

--- ************************************************
--- *** relation: rescue_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that rescues.                     ***
--- ************************************************
---

CREATE VIEW rescue_gene AS
  SELECT
    feature_id AS rescue_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'wild_type_rescue_gene' OR cvterm.name = 'rescue_gene';

--- ************************************************
--- *** relation: wild_type ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing sequence with th ***
--- *** e genotype found in nature and/or standa ***
--- *** rd laboratory stock.                     ***
--- ************************************************
---

CREATE VIEW wild_type AS
  SELECT
    feature_id AS wild_type_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'wild_type';

--- ************************************************
--- *** relation: wild_type_rescue_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that rescues.                     ***
--- ************************************************
---

CREATE VIEW wild_type_rescue_gene AS
  SELECT
    feature_id AS wild_type_rescue_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'wild_type_rescue_gene';

--- ************************************************
--- *** relation: mitochondrial_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosome originating in a mitochondr ***
--- *** ia.                                      ***
--- ************************************************
---

CREATE VIEW mitochondrial_chromosome AS
  SELECT
    feature_id AS mitochondrial_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mitochondrial_chromosome';

--- ************************************************
--- *** relation: chloroplast_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosome originating in a chloroplas ***
--- *** t.                                       ***
--- ************************************************
---

CREATE VIEW chloroplast_chromosome AS
  SELECT
    feature_id AS chloroplast_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'chloroplast_chromosome';

--- ************************************************
--- *** relation: chromoplast_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosome originating in a chromoplas ***
--- *** t.                                       ***
--- ************************************************
---

CREATE VIEW chromoplast_chromosome AS
  SELECT
    feature_id AS chromoplast_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'chromoplast_chromosome';

--- ************************************************
--- *** relation: cyanelle_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosome originating in a cyanelle.  ***
--- ************************************************
---

CREATE VIEW cyanelle_chromosome AS
  SELECT
    feature_id AS cyanelle_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cyanelle_chromosome';

--- ************************************************
--- *** relation: leucoplast_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosome with origin in a leucoplast ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW leucoplast_chromosome AS
  SELECT
    feature_id AS leucoplast_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'leucoplast_chromosome';

--- ************************************************
--- *** relation: macronuclear_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosome originating in a macronucle ***
--- *** us.                                      ***
--- ************************************************
---

CREATE VIEW macronuclear_chromosome AS
  SELECT
    feature_id AS macronuclear_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'macronuclear_chromosome';

--- ************************************************
--- *** relation: micronuclear_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosome originating in a micronucle ***
--- *** us.                                      ***
--- ************************************************
---

CREATE VIEW micronuclear_chromosome AS
  SELECT
    feature_id AS micronuclear_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'micronuclear_chromosome';

--- ************************************************
--- *** relation: nuclear_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosome originating in a nucleus.   ***
--- ************************************************
---

CREATE VIEW nuclear_chromosome AS
  SELECT
    feature_id AS nuclear_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'nuclear_chromosome';

--- ************************************************
--- *** relation: nucleomorphic_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosome originating in a nucleomorp ***
--- *** h.                                       ***
--- ************************************************
---

CREATE VIEW nucleomorphic_chromosome AS
  SELECT
    feature_id AS nucleomorphic_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'nucleomorphic_chromosome';

--- ************************************************
--- *** relation: chromosome_part ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of a chromosome.                ***
--- ************************************************
---

CREATE VIEW chromosome_part AS
  SELECT
    feature_id AS chromosome_part_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'chromosome_arm' OR cvterm.name = 'chromosome_band' OR cvterm.name = 'interband' OR cvterm.name = 'chromosomal_regulatory_element' OR cvterm.name = 'chromosomal_structural_element' OR cvterm.name = 'introgressed_chromosome_region' OR cvterm.name = 'matrix_attachment_site' OR cvterm.name = 'centromere' OR cvterm.name = 'telomere' OR cvterm.name = 'point_centromere' OR cvterm.name = 'regional_centromere' OR cvterm.name = 'chromosome_part';

--- ************************************************
--- *** relation: gene_member_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of a gene.                      ***
--- ************************************************
---

CREATE VIEW gene_member_region AS
  SELECT
    feature_id AS gene_member_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'transcript' OR cvterm.name = 'regulatory_region' OR cvterm.name = 'polycistronic_transcript' OR cvterm.name = 'transcript_with_translational_frameshift' OR cvterm.name = 'primary_transcript' OR cvterm.name = 'mature_transcript' OR cvterm.name = 'transcript_bound_by_nucleic_acid' OR cvterm.name = 'transcript_bound_by_protein' OR cvterm.name = 'enzymatic_RNA' OR cvterm.name = 'trans_spliced_transcript' OR cvterm.name = 'monocistronic_transcript' OR cvterm.name = 'aberrant_processed_transcript' OR cvterm.name = 'edited_transcript' OR cvterm.name = 'processed_transcript' OR cvterm.name = 'alternatively_spliced_transcript' OR cvterm.name = 'dicistronic_transcript' OR cvterm.name = 'polycistronic_primary_transcript' OR cvterm.name = 'polycistronic_mRNA' OR cvterm.name = 'dicistronic_mRNA' OR cvterm.name = 'dicistronic_primary_transcript' OR cvterm.name = 'dicistronic_primary_transcript' OR cvterm.name = 'dicistronic_mRNA' OR cvterm.name = 'protein_coding_primary_transcript' OR cvterm.name = 'nc_primary_transcript' OR cvterm.name = 'polycistronic_primary_transcript' OR cvterm.name = 'monocistronic_primary_transcript' OR cvterm.name = 'mini_exon_donor_RNA' OR cvterm.name = 'antisense_primary_transcript' OR cvterm.name = 'capped_primary_transcript' OR cvterm.name = 'pre_edited_mRNA' OR cvterm.name = 'scRNA_primary_transcript' OR cvterm.name = 'rRNA_primary_transcript' OR cvterm.name = 'tRNA_primary_transcript' OR cvterm.name = 'snRNA_primary_transcript' OR cvterm.name = 'snoRNA_primary_transcript' OR cvterm.name = 'tmRNA_primary_transcript' OR cvterm.name = 'SRP_RNA_primary_transcript' OR cvterm.name = 'miRNA_primary_transcript' OR cvterm.name = 'tasiRNA_primary_transcript' OR cvterm.name = 'rRNA_small_subunit_primary_transcript' OR cvterm.name = 'rRNA_large_subunit_primary_transcript' OR cvterm.name = 'alanine_tRNA_primary_transcript' OR cvterm.name = 'arginine_tRNA_primary_transcript' OR cvterm.name = 'asparagine_tRNA_primary_transcript' OR cvterm.name = 'aspartic_acid_tRNA_primary_transcript' OR cvterm.name = 'cysteine_tRNA_primary_transcript' OR cvterm.name = 'glutamic_acid_tRNA_primary_transcript' OR cvterm.name = 'glutamine_tRNA_primary_transcript' OR cvterm.name = 'glycine_tRNA_primary_transcript' OR cvterm.name = 'histidine_tRNA_primary_transcript' OR cvterm.name = 'isoleucine_tRNA_primary_transcript' OR cvterm.name = 'leucine_tRNA_primary_transcript' OR cvterm.name = 'lysine_tRNA_primary_transcript' OR cvterm.name = 'methionine_tRNA_primary_transcript' OR cvterm.name = 'phenylalanine_tRNA_primary_transcript' OR cvterm.name = 'proline_tRNA_primary_transcript' OR cvterm.name = 'serine_tRNA_primary_transcript' OR cvterm.name = 'threonine_tRNA_primary_transcript' OR cvterm.name = 'tryptophan_tRNA_primary_transcript' OR cvterm.name = 'tyrosine_tRNA_primary_transcript' OR cvterm.name = 'valine_tRNA_primary_transcript' OR cvterm.name = 'pyrrolysine_tRNA_primary_transcript' OR cvterm.name = 'selenocysteine_tRNA_primary_transcript' OR cvterm.name = 'methylation_guide_snoRNA_primary_transcript' OR cvterm.name = 'rRNA_cleavage_snoRNA_primary_transcript' OR cvterm.name = 'C_D_box_snoRNA_primary_transcript' OR cvterm.name = 'H_ACA_box_snoRNA_primary_transcript' OR cvterm.name = 'U14_snoRNA_primary_transcript' OR cvterm.name = 'stRNA_primary_transcript' OR cvterm.name = 'dicistronic_primary_transcript' OR cvterm.name = 'mRNA' OR cvterm.name = 'ncRNA' OR cvterm.name = 'mRNA_with_frameshift' OR cvterm.name = 'monocistronic_mRNA' OR cvterm.name = 'polycistronic_mRNA' OR cvterm.name = 'exemplar_mRNA' OR cvterm.name = 'capped_mRNA' OR cvterm.name = 'polyadenylated_mRNA' OR cvterm.name = 'trans_spliced_mRNA' OR cvterm.name = 'edited_mRNA' OR cvterm.name = 'consensus_mRNA' OR cvterm.name = 'recoded_mRNA' OR cvterm.name = 'mRNA_with_minus_1_frameshift' OR cvterm.name = 'mRNA_with_plus_1_frameshift' OR cvterm.name = 'mRNA_with_plus_2_frameshift' OR cvterm.name = 'mRNA_with_minus_2_frameshift' OR cvterm.name = 'dicistronic_mRNA' OR cvterm.name = 'mRNA_recoded_by_translational_bypass' OR cvterm.name = 'mRNA_recoded_by_codon_redefinition' OR cvterm.name = 'scRNA' OR cvterm.name = 'rRNA' OR cvterm.name = 'tRNA' OR cvterm.name = 'snRNA' OR cvterm.name = 'snoRNA' OR cvterm.name = 'small_regulatory_ncRNA' OR cvterm.name = 'RNase_MRP_RNA' OR cvterm.name = 'RNase_P_RNA' OR cvterm.name = 'telomerase_RNA' OR cvterm.name = 'vault_RNA' OR cvterm.name = 'Y_RNA' OR cvterm.name = 'rasiRNA' OR cvterm.name = 'SRP_RNA' OR cvterm.name = 'guide_RNA' OR cvterm.name = 'antisense_RNA' OR cvterm.name = 'siRNA' OR cvterm.name = 'stRNA' OR cvterm.name = 'class_II_RNA' OR cvterm.name = 'class_I_RNA' OR cvterm.name = 'piRNA' OR cvterm.name = 'lincRNA' OR cvterm.name = 'tasiRNA' OR cvterm.name = 'rRNA_cleavage_RNA' OR cvterm.name = 'small_subunit_rRNA' OR cvterm.name = 'large_subunit_rRNA' OR cvterm.name = 'rRNA_18S' OR cvterm.name = 'rRNA_16S' OR cvterm.name = 'rRNA_5_8S' OR cvterm.name = 'rRNA_5S' OR cvterm.name = 'rRNA_28S' OR cvterm.name = 'rRNA_23S' OR cvterm.name = 'rRNA_25S' OR cvterm.name = 'rRNA_21S' OR cvterm.name = 'alanyl_tRNA' OR cvterm.name = 'asparaginyl_tRNA' OR cvterm.name = 'aspartyl_tRNA' OR cvterm.name = 'cysteinyl_tRNA' OR cvterm.name = 'glutaminyl_tRNA' OR cvterm.name = 'glutamyl_tRNA' OR cvterm.name = 'glycyl_tRNA' OR cvterm.name = 'histidyl_tRNA' OR cvterm.name = 'isoleucyl_tRNA' OR cvterm.name = 'leucyl_tRNA' OR cvterm.name = 'lysyl_tRNA' OR cvterm.name = 'methionyl_tRNA' OR cvterm.name = 'phenylalanyl_tRNA' OR cvterm.name = 'prolyl_tRNA' OR cvterm.name = 'seryl_tRNA' OR cvterm.name = 'threonyl_tRNA' OR cvterm.name = 'tryptophanyl_tRNA' OR cvterm.name = 'tyrosyl_tRNA' OR cvterm.name = 'valyl_tRNA' OR cvterm.name = 'pyrrolysyl_tRNA' OR cvterm.name = 'arginyl_tRNA' OR cvterm.name = 'selenocysteinyl_tRNA' OR cvterm.name = 'U1_snRNA' OR cvterm.name = 'U2_snRNA' OR cvterm.name = 'U4_snRNA' OR cvterm.name = 'U4atac_snRNA' OR cvterm.name = 'U5_snRNA' OR cvterm.name = 'U6_snRNA' OR cvterm.name = 'U6atac_snRNA' OR cvterm.name = 'U11_snRNA' OR cvterm.name = 'U12_snRNA' OR cvterm.name = 'C_D_box_snoRNA' OR cvterm.name = 'H_ACA_box_snoRNA' OR cvterm.name = 'U14_snoRNA' OR cvterm.name = 'U3_snoRNA' OR cvterm.name = 'methylation_guide_snoRNA' OR cvterm.name = 'pseudouridylation_guide_snoRNA' OR cvterm.name = 'miRNA' OR cvterm.name = 'RNA_6S' OR cvterm.name = 'CsrB_RsmB_RNA' OR cvterm.name = 'DsrA_RNA' OR cvterm.name = 'OxyS_RNA' OR cvterm.name = 'RprA_RNA' OR cvterm.name = 'RRE_RNA' OR cvterm.name = 'spot_42_RNA' OR cvterm.name = 'tmRNA' OR cvterm.name = 'GcvB_RNA' OR cvterm.name = 'MicF_RNA' OR cvterm.name = 'ribozyme' OR cvterm.name = 'trans_spliced_mRNA' OR cvterm.name = 'monocistronic_primary_transcript' OR cvterm.name = 'monocistronic_mRNA' OR cvterm.name = 'edited_transcript_by_A_to_I_substitution' OR cvterm.name = 'edited_mRNA' OR cvterm.name = 'transcription_regulatory_region' OR cvterm.name = 'translation_regulatory_region' OR cvterm.name = 'recombination_regulatory_region' OR cvterm.name = 'replication_regulatory_region' OR cvterm.name = 'terminator' OR cvterm.name = 'TF_binding_site' OR cvterm.name = 'polyA_signal_sequence' OR cvterm.name = 'gene_group_regulatory_region' OR cvterm.name = 'transcriptional_cis_regulatory_region' OR cvterm.name = 'splicing_regulatory_region' OR cvterm.name = 'cis_regulatory_frameshift_element' OR cvterm.name = 'intronic_regulatory_region' OR cvterm.name = 'bacterial_terminator' OR cvterm.name = 'eukaryotic_terminator' OR cvterm.name = 'rho_dependent_bacterial_terminator' OR cvterm.name = 'rho_independent_bacterial_terminator' OR cvterm.name = 'terminator_of_type_2_RNApol_III_promoter' OR cvterm.name = 'operator' OR cvterm.name = 'bacterial_RNApol_promoter' OR cvterm.name = 'bacterial_terminator' OR cvterm.name = 'bacterial_RNApol_promoter_sigma_70' OR cvterm.name = 'bacterial_RNApol_promoter_sigma54' OR cvterm.name = 'rho_dependent_bacterial_terminator' OR cvterm.name = 'rho_independent_bacterial_terminator' OR cvterm.name = 'promoter' OR cvterm.name = 'insulator' OR cvterm.name = 'CRM' OR cvterm.name = 'promoter_targeting_sequence' OR cvterm.name = 'ISRE' OR cvterm.name = 'bidirectional_promoter' OR cvterm.name = 'RNA_polymerase_promoter' OR cvterm.name = 'RNApol_I_promoter' OR cvterm.name = 'RNApol_II_promoter' OR cvterm.name = 'RNApol_III_promoter' OR cvterm.name = 'bacterial_RNApol_promoter' OR cvterm.name = 'Phage_RNA_Polymerase_Promoter' OR cvterm.name = 'RNApol_II_core_promoter' OR cvterm.name = 'RNApol_III_promoter_type_1' OR cvterm.name = 'RNApol_III_promoter_type_2' OR cvterm.name = 'RNApol_III_promoter_type_3' OR cvterm.name = 'bacterial_RNApol_promoter_sigma_70' OR cvterm.name = 'bacterial_RNApol_promoter_sigma54' OR cvterm.name = 'SP6_RNA_Polymerase_Promoter' OR cvterm.name = 'T3_RNA_Polymerase_Promoter' OR cvterm.name = 'T7_RNA_Polymerase_Promoter' OR cvterm.name = 'locus_control_region' OR cvterm.name = 'enhancer' OR cvterm.name = 'silencer' OR cvterm.name = 'enhancer_bound_by_factor' OR cvterm.name = 'shadow_enhancer' OR cvterm.name = 'splice_enhancer' OR cvterm.name = 'intronic_splice_enhancer' OR cvterm.name = 'exonic_splice_enhancer' OR cvterm.name = 'attenuator' OR cvterm.name = 'gene_member_region';

--- ************************************************
--- *** relation: transcript_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of a transcript.                ***
--- ************************************************
---

CREATE VIEW transcript_region AS
  SELECT
    feature_id AS transcript_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'exon' OR cvterm.name = 'edited_transcript_feature' OR cvterm.name = 'mature_transcript_region' OR cvterm.name = 'primary_transcript_region' OR cvterm.name = 'exon_region' OR cvterm.name = 'anchor_binding_site' OR cvterm.name = 'coding_exon' OR cvterm.name = 'noncoding_exon' OR cvterm.name = 'interior_exon' OR cvterm.name = 'exon_of_single_exon_gene' OR cvterm.name = 'interior_coding_exon' OR cvterm.name = 'five_prime_coding_exon' OR cvterm.name = 'three_prime_coding_exon' OR cvterm.name = 'three_prime_noncoding_exon' OR cvterm.name = 'five_prime_noncoding_exon' OR cvterm.name = 'pre_edited_region' OR cvterm.name = 'editing_block' OR cvterm.name = 'editing_domain' OR cvterm.name = 'unedited_region' OR cvterm.name = 'mRNA_region' OR cvterm.name = 'tmRNA_region' OR cvterm.name = 'guide_RNA_region' OR cvterm.name = 'tRNA_region' OR cvterm.name = 'riboswitch' OR cvterm.name = 'ribosome_entry_site' OR cvterm.name = 'UTR' OR cvterm.name = 'CDS' OR cvterm.name = 'five_prime_open_reading_frame' OR cvterm.name = 'UTR_region' OR cvterm.name = 'CDS_region' OR cvterm.name = 'translational_frameshift' OR cvterm.name = 'recoding_stimulatory_region' OR cvterm.name = 'internal_ribosome_entry_site' OR cvterm.name = 'Shine_Dalgarno_sequence' OR cvterm.name = 'kozak_sequence' OR cvterm.name = 'internal_Shine_Dalgarno_sequence' OR cvterm.name = 'five_prime_UTR' OR cvterm.name = 'three_prime_UTR' OR cvterm.name = 'internal_UTR' OR cvterm.name = 'untranslated_region_polycistronic_mRNA' OR cvterm.name = 'edited_CDS' OR cvterm.name = 'CDS_fragment' OR cvterm.name = 'CDS_independently_known' OR cvterm.name = 'CDS_predicted' OR cvterm.name = 'orphan_CDS' OR cvterm.name = 'CDS_supported_by_sequence_similarity_data' OR cvterm.name = 'CDS_supported_by_domain_match_data' OR cvterm.name = 'CDS_supported_by_EST_or_cDNA_data' OR cvterm.name = 'upstream_AUG_codon' OR cvterm.name = 'AU_rich_element' OR cvterm.name = 'Bruno_response_element' OR cvterm.name = 'iron_responsive_element' OR cvterm.name = 'coding_start' OR cvterm.name = 'coding_end' OR cvterm.name = 'codon' OR cvterm.name = 'recoded_codon' OR cvterm.name = 'start_codon' OR cvterm.name = 'stop_codon' OR cvterm.name = 'stop_codon_read_through' OR cvterm.name = 'stop_codon_redefined_as_pyrrolysine' OR cvterm.name = 'stop_codon_redefined_as_selenocysteine' OR cvterm.name = 'non_canonical_start_codon' OR cvterm.name = 'four_bp_start_codon' OR cvterm.name = 'CTG_start_codon' OR cvterm.name = 'plus_1_translational_frameshift' OR cvterm.name = 'plus_2_translational_frameshift' OR cvterm.name = 'internal_Shine_Dalgarno_sequence' OR cvterm.name = 'SECIS_element' OR cvterm.name = 'three_prime_recoding_site' OR cvterm.name = 'five_prime_recoding_site' OR cvterm.name = 'stop_codon_signal' OR cvterm.name = 'three_prime_stem_loop_structure' OR cvterm.name = 'flanking_three_prime_quadruplet_recoding_signal' OR cvterm.name = 'three_prime_repeat_recoding_signal' OR cvterm.name = 'distant_three_prime_recoding_signal' OR cvterm.name = 'UAG_stop_codon_signal' OR cvterm.name = 'UAA_stop_codon_signal' OR cvterm.name = 'UGA_stop_codon_signal' OR cvterm.name = 'tmRNA_coding_piece' OR cvterm.name = 'tmRNA_acceptor_piece' OR cvterm.name = 'anchor_region' OR cvterm.name = 'template_region' OR cvterm.name = 'anticodon_loop' OR cvterm.name = 'anticodon' OR cvterm.name = 'CCA_tail' OR cvterm.name = 'DHU_loop' OR cvterm.name = 'T_loop' OR cvterm.name = 'splice_site' OR cvterm.name = 'intron' OR cvterm.name = 'clip' OR cvterm.name = 'TSS' OR cvterm.name = 'transcription_end_site' OR cvterm.name = 'spliced_leader_RNA' OR cvterm.name = 'rRNA_primary_transcript_region' OR cvterm.name = 'spliceosomal_intron_region' OR cvterm.name = 'intron_domain' OR cvterm.name = 'miRNA_primary_transcript_region' OR cvterm.name = 'outron' OR cvterm.name = 'cis_splice_site' OR cvterm.name = 'trans_splice_site' OR cvterm.name = 'cryptic_splice_site' OR cvterm.name = 'five_prime_cis_splice_site' OR cvterm.name = 'three_prime_cis_splice_site' OR cvterm.name = 'recursive_splice_site' OR cvterm.name = 'canonical_five_prime_splice_site' OR cvterm.name = 'non_canonical_five_prime_splice_site' OR cvterm.name = 'canonical_three_prime_splice_site' OR cvterm.name = 'non_canonical_three_prime_splice_site' OR cvterm.name = 'trans_splice_acceptor_site' OR cvterm.name = 'trans_splice_donor_site' OR cvterm.name = 'SL1_acceptor_site' OR cvterm.name = 'SL2_acceptor_site' OR cvterm.name = 'SL3_acceptor_site' OR cvterm.name = 'SL4_acceptor_site' OR cvterm.name = 'SL5_acceptor_site' OR cvterm.name = 'SL6_acceptor_site' OR cvterm.name = 'SL7_acceptor_site' OR cvterm.name = 'SL8_acceptor_site' OR cvterm.name = 'SL9_acceptor_site' OR cvterm.name = 'SL10_accceptor_site' OR cvterm.name = 'SL11_acceptor_site' OR cvterm.name = 'SL12_acceptor_site' OR cvterm.name = 'five_prime_intron' OR cvterm.name = 'interior_intron' OR cvterm.name = 'three_prime_intron' OR cvterm.name = 'twintron' OR cvterm.name = 'UTR_intron' OR cvterm.name = 'autocatalytically_spliced_intron' OR cvterm.name = 'spliceosomal_intron' OR cvterm.name = 'mobile_intron' OR cvterm.name = 'endonuclease_spliced_intron' OR cvterm.name = 'five_prime_UTR_intron' OR cvterm.name = 'three_prime_UTR_intron' OR cvterm.name = 'group_I_intron' OR cvterm.name = 'group_II_intron' OR cvterm.name = 'group_III_intron' OR cvterm.name = 'group_IIA_intron' OR cvterm.name = 'group_IIB_intron' OR cvterm.name = 'U2_intron' OR cvterm.name = 'U12_intron' OR cvterm.name = 'archaeal_intron' OR cvterm.name = 'tRNA_intron' OR cvterm.name = 'five_prime_clip' OR cvterm.name = 'three_prime_clip' OR cvterm.name = 'major_TSS' OR cvterm.name = 'minor_TSS' OR cvterm.name = 'transcribed_spacer_region' OR cvterm.name = 'internal_transcribed_spacer_region' OR cvterm.name = 'external_transcribed_spacer_region' OR cvterm.name = 'intronic_splice_enhancer' OR cvterm.name = 'branch_site' OR cvterm.name = 'polypyrimidine_tract' OR cvterm.name = 'internal_guide_sequence' OR cvterm.name = 'mirtron' OR cvterm.name = 'pre_miRNA' OR cvterm.name = 'miRNA_stem' OR cvterm.name = 'miRNA_loop' OR cvterm.name = 'miRNA_antiguide' OR cvterm.name = 'noncoding_region_of_exon' OR cvterm.name = 'coding_region_of_exon' OR cvterm.name = 'three_prime_coding_exon_noncoding_region' OR cvterm.name = 'five_prime_coding_exon_noncoding_region' OR cvterm.name = 'five_prime_coding_exon_coding_region' OR cvterm.name = 'three_prime_coding_exon_coding_region' OR cvterm.name = 'transcript_region';

--- ************************************************
--- *** relation: mature_transcript_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of a mature transcript.         ***
--- ************************************************
---

CREATE VIEW mature_transcript_region AS
  SELECT
    feature_id AS mature_transcript_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mRNA_region' OR cvterm.name = 'tmRNA_region' OR cvterm.name = 'guide_RNA_region' OR cvterm.name = 'tRNA_region' OR cvterm.name = 'riboswitch' OR cvterm.name = 'ribosome_entry_site' OR cvterm.name = 'UTR' OR cvterm.name = 'CDS' OR cvterm.name = 'five_prime_open_reading_frame' OR cvterm.name = 'UTR_region' OR cvterm.name = 'CDS_region' OR cvterm.name = 'translational_frameshift' OR cvterm.name = 'recoding_stimulatory_region' OR cvterm.name = 'internal_ribosome_entry_site' OR cvterm.name = 'Shine_Dalgarno_sequence' OR cvterm.name = 'kozak_sequence' OR cvterm.name = 'internal_Shine_Dalgarno_sequence' OR cvterm.name = 'five_prime_UTR' OR cvterm.name = 'three_prime_UTR' OR cvterm.name = 'internal_UTR' OR cvterm.name = 'untranslated_region_polycistronic_mRNA' OR cvterm.name = 'edited_CDS' OR cvterm.name = 'CDS_fragment' OR cvterm.name = 'CDS_independently_known' OR cvterm.name = 'CDS_predicted' OR cvterm.name = 'orphan_CDS' OR cvterm.name = 'CDS_supported_by_sequence_similarity_data' OR cvterm.name = 'CDS_supported_by_domain_match_data' OR cvterm.name = 'CDS_supported_by_EST_or_cDNA_data' OR cvterm.name = 'upstream_AUG_codon' OR cvterm.name = 'AU_rich_element' OR cvterm.name = 'Bruno_response_element' OR cvterm.name = 'iron_responsive_element' OR cvterm.name = 'coding_start' OR cvterm.name = 'coding_end' OR cvterm.name = 'codon' OR cvterm.name = 'recoded_codon' OR cvterm.name = 'start_codon' OR cvterm.name = 'stop_codon' OR cvterm.name = 'stop_codon_read_through' OR cvterm.name = 'stop_codon_redefined_as_pyrrolysine' OR cvterm.name = 'stop_codon_redefined_as_selenocysteine' OR cvterm.name = 'non_canonical_start_codon' OR cvterm.name = 'four_bp_start_codon' OR cvterm.name = 'CTG_start_codon' OR cvterm.name = 'plus_1_translational_frameshift' OR cvterm.name = 'plus_2_translational_frameshift' OR cvterm.name = 'internal_Shine_Dalgarno_sequence' OR cvterm.name = 'SECIS_element' OR cvterm.name = 'three_prime_recoding_site' OR cvterm.name = 'five_prime_recoding_site' OR cvterm.name = 'stop_codon_signal' OR cvterm.name = 'three_prime_stem_loop_structure' OR cvterm.name = 'flanking_three_prime_quadruplet_recoding_signal' OR cvterm.name = 'three_prime_repeat_recoding_signal' OR cvterm.name = 'distant_three_prime_recoding_signal' OR cvterm.name = 'UAG_stop_codon_signal' OR cvterm.name = 'UAA_stop_codon_signal' OR cvterm.name = 'UGA_stop_codon_signal' OR cvterm.name = 'tmRNA_coding_piece' OR cvterm.name = 'tmRNA_acceptor_piece' OR cvterm.name = 'anchor_region' OR cvterm.name = 'template_region' OR cvterm.name = 'anticodon_loop' OR cvterm.name = 'anticodon' OR cvterm.name = 'CCA_tail' OR cvterm.name = 'DHU_loop' OR cvterm.name = 'T_loop' OR cvterm.name = 'mature_transcript_region';

--- ************************************************
--- *** relation: primary_transcript_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A part of a primary transcript.          ***
--- ************************************************
---

CREATE VIEW primary_transcript_region AS
  SELECT
    feature_id AS primary_transcript_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'splice_site' OR cvterm.name = 'intron' OR cvterm.name = 'clip' OR cvterm.name = 'TSS' OR cvterm.name = 'transcription_end_site' OR cvterm.name = 'spliced_leader_RNA' OR cvterm.name = 'rRNA_primary_transcript_region' OR cvterm.name = 'spliceosomal_intron_region' OR cvterm.name = 'intron_domain' OR cvterm.name = 'miRNA_primary_transcript_region' OR cvterm.name = 'outron' OR cvterm.name = 'cis_splice_site' OR cvterm.name = 'trans_splice_site' OR cvterm.name = 'cryptic_splice_site' OR cvterm.name = 'five_prime_cis_splice_site' OR cvterm.name = 'three_prime_cis_splice_site' OR cvterm.name = 'recursive_splice_site' OR cvterm.name = 'canonical_five_prime_splice_site' OR cvterm.name = 'non_canonical_five_prime_splice_site' OR cvterm.name = 'canonical_three_prime_splice_site' OR cvterm.name = 'non_canonical_three_prime_splice_site' OR cvterm.name = 'trans_splice_acceptor_site' OR cvterm.name = 'trans_splice_donor_site' OR cvterm.name = 'SL1_acceptor_site' OR cvterm.name = 'SL2_acceptor_site' OR cvterm.name = 'SL3_acceptor_site' OR cvterm.name = 'SL4_acceptor_site' OR cvterm.name = 'SL5_acceptor_site' OR cvterm.name = 'SL6_acceptor_site' OR cvterm.name = 'SL7_acceptor_site' OR cvterm.name = 'SL8_acceptor_site' OR cvterm.name = 'SL9_acceptor_site' OR cvterm.name = 'SL10_accceptor_site' OR cvterm.name = 'SL11_acceptor_site' OR cvterm.name = 'SL12_acceptor_site' OR cvterm.name = 'five_prime_intron' OR cvterm.name = 'interior_intron' OR cvterm.name = 'three_prime_intron' OR cvterm.name = 'twintron' OR cvterm.name = 'UTR_intron' OR cvterm.name = 'autocatalytically_spliced_intron' OR cvterm.name = 'spliceosomal_intron' OR cvterm.name = 'mobile_intron' OR cvterm.name = 'endonuclease_spliced_intron' OR cvterm.name = 'five_prime_UTR_intron' OR cvterm.name = 'three_prime_UTR_intron' OR cvterm.name = 'group_I_intron' OR cvterm.name = 'group_II_intron' OR cvterm.name = 'group_III_intron' OR cvterm.name = 'group_IIA_intron' OR cvterm.name = 'group_IIB_intron' OR cvterm.name = 'U2_intron' OR cvterm.name = 'U12_intron' OR cvterm.name = 'archaeal_intron' OR cvterm.name = 'tRNA_intron' OR cvterm.name = 'five_prime_clip' OR cvterm.name = 'three_prime_clip' OR cvterm.name = 'major_TSS' OR cvterm.name = 'minor_TSS' OR cvterm.name = 'transcribed_spacer_region' OR cvterm.name = 'internal_transcribed_spacer_region' OR cvterm.name = 'external_transcribed_spacer_region' OR cvterm.name = 'intronic_splice_enhancer' OR cvterm.name = 'branch_site' OR cvterm.name = 'polypyrimidine_tract' OR cvterm.name = 'internal_guide_sequence' OR cvterm.name = 'mirtron' OR cvterm.name = 'pre_miRNA' OR cvterm.name = 'miRNA_stem' OR cvterm.name = 'miRNA_loop' OR cvterm.name = 'miRNA_antiguide' OR cvterm.name = 'primary_transcript_region';

--- ************************************************
--- *** relation: mrna_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of an mRNA.                     ***
--- ************************************************
---

CREATE VIEW mrna_region AS
  SELECT
    feature_id AS mrna_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'riboswitch' OR cvterm.name = 'ribosome_entry_site' OR cvterm.name = 'UTR' OR cvterm.name = 'CDS' OR cvterm.name = 'five_prime_open_reading_frame' OR cvterm.name = 'UTR_region' OR cvterm.name = 'CDS_region' OR cvterm.name = 'translational_frameshift' OR cvterm.name = 'recoding_stimulatory_region' OR cvterm.name = 'internal_ribosome_entry_site' OR cvterm.name = 'Shine_Dalgarno_sequence' OR cvterm.name = 'kozak_sequence' OR cvterm.name = 'internal_Shine_Dalgarno_sequence' OR cvterm.name = 'five_prime_UTR' OR cvterm.name = 'three_prime_UTR' OR cvterm.name = 'internal_UTR' OR cvterm.name = 'untranslated_region_polycistronic_mRNA' OR cvterm.name = 'edited_CDS' OR cvterm.name = 'CDS_fragment' OR cvterm.name = 'CDS_independently_known' OR cvterm.name = 'CDS_predicted' OR cvterm.name = 'orphan_CDS' OR cvterm.name = 'CDS_supported_by_sequence_similarity_data' OR cvterm.name = 'CDS_supported_by_domain_match_data' OR cvterm.name = 'CDS_supported_by_EST_or_cDNA_data' OR cvterm.name = 'upstream_AUG_codon' OR cvterm.name = 'AU_rich_element' OR cvterm.name = 'Bruno_response_element' OR cvterm.name = 'iron_responsive_element' OR cvterm.name = 'coding_start' OR cvterm.name = 'coding_end' OR cvterm.name = 'codon' OR cvterm.name = 'recoded_codon' OR cvterm.name = 'start_codon' OR cvterm.name = 'stop_codon' OR cvterm.name = 'stop_codon_read_through' OR cvterm.name = 'stop_codon_redefined_as_pyrrolysine' OR cvterm.name = 'stop_codon_redefined_as_selenocysteine' OR cvterm.name = 'non_canonical_start_codon' OR cvterm.name = 'four_bp_start_codon' OR cvterm.name = 'CTG_start_codon' OR cvterm.name = 'plus_1_translational_frameshift' OR cvterm.name = 'plus_2_translational_frameshift' OR cvterm.name = 'internal_Shine_Dalgarno_sequence' OR cvterm.name = 'SECIS_element' OR cvterm.name = 'three_prime_recoding_site' OR cvterm.name = 'five_prime_recoding_site' OR cvterm.name = 'stop_codon_signal' OR cvterm.name = 'three_prime_stem_loop_structure' OR cvterm.name = 'flanking_three_prime_quadruplet_recoding_signal' OR cvterm.name = 'three_prime_repeat_recoding_signal' OR cvterm.name = 'distant_three_prime_recoding_signal' OR cvterm.name = 'UAG_stop_codon_signal' OR cvterm.name = 'UAA_stop_codon_signal' OR cvterm.name = 'UGA_stop_codon_signal' OR cvterm.name = 'mRNA_region';

--- ************************************************
--- *** relation: utr_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of UTR.                         ***
--- ************************************************
---

CREATE VIEW utr_region AS
  SELECT
    feature_id AS utr_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'upstream_AUG_codon' OR cvterm.name = 'AU_rich_element' OR cvterm.name = 'Bruno_response_element' OR cvterm.name = 'iron_responsive_element' OR cvterm.name = 'UTR_region';

--- ************************************************
--- *** relation: rrna_primary_transcript_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of an rRNA primary transcript.  ***
--- ************************************************
---

CREATE VIEW rrna_primary_transcript_region AS
  SELECT
    feature_id AS rrna_primary_transcript_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'transcribed_spacer_region' OR cvterm.name = 'internal_transcribed_spacer_region' OR cvterm.name = 'external_transcribed_spacer_region' OR cvterm.name = 'rRNA_primary_transcript_region';

--- ************************************************
--- *** relation: polypeptide_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Biological sequence region that can be a ***
--- *** ssigned to a specific subsequence of a p ***
--- *** olypeptide.                              ***
--- ************************************************
---

CREATE VIEW polypeptide_region AS
  SELECT
    feature_id AS polypeptide_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mature_protein_region' OR cvterm.name = 'immature_peptide_region' OR cvterm.name = 'compositionally_biased_region_of_peptide' OR cvterm.name = 'polypeptide_structural_region' OR cvterm.name = 'polypeptide_variation_site' OR cvterm.name = 'peptide_localization_signal' OR cvterm.name = 'cleaved_peptide_region' OR cvterm.name = 'hydrophobic_region_of_peptide' OR cvterm.name = 'polypeptide_conserved_region' OR cvterm.name = 'active_peptide' OR cvterm.name = 'polypeptide_domain' OR cvterm.name = 'membrane_structure' OR cvterm.name = 'extramembrane_polypeptide_region' OR cvterm.name = 'intramembrane_polypeptide_region' OR cvterm.name = 'polypeptide_secondary_structure' OR cvterm.name = 'polypeptide_structural_motif' OR cvterm.name = 'intrinsically_unstructured_polypeptide_region' OR cvterm.name = 'cytoplasmic_polypeptide_region' OR cvterm.name = 'non_cytoplasmic_polypeptide_region' OR cvterm.name = 'membrane_peptide_loop' OR cvterm.name = 'transmembrane_polypeptide_region' OR cvterm.name = 'asx_motif' OR cvterm.name = 'beta_bulge' OR cvterm.name = 'beta_bulge_loop' OR cvterm.name = 'beta_strand' OR cvterm.name = 'peptide_helix' OR cvterm.name = 'polypeptide_nest_motif' OR cvterm.name = 'schellmann_loop' OR cvterm.name = 'serine_threonine_motif' OR cvterm.name = 'serine_threonine_staple_motif' OR cvterm.name = 'polypeptide_turn_motif' OR cvterm.name = 'catmat_left_handed_three' OR cvterm.name = 'catmat_left_handed_four' OR cvterm.name = 'catmat_right_handed_three' OR cvterm.name = 'catmat_right_handed_four' OR cvterm.name = 'alpha_beta_motif' OR cvterm.name = 'peptide_coil' OR cvterm.name = 'beta_bulge_loop_five' OR cvterm.name = 'beta_bulge_loop_six' OR cvterm.name = 'antiparallel_beta_strand' OR cvterm.name = 'parallel_beta_strand' OR cvterm.name = 'left_handed_peptide_helix' OR cvterm.name = 'right_handed_peptide_helix' OR cvterm.name = 'alpha_helix' OR cvterm.name = 'pi_helix' OR cvterm.name = 'three_ten_helix' OR cvterm.name = 'polypeptide_nest_left_right_motif' OR cvterm.name = 'polypeptide_nest_right_left_motif' OR cvterm.name = 'schellmann_loop_seven' OR cvterm.name = 'schellmann_loop_six' OR cvterm.name = 'asx_turn' OR cvterm.name = 'beta_turn' OR cvterm.name = 'gamma_turn' OR cvterm.name = 'serine_threonine_turn' OR cvterm.name = 'asx_turn_left_handed_type_one' OR cvterm.name = 'asx_turn_left_handed_type_two' OR cvterm.name = 'asx_turn_right_handed_type_two' OR cvterm.name = 'asx_turn_right_handed_type_one' OR cvterm.name = 'beta_turn_left_handed_type_one' OR cvterm.name = 'beta_turn_left_handed_type_two' OR cvterm.name = 'beta_turn_right_handed_type_one' OR cvterm.name = 'beta_turn_right_handed_type_two' OR cvterm.name = 'beta_turn_type_six' OR cvterm.name = 'beta_turn_type_eight' OR cvterm.name = 'beta_turn_type_six_a' OR cvterm.name = 'beta_turn_type_six_b' OR cvterm.name = 'beta_turn_type_six_a_one' OR cvterm.name = 'beta_turn_type_six_a_two' OR cvterm.name = 'gamma_turn_classic' OR cvterm.name = 'gamma_turn_inverse' OR cvterm.name = 'st_turn_left_handed_type_one' OR cvterm.name = 'st_turn_left_handed_type_two' OR cvterm.name = 'st_turn_right_handed_type_one' OR cvterm.name = 'st_turn_right_handed_type_two' OR cvterm.name = 'coiled_coil' OR cvterm.name = 'helix_turn_helix' OR cvterm.name = 'natural_variant_site' OR cvterm.name = 'mutated_variant_site' OR cvterm.name = 'alternate_sequence_site' OR cvterm.name = 'signal_peptide' OR cvterm.name = 'transit_peptide' OR cvterm.name = 'nuclear_localization_signal' OR cvterm.name = 'endosomal_localization_signal' OR cvterm.name = 'lysosomal_localization_signal' OR cvterm.name = 'nuclear_export_signal' OR cvterm.name = 'nuclear_rim_localization_signal' OR cvterm.name = 'cleaved_initiator_methionine' OR cvterm.name = 'intein' OR cvterm.name = 'propeptide_cleavage_site' OR cvterm.name = 'propeptide' OR cvterm.name = 'cleaved_for_gpi_anchor_region' OR cvterm.name = 'lipoprotein_signal_peptide' OR cvterm.name = 'n_terminal_region' OR cvterm.name = 'c_terminal_region' OR cvterm.name = 'central_hydrophobic_region_of_signal_peptide' OR cvterm.name = 'polypeptide_domain' OR cvterm.name = 'polypeptide_motif' OR cvterm.name = 'polypeptide_repeat' OR cvterm.name = 'biochemical_region_of_peptide' OR cvterm.name = 'polypeptide_conserved_motif' OR cvterm.name = 'post_translationally_modified_region' OR cvterm.name = 'conformational_switch' OR cvterm.name = 'molecular_contact_region' OR cvterm.name = 'polypeptide_binding_motif' OR cvterm.name = 'polypeptide_catalytic_motif' OR cvterm.name = 'histone_modification' OR cvterm.name = 'histone_methylation_site' OR cvterm.name = 'histone_acetylation_site' OR cvterm.name = 'histone_ubiqitination_site' OR cvterm.name = 'histone_acylation_region' OR cvterm.name = 'H4K20_monomethylation_site' OR cvterm.name = 'H2BK5_monomethylation_site' OR cvterm.name = 'H3K27_methylation_site' OR cvterm.name = 'H3K36_methylation_site' OR cvterm.name = 'H3K4_methylation_site' OR cvterm.name = 'H3K79_methylation_site' OR cvterm.name = 'H3K9_methylation_site' OR cvterm.name = 'H3K27_monomethylation_site' OR cvterm.name = 'H3K27_trimethylation_site' OR cvterm.name = 'H3K27_dimethylation_site' OR cvterm.name = 'H3K36_monomethylation_site' OR cvterm.name = 'H3K36_dimethylation_site' OR cvterm.name = 'H3K36_trimethylation_site' OR cvterm.name = 'H3K4_monomethylation_site' OR cvterm.name = 'H3K4_trimethylation' OR cvterm.name = 'H3K4_dimethylation_site' OR cvterm.name = 'H3K79_monomethylation_site' OR cvterm.name = 'H3K79_dimethylation_site' OR cvterm.name = 'H3K79_trimethylation_site' OR cvterm.name = 'H3K9_trimethylation_site' OR cvterm.name = 'H3K9_monomethylation_site' OR cvterm.name = 'H3K9_dimethylation_site' OR cvterm.name = 'H3K9_acetylation_site' OR cvterm.name = 'H3K14_acetylation_site' OR cvterm.name = 'H3K18_acetylation_site' OR cvterm.name = 'H3K23_acylation site' OR cvterm.name = 'H3K27_acylation_site' OR cvterm.name = 'H4K16_acylation_site' OR cvterm.name = 'H4K5_acylation_site' OR cvterm.name = 'H4K8_acylation site' OR cvterm.name = 'H2B_ubiquitination_site' OR cvterm.name = 'H4K_acylation_region' OR cvterm.name = 'polypeptide_metal_contact' OR cvterm.name = 'protein_protein_contact' OR cvterm.name = 'polypeptide_ligand_contact' OR cvterm.name = 'polypeptide_DNA_contact' OR cvterm.name = 'polypeptide_calcium_ion_contact_site' OR cvterm.name = 'polypeptide_cobalt_ion_contact_site' OR cvterm.name = 'polypeptide_copper_ion_contact_site' OR cvterm.name = 'polypeptide_iron_ion_contact_site' OR cvterm.name = 'polypeptide_magnesium_ion_contact_site' OR cvterm.name = 'polypeptide_manganese_ion_contact_site' OR cvterm.name = 'polypeptide_molybdenum_ion_contact_site' OR cvterm.name = 'polypeptide_nickel_ion_contact_site' OR cvterm.name = 'polypeptide_tungsten_ion_contact_site' OR cvterm.name = 'polypeptide_zinc_ion_contact_site' OR cvterm.name = 'polypeptide_region';

--- ************************************************
--- *** relation: repeat_component ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of a repeated sequence.         ***
--- ************************************************
---

CREATE VIEW repeat_component AS
  SELECT
    feature_id AS repeat_component_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'non_LTR_retrotransposon_polymeric_tract' OR cvterm.name = 'LTR_component' OR cvterm.name = 'repeat_fragment' OR cvterm.name = 'transposon_fragment' OR cvterm.name = 'U5_LTR_region' OR cvterm.name = 'R_LTR_region' OR cvterm.name = 'U3_LTR_region' OR cvterm.name = 'three_prime_LTR_component' OR cvterm.name = 'five_prime_LTR_component' OR cvterm.name = 'U5_five_prime_LTR_region' OR cvterm.name = 'R_five_prime_LTR_region' OR cvterm.name = 'U3_five_prime_LTR_region' OR cvterm.name = 'R_three_prime_LTR_region' OR cvterm.name = 'U3_three_prime_LTR_region' OR cvterm.name = 'U5_three_prime_LTR_region' OR cvterm.name = 'R_five_prime_LTR_region' OR cvterm.name = 'U5_five_prime_LTR_region' OR cvterm.name = 'U3_five_prime_LTR_region' OR cvterm.name = 'repeat_component';

--- ************************************************
--- *** relation: spliceosomal_intron_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region within an intron.               ***
--- ************************************************
---

CREATE VIEW spliceosomal_intron_region AS
  SELECT
    feature_id AS spliceosomal_intron_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'intronic_splice_enhancer' OR cvterm.name = 'branch_site' OR cvterm.name = 'polypyrimidine_tract' OR cvterm.name = 'spliceosomal_intron_region';

--- ************************************************
--- *** relation: gene_component_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW gene_component_region AS
  SELECT
    feature_id AS gene_component_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'non_transcribed_region' OR cvterm.name = 'gene_fragment' OR cvterm.name = 'TSS_region' OR cvterm.name = 'gene_segment' OR cvterm.name = 'pseudogenic_gene_segment' OR cvterm.name = 'gene_component_region';

--- ************************************************
--- *** relation: tmrna_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of a tmRNA.                     ***
--- ************************************************
---

CREATE VIEW tmrna_region AS
  SELECT
    feature_id AS tmrna_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tmRNA_coding_piece' OR cvterm.name = 'tmRNA_acceptor_piece' OR cvterm.name = 'tmRNA_region';

--- ************************************************
--- *** relation: ltr_component ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW ltr_component AS
  SELECT
    feature_id AS ltr_component_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'U5_LTR_region' OR cvterm.name = 'R_LTR_region' OR cvterm.name = 'U3_LTR_region' OR cvterm.name = 'three_prime_LTR_component' OR cvterm.name = 'five_prime_LTR_component' OR cvterm.name = 'U5_five_prime_LTR_region' OR cvterm.name = 'R_five_prime_LTR_region' OR cvterm.name = 'U3_five_prime_LTR_region' OR cvterm.name = 'R_three_prime_LTR_region' OR cvterm.name = 'U3_three_prime_LTR_region' OR cvterm.name = 'U5_three_prime_LTR_region' OR cvterm.name = 'R_five_prime_LTR_region' OR cvterm.name = 'U5_five_prime_LTR_region' OR cvterm.name = 'U3_five_prime_LTR_region' OR cvterm.name = 'LTR_component';

--- ************************************************
--- *** relation: three_prime_ltr_component ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW three_prime_ltr_component AS
  SELECT
    feature_id AS three_prime_ltr_component_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'R_three_prime_LTR_region' OR cvterm.name = 'U3_three_prime_LTR_region' OR cvterm.name = 'U5_three_prime_LTR_region' OR cvterm.name = 'three_prime_LTR_component';

--- ************************************************
--- *** relation: five_prime_ltr_component ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW five_prime_ltr_component AS
  SELECT
    feature_id AS five_prime_ltr_component_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'R_five_prime_LTR_region' OR cvterm.name = 'U5_five_prime_LTR_region' OR cvterm.name = 'U3_five_prime_LTR_region' OR cvterm.name = 'five_prime_LTR_component';

--- ************************************************
--- *** relation: cds_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of a CDS.                       ***
--- ************************************************
---

CREATE VIEW cds_region AS
  SELECT
    feature_id AS cds_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'coding_start' OR cvterm.name = 'coding_end' OR cvterm.name = 'codon' OR cvterm.name = 'recoded_codon' OR cvterm.name = 'start_codon' OR cvterm.name = 'stop_codon' OR cvterm.name = 'stop_codon_read_through' OR cvterm.name = 'stop_codon_redefined_as_pyrrolysine' OR cvterm.name = 'stop_codon_redefined_as_selenocysteine' OR cvterm.name = 'non_canonical_start_codon' OR cvterm.name = 'four_bp_start_codon' OR cvterm.name = 'CTG_start_codon' OR cvterm.name = 'CDS_region';

--- ************************************************
--- *** relation: exon_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of an exon.                     ***
--- ************************************************
---

CREATE VIEW exon_region AS
  SELECT
    feature_id AS exon_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'noncoding_region_of_exon' OR cvterm.name = 'coding_region_of_exon' OR cvterm.name = 'three_prime_coding_exon_noncoding_region' OR cvterm.name = 'five_prime_coding_exon_noncoding_region' OR cvterm.name = 'five_prime_coding_exon_coding_region' OR cvterm.name = 'three_prime_coding_exon_coding_region' OR cvterm.name = 'exon_region';

--- ************************************************
--- *** relation: homologous_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region that is homologous to another r ***
--- *** egion.                                   ***
--- ************************************************
---

CREATE VIEW homologous_region AS
  SELECT
    feature_id AS homologous_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'paralogous_region' OR cvterm.name = 'orthologous_region' OR cvterm.name = 'homologous_region';

--- ************************************************
--- *** relation: paralogous_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A homologous_region that is paralogous t ***
--- *** o another region.                        ***
--- ************************************************
---

CREATE VIEW paralogous_region AS
  SELECT
    feature_id AS paralogous_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'paralogous_region';

--- ************************************************
--- *** relation: orthologous_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A homologous_region that is orthologous  ***
--- *** to another region.                       ***
--- ************************************************
---

CREATE VIEW orthologous_region AS
  SELECT
    feature_id AS orthologous_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'orthologous_region';

--- ************************************************
--- *** relation: conserved ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW conserved AS
  SELECT
    feature_id AS conserved_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'homologous' OR cvterm.name = 'syntenic' OR cvterm.name = 'orthologous' OR cvterm.name = 'paralogous' OR cvterm.name = 'conserved';

--- ************************************************
--- *** relation: homologous ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Similarity due to common ancestry.       ***
--- ************************************************
---

CREATE VIEW homologous AS
  SELECT
    feature_id AS homologous_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'orthologous' OR cvterm.name = 'paralogous' OR cvterm.name = 'homologous';

--- ************************************************
--- *** relation: orthologous ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a kind of homolo ***
--- *** gy where divergence occured after a spec ***
--- *** iation event.                            ***
--- ************************************************
---

CREATE VIEW orthologous AS
  SELECT
    feature_id AS orthologous_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'orthologous';

--- ************************************************
--- *** relation: paralogous ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a kind of homolo ***
--- *** gy where divergence occurred after a dup ***
--- *** lication event.                          ***
--- ************************************************
---

CREATE VIEW paralogous AS
  SELECT
    feature_id AS paralogous_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'paralogous';

--- ************************************************
--- *** relation: syntenic ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Attribute describing sequence regions oc ***
--- *** curring in same order on chromosome of d ***
--- *** ifferent species.                        ***
--- ************************************************
---

CREATE VIEW syntenic AS
  SELECT
    feature_id AS syntenic_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'syntenic';

--- ************************************************
--- *** relation: capped_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript that is capped.     ***
--- ************************************************
---

CREATE VIEW capped_primary_transcript AS
  SELECT
    feature_id AS capped_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'capped_primary_transcript';

--- ************************************************
--- *** relation: capped_mrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An mRNA that is capped.                  ***
--- ************************************************
---

CREATE VIEW capped_mrna AS
  SELECT
    feature_id AS capped_mrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'capped_mRNA';

--- ************************************************
--- *** relation: mrna_attribute ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing an mRNA feature. ***
--- ************************************************
---

CREATE VIEW mrna_attribute AS
  SELECT
    feature_id AS mrna_attribute_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polyadenylated' OR cvterm.name = 'exemplar' OR cvterm.name = 'frameshift' OR cvterm.name = 'recoded' OR cvterm.name = 'minus_1_frameshift' OR cvterm.name = 'minus_2_frameshift' OR cvterm.name = 'plus_1_frameshift' OR cvterm.name = 'plus_2_framshift' OR cvterm.name = 'codon_redefined' OR cvterm.name = 'recoded_by_translational_bypass' OR cvterm.name = 'translationally_frameshifted' OR cvterm.name = 'minus_1_translationally_frameshifted' OR cvterm.name = 'plus_1_translationally_frameshifted' OR cvterm.name = 'mRNA_attribute';

--- ************************************************
--- *** relation: exemplar ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a sequence is re ***
--- *** presentative of a class of similar seque ***
--- *** nces.                                    ***
--- ************************************************
---

CREATE VIEW exemplar AS
  SELECT
    feature_id AS exemplar_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'exemplar';

--- ************************************************
--- *** relation: frameshift ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a sequence that  ***
--- *** contains a mutation involving the deleti ***
--- *** on or insertion of one or more bases, wh ***
--- *** ere this number is not divisible by 3.   ***
--- ************************************************
---

CREATE VIEW frameshift AS
  SELECT
    feature_id AS frameshift_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'minus_1_frameshift' OR cvterm.name = 'minus_2_frameshift' OR cvterm.name = 'plus_1_frameshift' OR cvterm.name = 'plus_2_framshift' OR cvterm.name = 'frameshift';

--- ************************************************
--- *** relation: minus_1_frameshift ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A frameshift caused by deleting one base ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW minus_1_frameshift AS
  SELECT
    feature_id AS minus_1_frameshift_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'minus_1_frameshift';

--- ************************************************
--- *** relation: minus_2_frameshift ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A frameshift caused by deleting two base ***
--- *** s.                                       ***
--- ************************************************
---

CREATE VIEW minus_2_frameshift AS
  SELECT
    feature_id AS minus_2_frameshift_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'minus_2_frameshift';

--- ************************************************
--- *** relation: plus_1_frameshift ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A frameshift caused by inserting one bas ***
--- *** e.                                       ***
--- ************************************************
---

CREATE VIEW plus_1_frameshift AS
  SELECT
    feature_id AS plus_1_frameshift_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'plus_1_frameshift';

--- ************************************************
--- *** relation: plus_2_framshift ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A frameshift caused by inserting two bas ***
--- *** es.                                      ***
--- ************************************************
---

CREATE VIEW plus_2_framshift AS
  SELECT
    feature_id AS plus_2_framshift_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'plus_2_framshift';

--- ************************************************
--- *** relation: trans_spliced ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing transcript seque ***
--- *** nce that is created by splicing exons fr ***
--- *** om diferent genes.                       ***
--- ************************************************
---

CREATE VIEW trans_spliced AS
  SELECT
    feature_id AS trans_spliced_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'trans_spliced';

--- ************************************************
--- *** relation: polyadenylated_mrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An mRNA that is polyadenylated.          ***
--- ************************************************
---

CREATE VIEW polyadenylated_mrna AS
  SELECT
    feature_id AS polyadenylated_mrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polyadenylated_mRNA';

--- ************************************************
--- *** relation: trans_spliced_mrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An mRNA that is trans-spliced.           ***
--- ************************************************
---

CREATE VIEW trans_spliced_mrna AS
  SELECT
    feature_id AS trans_spliced_mrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'trans_spliced_mRNA';

--- ************************************************
--- *** relation: edited_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transcript that is edited.             ***
--- ************************************************
---

CREATE VIEW edited_transcript AS
  SELECT
    feature_id AS edited_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'edited_transcript_by_A_to_I_substitution' OR cvterm.name = 'edited_mRNA' OR cvterm.name = 'edited_transcript';

--- ************************************************
--- *** relation: edited_transcript_by_a_to_i_substitution ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transcript that has been edited by A t ***
--- *** o I substitution.                        ***
--- ************************************************
---

CREATE VIEW edited_transcript_by_a_to_i_substitution AS
  SELECT
    feature_id AS edited_transcript_by_a_to_i_substitution_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'edited_transcript_by_A_to_I_substitution';

--- ************************************************
--- *** relation: bound_by_protein ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a sequence that  ***
--- *** is bound by a protein.                   ***
--- ************************************************
---

CREATE VIEW bound_by_protein AS
  SELECT
    feature_id AS bound_by_protein_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'bound_by_protein';

--- ************************************************
--- *** relation: bound_by_nucleic_acid ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a sequence that  ***
--- *** is bound by a nucleic acid.              ***
--- ************************************************
---

CREATE VIEW bound_by_nucleic_acid AS
  SELECT
    feature_id AS bound_by_nucleic_acid_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'bound_by_nucleic_acid';

--- ************************************************
--- *** relation: alternatively_spliced ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a situation wher ***
--- *** e a gene may encode for more than 1 tran ***
--- *** script.                                  ***
--- ************************************************
---

CREATE VIEW alternatively_spliced AS
  SELECT
    feature_id AS alternatively_spliced_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'alternatively_spliced';

--- ************************************************
--- *** relation: monocistronic ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a sequence that  ***
--- *** contains the code for one gene product.  ***
--- ************************************************
---

CREATE VIEW monocistronic AS
  SELECT
    feature_id AS monocistronic_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'monocistronic';

--- ************************************************
--- *** relation: dicistronic ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a sequence that  ***
--- *** contains the code for two gene products. ***
--- ************************************************
---

CREATE VIEW dicistronic AS
  SELECT
    feature_id AS dicistronic_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'dicistronic';

--- ************************************************
--- *** relation: polycistronic ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a sequence that  ***
--- *** contains the code for more than one gene ***
--- ***  product.                                ***
--- ************************************************
---

CREATE VIEW polycistronic AS
  SELECT
    feature_id AS polycistronic_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'dicistronic' OR cvterm.name = 'polycistronic';

--- ************************************************
--- *** relation: recoded ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing an mRNA sequence ***
--- ***  that has been reprogrammed at translati ***
--- *** on, causing localized alterations.       ***
--- ************************************************
---

CREATE VIEW recoded AS
  SELECT
    feature_id AS recoded_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'codon_redefined' OR cvterm.name = 'recoded_by_translational_bypass' OR cvterm.name = 'translationally_frameshifted' OR cvterm.name = 'minus_1_translationally_frameshifted' OR cvterm.name = 'plus_1_translationally_frameshifted' OR cvterm.name = 'recoded';

--- ************************************************
--- *** relation: codon_redefined ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing the alteration o ***
--- *** f codon meaning.                         ***
--- ************************************************
---

CREATE VIEW codon_redefined AS
  SELECT
    feature_id AS codon_redefined_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'codon_redefined';

--- ************************************************
--- *** relation: stop_codon_read_through ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A stop codon redefined to be a new amino ***
--- ***  acid.                                   ***
--- ************************************************
---

CREATE VIEW stop_codon_read_through AS
  SELECT
    feature_id AS stop_codon_read_through_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'stop_codon_redefined_as_pyrrolysine' OR cvterm.name = 'stop_codon_redefined_as_selenocysteine' OR cvterm.name = 'stop_codon_read_through';

--- ************************************************
--- *** relation: stop_codon_redefined_as_pyrrolysine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A stop codon redefined to be the new ami ***
--- *** no acid, pyrrolysine.                    ***
--- ************************************************
---

CREATE VIEW stop_codon_redefined_as_pyrrolysine AS
  SELECT
    feature_id AS stop_codon_redefined_as_pyrrolysine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'stop_codon_redefined_as_pyrrolysine';

--- ************************************************
--- *** relation: stop_codon_redefined_as_selenocysteine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A stop codon redefined to be the new ami ***
--- *** no acid, selenocysteine.                 ***
--- ************************************************
---

CREATE VIEW stop_codon_redefined_as_selenocysteine AS
  SELECT
    feature_id AS stop_codon_redefined_as_selenocysteine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'stop_codon_redefined_as_selenocysteine';

--- ************************************************
--- *** relation: recoded_by_translational_bypass ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Recoded mRNA where a block of nucleotide ***
--- *** s is not translated.                     ***
--- ************************************************
---

CREATE VIEW recoded_by_translational_bypass AS
  SELECT
    feature_id AS recoded_by_translational_bypass_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'recoded_by_translational_bypass';

--- ************************************************
--- *** relation: translationally_frameshifted ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Recoding by frameshifting a particular s ***
--- *** ite.                                     ***
--- ************************************************
---

CREATE VIEW translationally_frameshifted AS
  SELECT
    feature_id AS translationally_frameshifted_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'minus_1_translationally_frameshifted' OR cvterm.name = 'plus_1_translationally_frameshifted' OR cvterm.name = 'translationally_frameshifted';

--- ************************************************
--- *** relation: maternally_imprinted_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is maternally_imprinted.     ***
--- ************************************************
---

CREATE VIEW maternally_imprinted_gene AS
  SELECT
    feature_id AS maternally_imprinted_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'maternally_imprinted_gene';

--- ************************************************
--- *** relation: paternally_imprinted_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is paternally imprinted.     ***
--- ************************************************
---

CREATE VIEW paternally_imprinted_gene AS
  SELECT
    feature_id AS paternally_imprinted_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'paternally_imprinted_gene';

--- ************************************************
--- *** relation: post_translationally_regulated_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is post translationally regu ***
--- *** lated.                                   ***
--- ************************************************
---

CREATE VIEW post_translationally_regulated_gene AS
  SELECT
    feature_id AS post_translationally_regulated_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'post_translationally_regulated_gene';

--- ************************************************
--- *** relation: negatively_autoregulated_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is negatively autoreguated.  ***
--- ************************************************
---

CREATE VIEW negatively_autoregulated_gene AS
  SELECT
    feature_id AS negatively_autoregulated_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'negatively_autoregulated_gene';

--- ************************************************
--- *** relation: positively_autoregulated_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is positively autoregulated. ***
--- ************************************************
---

CREATE VIEW positively_autoregulated_gene AS
  SELECT
    feature_id AS positively_autoregulated_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'positively_autoregulated_gene';

--- ************************************************
--- *** relation: silenced ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing an epigenetic pr ***
--- *** ocess where a gene is inactivated at tra ***
--- *** nscriptional or translational level.     ***
--- ************************************************
---

CREATE VIEW silenced AS
  SELECT
    feature_id AS silenced_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'silenced_by_DNA_modification' OR cvterm.name = 'silenced_by_RNA_interference' OR cvterm.name = 'silenced_by_histone_modification' OR cvterm.name = 'silenced_by_DNA_methylation' OR cvterm.name = 'silenced_by_histone_methylation' OR cvterm.name = 'silenced_by_histone_deacetylation' OR cvterm.name = 'silenced';

--- ************************************************
--- *** relation: silenced_by_dna_modification ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing an epigenetic pr ***
--- *** ocess where a gene is inactivated by DNA ***
--- ***  modifications, resulting in repression  ***
--- *** of transcription.                        ***
--- ************************************************
---

CREATE VIEW silenced_by_dna_modification AS
  SELECT
    feature_id AS silenced_by_dna_modification_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'silenced_by_DNA_methylation' OR cvterm.name = 'silenced_by_DNA_modification';

--- ************************************************
--- *** relation: silenced_by_dna_methylation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing an epigenetic pr ***
--- *** ocess where a gene is inactivated by DNA ***
--- ***  methylation, resulting in repression of ***
--- ***  transcription.                          ***
--- ************************************************
---

CREATE VIEW silenced_by_dna_methylation AS
  SELECT
    feature_id AS silenced_by_dna_methylation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'silenced_by_DNA_methylation';

--- ************************************************
--- *** relation: translationally_regulated_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is translationally regulated ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW translationally_regulated_gene AS
  SELECT
    feature_id AS translationally_regulated_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'translationally_regulated_gene';

--- ************************************************
--- *** relation: allelically_excluded_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is allelically_excluded.     ***
--- ************************************************
---

CREATE VIEW allelically_excluded_gene AS
  SELECT
    feature_id AS allelically_excluded_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'allelically_excluded_gene';

--- ************************************************
--- *** relation: epigenetically_modified_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is epigenetically modified.  ***
--- ************************************************
---

CREATE VIEW epigenetically_modified_gene AS
  SELECT
    feature_id AS epigenetically_modified_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_rearranged_at_DNA_level' OR cvterm.name = 'maternally_imprinted_gene' OR cvterm.name = 'paternally_imprinted_gene' OR cvterm.name = 'allelically_excluded_gene' OR cvterm.name = 'epigenetically_modified_gene';

--- ************************************************
--- *** relation: transgene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transgene is a gene that has been tran ***
--- *** sferred naturally or by any of a number  ***
--- *** of genetic engineering techniques from o ***
--- *** ne organism to another.                  ***
--- ************************************************
---

CREATE VIEW transgene AS
  SELECT
    feature_id AS transgene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'floxed_gene' OR cvterm.name = 'transgene';

--- ************************************************
--- *** relation: endogenous_retroviral_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW endogenous_retroviral_sequence AS
  SELECT
    feature_id AS endogenous_retroviral_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'endogenous_retroviral_sequence';

--- ************************************************
--- *** relation: rearranged_at_dna_level ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute to describe the sequence of ***
--- ***  a feature, where the DNA is rearranged. ***
--- ************************************************
---

CREATE VIEW rearranged_at_dna_level AS
  SELECT
    feature_id AS rearranged_at_dna_level_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rearranged_at_DNA_level';

--- ************************************************
--- *** relation: status ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing the status of a  ***
--- *** feature, based on the available evidence ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW status AS
  SELECT
    feature_id AS status_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'fragmentary' OR cvterm.name = 'predicted' OR cvterm.name = 'validated' OR cvterm.name = 'invalidated' OR cvterm.name = 'independently_known' OR cvterm.name = 'consensus' OR cvterm.name = 'low_complexity' OR cvterm.name = 'whole_genome_sequence_status' OR cvterm.name = 'supported_by_sequence_similarity' OR cvterm.name = 'orphan' OR cvterm.name = 'predicted_by_ab_initio_computation' OR cvterm.name = 'supported_by_domain_match' OR cvterm.name = 'supported_by_EST_or_cDNA' OR cvterm.name = 'experimentally_determined' OR cvterm.name = 'invalidated_by_chimeric_cDNA' OR cvterm.name = 'invalidated_by_genomic_contamination' OR cvterm.name = 'invalidated_by_genomic_polyA_primed_cDNA' OR cvterm.name = 'invalidated_by_partial_processing' OR cvterm.name = 'standard_draft' OR cvterm.name = 'high_quality_draft' OR cvterm.name = 'improved_high_quality_draft' OR cvterm.name = 'annotation_directed_improved_draft' OR cvterm.name = 'noncontiguous_finished' OR cvterm.name = 'finished_genome' OR cvterm.name = 'status';

--- ************************************************
--- *** relation: independently_known ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Attribute to describe a feature that is  ***
--- *** independently known - not predicted.     ***
--- ************************************************
---

CREATE VIEW independently_known AS
  SELECT
    feature_id AS independently_known_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'independently_known';

--- ************************************************
--- *** relation: supported_by_sequence_similarity ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute to describe a feature that  ***
--- *** has been predicted using sequence simila ***
--- *** rity techniques.                         ***
--- ************************************************
---

CREATE VIEW supported_by_sequence_similarity AS
  SELECT
    feature_id AS supported_by_sequence_similarity_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'supported_by_domain_match' OR cvterm.name = 'supported_by_EST_or_cDNA' OR cvterm.name = 'supported_by_sequence_similarity';

--- ************************************************
--- *** relation: supported_by_domain_match ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute to describe a feature that  ***
--- *** has been predicted using sequence simila ***
--- *** rity of a known domain.                  ***
--- ************************************************
---

CREATE VIEW supported_by_domain_match AS
  SELECT
    feature_id AS supported_by_domain_match_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'supported_by_domain_match';

--- ************************************************
--- *** relation: supported_by_est_or_cdna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute to describe a feature that  ***
--- *** has been predicted using sequence simila ***
--- *** rity to EST or cDNA data.                ***
--- ************************************************
---

CREATE VIEW supported_by_est_or_cdna AS
  SELECT
    feature_id AS supported_by_est_or_cdna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'supported_by_EST_or_cDNA';

--- ************************************************
--- *** relation: orphan ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW orphan AS
  SELECT
    feature_id AS orphan_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'orphan';

--- ************************************************
--- *** relation: predicted_by_ab_initio_computation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a feature that i ***
--- *** s predicted by a computer program that d ***
--- *** id not rely on sequence similarity.      ***
--- ************************************************
---

CREATE VIEW predicted_by_ab_initio_computation AS
  SELECT
    feature_id AS predicted_by_ab_initio_computation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'predicted_by_ab_initio_computation';

--- ************************************************
--- *** relation: asx_turn ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A motif of three consecutive residues an ***
--- *** d one H-bond in which: residue(i) is Asp ***
--- *** artate or Asparagine (Asx), the side-cha ***
--- *** in O of residue(i) is H-bonded to the ma ***
--- *** in-chain NH of residue(i+2).             ***
--- ************************************************
---

CREATE VIEW asx_turn AS
  SELECT
    feature_id AS asx_turn_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'asx_turn_left_handed_type_one' OR cvterm.name = 'asx_turn_left_handed_type_two' OR cvterm.name = 'asx_turn_right_handed_type_two' OR cvterm.name = 'asx_turn_right_handed_type_one' OR cvterm.name = 'asx_turn';

--- ************************************************
--- *** relation: cloned_cdna_insert ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A clone insert made from cDNA.           ***
--- ************************************************
---

CREATE VIEW cloned_cdna_insert AS
  SELECT
    feature_id AS cloned_cdna_insert_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cloned_cDNA_insert';

--- ************************************************
--- *** relation: cloned_genomic_insert ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A clone insert made from genomic DNA.    ***
--- ************************************************
---

CREATE VIEW cloned_genomic_insert AS
  SELECT
    feature_id AS cloned_genomic_insert_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'BAC_cloned_genomic_insert' OR cvterm.name = 'cloned_genomic_insert';

--- ************************************************
--- *** relation: engineered_insert ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A clone insert that is engineered.       ***
--- ************************************************
---

CREATE VIEW engineered_insert AS
  SELECT
    feature_id AS engineered_insert_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'engineered_insert';

--- ************************************************
--- *** relation: edited_mrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An mRNA that is edited.                  ***
--- ************************************************
---

CREATE VIEW edited_mrna AS
  SELECT
    feature_id AS edited_mrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'edited_mRNA';

--- ************************************************
--- *** relation: guide_rna_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of guide RNA.                   ***
--- ************************************************
---

CREATE VIEW guide_rna_region AS
  SELECT
    feature_id AS guide_rna_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'anchor_region' OR cvterm.name = 'template_region' OR cvterm.name = 'guide_RNA_region';

--- ************************************************
--- *** relation: anchor_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of a guide_RNA that base-pairs  ***
--- *** to a target mRNA.                        ***
--- ************************************************
---

CREATE VIEW anchor_region AS
  SELECT
    feature_id AS anchor_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'anchor_region';

--- ************************************************
--- *** relation: pre_edited_mrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW pre_edited_mrna AS
  SELECT
    feature_id AS pre_edited_mrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pre_edited_mRNA';

--- ************************************************
--- *** relation: intermediate ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute to describe a feature betwe ***
--- *** en stages of processing.                 ***
--- ************************************************
---

CREATE VIEW intermediate AS
  SELECT
    feature_id AS intermediate_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'intermediate';

--- ************************************************
--- *** relation: mirna_target_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A miRNA target site is a binding site wh ***
--- *** ere the molecule is a micro RNA.         ***
--- ************************************************
---

CREATE VIEW mirna_target_site AS
  SELECT
    feature_id AS mirna_target_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'miRNA_target_site';

--- ************************************************
--- *** relation: edited_cds ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A CDS that is edited.                    ***
--- ************************************************
---

CREATE VIEW edited_cds AS
  SELECT
    feature_id AS edited_cds_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'edited_CDS';

--- ************************************************
--- *** relation: vertebrate_immunoglobulin_t_cell_receptor_rearranged_segment ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW vertebrate_immunoglobulin_t_cell_receptor_rearranged_segment AS
  SELECT
    feature_id AS vertebrate_immunoglobulin_t_cell_receptor_rearranged_segment_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'VD_gene' OR cvterm.name = 'DJ_gene' OR cvterm.name = 'VDJ_gene' OR cvterm.name = 'VJ_gene' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_rearranged_segment';

--- ************************************************
--- *** relation: vertebrate_ig_t_cell_receptor_rearranged_gene_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW vertebrate_ig_t_cell_receptor_rearranged_gene_cluster AS
  SELECT
    feature_id AS vertebrate_ig_t_cell_receptor_rearranged_gene_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DJ_J_cluster' OR cvterm.name = 'VDJ_J_C_cluster' OR cvterm.name = 'VDJ_J_cluster' OR cvterm.name = 'VJ_C_cluster' OR cvterm.name = 'VJ_J_C_cluster' OR cvterm.name = 'VJ_J_cluster' OR cvterm.name = 'D_DJ_C_cluster' OR cvterm.name = 'D_DJ_cluster' OR cvterm.name = 'D_DJ_J_C_cluster' OR cvterm.name = 'D_DJ_J_cluster' OR cvterm.name = 'V_DJ_cluster' OR cvterm.name = 'V_DJ_J_cluster' OR cvterm.name = 'V_VDJ_C_cluster' OR cvterm.name = 'V_VDJ_cluster' OR cvterm.name = 'V_VDJ_J_cluster' OR cvterm.name = 'V_VJ_C_cluster' OR cvterm.name = 'V_VJ_cluster' OR cvterm.name = 'V_VJ_J_cluster' OR cvterm.name = 'V_D_DJ_C_cluster' OR cvterm.name = 'V_D_DJ_cluster' OR cvterm.name = 'V_D_DJ_J_C_cluster' OR cvterm.name = 'V_D_DJ_J_cluster' OR cvterm.name = 'V_D_J_C_cluster' OR cvterm.name = 'V_D_J_cluster' OR cvterm.name = 'DJ_C_cluster' OR cvterm.name = 'DJ_J_C_cluster' OR cvterm.name = 'VDJ_C_cluster' OR cvterm.name = 'V_DJ_C_cluster' OR cvterm.name = 'V_DJ_J_C_cluster' OR cvterm.name = 'V_VDJ_J_C_cluster' OR cvterm.name = 'V_VJ_J_C_cluster' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster';

--- ************************************************
--- *** relation: vertebrate_immune_system_gene_recombination_signal_feature ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW vertebrate_immune_system_gene_recombination_signal_feature AS
  SELECT
    feature_id AS vertebrate_immune_system_gene_recombination_signal_feature_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'J_gene_recombination_feature' OR cvterm.name = 'D_gene_recombination_feature' OR cvterm.name = 'V_gene_recombination_feature' OR cvterm.name = 'heptamer_of_recombination_feature_of_vertebrate_immune_system_gene' OR cvterm.name = 'nonamer_of_recombination_feature_of_vertebrate_immune_system_gene' OR cvterm.name = 'five_prime_D_recombination_signal_sequence' OR cvterm.name = 'three_prime_D_recombination_signal_sequence' OR cvterm.name = 'three_prime_D_heptamer' OR cvterm.name = 'five_prime_D_heptamer' OR cvterm.name = 'J_heptamer' OR cvterm.name = 'V_heptamer' OR cvterm.name = 'three_prime_D_nonamer' OR cvterm.name = 'five_prime_D_nonamer' OR cvterm.name = 'J_nonamer' OR cvterm.name = 'V_nonamer' OR cvterm.name = 'vertebrate_immune_system_gene_recombination_signal_feature';

--- ************************************************
--- *** relation: recombinationally_rearranged ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW recombinationally_rearranged AS
  SELECT
    feature_id AS recombinationally_rearranged_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'recombinationally_rearranged';

--- ************************************************
--- *** relation: recombinationally_rearranged_vertebrate_immune_system_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A recombinationally rearranged gene of t ***
--- *** he vertebrate immune system.             ***
--- ************************************************
---

CREATE VIEW recombinationally_rearranged_vertebrate_immune_system_gene AS
  SELECT
    feature_id AS recombinationally_rearranged_vertebrate_immune_system_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'recombinationally_rearranged_vertebrate_immune_system_gene';

--- ************************************************
--- *** relation: attp_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An integration/excision site of a phage  ***
--- *** chromosome at which a recombinase acts t ***
--- *** o insert the phage DNA at a cognate inte ***
--- *** gration/excision site on a bacterial chr ***
--- *** omosome.                                 ***
--- ************************************************
---

CREATE VIEW attp_site AS
  SELECT
    feature_id AS attp_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'attP_site';

--- ************************************************
--- *** relation: attb_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An integration/excision site of a bacter ***
--- *** ial chromosome at which a recombinase ac ***
--- *** ts to insert foreign DNA containing a co ***
--- *** gnate integration/excision site.         ***
--- ************************************************
---

CREATE VIEW attb_site AS
  SELECT
    feature_id AS attb_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'attB_site';

--- ************************************************
--- *** relation: attl_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region that results from recombination ***
--- ***  between attP_site and attB_site, compos ***
--- *** ed of the 5' portion of attB_site and th ***
--- *** e 3' portion of attP_site.               ***
--- ************************************************
---

CREATE VIEW attl_site AS
  SELECT
    feature_id AS attl_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'attL_site';

--- ************************************************
--- *** relation: attr_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region that results from recombination ***
--- ***  between attP_site and attB_site, compos ***
--- *** ed of the 5' portion of attP_site and th ***
--- *** e 3' portion of attB_site.               ***
--- ************************************************
---

CREATE VIEW attr_site AS
  SELECT
    feature_id AS attr_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'attR_site';

--- ************************************************
--- *** relation: integration_excision_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region specifically recognised by a re ***
--- *** combinase, which inserts or removes anot ***
--- *** her region marked by a distinct cognate  ***
--- *** integration/excision site.               ***
--- ************************************************
---

CREATE VIEW integration_excision_site AS
  SELECT
    feature_id AS integration_excision_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'attI_site' OR cvterm.name = 'attP_site' OR cvterm.name = 'attB_site' OR cvterm.name = 'attL_site' OR cvterm.name = 'attR_site' OR cvterm.name = 'attC_site' OR cvterm.name = 'attCtn_site' OR cvterm.name = 'integration_excision_site';

--- ************************************************
--- *** relation: resolution_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region specifically recognised by a re ***
--- *** combinase, which separates a physically  ***
--- *** contiguous circle of DNA into two physic ***
--- *** ally separate circles.                   ***
--- ************************************************
---

CREATE VIEW resolution_site AS
  SELECT
    feature_id AS resolution_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'loxP_site' OR cvterm.name = 'dif_site' OR cvterm.name = 'resolution_site';

--- ************************************************
--- *** relation: inversion_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region specifically recognised by a re ***
--- *** combinase, which inverts the region flan ***
--- *** ked by a pair of sites.                  ***
--- ************************************************
---

CREATE VIEW inversion_site AS
  SELECT
    feature_id AS inversion_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'FRT_site' OR cvterm.name = 'inversion_site';

--- ************************************************
--- *** relation: dif_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A site at which replicated bacterial cir ***
--- *** cular chromosomes are decatenated by sit ***
--- *** e specific resolvase.                    ***
--- ************************************************
---

CREATE VIEW dif_site AS
  SELECT
    feature_id AS dif_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'dif_site';

--- ************************************************
--- *** relation: attc_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attC site is a sequence required for  ***
--- *** the integration of a DNA of an integron. ***
--- ************************************************
---

CREATE VIEW attc_site AS
  SELECT
    feature_id AS attc_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'attC_site';

--- ************************************************
--- *** relation: eukaryotic_terminator ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW eukaryotic_terminator AS
  SELECT
    feature_id AS eukaryotic_terminator_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'terminator_of_type_2_RNApol_III_promoter' OR cvterm.name = 'eukaryotic_terminator';

--- ************************************************
--- *** relation: oriv ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An origin of vegetative replication in p ***
--- *** lasmids and phages.                      ***
--- ************************************************
---

CREATE VIEW oriv AS
  SELECT
    feature_id AS oriv_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'oriV';

--- ************************************************
--- *** relation: oric ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An origin of bacterial chromosome replic ***
--- *** ation.                                   ***
--- ************************************************
---

CREATE VIEW oric AS
  SELECT
    feature_id AS oric_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'oriC';

--- ************************************************
--- *** relation: dna_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Structural unit composed of a self-repli ***
--- *** cating, DNA molecule.                    ***
--- ************************************************
---

CREATE VIEW dna_chromosome AS
  SELECT
    feature_id AS dna_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'double_stranded_DNA_chromosome' OR cvterm.name = 'single_stranded_DNA_chromosome' OR cvterm.name = 'linear_double_stranded_DNA_chromosome' OR cvterm.name = 'circular_double_stranded_DNA_chromosome' OR cvterm.name = 'linear_single_stranded_DNA_chromosome' OR cvterm.name = 'circular_single_stranded_DNA_chromosome' OR cvterm.name = 'DNA_chromosome';

--- ************************************************
--- *** relation: double_stranded_dna_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Structural unit composed of a self-repli ***
--- *** cating, double-stranded DNA molecule.    ***
--- ************************************************
---

CREATE VIEW double_stranded_dna_chromosome AS
  SELECT
    feature_id AS double_stranded_dna_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'linear_double_stranded_DNA_chromosome' OR cvterm.name = 'circular_double_stranded_DNA_chromosome' OR cvterm.name = 'double_stranded_DNA_chromosome';

--- ************************************************
--- *** relation: single_stranded_dna_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Structural unit composed of a self-repli ***
--- *** cating, single-stranded DNA molecule.    ***
--- ************************************************
---

CREATE VIEW single_stranded_dna_chromosome AS
  SELECT
    feature_id AS single_stranded_dna_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'linear_single_stranded_DNA_chromosome' OR cvterm.name = 'circular_single_stranded_DNA_chromosome' OR cvterm.name = 'single_stranded_DNA_chromosome';

--- ************************************************
--- *** relation: linear_double_stranded_dna_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Structural unit composed of a self-repli ***
--- *** cating, double-stranded, linear DNA mole ***
--- *** cule.                                    ***
--- ************************************************
---

CREATE VIEW linear_double_stranded_dna_chromosome AS
  SELECT
    feature_id AS linear_double_stranded_dna_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'linear_double_stranded_DNA_chromosome';

--- ************************************************
--- *** relation: circular_double_stranded_dna_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Structural unit composed of a self-repli ***
--- *** cating, double-stranded, circular DNA mo ***
--- *** lecule.                                  ***
--- ************************************************
---

CREATE VIEW circular_double_stranded_dna_chromosome AS
  SELECT
    feature_id AS circular_double_stranded_dna_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'circular_double_stranded_DNA_chromosome';

--- ************************************************
--- *** relation: linear_single_stranded_dna_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Structural unit composed of a self-repli ***
--- *** cating, single-stranded, linear DNA mole ***
--- *** cule.                                    ***
--- ************************************************
---

CREATE VIEW linear_single_stranded_dna_chromosome AS
  SELECT
    feature_id AS linear_single_stranded_dna_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'linear_single_stranded_DNA_chromosome';

--- ************************************************
--- *** relation: circular_single_stranded_dna_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Structural unit composed of a self-repli ***
--- *** cating, single-stranded, circular DNA mo ***
--- *** lecule.                                  ***
--- ************************************************
---

CREATE VIEW circular_single_stranded_dna_chromosome AS
  SELECT
    feature_id AS circular_single_stranded_dna_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'circular_single_stranded_DNA_chromosome';

--- ************************************************
--- *** relation: rna_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Structural unit composed of a self-repli ***
--- *** cating, RNA molecule.                    ***
--- ************************************************
---

CREATE VIEW rna_chromosome AS
  SELECT
    feature_id AS rna_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'single_stranded_RNA_chromosome' OR cvterm.name = 'double_stranded_RNA_chromosome' OR cvterm.name = 'linear_single_stranded_RNA_chromosome' OR cvterm.name = 'circular_single_stranded_RNA_chromosome' OR cvterm.name = 'linear_double_stranded_RNA_chromosome' OR cvterm.name = 'circular_double_stranded_RNA_chromosome' OR cvterm.name = 'RNA_chromosome';

--- ************************************************
--- *** relation: single_stranded_rna_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Structural unit composed of a self-repli ***
--- *** cating, single-stranded RNA molecule.    ***
--- ************************************************
---

CREATE VIEW single_stranded_rna_chromosome AS
  SELECT
    feature_id AS single_stranded_rna_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'linear_single_stranded_RNA_chromosome' OR cvterm.name = 'circular_single_stranded_RNA_chromosome' OR cvterm.name = 'single_stranded_RNA_chromosome';

--- ************************************************
--- *** relation: linear_single_stranded_rna_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Structural unit composed of a self-repli ***
--- *** cating, single-stranded, linear RNA mole ***
--- *** cule.                                    ***
--- ************************************************
---

CREATE VIEW linear_single_stranded_rna_chromosome AS
  SELECT
    feature_id AS linear_single_stranded_rna_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'linear_single_stranded_RNA_chromosome';

--- ************************************************
--- *** relation: linear_double_stranded_rna_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Structural unit composed of a self-repli ***
--- *** cating, double-stranded, linear RNA mole ***
--- *** cule.                                    ***
--- ************************************************
---

CREATE VIEW linear_double_stranded_rna_chromosome AS
  SELECT
    feature_id AS linear_double_stranded_rna_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'linear_double_stranded_RNA_chromosome';

--- ************************************************
--- *** relation: double_stranded_rna_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Structural unit composed of a self-repli ***
--- *** cating, double-stranded RNA molecule.    ***
--- ************************************************
---

CREATE VIEW double_stranded_rna_chromosome AS
  SELECT
    feature_id AS double_stranded_rna_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'linear_double_stranded_RNA_chromosome' OR cvterm.name = 'circular_double_stranded_RNA_chromosome' OR cvterm.name = 'double_stranded_RNA_chromosome';

--- ************************************************
--- *** relation: circular_single_stranded_rna_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Structural unit composed of a self-repli ***
--- *** cating, single-stranded, circular DNA mo ***
--- *** lecule.                                  ***
--- ************************************************
---

CREATE VIEW circular_single_stranded_rna_chromosome AS
  SELECT
    feature_id AS circular_single_stranded_rna_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'circular_single_stranded_RNA_chromosome';

--- ************************************************
--- *** relation: circular_double_stranded_rna_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Structural unit composed of a self-repli ***
--- *** cating, double-stranded, circular RNA mo ***
--- *** lecule.                                  ***
--- ************************************************
---

CREATE VIEW circular_double_stranded_rna_chromosome AS
  SELECT
    feature_id AS circular_double_stranded_rna_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'circular_double_stranded_RNA_chromosome';

--- ************************************************
--- *** relation: insertion_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A terminal_inverted_repeat_element that  ***
--- *** is bacterial and only encodes the functi ***
--- *** ons required for its transposition betwe ***
--- *** en these inverted repeats.               ***
--- ************************************************
---

CREATE VIEW insertion_sequence AS
  SELECT
    feature_id AS insertion_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'insertion_sequence';

--- ************************************************
--- *** relation: minicircle_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW minicircle_gene AS
  SELECT
    feature_id AS minicircle_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'minicircle_gene';

--- ************************************************
--- *** relation: cryptic ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A feature_attribute describing a feature ***
--- ***  that is not manifest under normal condi ***
--- *** tions.                                   ***
--- ************************************************
---

CREATE VIEW cryptic AS
  SELECT
    feature_id AS cryptic_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cryptic';

--- ************************************************
--- *** relation: anchor_binding_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW anchor_binding_site AS
  SELECT
    feature_id AS anchor_binding_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'anchor_binding_site';

--- ************************************************
--- *** relation: template_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of a guide_RNA that specifies t ***
--- *** he insertions and deletions of bases in  ***
--- *** the editing of a target mRNA.            ***
--- ************************************************
---

CREATE VIEW template_region AS
  SELECT
    feature_id AS template_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'template_region';

--- ************************************************
--- *** relation: grna_encoding ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A non-protein_coding gene that encodes a ***
--- ***  guide_RNA.                              ***
--- ************************************************
---

CREATE VIEW grna_encoding AS
  SELECT
    feature_id AS grna_encoding_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gRNA_encoding';

--- ************************************************
--- *** relation: minicircle ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A minicircle is a replicon, part of a ki ***
--- *** netoplast, that encodes for guide RNAs.  ***
--- ************************************************
---

CREATE VIEW minicircle AS
  SELECT
    feature_id AS minicircle_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'minicircle';

--- ************************************************
--- *** relation: rho_dependent_bacterial_terminator ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW rho_dependent_bacterial_terminator AS
  SELECT
    feature_id AS rho_dependent_bacterial_terminator_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rho_dependent_bacterial_terminator';

--- ************************************************
--- *** relation: rho_independent_bacterial_terminator ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW rho_independent_bacterial_terminator AS
  SELECT
    feature_id AS rho_independent_bacterial_terminator_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rho_independent_bacterial_terminator';

--- ************************************************
--- *** relation: strand_attribute ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW strand_attribute AS
  SELECT
    feature_id AS strand_attribute_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'single' OR cvterm.name = 'double' OR cvterm.name = 'strand_attribute';

--- ************************************************
--- *** relation: single ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW single AS
  SELECT
    feature_id AS single_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'single';

--- ************************************************
--- *** relation: double ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW double AS
  SELECT
    feature_id AS double_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'double';

--- ************************************************
--- *** relation: topology_attribute ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW topology_attribute AS
  SELECT
    feature_id AS topology_attribute_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'linear' OR cvterm.name = 'circular' OR cvterm.name = 'topology_attribute';

--- ************************************************
--- *** relation: linear ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A quality of a nucleotide polymer that h ***
--- *** as a 3'-terminal residue and a 5'-termin ***
--- *** al residue.                              ***
--- ************************************************
---

CREATE VIEW linear AS
  SELECT
    feature_id AS linear_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'linear';

--- ************************************************
--- *** relation: circular ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A quality of a nucleotide polymer that h ***
--- *** as no terminal nucleotide residues.      ***
--- ************************************************
---

CREATE VIEW circular AS
  SELECT
    feature_id AS circular_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'circular';

--- ************************************************
--- *** relation: class_ii_rna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Small non-coding RNA (59-60 nt long) con ***
--- *** taining 5' and 3' ends that are predicte ***
--- *** d to come together to form a stem struct ***
--- *** ure. Identified in the social amoeba Dic ***
--- *** tyostelium discoideum and localized in t ***
--- *** he cytoplasm.                            ***
--- ************************************************
---

CREATE VIEW class_ii_rna AS
  SELECT
    feature_id AS class_ii_rna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'class_II_RNA';

--- ************************************************
--- *** relation: class_i_rna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Small non-coding RNA (55-65 nt long) con ***
--- *** taining highly conserved 5' and 3' ends  ***
--- *** (16 and 8 nt, respectively) that are pre ***
--- *** dicted to come together to form a stem s ***
--- *** tructure. Identified in the social amoeb ***
--- *** a Dictyostelium discoideum and localized ***
--- ***  in the cytoplasm.                       ***
--- ************************************************
---

CREATE VIEW class_i_rna AS
  SELECT
    feature_id AS class_i_rna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'class_I_RNA';

--- ************************************************
--- *** relation: genomic_dna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW genomic_dna AS
  SELECT
    feature_id AS genomic_dna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'genomic_DNA';

--- ************************************************
--- *** relation: bac_cloned_genomic_insert ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW bac_cloned_genomic_insert AS
  SELECT
    feature_id AS bac_cloned_genomic_insert_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'BAC_cloned_genomic_insert';

--- ************************************************
--- *** relation: consensus ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW consensus AS
  SELECT
    feature_id AS consensus_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'consensus';

--- ************************************************
--- *** relation: consensus_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW consensus_region AS
  SELECT
    feature_id AS consensus_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'consensus_mRNA' OR cvterm.name = 'consensus_region';

--- ************************************************
--- *** relation: consensus_mrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW consensus_mrna AS
  SELECT
    feature_id AS consensus_mrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'consensus_mRNA';

--- ************************************************
--- *** relation: predicted_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW predicted_gene AS
  SELECT
    feature_id AS predicted_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'predicted_gene';

--- ************************************************
--- *** relation: gene_fragment ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW gene_fragment AS
  SELECT
    feature_id AS gene_fragment_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_fragment';

--- ************************************************
--- *** relation: recursive_splice_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A recursive splice site is a splice site ***
--- ***  which subdivides a large intron. Recurs ***
--- *** ive splicing is a mechanism that splices ***
--- ***  large introns by sub dividing the intro ***
--- *** n at non exonic elements and alternate e ***
--- *** xons.                                    ***
--- ************************************************
---

CREATE VIEW recursive_splice_site AS
  SELECT
    feature_id AS recursive_splice_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'recursive_splice_site';

--- ************************************************
--- *** relation: bac_end ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of sequence from the end of a B ***
--- *** AC clone that may provide a highly speci ***
--- *** fic marker.                              ***
--- ************************************************
---

CREATE VIEW bac_end AS
  SELECT
    feature_id AS bac_end_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'BAC_end';

--- ************************************************
--- *** relation: rrna_16s ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A large polynucleotide in Bacteria and A ***
--- *** rchaea, which functions as the small sub ***
--- *** unit of the ribosome.                    ***
--- ************************************************
---

CREATE VIEW rrna_16s AS
  SELECT
    feature_id AS rrna_16s_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rRNA_16S';

--- ************************************************
--- *** relation: rrna_23s ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A large polynucleotide in Bacteria and A ***
--- *** rchaea, which functions as the large sub ***
--- *** unit of the ribosome.                    ***
--- ************************************************
---

CREATE VIEW rrna_23s AS
  SELECT
    feature_id AS rrna_23s_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rRNA_23S';

--- ************************************************
--- *** relation: rrna_25s ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A large polynucleotide which functions a ***
--- *** s part of the large subunit of the ribos ***
--- *** ome in some eukaryotes.                  ***
--- ************************************************
---

CREATE VIEW rrna_25s AS
  SELECT
    feature_id AS rrna_25s_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rRNA_25S';

--- ************************************************
--- *** relation: solo_ltr ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A recombination product between the 2 LT ***
--- *** R of the same element.                   ***
--- ************************************************
---

CREATE VIEW solo_ltr AS
  SELECT
    feature_id AS solo_ltr_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'solo_LTR';

--- ************************************************
--- *** relation: low_complexity ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW low_complexity AS
  SELECT
    feature_id AS low_complexity_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'low_complexity';

--- ************************************************
--- *** relation: low_complexity_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW low_complexity_region AS
  SELECT
    feature_id AS low_complexity_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'low_complexity_region';

--- ************************************************
--- *** relation: prophage ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A phage genome after it has established  ***
--- *** in the host genome in a latent/immune st ***
--- *** ate either as a plasmid or as an integra ***
--- *** ted "island".                            ***
--- ************************************************
---

CREATE VIEW prophage AS
  SELECT
    feature_id AS prophage_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'prophage';

--- ************************************************
--- *** relation: cryptic_prophage ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A remnant of an integrated prophage in t ***
--- *** he host genome or an "island" in the hos ***
--- *** t genome that includes phage like-genes. ***
--- ************************************************
---

CREATE VIEW cryptic_prophage AS
  SELECT
    feature_id AS cryptic_prophage_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cryptic_prophage';

--- ************************************************
--- *** relation: tetraloop ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A base-paired stem with loop of 4 non-hy ***
--- *** drogen bonded nucleotides.               ***
--- ************************************************
---

CREATE VIEW tetraloop AS
  SELECT
    feature_id AS tetraloop_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tetraloop';

--- ************************************************
--- *** relation: dna_constraint_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A double-stranded DNA used to control ma ***
--- *** cromolecular structure and function.     ***
--- ************************************************
---

CREATE VIEW dna_constraint_sequence AS
  SELECT
    feature_id AS dna_constraint_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DNA_constraint_sequence';

--- ************************************************
--- *** relation: i_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A cytosine rich domain whereby strands a ***
--- *** ssociate both inter- and intramolecularl ***
--- *** y at moderately acidic pH.               ***
--- ************************************************
---

CREATE VIEW i_motif AS
  SELECT
    feature_id AS i_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'i_motif';

--- ************************************************
--- *** relation: pna_oligo ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Peptide nucleic acid, is a chemical not  ***
--- *** known to occur naturally but is artifici ***
--- *** ally synthesized and used in some biolog ***
--- *** ical research and medical treatments. Th ***
--- *** e PNA backbone is composed of repeating  ***
--- *** N-(2-aminoethyl)-glycine units linked by ***
--- ***  peptide bonds. The purine and pyrimidin ***
--- *** e bases are linked to the backbone by me ***
--- *** thylene carbonyl bonds.                  ***
--- ************************************************
---

CREATE VIEW pna_oligo AS
  SELECT
    feature_id AS pna_oligo_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'PNA_oligo';

--- ************************************************
--- *** relation: dnazyme ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A DNA sequence with catalytic activity.  ***
--- ************************************************
---

CREATE VIEW dnazyme AS
  SELECT
    feature_id AS dnazyme_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DNAzyme';

--- ************************************************
--- *** relation: mnp ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A multiple nucleotide polymorphism with  ***
--- *** alleles of common length > 1, for exampl ***
--- *** e AAA/TTT.                               ***
--- ************************************************
---

CREATE VIEW mnp AS
  SELECT
    feature_id AS mnp_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'MNP';

--- ************************************************
--- *** relation: intron_domain ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW intron_domain AS
  SELECT
    feature_id AS intron_domain_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'internal_guide_sequence' OR cvterm.name = 'mirtron' OR cvterm.name = 'intron_domain';

--- ************************************************
--- *** relation: wobble_base_pair ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A type of non-canonical base pairing, mo ***
--- *** st commonly between G and U, which is im ***
--- *** portant for the secondary structure of R ***
--- *** NAs. It has similar thermodynamic stabil ***
--- *** ity to the Watson-Crick pairing. Wobble  ***
--- *** base pairs only have two hydrogen bonds. ***
--- ***  Other wobble base pair possibilities ar ***
--- *** e I-A, I-U and I-C.                      ***
--- ************************************************
---

CREATE VIEW wobble_base_pair AS
  SELECT
    feature_id AS wobble_base_pair_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'wobble_base_pair';

--- ************************************************
--- *** relation: internal_guide_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A purine-rich sequence in the group I in ***
--- *** trons which determines the locations of  ***
--- *** the splice sites in group I intron splic ***
--- *** ing and has catalytic activity.          ***
--- ************************************************
---

CREATE VIEW internal_guide_sequence AS
  SELECT
    feature_id AS internal_guide_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'internal_guide_sequence';

--- ************************************************
--- *** relation: silent_mutation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that does not affect  ***
--- *** protein function. Silent mutations may o ***
--- *** ccur in genic ( CDS, UTR, intron etc) an ***
--- *** d intergenic regions. Silent mutations m ***
--- *** ay have affects on processes such as spl ***
--- *** icing and regulation.                    ***
--- ************************************************
---

CREATE VIEW silent_mutation AS
  SELECT
    feature_id AS silent_mutation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'silent_mutation';

--- ************************************************
--- *** relation: epitope ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A binding site that, in the molecule, in ***
--- *** teracts selectively and non-covalently w ***
--- *** ith antibodies, B cells or T cells.      ***
--- ************************************************
---

CREATE VIEW epitope AS
  SELECT
    feature_id AS epitope_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'epitope';

--- ************************************************
--- *** relation: copy_number_variation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A variation that increases or decreases  ***
--- *** the copy number of a given region.       ***
--- ************************************************
---

CREATE VIEW copy_number_variation AS
  SELECT
    feature_id AS copy_number_variation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'copy_number_gain' OR cvterm.name = 'copy_number_loss' OR cvterm.name = 'copy_number_variation';

--- ************************************************
--- *** relation: chromosome_breakpoint ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW chromosome_breakpoint AS
  SELECT
    feature_id AS chromosome_breakpoint_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inversion_breakpoint' OR cvterm.name = 'translocation_breakpoint' OR cvterm.name = 'insertion_breakpoint' OR cvterm.name = 'deletion_breakpoint' OR cvterm.name = 'chromosome_breakpoint';

--- ************************************************
--- *** relation: inversion_breakpoint ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The point within a chromosome where an i ***
--- *** nversion begins or ends.                 ***
--- ************************************************
---

CREATE VIEW inversion_breakpoint AS
  SELECT
    feature_id AS inversion_breakpoint_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inversion_breakpoint';

--- ************************************************
--- *** relation: allele ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An allele is one of a set of coexisting  ***
--- *** sequence variants of a gene.             ***
--- ************************************************
---

CREATE VIEW allele AS
  SELECT
    feature_id AS allele_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polymorphic_sequence_variant' OR cvterm.name = 'allele';

--- ************************************************
--- *** relation: haplotype ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A haplotype is one of a set of coexistin ***
--- *** g sequence variants of a haplotype block ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW haplotype AS
  SELECT
    feature_id AS haplotype_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'haplotype';

--- ************************************************
--- *** relation: polymorphic_sequence_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that is segregating i ***
--- *** n one or more natural populations of a s ***
--- *** pecies.                                  ***
--- ************************************************
---

CREATE VIEW polymorphic_sequence_variant AS
  SELECT
    feature_id AS polymorphic_sequence_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polymorphic_sequence_variant';

--- ************************************************
--- *** relation: genome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A genome is the sum of genetic material  ***
--- *** within a cell or virion.                 ***
--- ************************************************
---

CREATE VIEW genome AS
  SELECT
    feature_id AS genome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'kinetoplast' OR cvterm.name = 'reference_genome' OR cvterm.name = 'variant_genome' OR cvterm.name = 'chromosomally_aberrant_genome' OR cvterm.name = 'genome';

--- ************************************************
--- *** relation: so_genotype ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A genotype is a variant genome, complete ***
--- ***  or incomplete.                          ***
--- ************************************************
---

CREATE VIEW so_genotype AS
  SELECT
    feature_id AS so_genotype_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'genotype';

--- ************************************************
--- *** relation: diplotype ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A diplotype is a pair of haplotypes from ***
--- ***  a given individual. It is a genotype wh ***
--- *** ere the phase is known.                  ***
--- ************************************************
---

CREATE VIEW diplotype AS
  SELECT
    feature_id AS diplotype_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'diplotype';

--- ************************************************
--- *** relation: direction_attribute ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW direction_attribute AS
  SELECT
    feature_id AS direction_attribute_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'forward' OR cvterm.name = 'reverse' OR cvterm.name = 'direction_attribute';

--- ************************************************
--- *** relation: forward ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Forward is an attribute of the feature,  ***
--- *** where the feature is in the 5' to 3' dir ***
--- *** ection.                                  ***
--- ************************************************
---

CREATE VIEW forward AS
  SELECT
    feature_id AS forward_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'forward';

--- ************************************************
--- *** relation: reverse ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Reverse is an attribute of the feature,  ***
--- *** where the feature is in the 3' to 5' dir ***
--- *** ection. Again could be applied to primer ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW reverse AS
  SELECT
    feature_id AS reverse_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'reverse';

--- ************************************************
--- *** relation: mitochondrial_dna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW mitochondrial_dna AS
  SELECT
    feature_id AS mitochondrial_dna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mitochondrial_DNA';

--- ************************************************
--- *** relation: chloroplast_dna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW chloroplast_dna AS
  SELECT
    feature_id AS chloroplast_dna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'chloroplast_DNA';

--- ************************************************
--- *** relation: mirtron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A de-branched intron which mimics the st ***
--- *** ructure of pre-miRNA and enters the miRN ***
--- *** A processing pathway without Drosha medi ***
--- *** ated cleavage.                           ***
--- ************************************************
---

CREATE VIEW mirtron AS
  SELECT
    feature_id AS mirtron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mirtron';

--- ************************************************
--- *** relation: pirna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A small non coding RNA, part of a silenc ***
--- *** ing system that prevents the spreading o ***
--- *** f selfish genetic elements.              ***
--- ************************************************
---

CREATE VIEW pirna AS
  SELECT
    feature_id AS pirna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'piRNA';

--- ************************************************
--- *** relation: arginyl_trna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tRNA sequence that has an arginine ant ***
--- *** icodon, and a 3' arginine binding region ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW arginyl_trna AS
  SELECT
    feature_id AS arginyl_trna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'arginyl_tRNA';

--- ************************************************
--- *** relation: mobile_genetic_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A nucleotide region with either intra-ge ***
--- *** nome or intracellular moblity, of varyin ***
--- *** g length, which often carry the informat ***
--- *** ion necessary for transfer and recombina ***
--- *** tion with the host genome.               ***
--- ************************************************
---

CREATE VIEW mobile_genetic_element AS
  SELECT
    feature_id AS mobile_genetic_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mobile_intron' OR cvterm.name = 'extrachromosomal_mobile_genetic_element' OR cvterm.name = 'integrated_mobile_genetic_element' OR cvterm.name = 'natural_transposable_element' OR cvterm.name = 'viral_sequence' OR cvterm.name = 'natural_plasmid' OR cvterm.name = 'phage_sequence' OR cvterm.name = 'ds_RNA_viral_sequence' OR cvterm.name = 'ds_DNA_viral_sequence' OR cvterm.name = 'ss_RNA_viral_sequence' OR cvterm.name = 'negative_sense_ssRNA_viral_sequence' OR cvterm.name = 'positive_sense_ssRNA_viral_sequence' OR cvterm.name = 'ambisense_ssRNA_viral_sequence' OR cvterm.name = 'transposable_element' OR cvterm.name = 'proviral_region' OR cvterm.name = 'integron' OR cvterm.name = 'genomic_island' OR cvterm.name = 'integrated_plasmid' OR cvterm.name = 'cointegrated_plasmid' OR cvterm.name = 'retrotransposon' OR cvterm.name = 'DNA_transposon' OR cvterm.name = 'foreign_transposable_element' OR cvterm.name = 'transgenic_transposable_element' OR cvterm.name = 'natural_transposable_element' OR cvterm.name = 'engineered_transposable_element' OR cvterm.name = 'nested_transposon' OR cvterm.name = 'LTR_retrotransposon' OR cvterm.name = 'non_LTR_retrotransposon' OR cvterm.name = 'LINE_element' OR cvterm.name = 'SINE_element' OR cvterm.name = 'terminal_inverted_repeat_element' OR cvterm.name = 'foldback_element' OR cvterm.name = 'conjugative_transposon' OR cvterm.name = 'helitron' OR cvterm.name = 'p_element' OR cvterm.name = 'MITE' OR cvterm.name = 'insertion_sequence' OR cvterm.name = 'polinton' OR cvterm.name = 'engineered_foreign_transposable_element' OR cvterm.name = 'engineered_foreign_transposable_element' OR cvterm.name = 'prophage' OR cvterm.name = 'pathogenic_island' OR cvterm.name = 'metabolic_island' OR cvterm.name = 'adaptive_island' OR cvterm.name = 'symbiosis_island' OR cvterm.name = 'cryptic_prophage' OR cvterm.name = 'defective_conjugative_transposon' OR cvterm.name = 'mobile_genetic_element';

--- ************************************************
--- *** relation: extrachromosomal_mobile_genetic_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An MGE that is not integrated into the h ***
--- *** ost chromosome.                          ***
--- ************************************************
---

CREATE VIEW extrachromosomal_mobile_genetic_element AS
  SELECT
    feature_id AS extrachromosomal_mobile_genetic_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'natural_transposable_element' OR cvterm.name = 'viral_sequence' OR cvterm.name = 'natural_plasmid' OR cvterm.name = 'phage_sequence' OR cvterm.name = 'ds_RNA_viral_sequence' OR cvterm.name = 'ds_DNA_viral_sequence' OR cvterm.name = 'ss_RNA_viral_sequence' OR cvterm.name = 'negative_sense_ssRNA_viral_sequence' OR cvterm.name = 'positive_sense_ssRNA_viral_sequence' OR cvterm.name = 'ambisense_ssRNA_viral_sequence' OR cvterm.name = 'extrachromosomal_mobile_genetic_element';

--- ************************************************
--- *** relation: integrated_mobile_genetic_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An MGE that is integrated into the host  ***
--- *** chromosome.                              ***
--- ************************************************
---

CREATE VIEW integrated_mobile_genetic_element AS
  SELECT
    feature_id AS integrated_mobile_genetic_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'transposable_element' OR cvterm.name = 'proviral_region' OR cvterm.name = 'integron' OR cvterm.name = 'genomic_island' OR cvterm.name = 'integrated_plasmid' OR cvterm.name = 'cointegrated_plasmid' OR cvterm.name = 'retrotransposon' OR cvterm.name = 'DNA_transposon' OR cvterm.name = 'foreign_transposable_element' OR cvterm.name = 'transgenic_transposable_element' OR cvterm.name = 'natural_transposable_element' OR cvterm.name = 'engineered_transposable_element' OR cvterm.name = 'nested_transposon' OR cvterm.name = 'LTR_retrotransposon' OR cvterm.name = 'non_LTR_retrotransposon' OR cvterm.name = 'LINE_element' OR cvterm.name = 'SINE_element' OR cvterm.name = 'terminal_inverted_repeat_element' OR cvterm.name = 'foldback_element' OR cvterm.name = 'conjugative_transposon' OR cvterm.name = 'helitron' OR cvterm.name = 'p_element' OR cvterm.name = 'MITE' OR cvterm.name = 'insertion_sequence' OR cvterm.name = 'polinton' OR cvterm.name = 'engineered_foreign_transposable_element' OR cvterm.name = 'engineered_foreign_transposable_element' OR cvterm.name = 'prophage' OR cvterm.name = 'pathogenic_island' OR cvterm.name = 'metabolic_island' OR cvterm.name = 'adaptive_island' OR cvterm.name = 'symbiosis_island' OR cvterm.name = 'cryptic_prophage' OR cvterm.name = 'defective_conjugative_transposon' OR cvterm.name = 'integrated_mobile_genetic_element';

--- ************************************************
--- *** relation: integrated_plasmid ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A plasmid sequence that is integrated wi ***
--- *** thin the host chromosome.                ***
--- ************************************************
---

CREATE VIEW integrated_plasmid AS
  SELECT
    feature_id AS integrated_plasmid_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'integrated_plasmid';

--- ************************************************
--- *** relation: viral_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The region of nucleotide sequence of a v ***
--- *** irus, a submicroscopic particle that rep ***
--- *** licates by infecting a host cell.        ***
--- ************************************************
---

CREATE VIEW viral_sequence AS
  SELECT
    feature_id AS viral_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'phage_sequence' OR cvterm.name = 'ds_RNA_viral_sequence' OR cvterm.name = 'ds_DNA_viral_sequence' OR cvterm.name = 'ss_RNA_viral_sequence' OR cvterm.name = 'negative_sense_ssRNA_viral_sequence' OR cvterm.name = 'positive_sense_ssRNA_viral_sequence' OR cvterm.name = 'ambisense_ssRNA_viral_sequence' OR cvterm.name = 'viral_sequence';

--- ************************************************
--- *** relation: phage_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The nucleotide sequence of a virus that  ***
--- *** infects bacteria.                        ***
--- ************************************************
---

CREATE VIEW phage_sequence AS
  SELECT
    feature_id AS phage_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'phage_sequence';

--- ************************************************
--- *** relation: attctn_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attachment site located on a conjugat ***
--- *** ive transposon and used for site-specifi ***
--- *** c integration of a conjugative transposo ***
--- *** n.                                       ***
--- ************************************************
---

CREATE VIEW attctn_site AS
  SELECT
    feature_id AS attctn_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'attCtn_site';

--- ************************************************
--- *** relation: nuclear_mt_pseudogene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A nuclear pseudogene of either coding or ***
--- ***  non-coding mitochondria derived sequenc ***
--- *** e.                                       ***
--- ************************************************
---

CREATE VIEW nuclear_mt_pseudogene AS
  SELECT
    feature_id AS nuclear_mt_pseudogene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'nuclear_mt_pseudogene';

--- ************************************************
--- *** relation: cointegrated_plasmid ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A MGE region consisting of two fused pla ***
--- *** smids resulting from a replicative trans ***
--- *** position event.                          ***
--- ************************************************
---

CREATE VIEW cointegrated_plasmid AS
  SELECT
    feature_id AS cointegrated_plasmid_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cointegrated_plasmid';

--- ************************************************
--- *** relation: irlinv_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Component of the inversion site located  ***
--- *** at the left of a region susceptible to s ***
--- *** ite-specific inversion.                  ***
--- ************************************************
---

CREATE VIEW irlinv_site AS
  SELECT
    feature_id AS irlinv_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'IRLinv_site';

--- ************************************************
--- *** relation: irrinv_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Component of the inversion site located  ***
--- *** at the right of a region susceptible to  ***
--- *** site-specific inversion.                 ***
--- ************************************************
---

CREATE VIEW irrinv_site AS
  SELECT
    feature_id AS irrinv_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'IRRinv_site';

--- ************************************************
--- *** relation: inversion_site_part ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region located within an inversion sit ***
--- *** e.                                       ***
--- ************************************************
---

CREATE VIEW inversion_site_part AS
  SELECT
    feature_id AS inversion_site_part_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'IRLinv_site' OR cvterm.name = 'IRRinv_site' OR cvterm.name = 'inversion_site_part';

--- ************************************************
--- *** relation: defective_conjugative_transposon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An island that contains genes for integr ***
--- *** ation/excision and the gene and site for ***
--- ***  the initiation of intercellular transfe ***
--- *** r by conjugation. It can be complemented ***
--- ***  for transfer by a conjugative transposo ***
--- *** n.                                       ***
--- ************************************************
---

CREATE VIEW defective_conjugative_transposon AS
  SELECT
    feature_id AS defective_conjugative_transposon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'defective_conjugative_transposon';

--- ************************************************
--- *** relation: repeat_fragment ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A portion of a repeat, interrupted by th ***
--- *** e insertion of another element.          ***
--- ************************************************
---

CREATE VIEW repeat_fragment AS
  SELECT
    feature_id AS repeat_fragment_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'repeat_fragment';

--- ************************************************
--- *** relation: transposon_fragment ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A portion of a transposon, interrupted b ***
--- *** y the insertion of another element.      ***
--- ************************************************
---

CREATE VIEW transposon_fragment AS
  SELECT
    feature_id AS transposon_fragment_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'transposon_fragment';

--- ************************************************
--- *** relation: transcriptional_cis_regulatory_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A regulatory_region that modulates the t ***
--- *** ranscription of a gene or genes.         ***
--- ************************************************
---

CREATE VIEW transcriptional_cis_regulatory_region AS
  SELECT
    feature_id AS transcriptional_cis_regulatory_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'promoter' OR cvterm.name = 'insulator' OR cvterm.name = 'CRM' OR cvterm.name = 'promoter_targeting_sequence' OR cvterm.name = 'ISRE' OR cvterm.name = 'bidirectional_promoter' OR cvterm.name = 'RNA_polymerase_promoter' OR cvterm.name = 'RNApol_I_promoter' OR cvterm.name = 'RNApol_II_promoter' OR cvterm.name = 'RNApol_III_promoter' OR cvterm.name = 'bacterial_RNApol_promoter' OR cvterm.name = 'Phage_RNA_Polymerase_Promoter' OR cvterm.name = 'RNApol_II_core_promoter' OR cvterm.name = 'RNApol_III_promoter_type_1' OR cvterm.name = 'RNApol_III_promoter_type_2' OR cvterm.name = 'RNApol_III_promoter_type_3' OR cvterm.name = 'bacterial_RNApol_promoter_sigma_70' OR cvterm.name = 'bacterial_RNApol_promoter_sigma54' OR cvterm.name = 'SP6_RNA_Polymerase_Promoter' OR cvterm.name = 'T3_RNA_Polymerase_Promoter' OR cvterm.name = 'T7_RNA_Polymerase_Promoter' OR cvterm.name = 'locus_control_region' OR cvterm.name = 'enhancer' OR cvterm.name = 'silencer' OR cvterm.name = 'enhancer_bound_by_factor' OR cvterm.name = 'shadow_enhancer' OR cvterm.name = 'transcriptional_cis_regulatory_region';

--- ************************************************
--- *** relation: splicing_regulatory_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A regulatory_region that modulates splic ***
--- *** ing.                                     ***
--- ************************************************
---

CREATE VIEW splicing_regulatory_region AS
  SELECT
    feature_id AS splicing_regulatory_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'splice_enhancer' OR cvterm.name = 'intronic_splice_enhancer' OR cvterm.name = 'exonic_splice_enhancer' OR cvterm.name = 'splicing_regulatory_region';

--- ************************************************
--- *** relation: promoter_targeting_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transcriptional_cis_regulatory_region  ***
--- *** that restricts the activity of a CRM to  ***
--- *** a single promoter and which functions on ***
--- *** ly when both itself and an insulator are ***
--- ***  located between the CRM and the promote ***
--- *** r.                                       ***
--- ************************************************
---

CREATE VIEW promoter_targeting_sequence AS
  SELECT
    feature_id AS promoter_targeting_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'promoter_targeting_sequence';

--- ************************************************
--- *** relation: sequence_alteration ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence_alteration is a sequence_feat ***
--- *** ure whose extent is the deviation from a ***
--- *** nother sequence.                         ***
--- ************************************************
---

CREATE VIEW sequence_alteration AS
  SELECT
    feature_id AS sequence_alteration_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'deletion' OR cvterm.name = 'translocation' OR cvterm.name = 'insertion' OR cvterm.name = 'copy_number_variation' OR cvterm.name = 'UPD' OR cvterm.name = 'structural_alteration' OR cvterm.name = 'substitution' OR cvterm.name = 'indel' OR cvterm.name = 'inversion' OR cvterm.name = 'transgenic_insertion' OR cvterm.name = 'duplication' OR cvterm.name = 'tandem_duplication' OR cvterm.name = 'direct_tandem_duplication' OR cvterm.name = 'inverted_tandem_duplication' OR cvterm.name = 'copy_number_gain' OR cvterm.name = 'copy_number_loss' OR cvterm.name = 'maternal_uniparental_disomy' OR cvterm.name = 'paternal_uniparental_disomy' OR cvterm.name = 'complex_structural_alteration' OR cvterm.name = 'sequence_length_variation' OR cvterm.name = 'MNP' OR cvterm.name = 'SNV' OR cvterm.name = 'complex_substitution' OR cvterm.name = 'simple_sequence_length_variation' OR cvterm.name = 'SNP' OR cvterm.name = 'point_mutation' OR cvterm.name = 'transition' OR cvterm.name = 'transversion' OR cvterm.name = 'pyrimidine_transition' OR cvterm.name = 'purine_transition' OR cvterm.name = 'C_to_T_transition' OR cvterm.name = 'T_to_C_transition' OR cvterm.name = 'C_to_T_transition_at_pCpG_site' OR cvterm.name = 'A_to_G_transition' OR cvterm.name = 'G_to_A_transition' OR cvterm.name = 'pyrimidine_to_purine_transversion' OR cvterm.name = 'purine_to_pyrimidine_transversion' OR cvterm.name = 'C_to_A_transversion' OR cvterm.name = 'C_to_G_transversion' OR cvterm.name = 'T_to_A_transversion' OR cvterm.name = 'T_to_G_transversion' OR cvterm.name = 'A_to_C_transversion' OR cvterm.name = 'A_to_T_transversion' OR cvterm.name = 'G_to_C_transversion' OR cvterm.name = 'G_to_T_transversion' OR cvterm.name = 'sequence_alteration';

--- ************************************************
--- *** relation: sequence_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence_variant is a non exact copy o ***
--- *** f a sequence_feature or genome exhibitin ***
--- *** g one or more sequence_alteration.       ***
--- ************************************************
---

CREATE VIEW sequence_variant AS
  SELECT
    feature_id AS sequence_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'functional_variant' OR cvterm.name = 'structural_variant' OR cvterm.name = 'loss_of_heterozygosity' OR cvterm.name = 'transcript_function_variant' OR cvterm.name = 'translational_product_function_variant' OR cvterm.name = 'level_of_transcript_variant' OR cvterm.name = 'transcript_processing_variant' OR cvterm.name = 'transcript_stability_variant' OR cvterm.name = 'transcription_variant' OR cvterm.name = 'decreased_transcript_level_variant' OR cvterm.name = 'increased_transcript_level_variant' OR cvterm.name = 'editing_variant' OR cvterm.name = 'polyadenylation_variant' OR cvterm.name = 'increased_polyadenylation_variant' OR cvterm.name = 'decreased_polyadenylation_variant' OR cvterm.name = 'decreased_transcript_stability_variant' OR cvterm.name = 'increased_transcript_stability_variant' OR cvterm.name = 'rate_of_transcription_variant' OR cvterm.name = 'increased_transcription_rate_variant' OR cvterm.name = 'decreased_transcription_rate_variant' OR cvterm.name = 'translational_product_level_variant' OR cvterm.name = 'polypeptide_function_variant' OR cvterm.name = 'decreased_translational_product_level' OR cvterm.name = 'increased_translational_product_level' OR cvterm.name = 'polypeptide_gain_of_function_variant' OR cvterm.name = 'polypeptide_localization_variant' OR cvterm.name = 'polypeptide_loss_of_function_variant' OR cvterm.name = 'polypeptide_post_translational_processing_variant' OR cvterm.name = 'inactive_ligand_binding_site' OR cvterm.name = 'polypeptide_partial_loss_of_function' OR cvterm.name = 'inactive_catalytic_site' OR cvterm.name = 'silent_mutation' OR cvterm.name = 'copy_number_change' OR cvterm.name = 'gene_variant' OR cvterm.name = 'regulatory_region_variant' OR cvterm.name = 'intergenic_variant' OR cvterm.name = 'upstream_gene_variant' OR cvterm.name = 'downstream_gene_variant' OR cvterm.name = 'gene_fusion' OR cvterm.name = 'splicing_variant' OR cvterm.name = 'transcript_variant' OR cvterm.name = 'translational_product_structure_variant' OR cvterm.name = 'cryptic_splice_site_variant' OR cvterm.name = 'exon_loss' OR cvterm.name = 'intron_gain' OR cvterm.name = 'splice_region_variant' OR cvterm.name = 'cryptic_splice_acceptor' OR cvterm.name = 'cryptic_splice_donor' OR cvterm.name = 'complex_change_in_transcript' OR cvterm.name = 'transcript_secondary_structure_variant' OR cvterm.name = 'nc_transcript_variant' OR cvterm.name = 'NMD_transcript_variant' OR cvterm.name = 'UTR_variant' OR cvterm.name = 'intron_variant' OR cvterm.name = 'exon_variant' OR cvterm.name = 'compensatory_transcript_secondary_structure_variant' OR cvterm.name = 'mature_miRNA_variant' OR cvterm.name = '5_prime_UTR_variant' OR cvterm.name = '3_prime_UTR_variant' OR cvterm.name = 'splice_site_variant' OR cvterm.name = 'splice_acceptor_variant' OR cvterm.name = 'splice_donor_variant' OR cvterm.name = 'splice_donor_5th_base_variant' OR cvterm.name = 'coding_sequence_variant' OR cvterm.name = 'non_coding_exon_variant' OR cvterm.name = 'codon_variant' OR cvterm.name = 'frameshift_variant' OR cvterm.name = 'inframe_variant' OR cvterm.name = 'initiator_codon_change' OR cvterm.name = 'non_synonymous_codon' OR cvterm.name = 'synonymous_codon' OR cvterm.name = 'terminal_codon_variant' OR cvterm.name = 'stop_gained' OR cvterm.name = 'missense_codon' OR cvterm.name = 'conservative_missense_codon' OR cvterm.name = 'non_conservative_missense_codon' OR cvterm.name = 'terminator_codon_variant' OR cvterm.name = 'incomplete_terminal_codon_variant' OR cvterm.name = 'stop_retained_variant' OR cvterm.name = 'stop_lost' OR cvterm.name = 'frame_restoring_variant' OR cvterm.name = 'minus_1_frameshift_variant' OR cvterm.name = 'minus_2_frameshift_variant' OR cvterm.name = 'plus_1_frameshift_variant' OR cvterm.name = 'plus_2_frameshift variant' OR cvterm.name = 'inframe_codon_gain' OR cvterm.name = 'inframe_codon_loss' OR cvterm.name = '3D_polypeptide_structure_variant' OR cvterm.name = 'complex_change_of_translational_product_variant' OR cvterm.name = 'polypeptide_sequence_variant' OR cvterm.name = 'complex_3D_structural_variant' OR cvterm.name = 'conformational_change_variant' OR cvterm.name = 'amino_acid_deletion' OR cvterm.name = 'amino_acid_insertion' OR cvterm.name = 'amino_acid_substitution' OR cvterm.name = 'elongated_polypeptide' OR cvterm.name = 'polypeptide_fusion' OR cvterm.name = 'polypeptide_truncation' OR cvterm.name = 'conservative_amino_acid_substitution' OR cvterm.name = 'non_conservative_amino_acid_substitution' OR cvterm.name = 'elongated_polypeptide_C_terminal' OR cvterm.name = 'elongated_polypeptide_N_terminal' OR cvterm.name = 'elongated_in_frame_polypeptide_C_terminal' OR cvterm.name = 'elongated_out_of_frame_polypeptide_C_terminal' OR cvterm.name = 'elongated_in_frame_polypeptide_N_terminal_elongation' OR cvterm.name = 'elongated_out_of_frame_polypeptide_N_terminal' OR cvterm.name = 'TF_binding_site_variant' OR cvterm.name = '5KB_upstream_variant' OR cvterm.name = '2KB_upstream_variant' OR cvterm.name = '5KB_downstream_variant' OR cvterm.name = '500B_downstream_variant' OR cvterm.name = 'sequence_variant';

--- ************************************************
--- *** relation: propeptide_cleavage_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The propeptide_cleavage_site is the argi ***
--- *** nine/lysine boundary on a propeptide whe ***
--- *** re cleavage occurs.                      ***
--- ************************************************
---

CREATE VIEW propeptide_cleavage_site AS
  SELECT
    feature_id AS propeptide_cleavage_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'propeptide_cleavage_site';

--- ************************************************
--- *** relation: propeptide ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Part of a peptide chain which is cleaved ***
--- ***  off during the formation of the mature  ***
--- *** protein.                                 ***
--- ************************************************
---

CREATE VIEW propeptide AS
  SELECT
    feature_id AS propeptide_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'propeptide';

--- ************************************************
--- *** relation: immature_peptide_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An immature_peptide_region is the extent ***
--- ***  of the peptide after it has been transl ***
--- *** ated and before any processing occurs.   ***
--- ************************************************
---

CREATE VIEW immature_peptide_region AS
  SELECT
    feature_id AS immature_peptide_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'immature_peptide_region';

--- ************************************************
--- *** relation: active_peptide ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Active peptides are proteins which are b ***
--- *** iologically active, released from a prec ***
--- *** ursor molecule.                          ***
--- ************************************************
---

CREATE VIEW active_peptide AS
  SELECT
    feature_id AS active_peptide_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'active_peptide';

--- ************************************************
--- *** relation: compositionally_biased_region_of_peptide ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Polypeptide region that is rich in a par ***
--- *** ticular amino acid or homopolymeric and  ***
--- *** greater than three residues in length.   ***
--- ************************************************
---

CREATE VIEW compositionally_biased_region_of_peptide AS
  SELECT
    feature_id AS compositionally_biased_region_of_peptide_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'compositionally_biased_region_of_peptide';

--- ************************************************
--- *** relation: polypeptide_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence motif is a short (up to 20 am ***
--- *** ino acids) region of biological interest ***
--- *** . Such motifs, although they are too sho ***
--- *** rt to constitute functional domains, sha ***
--- *** re sequence similarities and are conserv ***
--- *** ed in different proteins. They display a ***
--- ***  common function (protein-binding, subce ***
--- *** llular location etc.).                   ***
--- ************************************************
---

CREATE VIEW polypeptide_motif AS
  SELECT
    feature_id AS polypeptide_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'biochemical_region_of_peptide' OR cvterm.name = 'polypeptide_conserved_motif' OR cvterm.name = 'post_translationally_modified_region' OR cvterm.name = 'conformational_switch' OR cvterm.name = 'molecular_contact_region' OR cvterm.name = 'polypeptide_binding_motif' OR cvterm.name = 'polypeptide_catalytic_motif' OR cvterm.name = 'histone_modification' OR cvterm.name = 'histone_methylation_site' OR cvterm.name = 'histone_acetylation_site' OR cvterm.name = 'histone_ubiqitination_site' OR cvterm.name = 'histone_acylation_region' OR cvterm.name = 'H4K20_monomethylation_site' OR cvterm.name = 'H2BK5_monomethylation_site' OR cvterm.name = 'H3K27_methylation_site' OR cvterm.name = 'H3K36_methylation_site' OR cvterm.name = 'H3K4_methylation_site' OR cvterm.name = 'H3K79_methylation_site' OR cvterm.name = 'H3K9_methylation_site' OR cvterm.name = 'H3K27_monomethylation_site' OR cvterm.name = 'H3K27_trimethylation_site' OR cvterm.name = 'H3K27_dimethylation_site' OR cvterm.name = 'H3K36_monomethylation_site' OR cvterm.name = 'H3K36_dimethylation_site' OR cvterm.name = 'H3K36_trimethylation_site' OR cvterm.name = 'H3K4_monomethylation_site' OR cvterm.name = 'H3K4_trimethylation' OR cvterm.name = 'H3K4_dimethylation_site' OR cvterm.name = 'H3K79_monomethylation_site' OR cvterm.name = 'H3K79_dimethylation_site' OR cvterm.name = 'H3K79_trimethylation_site' OR cvterm.name = 'H3K9_trimethylation_site' OR cvterm.name = 'H3K9_monomethylation_site' OR cvterm.name = 'H3K9_dimethylation_site' OR cvterm.name = 'H3K9_acetylation_site' OR cvterm.name = 'H3K14_acetylation_site' OR cvterm.name = 'H3K18_acetylation_site' OR cvterm.name = 'H3K23_acylation site' OR cvterm.name = 'H3K27_acylation_site' OR cvterm.name = 'H4K16_acylation_site' OR cvterm.name = 'H4K5_acylation_site' OR cvterm.name = 'H4K8_acylation site' OR cvterm.name = 'H2B_ubiquitination_site' OR cvterm.name = 'H4K_acylation_region' OR cvterm.name = 'polypeptide_metal_contact' OR cvterm.name = 'protein_protein_contact' OR cvterm.name = 'polypeptide_ligand_contact' OR cvterm.name = 'polypeptide_DNA_contact' OR cvterm.name = 'polypeptide_calcium_ion_contact_site' OR cvterm.name = 'polypeptide_cobalt_ion_contact_site' OR cvterm.name = 'polypeptide_copper_ion_contact_site' OR cvterm.name = 'polypeptide_iron_ion_contact_site' OR cvterm.name = 'polypeptide_magnesium_ion_contact_site' OR cvterm.name = 'polypeptide_manganese_ion_contact_site' OR cvterm.name = 'polypeptide_molybdenum_ion_contact_site' OR cvterm.name = 'polypeptide_nickel_ion_contact_site' OR cvterm.name = 'polypeptide_tungsten_ion_contact_site' OR cvterm.name = 'polypeptide_zinc_ion_contact_site' OR cvterm.name = 'polypeptide_motif';

--- ************************************************
--- *** relation: polypeptide_repeat ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A polypeptide_repeat is a single copy of ***
--- ***  an internal sequence repetition.        ***
--- ************************************************
---

CREATE VIEW polypeptide_repeat AS
  SELECT
    feature_id AS polypeptide_repeat_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_repeat';

--- ************************************************
--- *** relation: polypeptide_structural_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Region of polypeptide with a given struc ***
--- *** tural property.                          ***
--- ************************************************
---

CREATE VIEW polypeptide_structural_region AS
  SELECT
    feature_id AS polypeptide_structural_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_domain' OR cvterm.name = 'membrane_structure' OR cvterm.name = 'extramembrane_polypeptide_region' OR cvterm.name = 'intramembrane_polypeptide_region' OR cvterm.name = 'polypeptide_secondary_structure' OR cvterm.name = 'polypeptide_structural_motif' OR cvterm.name = 'intrinsically_unstructured_polypeptide_region' OR cvterm.name = 'cytoplasmic_polypeptide_region' OR cvterm.name = 'non_cytoplasmic_polypeptide_region' OR cvterm.name = 'membrane_peptide_loop' OR cvterm.name = 'transmembrane_polypeptide_region' OR cvterm.name = 'asx_motif' OR cvterm.name = 'beta_bulge' OR cvterm.name = 'beta_bulge_loop' OR cvterm.name = 'beta_strand' OR cvterm.name = 'peptide_helix' OR cvterm.name = 'polypeptide_nest_motif' OR cvterm.name = 'schellmann_loop' OR cvterm.name = 'serine_threonine_motif' OR cvterm.name = 'serine_threonine_staple_motif' OR cvterm.name = 'polypeptide_turn_motif' OR cvterm.name = 'catmat_left_handed_three' OR cvterm.name = 'catmat_left_handed_four' OR cvterm.name = 'catmat_right_handed_three' OR cvterm.name = 'catmat_right_handed_four' OR cvterm.name = 'alpha_beta_motif' OR cvterm.name = 'peptide_coil' OR cvterm.name = 'beta_bulge_loop_five' OR cvterm.name = 'beta_bulge_loop_six' OR cvterm.name = 'antiparallel_beta_strand' OR cvterm.name = 'parallel_beta_strand' OR cvterm.name = 'left_handed_peptide_helix' OR cvterm.name = 'right_handed_peptide_helix' OR cvterm.name = 'alpha_helix' OR cvterm.name = 'pi_helix' OR cvterm.name = 'three_ten_helix' OR cvterm.name = 'polypeptide_nest_left_right_motif' OR cvterm.name = 'polypeptide_nest_right_left_motif' OR cvterm.name = 'schellmann_loop_seven' OR cvterm.name = 'schellmann_loop_six' OR cvterm.name = 'asx_turn' OR cvterm.name = 'beta_turn' OR cvterm.name = 'gamma_turn' OR cvterm.name = 'serine_threonine_turn' OR cvterm.name = 'asx_turn_left_handed_type_one' OR cvterm.name = 'asx_turn_left_handed_type_two' OR cvterm.name = 'asx_turn_right_handed_type_two' OR cvterm.name = 'asx_turn_right_handed_type_one' OR cvterm.name = 'beta_turn_left_handed_type_one' OR cvterm.name = 'beta_turn_left_handed_type_two' OR cvterm.name = 'beta_turn_right_handed_type_one' OR cvterm.name = 'beta_turn_right_handed_type_two' OR cvterm.name = 'beta_turn_type_six' OR cvterm.name = 'beta_turn_type_eight' OR cvterm.name = 'beta_turn_type_six_a' OR cvterm.name = 'beta_turn_type_six_b' OR cvterm.name = 'beta_turn_type_six_a_one' OR cvterm.name = 'beta_turn_type_six_a_two' OR cvterm.name = 'gamma_turn_classic' OR cvterm.name = 'gamma_turn_inverse' OR cvterm.name = 'st_turn_left_handed_type_one' OR cvterm.name = 'st_turn_left_handed_type_two' OR cvterm.name = 'st_turn_right_handed_type_one' OR cvterm.name = 'st_turn_right_handed_type_two' OR cvterm.name = 'coiled_coil' OR cvterm.name = 'helix_turn_helix' OR cvterm.name = 'polypeptide_structural_region';

--- ************************************************
--- *** relation: membrane_structure ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Arrangement of the polypeptide with resp ***
--- *** ect to the lipid bilayer.                ***
--- ************************************************
---

CREATE VIEW membrane_structure AS
  SELECT
    feature_id AS membrane_structure_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'membrane_structure';

--- ************************************************
--- *** relation: extramembrane_polypeptide_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Polypeptide region that is localized out ***
--- *** side of a lipid bilayer.                 ***
--- ************************************************
---

CREATE VIEW extramembrane_polypeptide_region AS
  SELECT
    feature_id AS extramembrane_polypeptide_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cytoplasmic_polypeptide_region' OR cvterm.name = 'non_cytoplasmic_polypeptide_region' OR cvterm.name = 'extramembrane_polypeptide_region';

--- ************************************************
--- *** relation: cytoplasmic_polypeptide_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Polypeptide region that is localized ins ***
--- *** ide the cytoplasm.                       ***
--- ************************************************
---

CREATE VIEW cytoplasmic_polypeptide_region AS
  SELECT
    feature_id AS cytoplasmic_polypeptide_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cytoplasmic_polypeptide_region';

--- ************************************************
--- *** relation: non_cytoplasmic_polypeptide_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Polypeptide region that is localized out ***
--- *** side of a lipid bilayer and outside of t ***
--- *** he cytoplasm.                            ***
--- ************************************************
---

CREATE VIEW non_cytoplasmic_polypeptide_region AS
  SELECT
    feature_id AS non_cytoplasmic_polypeptide_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'non_cytoplasmic_polypeptide_region';

--- ************************************************
--- *** relation: intramembrane_polypeptide_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Polypeptide region present in the lipid  ***
--- *** bilayer.                                 ***
--- ************************************************
---

CREATE VIEW intramembrane_polypeptide_region AS
  SELECT
    feature_id AS intramembrane_polypeptide_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'membrane_peptide_loop' OR cvterm.name = 'transmembrane_polypeptide_region' OR cvterm.name = 'intramembrane_polypeptide_region';

--- ************************************************
--- *** relation: membrane_peptide_loop ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Polypeptide region localized within the  ***
--- *** lipid bilayer where both ends traverse t ***
--- *** he same membrane.                        ***
--- ************************************************
---

CREATE VIEW membrane_peptide_loop AS
  SELECT
    feature_id AS membrane_peptide_loop_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'membrane_peptide_loop';

--- ************************************************
--- *** relation: transmembrane_polypeptide_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Polypeptide region traversing the lipid  ***
--- *** bilayer.                                 ***
--- ************************************************
---

CREATE VIEW transmembrane_polypeptide_region AS
  SELECT
    feature_id AS transmembrane_polypeptide_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'transmembrane_polypeptide_region';

--- ************************************************
--- *** relation: polypeptide_secondary_structure ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of peptide with secondary struc ***
--- *** ture has hydrogen bonding along the pept ***
--- *** ide chain that causes a defined conforma ***
--- *** tion of the chain.                       ***
--- ************************************************
---

CREATE VIEW polypeptide_secondary_structure AS
  SELECT
    feature_id AS polypeptide_secondary_structure_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'asx_motif' OR cvterm.name = 'beta_bulge' OR cvterm.name = 'beta_bulge_loop' OR cvterm.name = 'beta_strand' OR cvterm.name = 'peptide_helix' OR cvterm.name = 'polypeptide_nest_motif' OR cvterm.name = 'schellmann_loop' OR cvterm.name = 'serine_threonine_motif' OR cvterm.name = 'serine_threonine_staple_motif' OR cvterm.name = 'polypeptide_turn_motif' OR cvterm.name = 'catmat_left_handed_three' OR cvterm.name = 'catmat_left_handed_four' OR cvterm.name = 'catmat_right_handed_three' OR cvterm.name = 'catmat_right_handed_four' OR cvterm.name = 'alpha_beta_motif' OR cvterm.name = 'peptide_coil' OR cvterm.name = 'beta_bulge_loop_five' OR cvterm.name = 'beta_bulge_loop_six' OR cvterm.name = 'antiparallel_beta_strand' OR cvterm.name = 'parallel_beta_strand' OR cvterm.name = 'left_handed_peptide_helix' OR cvterm.name = 'right_handed_peptide_helix' OR cvterm.name = 'alpha_helix' OR cvterm.name = 'pi_helix' OR cvterm.name = 'three_ten_helix' OR cvterm.name = 'polypeptide_nest_left_right_motif' OR cvterm.name = 'polypeptide_nest_right_left_motif' OR cvterm.name = 'schellmann_loop_seven' OR cvterm.name = 'schellmann_loop_six' OR cvterm.name = 'asx_turn' OR cvterm.name = 'beta_turn' OR cvterm.name = 'gamma_turn' OR cvterm.name = 'serine_threonine_turn' OR cvterm.name = 'asx_turn_left_handed_type_one' OR cvterm.name = 'asx_turn_left_handed_type_two' OR cvterm.name = 'asx_turn_right_handed_type_two' OR cvterm.name = 'asx_turn_right_handed_type_one' OR cvterm.name = 'beta_turn_left_handed_type_one' OR cvterm.name = 'beta_turn_left_handed_type_two' OR cvterm.name = 'beta_turn_right_handed_type_one' OR cvterm.name = 'beta_turn_right_handed_type_two' OR cvterm.name = 'beta_turn_type_six' OR cvterm.name = 'beta_turn_type_eight' OR cvterm.name = 'beta_turn_type_six_a' OR cvterm.name = 'beta_turn_type_six_b' OR cvterm.name = 'beta_turn_type_six_a_one' OR cvterm.name = 'beta_turn_type_six_a_two' OR cvterm.name = 'gamma_turn_classic' OR cvterm.name = 'gamma_turn_inverse' OR cvterm.name = 'st_turn_left_handed_type_one' OR cvterm.name = 'st_turn_left_handed_type_two' OR cvterm.name = 'st_turn_right_handed_type_one' OR cvterm.name = 'st_turn_right_handed_type_two' OR cvterm.name = 'polypeptide_secondary_structure';

--- ************************************************
--- *** relation: polypeptide_structural_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Motif is a three-dimensional structural  ***
--- *** element within the chain, which appears  ***
--- *** also in a variety of other molecules. Un ***
--- *** like a domain, a motif does not need to  ***
--- *** form a stable globular unit.             ***
--- ************************************************
---

CREATE VIEW polypeptide_structural_motif AS
  SELECT
    feature_id AS polypeptide_structural_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'coiled_coil' OR cvterm.name = 'helix_turn_helix' OR cvterm.name = 'polypeptide_structural_motif';

--- ************************************************
--- *** relation: coiled_coil ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A coiled coil is a structural motif in p ***
--- *** roteins, in which alpha-helices are coil ***
--- *** ed together like the strands of a rope.  ***
--- ************************************************
---

CREATE VIEW coiled_coil AS
  SELECT
    feature_id AS coiled_coil_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'coiled_coil';

--- ************************************************
--- *** relation: helix_turn_helix ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A motif comprising two helices separated ***
--- ***  by a turn.                              ***
--- ************************************************
---

CREATE VIEW helix_turn_helix AS
  SELECT
    feature_id AS helix_turn_helix_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'helix_turn_helix';

--- ************************************************
--- *** relation: polypeptide_sequencing_information ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Incompatibility in the sequence due to s ***
--- *** ome experimental problem.                ***
--- ************************************************
---

CREATE VIEW polypeptide_sequencing_information AS
  SELECT
    feature_id AS polypeptide_sequencing_information_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'non_adjacent_residues' OR cvterm.name = 'non_terminal_residue' OR cvterm.name = 'sequence_conflict' OR cvterm.name = 'sequence_uncertainty' OR cvterm.name = 'contig_collection' OR cvterm.name = 'polypeptide_sequencing_information';

--- ************************************************
--- *** relation: non_adjacent_residues ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Indicates that two consecutive residues  ***
--- *** in a fragment sequence are not consecuti ***
--- *** ve in the full-length protein and that t ***
--- *** here are a number of unsequenced residue ***
--- *** s between them.                          ***
--- ************************************************
---

CREATE VIEW non_adjacent_residues AS
  SELECT
    feature_id AS non_adjacent_residues_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'non_adjacent_residues';

--- ************************************************
--- *** relation: non_terminal_residue ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The residue at an extremity of the seque ***
--- *** nce is not the terminal residue.         ***
--- ************************************************
---

CREATE VIEW non_terminal_residue AS
  SELECT
    feature_id AS non_terminal_residue_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'non_terminal_residue';

--- ************************************************
--- *** relation: sequence_conflict ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Different sources report differing seque ***
--- *** nces.                                    ***
--- ************************************************
---

CREATE VIEW sequence_conflict AS
  SELECT
    feature_id AS sequence_conflict_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'contig_collection' OR cvterm.name = 'sequence_conflict';

--- ************************************************
--- *** relation: sequence_uncertainty ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Describes the positions in a sequence wh ***
--- *** ere the authors are unsure about the seq ***
--- *** uence assignment.                        ***
--- ************************************************
---

CREATE VIEW sequence_uncertainty AS
  SELECT
    feature_id AS sequence_uncertainty_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'sequence_uncertainty';

--- ************************************************
--- *** relation: post_translationally_modified_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region where a transformation occurs i ***
--- *** n a protein after it has been synthesize ***
--- *** d. This which may regulate, stabilize, c ***
--- *** rosslink or introduce new chemical funct ***
--- *** ionalities in the protein.               ***
--- ************************************************
---

CREATE VIEW post_translationally_modified_region AS
  SELECT
    feature_id AS post_translationally_modified_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'histone_modification' OR cvterm.name = 'histone_methylation_site' OR cvterm.name = 'histone_acetylation_site' OR cvterm.name = 'histone_ubiqitination_site' OR cvterm.name = 'histone_acylation_region' OR cvterm.name = 'H4K20_monomethylation_site' OR cvterm.name = 'H2BK5_monomethylation_site' OR cvterm.name = 'H3K27_methylation_site' OR cvterm.name = 'H3K36_methylation_site' OR cvterm.name = 'H3K4_methylation_site' OR cvterm.name = 'H3K79_methylation_site' OR cvterm.name = 'H3K9_methylation_site' OR cvterm.name = 'H3K27_monomethylation_site' OR cvterm.name = 'H3K27_trimethylation_site' OR cvterm.name = 'H3K27_dimethylation_site' OR cvterm.name = 'H3K36_monomethylation_site' OR cvterm.name = 'H3K36_dimethylation_site' OR cvterm.name = 'H3K36_trimethylation_site' OR cvterm.name = 'H3K4_monomethylation_site' OR cvterm.name = 'H3K4_trimethylation' OR cvterm.name = 'H3K4_dimethylation_site' OR cvterm.name = 'H3K79_monomethylation_site' OR cvterm.name = 'H3K79_dimethylation_site' OR cvterm.name = 'H3K79_trimethylation_site' OR cvterm.name = 'H3K9_trimethylation_site' OR cvterm.name = 'H3K9_monomethylation_site' OR cvterm.name = 'H3K9_dimethylation_site' OR cvterm.name = 'H3K9_acetylation_site' OR cvterm.name = 'H3K14_acetylation_site' OR cvterm.name = 'H3K18_acetylation_site' OR cvterm.name = 'H3K23_acylation site' OR cvterm.name = 'H3K27_acylation_site' OR cvterm.name = 'H4K16_acylation_site' OR cvterm.name = 'H4K5_acylation_site' OR cvterm.name = 'H4K8_acylation site' OR cvterm.name = 'H2B_ubiquitination_site' OR cvterm.name = 'H4K_acylation_region' OR cvterm.name = 'post_translationally_modified_region';

--- ************************************************
--- *** relation: polypeptide_metal_contact ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A binding site that, in the polypeptide  ***
--- *** molecule, interacts selectively and non- ***
--- *** covalently with metal ions.              ***
--- ************************************************
---

CREATE VIEW polypeptide_metal_contact AS
  SELECT
    feature_id AS polypeptide_metal_contact_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_calcium_ion_contact_site' OR cvterm.name = 'polypeptide_cobalt_ion_contact_site' OR cvterm.name = 'polypeptide_copper_ion_contact_site' OR cvterm.name = 'polypeptide_iron_ion_contact_site' OR cvterm.name = 'polypeptide_magnesium_ion_contact_site' OR cvterm.name = 'polypeptide_manganese_ion_contact_site' OR cvterm.name = 'polypeptide_molybdenum_ion_contact_site' OR cvterm.name = 'polypeptide_nickel_ion_contact_site' OR cvterm.name = 'polypeptide_tungsten_ion_contact_site' OR cvterm.name = 'polypeptide_zinc_ion_contact_site' OR cvterm.name = 'polypeptide_metal_contact';

--- ************************************************
--- *** relation: protein_protein_contact ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A binding site that, in the protein mole ***
--- *** cule, interacts selectively and non-cova ***
--- *** lently with polypeptide residues.        ***
--- ************************************************
---

CREATE VIEW protein_protein_contact AS
  SELECT
    feature_id AS protein_protein_contact_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'protein_protein_contact';

--- ************************************************
--- *** relation: polypeptide_calcium_ion_contact_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A binding site that, in the polypeptide  ***
--- *** molecule, interacts selectively and non- ***
--- *** covalently with calcium ions.            ***
--- ************************************************
---

CREATE VIEW polypeptide_calcium_ion_contact_site AS
  SELECT
    feature_id AS polypeptide_calcium_ion_contact_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_calcium_ion_contact_site';

--- ************************************************
--- *** relation: polypeptide_cobalt_ion_contact_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A binding site that, in the polypeptide  ***
--- *** molecule, interacts selectively and non- ***
--- *** covalently with cobalt ions.             ***
--- ************************************************
---

CREATE VIEW polypeptide_cobalt_ion_contact_site AS
  SELECT
    feature_id AS polypeptide_cobalt_ion_contact_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_cobalt_ion_contact_site';

--- ************************************************
--- *** relation: polypeptide_copper_ion_contact_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A binding site that, in the polypeptide  ***
--- *** molecule, interacts selectively and non- ***
--- *** covalently with copper ions.             ***
--- ************************************************
---

CREATE VIEW polypeptide_copper_ion_contact_site AS
  SELECT
    feature_id AS polypeptide_copper_ion_contact_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_copper_ion_contact_site';

--- ************************************************
--- *** relation: polypeptide_iron_ion_contact_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A binding site that, in the polypeptide  ***
--- *** molecule, interacts selectively and non- ***
--- *** covalently with iron ions.               ***
--- ************************************************
---

CREATE VIEW polypeptide_iron_ion_contact_site AS
  SELECT
    feature_id AS polypeptide_iron_ion_contact_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_iron_ion_contact_site';

--- ************************************************
--- *** relation: polypeptide_magnesium_ion_contact_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A binding site that, in the polypeptide  ***
--- *** molecule, interacts selectively and non- ***
--- *** covalently with magnesium ions.          ***
--- ************************************************
---

CREATE VIEW polypeptide_magnesium_ion_contact_site AS
  SELECT
    feature_id AS polypeptide_magnesium_ion_contact_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_magnesium_ion_contact_site';

--- ************************************************
--- *** relation: polypeptide_manganese_ion_contact_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A binding site that, in the polypeptide  ***
--- *** molecule, interacts selectively and non- ***
--- *** covalently with manganese ions.          ***
--- ************************************************
---

CREATE VIEW polypeptide_manganese_ion_contact_site AS
  SELECT
    feature_id AS polypeptide_manganese_ion_contact_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_manganese_ion_contact_site';

--- ************************************************
--- *** relation: polypeptide_molybdenum_ion_contact_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A binding site that, in the polypeptide  ***
--- *** molecule, interacts selectively and non- ***
--- *** covalently with molybdenum ions.         ***
--- ************************************************
---

CREATE VIEW polypeptide_molybdenum_ion_contact_site AS
  SELECT
    feature_id AS polypeptide_molybdenum_ion_contact_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_molybdenum_ion_contact_site';

--- ************************************************
--- *** relation: polypeptide_nickel_ion_contact_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A binding site that, in the polypeptide  ***
--- *** molecule, interacts selectively and non- ***
--- *** covalently with nickel ions.             ***
--- ************************************************
---

CREATE VIEW polypeptide_nickel_ion_contact_site AS
  SELECT
    feature_id AS polypeptide_nickel_ion_contact_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_nickel_ion_contact_site';

--- ************************************************
--- *** relation: polypeptide_tungsten_ion_contact_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A binding site that, in the polypeptide  ***
--- *** molecule, interacts selectively and non- ***
--- *** covalently with tungsten ions.           ***
--- ************************************************
---

CREATE VIEW polypeptide_tungsten_ion_contact_site AS
  SELECT
    feature_id AS polypeptide_tungsten_ion_contact_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_tungsten_ion_contact_site';

--- ************************************************
--- *** relation: polypeptide_zinc_ion_contact_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A binding site that, in the polypeptide  ***
--- *** molecule, interacts selectively and non- ***
--- *** covalently with zinc ions.               ***
--- ************************************************
---

CREATE VIEW polypeptide_zinc_ion_contact_site AS
  SELECT
    feature_id AS polypeptide_zinc_ion_contact_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_zinc_ion_contact_site';

--- ************************************************
--- *** relation: catalytic_residue ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Amino acid involved in the activity of a ***
--- *** n enzyme.                                ***
--- ************************************************
---

CREATE VIEW catalytic_residue AS
  SELECT
    feature_id AS catalytic_residue_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'catalytic_residue';

--- ************************************************
--- *** relation: polypeptide_ligand_contact ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Residues which interact with a ligand.   ***
--- ************************************************
---

CREATE VIEW polypeptide_ligand_contact AS
  SELECT
    feature_id AS polypeptide_ligand_contact_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_ligand_contact';

--- ************************************************
--- *** relation: asx_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A motif of five consecutive residues and ***
--- ***  two H-bonds in which: Residue(i) is Asp ***
--- *** artate or Asparagine (Asx), side-chain O ***
--- ***  of residue(i) is H-bonded to the main-c ***
--- *** hain NH of residue(i+2) or (i+3), main-c ***
--- *** hain CO of residue(i) is H-bonded to the ***
--- ***  main-chain NH of residue(i+3) or (i+4). ***
--- ************************************************
---

CREATE VIEW asx_motif AS
  SELECT
    feature_id AS asx_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'asx_motif';

--- ************************************************
--- *** relation: beta_bulge ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A motif of three residues within a beta- ***
--- *** sheet in which the main chains of two co ***
--- *** nsecutive residues are H-bonded to that  ***
--- *** of the third, and in which the dihedral  ***
--- *** angles are as follows: Residue(i): -140  ***
--- *** degrees < phi(l) -20 degrees , -90 degre ***
--- *** es < psi(l) < 40 degrees. Residue (i+1): ***
--- ***  -180 degrees < phi < -25 degrees or +12 ***
--- *** 0 degrees < phi < +180 degrees, +40 degr ***
--- *** ees < psi < +180 degrees or -180 degrees ***
--- ***  < psi < -120 degrees.                   ***
--- ************************************************
---

CREATE VIEW beta_bulge AS
  SELECT
    feature_id AS beta_bulge_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'beta_bulge';

--- ************************************************
--- *** relation: beta_bulge_loop ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A motif of three residues within a beta- ***
--- *** sheet consisting of two H-bonds. Beta bu ***
--- *** lge loops often occur at the loop ends o ***
--- *** f beta-hairpins.                         ***
--- ************************************************
---

CREATE VIEW beta_bulge_loop AS
  SELECT
    feature_id AS beta_bulge_loop_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'beta_bulge_loop_five' OR cvterm.name = 'beta_bulge_loop_six' OR cvterm.name = 'beta_bulge_loop';

--- ************************************************
--- *** relation: beta_bulge_loop_five ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A motif of three residues within a beta- ***
--- *** sheet consisting of two H-bonds in which ***
--- *** : the main-chain NH of residue(i) is H-b ***
--- *** onded to the main-chain CO of residue(i+ ***
--- *** 4), the main-chain CO of residue i is H- ***
--- *** bonded to the main-chain NH of residue(i ***
--- *** +3), these loops have an RL nest at resi ***
--- *** dues i+2 and i+3.                        ***
--- ************************************************
---

CREATE VIEW beta_bulge_loop_five AS
  SELECT
    feature_id AS beta_bulge_loop_five_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'beta_bulge_loop_five';

--- ************************************************
--- *** relation: beta_bulge_loop_six ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A motif of three residues within a beta- ***
--- *** sheet consisting of two H-bonds in which ***
--- *** : the main-chain NH of residue(i) is H-b ***
--- *** onded to the main-chain CO of residue(i+ ***
--- *** 5), the main-chain CO of residue i is H- ***
--- *** bonded to the main-chain NH of residue(i ***
--- *** +4), these loops have an RL nest at resi ***
--- *** dues i+3 and i+4.                        ***
--- ************************************************
---

CREATE VIEW beta_bulge_loop_six AS
  SELECT
    feature_id AS beta_bulge_loop_six_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'beta_bulge_loop_six';

--- ************************************************
--- *** relation: beta_strand ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A beta strand describes a single length  ***
--- *** of polypeptide chain that forms part of  ***
--- *** a beta sheet. A single continuous stretc ***
--- *** h of amino acids adopting an extended co ***
--- *** nformation of hydrogen bonds between the ***
--- ***  N-O and the C=O of another part of the  ***
--- *** peptide. This forms a secondary protein  ***
--- *** structure in which two or more extended  ***
--- *** polypeptide regions are hydrogen-bonded  ***
--- *** to one another in a planar array.        ***
--- ************************************************
---

CREATE VIEW beta_strand AS
  SELECT
    feature_id AS beta_strand_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'antiparallel_beta_strand' OR cvterm.name = 'parallel_beta_strand' OR cvterm.name = 'beta_strand';

--- ************************************************
--- *** relation: antiparallel_beta_strand ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A peptide region which hydrogen bonded t ***
--- *** o another region of peptide running in t ***
--- *** he oposite direction (one running N-term ***
--- *** inal to C-terminal and one running C-ter ***
--- *** minal to N-terminal). Hydrogen bonding o ***
--- *** ccurs between every other C=O from one s ***
--- *** trand to every other N-H on the adjacent ***
--- ***  strand. In this case, if two atoms C-al ***
--- *** pha (i) and C-alpha (j) are adjacent in  ***
--- *** two hydrogen-bonded beta strands, then t ***
--- *** hey form two mutual backbone hydrogen bo ***
--- *** nds to each other's flanking peptide gro ***
--- *** ups; this is known as a close pair of hy ***
--- *** drogen bonds. The peptide backbone dihed ***
--- *** ral angles (phi, psi) are about (-140 de ***
--- *** grees, 135 degrees) in antiparallel shee ***
--- *** ts.                                      ***
--- ************************************************
---

CREATE VIEW antiparallel_beta_strand AS
  SELECT
    feature_id AS antiparallel_beta_strand_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'antiparallel_beta_strand';

--- ************************************************
--- *** relation: parallel_beta_strand ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A peptide region which hydrogen bonded t ***
--- *** o another region of peptide running in t ***
--- *** he oposite direction (both running N-ter ***
--- *** minal to C-terminal). This orientation i ***
--- *** s slightly less stable because it introd ***
--- *** uces nonplanarity in the inter-strand hy ***
--- *** drogen bonding pattern. Hydrogen bonding ***
--- ***  occurs between every other C=O from one ***
--- ***  strand to every other N-H on the adjace ***
--- *** nt strand. In this case, if two atoms C- ***
--- *** alpha (i)and C-alpha (j) are adjacent in ***
--- ***  two hydrogen-bonded beta strands, then  ***
--- *** they do not hydrogen bond to each other; ***
--- ***  rather, one residue forms hydrogen bond ***
--- *** s to the residues that flank the other ( ***
--- *** but not vice versa). For example, residu ***
--- *** e i may form hydrogen bonds to residues  ***
--- *** j - 1 and j + 1; this is known as a wide ***
--- ***  pair of hydrogen bonds. By contrast, re ***
--- *** sidue j may hydrogen-bond to different r ***
--- *** esidues altogether, or to none at all. T ***
--- *** he dihedral angles (phi, psi) are about  ***
--- *** (-120 degrees, 115 degrees) in parallel  ***
--- *** sheets.                                  ***
--- ************************************************
---

CREATE VIEW parallel_beta_strand AS
  SELECT
    feature_id AS parallel_beta_strand_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'parallel_beta_strand';

--- ************************************************
--- *** relation: peptide_helix ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A helix is a secondary_structure conform ***
--- *** ation where the peptide backbone forms a ***
--- ***  coil.                                   ***
--- ************************************************
---

CREATE VIEW peptide_helix AS
  SELECT
    feature_id AS peptide_helix_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'left_handed_peptide_helix' OR cvterm.name = 'right_handed_peptide_helix' OR cvterm.name = 'alpha_helix' OR cvterm.name = 'pi_helix' OR cvterm.name = 'three_ten_helix' OR cvterm.name = 'peptide_helix';

--- ************************************************
--- *** relation: left_handed_peptide_helix ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A left handed helix is a region of pepti ***
--- *** de where the coiled conformation turns i ***
--- *** n an anticlockwise, left handed screw.   ***
--- ************************************************
---

CREATE VIEW left_handed_peptide_helix AS
  SELECT
    feature_id AS left_handed_peptide_helix_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'left_handed_peptide_helix';

--- ************************************************
--- *** relation: right_handed_peptide_helix ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A right handed helix is a region of pept ***
--- *** ide where the coiled conformation turns  ***
--- *** in a clockwise, right handed screw.      ***
--- ************************************************
---

CREATE VIEW right_handed_peptide_helix AS
  SELECT
    feature_id AS right_handed_peptide_helix_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'alpha_helix' OR cvterm.name = 'pi_helix' OR cvterm.name = 'three_ten_helix' OR cvterm.name = 'right_handed_peptide_helix';

--- ************************************************
--- *** relation: alpha_helix ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The helix has 3.6 residues per turn whic ***
--- *** h corersponds to a translation of 1.5 an ***
--- *** gstroms (= 0.15 nm) along the helical ax ***
--- *** is. Every backbone N-H group donates a h ***
--- *** ydrogen bond to the backbone C=O group o ***
--- *** f the amino acid four residues earlier.  ***
--- ************************************************
---

CREATE VIEW alpha_helix AS
  SELECT
    feature_id AS alpha_helix_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'alpha_helix';

--- ************************************************
--- *** relation: pi_helix ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The pi helix has 4.1 residues per turn a ***
--- *** nd a translation of 1.15  (=0.115 nm) al ***
--- *** ong the helical axis. The N-H group of a ***
--- *** n amino acid forms a hydrogen bond with  ***
--- *** the C=O group of the amino acid five res ***
--- *** idues earlier.                           ***
--- ************************************************
---

CREATE VIEW pi_helix AS
  SELECT
    feature_id AS pi_helix_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pi_helix';

--- ************************************************
--- *** relation: three_ten_helix ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The 3-10 helix has 3 residues per turn w ***
--- *** ith a translation of 2.0 angstroms (=0.2 ***
--- ***  nm) along the helical axis. The N-H gro ***
--- *** up of an amino acid forms a hydrogen bon ***
--- *** d with the C=O group of the amino acid t ***
--- *** hree residues earlier.                   ***
--- ************************************************
---

CREATE VIEW three_ten_helix AS
  SELECT
    feature_id AS three_ten_helix_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_ten_helix';

--- ************************************************
--- *** relation: polypeptide_nest_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A motif of two consecutive residues with ***
--- ***  dihedral angles. Nest should not have P ***
--- *** roline as any residue. Nests frequently  ***
--- *** occur as parts of other motifs such as S ***
--- *** chellman loops.                          ***
--- ************************************************
---

CREATE VIEW polypeptide_nest_motif AS
  SELECT
    feature_id AS polypeptide_nest_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_nest_left_right_motif' OR cvterm.name = 'polypeptide_nest_right_left_motif' OR cvterm.name = 'polypeptide_nest_motif';

--- ************************************************
--- *** relation: polypeptide_nest_left_right_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A motif of two consecutive residues with ***
--- ***  dihedral angles: Residue(i): +20 degree ***
--- *** s < phi < +140 degrees, -40 degrees < ps ***
--- *** i < +90 degrees. Residue(i+1): -140 degr ***
--- *** ees < phi < -20 degrees, -90 degrees < p ***
--- *** si < +40 degrees.                        ***
--- ************************************************
---

CREATE VIEW polypeptide_nest_left_right_motif AS
  SELECT
    feature_id AS polypeptide_nest_left_right_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_nest_left_right_motif';

--- ************************************************
--- *** relation: polypeptide_nest_right_left_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A motif of two consecutive residues with ***
--- ***  dihedral angles: Residue(i): -140 degre ***
--- *** es < phi < -20 degrees, -90 degrees < ps ***
--- *** i < +40 degrees. Residue(i+1): +20 degre ***
--- *** es < phi < +140 degrees, -40 degrees < p ***
--- *** si < +90 degrees.                        ***
--- ************************************************
---

CREATE VIEW polypeptide_nest_right_left_motif AS
  SELECT
    feature_id AS polypeptide_nest_right_left_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_nest_right_left_motif';

--- ************************************************
--- *** relation: schellmann_loop ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A motif of six or seven consecutive resi ***
--- *** dues that contains two H-bonds.          ***
--- ************************************************
---

CREATE VIEW schellmann_loop AS
  SELECT
    feature_id AS schellmann_loop_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'schellmann_loop_seven' OR cvterm.name = 'schellmann_loop_six' OR cvterm.name = 'schellmann_loop';

--- ************************************************
--- *** relation: schellmann_loop_seven ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Wild type: A motif of seven consecutive  ***
--- *** residues that contains two H-bonds in wh ***
--- *** ich: the main-chain CO of residue(i) is  ***
--- *** H-bonded to the main-chain NH of residue ***
--- *** (i+6), the main-chain CO of residue(i+1) ***
--- ***  is H-bonded to the main-chain NH of res ***
--- *** idue(i+5).                               ***
--- ************************************************
---

CREATE VIEW schellmann_loop_seven AS
  SELECT
    feature_id AS schellmann_loop_seven_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'schellmann_loop_seven';

--- ************************************************
--- *** relation: schellmann_loop_six ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Common Type: A motif of six consecutive  ***
--- *** residues that contains two H-bonds in wh ***
--- *** ich: the main-chain CO of residue(i) is  ***
--- *** H-bonded to the main-chain NH of residue ***
--- *** (i+5) the main-chain CO of residue(i+1)  ***
--- *** is H-bonded to the main-chain NH of resi ***
--- *** due(i+4).                                ***
--- ************************************************
---

CREATE VIEW schellmann_loop_six AS
  SELECT
    feature_id AS schellmann_loop_six_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'schellmann_loop_six';

--- ************************************************
--- *** relation: serine_threonine_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A motif of five consecutive residues and ***
--- ***  two hydrogen bonds in which: residue(i) ***
--- ***  is Serine (S) or Threonine (T), the sid ***
--- *** e-chain O of residue(i) is H-bonded to t ***
--- *** he main-chain NH of residue(i+2) or (i+3 ***
--- *** ) , the main-chain CO group of residue(i ***
--- *** ) is H-bonded to the main-chain NH of re ***
--- *** sidue(i+3) or (i+4).                     ***
--- ************************************************
---

CREATE VIEW serine_threonine_motif AS
  SELECT
    feature_id AS serine_threonine_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'serine_threonine_motif';

--- ************************************************
--- *** relation: serine_threonine_staple_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A motif of four or five consecutive resi ***
--- *** dues and one H-bond in which: residue(i) ***
--- ***  is Serine (S) or Threonine (T), the sid ***
--- *** e-chain OH of residue(i) is H-bonded to  ***
--- *** the main-chain CO of residue(i3) or (i4) ***
--- *** , Phi angles of residues(i1), (i2) and ( ***
--- *** i3) are negative.                        ***
--- ************************************************
---

CREATE VIEW serine_threonine_staple_motif AS
  SELECT
    feature_id AS serine_threonine_staple_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'serine_threonine_staple_motif';

--- ************************************************
--- *** relation: polypeptide_turn_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A reversal in the direction of the backb ***
--- *** one of a protein that is stabilized by h ***
--- *** ydrogen bond between backbone NH and CO  ***
--- *** groups, involving no more than 4 amino a ***
--- *** cid residues.                            ***
--- ************************************************
---

CREATE VIEW polypeptide_turn_motif AS
  SELECT
    feature_id AS polypeptide_turn_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'asx_turn' OR cvterm.name = 'beta_turn' OR cvterm.name = 'gamma_turn' OR cvterm.name = 'serine_threonine_turn' OR cvterm.name = 'asx_turn_left_handed_type_one' OR cvterm.name = 'asx_turn_left_handed_type_two' OR cvterm.name = 'asx_turn_right_handed_type_two' OR cvterm.name = 'asx_turn_right_handed_type_one' OR cvterm.name = 'beta_turn_left_handed_type_one' OR cvterm.name = 'beta_turn_left_handed_type_two' OR cvterm.name = 'beta_turn_right_handed_type_one' OR cvterm.name = 'beta_turn_right_handed_type_two' OR cvterm.name = 'beta_turn_type_six' OR cvterm.name = 'beta_turn_type_eight' OR cvterm.name = 'beta_turn_type_six_a' OR cvterm.name = 'beta_turn_type_six_b' OR cvterm.name = 'beta_turn_type_six_a_one' OR cvterm.name = 'beta_turn_type_six_a_two' OR cvterm.name = 'gamma_turn_classic' OR cvterm.name = 'gamma_turn_inverse' OR cvterm.name = 'st_turn_left_handed_type_one' OR cvterm.name = 'st_turn_left_handed_type_two' OR cvterm.name = 'st_turn_right_handed_type_one' OR cvterm.name = 'st_turn_right_handed_type_two' OR cvterm.name = 'polypeptide_turn_motif';

--- ************************************************
--- *** relation: asx_turn_left_handed_type_one ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Left handed type I (dihedral angles):- R ***
--- *** esidue(i): -140 degrees < chi (1) -120 d ***
--- *** egrees < -20 degrees, -90 degrees < psi  ***
--- *** +120 degrees < +40 degrees. Residue(i+1) ***
--- *** : -140 degrees < phi < -20 degrees, -90  ***
--- *** degrees < psi < +40 degrees.             ***
--- ************************************************
---

CREATE VIEW asx_turn_left_handed_type_one AS
  SELECT
    feature_id AS asx_turn_left_handed_type_one_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'asx_turn_left_handed_type_one';

--- ************************************************
--- *** relation: asx_turn_left_handed_type_two ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Left handed type II (dihedral angles):-  ***
--- *** Residue(i): -140 degrees < chi (1) -120  ***
--- *** degrees < -20 degrees, +80 degrees < psi ***
--- ***  +120 degrees < +180 degrees. Residue(i+ ***
--- *** 1): +20 degrees < phi < +140 degrees, -4 ***
--- *** 0 degrees < psi < +90 degrees.           ***
--- ************************************************
---

CREATE VIEW asx_turn_left_handed_type_two AS
  SELECT
    feature_id AS asx_turn_left_handed_type_two_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'asx_turn_left_handed_type_two';

--- ************************************************
--- *** relation: asx_turn_right_handed_type_two ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Right handed type II (dihedral angles):- ***
--- ***  Residue(i): -140 degrees < chi (1) -120 ***
--- ***  degrees < -20 degrees, +80 degrees < ps ***
--- *** i +120 degrees < +180 degrees. Residue(i ***
--- *** +1): +20 degrees < phi < +140 degrees, - ***
--- *** 40 degrees < psi < +90 degrees.          ***
--- ************************************************
---

CREATE VIEW asx_turn_right_handed_type_two AS
  SELECT
    feature_id AS asx_turn_right_handed_type_two_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'asx_turn_right_handed_type_two';

--- ************************************************
--- *** relation: asx_turn_right_handed_type_one ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Right handed type I (dihedral angles):-  ***
--- *** Residue(i): -140 degrees < chi (1) -120  ***
--- *** degrees < -20 degrees, -90 degrees < psi ***
--- ***  +120 degrees < +40 degrees. Residue(i+1 ***
--- *** ): -140 degrees < phi < -20 degrees, -90 ***
--- ***  degrees < psi < +40 degrees.            ***
--- ************************************************
---

CREATE VIEW asx_turn_right_handed_type_one AS
  SELECT
    feature_id AS asx_turn_right_handed_type_one_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'asx_turn_right_handed_type_one';

--- ************************************************
--- *** relation: beta_turn ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A motif of four consecutive residues tha ***
--- *** t may contain one H-bond, which, if pres ***
--- *** ent, is between the main-chain CO of the ***
--- ***  first residue and the main-chain NH of  ***
--- *** the fourth. It is characterized by the d ***
--- *** ihedral angles of the second and third r ***
--- *** esidues, which are the basis for sub-cat ***
--- *** egorization.                             ***
--- ************************************************
---

CREATE VIEW beta_turn AS
  SELECT
    feature_id AS beta_turn_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'beta_turn_left_handed_type_one' OR cvterm.name = 'beta_turn_left_handed_type_two' OR cvterm.name = 'beta_turn_right_handed_type_one' OR cvterm.name = 'beta_turn_right_handed_type_two' OR cvterm.name = 'beta_turn_type_six' OR cvterm.name = 'beta_turn_type_eight' OR cvterm.name = 'beta_turn_type_six_a' OR cvterm.name = 'beta_turn_type_six_b' OR cvterm.name = 'beta_turn_type_six_a_one' OR cvterm.name = 'beta_turn_type_six_a_two' OR cvterm.name = 'beta_turn';

--- ************************************************
--- *** relation: beta_turn_left_handed_type_one ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Left handed type I:A motif of four conse ***
--- *** cutive residues that may contain one H-b ***
--- *** ond, which, if present, is between the m ***
--- *** ain-chain CO of the first residue and th ***
--- *** e main-chain NH of the fourth. It is cha ***
--- *** racterized by the dihedral angles:- Resi ***
--- *** due(i+1): -140 degrees > phi > -20 degre ***
--- *** es, -90 degrees > psi > +40 degrees. Res ***
--- *** idue(i+2): -140 degrees > phi > -20 degr ***
--- *** ees, -90 degrees > psi > +40 degrees.    ***
--- ************************************************
---

CREATE VIEW beta_turn_left_handed_type_one AS
  SELECT
    feature_id AS beta_turn_left_handed_type_one_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'beta_turn_left_handed_type_one';

--- ************************************************
--- *** relation: beta_turn_left_handed_type_two ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Left handed type II: A motif of four con ***
--- *** secutive residues that may contain one H ***
--- *** -bond, which, if present, is between the ***
--- ***  main-chain CO of the first residue and  ***
--- *** the main-chain NH of the fourth. It is c ***
--- *** haracterized by the dihedral angles: Res ***
--- *** idue(i+1): -140 degrees > phi > -20 degr ***
--- *** ees, +80 degrees > psi > +180 degrees. R ***
--- *** esidue(i+2): +20 degrees > phi > +140 de ***
--- *** grees, -40 degrees > psi > +90 degrees.  ***
--- ************************************************
---

CREATE VIEW beta_turn_left_handed_type_two AS
  SELECT
    feature_id AS beta_turn_left_handed_type_two_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'beta_turn_left_handed_type_two';

--- ************************************************
--- *** relation: beta_turn_right_handed_type_one ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Right handed type I:A motif of four cons ***
--- *** ecutive residues that may contain one H- ***
--- *** bond, which, if present, is between the  ***
--- *** main-chain CO of the first residue and t ***
--- *** he main-chain NH of the fourth. It is ch ***
--- *** aracterized by the dihedral angles: Resi ***
--- *** due(i+1): -140 degrees < phi < -20 degre ***
--- *** es, -90 degrees < psi < +40 degrees. Res ***
--- *** idue(i+2): -140 degrees < phi < -20 degr ***
--- *** ees, -90 degrees < psi < +40 degrees.    ***
--- ************************************************
---

CREATE VIEW beta_turn_right_handed_type_one AS
  SELECT
    feature_id AS beta_turn_right_handed_type_one_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'beta_turn_right_handed_type_one';

--- ************************************************
--- *** relation: beta_turn_right_handed_type_two ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Right handed type II:A motif of four con ***
--- *** secutive residues that may contain one H ***
--- *** -bond, which, if present, is between the ***
--- ***  main-chain CO of the first residue and  ***
--- *** the main-chain NH of the fourth. It is c ***
--- *** haracterized by the dihedral angles: Res ***
--- *** idue(i+1): -140 degrees < phi < -20 degr ***
--- *** ees, +80 degrees < psi < +180 degrees. R ***
--- *** esidue(i+2): +20 degrees < phi < +140 de ***
--- *** grees, -40 degrees < psi < +90 degrees.  ***
--- ************************************************
---

CREATE VIEW beta_turn_right_handed_type_two AS
  SELECT
    feature_id AS beta_turn_right_handed_type_two_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'beta_turn_right_handed_type_two';

--- ************************************************
--- *** relation: gamma_turn ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Gamma turns, defined for 3 residues i,(  ***
--- *** i+1),( i+2) if a hydrogen bond exists be ***
--- *** tween residues i and i+2 and the phi and ***
--- ***  psi angles of residue i+1 fall within 4 ***
--- *** 0 degrees.                               ***
--- ************************************************
---

CREATE VIEW gamma_turn AS
  SELECT
    feature_id AS gamma_turn_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gamma_turn_classic' OR cvterm.name = 'gamma_turn_inverse' OR cvterm.name = 'gamma_turn';

--- ************************************************
--- *** relation: gamma_turn_classic ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Gamma turns, defined for 3 residues i, i ***
--- *** +1, i+2 if a hydrogen bond exists betwee ***
--- *** n residues i and i+2 and the phi and psi ***
--- ***  angles of residue i+1 fall within 40 de ***
--- *** grees: phi(i+1)=75.0 - psi(i+1)=-64.0.   ***
--- ************************************************
---

CREATE VIEW gamma_turn_classic AS
  SELECT
    feature_id AS gamma_turn_classic_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gamma_turn_classic';

--- ************************************************
--- *** relation: gamma_turn_inverse ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Gamma turns, defined for 3 residues i, i ***
--- *** +1, i+2 if a hydrogen bond exists betwee ***
--- *** n residues i and i+2 and the phi and psi ***
--- ***  angles of residue i+1 fall within 40 de ***
--- *** grees: phi(i+1)=-79.0 - psi(i+1)=69.0.   ***
--- ************************************************
---

CREATE VIEW gamma_turn_inverse AS
  SELECT
    feature_id AS gamma_turn_inverse_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gamma_turn_inverse';

--- ************************************************
--- *** relation: serine_threonine_turn ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A motif of three consecutive residues an ***
--- *** d one H-bond in which: residue(i) is Ser ***
--- *** ine (S) or Threonine (T), the side-chain ***
--- ***  O of residue(i) is H-bonded to the main ***
--- *** -chain NH of residue(i+2).               ***
--- ************************************************
---

CREATE VIEW serine_threonine_turn AS
  SELECT
    feature_id AS serine_threonine_turn_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'st_turn_left_handed_type_one' OR cvterm.name = 'st_turn_left_handed_type_two' OR cvterm.name = 'st_turn_right_handed_type_one' OR cvterm.name = 'st_turn_right_handed_type_two' OR cvterm.name = 'serine_threonine_turn';

--- ************************************************
--- *** relation: st_turn_left_handed_type_one ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The peptide twists in an anticlockwise,  ***
--- *** left handed manner. The dihedral angles  ***
--- *** for this turn are: Residue(i): -140 degr ***
--- *** ees < chi(1) -120 degrees < -20 degrees, ***
--- ***  -90 degrees psi +120 degrees < +40 degr ***
--- *** ees, residue(i+1): -140 degrees < phi <  ***
--- *** -20 degrees, -90 < psi < +40 degrees.    ***
--- ************************************************
---

CREATE VIEW st_turn_left_handed_type_one AS
  SELECT
    feature_id AS st_turn_left_handed_type_one_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'st_turn_left_handed_type_one';

--- ************************************************
--- *** relation: st_turn_left_handed_type_two ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The peptide twists in an anticlockwise,  ***
--- *** left handed manner. The dihedral angles  ***
--- *** for this turn are: Residue(i): -140 degr ***
--- *** ees < chi(1) -120 degrees < -20 degrees, ***
--- ***  +80 degrees psi +120 degrees < +180 deg ***
--- *** rees, residue(i+1): +20 degrees < phi <  ***
--- *** +140 degrees, -40 < psi < +90 degrees.   ***
--- ************************************************
---

CREATE VIEW st_turn_left_handed_type_two AS
  SELECT
    feature_id AS st_turn_left_handed_type_two_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'st_turn_left_handed_type_two';

--- ************************************************
--- *** relation: st_turn_right_handed_type_one ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The peptide twists in an clockwise, righ ***
--- *** t handed manner. The dihedral angles for ***
--- ***  this turn are: Residue(i): -140 degrees ***
--- ***  < chi(1) -120 degrees < -20 degrees, -9 ***
--- *** 0 degrees psi +120 degrees < +40 degrees ***
--- *** , residue(i+1): -140 degrees < phi < -20 ***
--- ***  degrees, -90 < psi < +40 degrees.       ***
--- ************************************************
---

CREATE VIEW st_turn_right_handed_type_one AS
  SELECT
    feature_id AS st_turn_right_handed_type_one_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'st_turn_right_handed_type_one';

--- ************************************************
--- *** relation: st_turn_right_handed_type_two ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The peptide twists in an clockwise, righ ***
--- *** t handed manner. The dihedral angles for ***
--- ***  this turn are: Residue(i): -140 degrees ***
--- ***  < chi(1) -120 degrees < -20 degrees, +8 ***
--- *** 0 degrees psi +120 degrees < +180 degree ***
--- *** s, residue(i+1): +20 degrees < phi < +14 ***
--- *** 0 degrees, -40 < psi < +90 degrees.      ***
--- ************************************************
---

CREATE VIEW st_turn_right_handed_type_two AS
  SELECT
    feature_id AS st_turn_right_handed_type_two_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'st_turn_right_handed_type_two';

--- ************************************************
--- *** relation: polypeptide_variation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A site of sequence variation (alteration ***
--- *** ). Alternative sequence due to naturally ***
--- ***  occuring events such as polymorphisms a ***
--- *** nd altermatve splicing or experimental m ***
--- *** ethods such as site directed mutagenesis ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW polypeptide_variation_site AS
  SELECT
    feature_id AS polypeptide_variation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'natural_variant_site' OR cvterm.name = 'mutated_variant_site' OR cvterm.name = 'alternate_sequence_site' OR cvterm.name = 'polypeptide_variation_site';

--- ************************************************
--- *** relation: natural_variant_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Describes the natural sequence variants  ***
--- *** due to polymorphisms, disease-associated ***
--- ***  mutations, RNA editing and variations b ***
--- *** etween strains, isolates or cultivars.   ***
--- ************************************************
---

CREATE VIEW natural_variant_site AS
  SELECT
    feature_id AS natural_variant_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'natural_variant_site';

--- ************************************************
--- *** relation: mutated_variant_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Site which has been experimentally alter ***
--- *** ed.                                      ***
--- ************************************************
---

CREATE VIEW mutated_variant_site AS
  SELECT
    feature_id AS mutated_variant_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mutated_variant_site';

--- ************************************************
--- *** relation: alternate_sequence_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Description of sequence variants produce ***
--- *** d by alternative splicing, alternative p ***
--- *** romoter usage, alternative initiation an ***
--- *** d ribosomal frameshifting.               ***
--- ************************************************
---

CREATE VIEW alternate_sequence_site AS
  SELECT
    feature_id AS alternate_sequence_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'alternate_sequence_site';

--- ************************************************
--- *** relation: beta_turn_type_six ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A motif of four consecutive peptide resi ***
--- *** des of type VIa or type VIb and where th ***
--- *** e i+2 residue is cis-proline.            ***
--- ************************************************
---

CREATE VIEW beta_turn_type_six AS
  SELECT
    feature_id AS beta_turn_type_six_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'beta_turn_type_six_a' OR cvterm.name = 'beta_turn_type_six_b' OR cvterm.name = 'beta_turn_type_six_a_one' OR cvterm.name = 'beta_turn_type_six_a_two' OR cvterm.name = 'beta_turn_type_six';

--- ************************************************
--- *** relation: beta_turn_type_six_a ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A motif of four consecutive peptide resi ***
--- *** dues, of which the i+2 residue is prolin ***
--- *** e, and that may contain one H-bond, whic ***
--- *** h, if present, is between the main-chain ***
--- ***  CO of the first residue and the main-ch ***
--- *** ain NH of the fourth and is characterize ***
--- *** d by the dihedral angles: Residue(i+1):  ***
--- *** phi ~ -60 degrees, psi ~ 120 degrees. Re ***
--- *** sidue(i+2): phi ~ -90 degrees, psi ~ 0 d ***
--- *** egrees.                                  ***
--- ************************************************
---

CREATE VIEW beta_turn_type_six_a AS
  SELECT
    feature_id AS beta_turn_type_six_a_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'beta_turn_type_six_a_one' OR cvterm.name = 'beta_turn_type_six_a_two' OR cvterm.name = 'beta_turn_type_six_a';

--- ************************************************
--- *** relation: beta_turn_type_six_a_one ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW beta_turn_type_six_a_one AS
  SELECT
    feature_id AS beta_turn_type_six_a_one_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'beta_turn_type_six_a_one';

--- ************************************************
--- *** relation: beta_turn_type_six_a_two ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW beta_turn_type_six_a_two AS
  SELECT
    feature_id AS beta_turn_type_six_a_two_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'beta_turn_type_six_a_two';

--- ************************************************
--- *** relation: beta_turn_type_six_b ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A motif of four consecutive peptide resi ***
--- *** dues, of which the i+2 residue is prolin ***
--- *** e, and that may contain one H-bond, whic ***
--- *** h, if present, is between the main-chain ***
--- ***  CO of the first residue and the main-ch ***
--- *** ain NH of the fourth and is characterize ***
--- *** d by the dihedral angles: Residue(i+1):  ***
--- *** phi ~ -120 degrees, psi ~ 120 degrees. R ***
--- *** esidue(i+2): phi ~ -60 degrees, psi ~ 0  ***
--- *** degrees.                                 ***
--- ************************************************
---

CREATE VIEW beta_turn_type_six_b AS
  SELECT
    feature_id AS beta_turn_type_six_b_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'beta_turn_type_six_b';

--- ************************************************
--- *** relation: beta_turn_type_eight ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A motif of four consecutive peptide resi ***
--- *** dues that may contain one H-bond, which, ***
--- ***  if present, is between the main-chain C ***
--- *** O of the first residue and the main-chai ***
--- *** n NH of the fourth and is characterized  ***
--- *** by the dihedral angles: Residue(i+1): ph ***
--- *** i ~ -60 degrees, psi ~ -30 degrees. Resi ***
--- *** due(i+2): phi ~ -120 degrees, psi ~ 120  ***
--- *** degrees.                                 ***
--- ************************************************
---

CREATE VIEW beta_turn_type_eight AS
  SELECT
    feature_id AS beta_turn_type_eight_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'beta_turn_type_eight';

--- ************************************************
--- *** relation: dre_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence element characteristic of som ***
--- *** e RNA polymerase II promoters, usually l ***
--- *** ocated between -10 and -60 relative to t ***
--- *** he TSS. Consensus sequence is WATCGATW.  ***
--- ************************************************
---

CREATE VIEW dre_motif AS
  SELECT
    feature_id AS dre_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DRE_motif';

--- ************************************************
--- *** relation: dmv4_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence element characteristic of som ***
--- *** e RNA polymerase II promoters, located i ***
--- *** mmediately upstream of some TATA box ele ***
--- *** ments with respect to the TSS (+1). Cons ***
--- *** ensus sequence is YGGTCACACTR. Marked sp ***
--- *** atial preference within core promoter; t ***
--- *** end to occur near the TSS, although not  ***
--- *** as tightly as INR (SO:0000014).          ***
--- ************************************************
---

CREATE VIEW dmv4_motif AS
  SELECT
    feature_id AS dmv4_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DMv4_motif';

--- ************************************************
--- *** relation: e_box_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence element characteristic of som ***
--- *** e RNA polymerase II promoters, usually l ***
--- *** ocated between -60 and +1 relative to th ***
--- *** e TSS. Consensus sequence is AWCAGCTGWT. ***
--- ***  Tends to co-occur with DMv2 (SO:0001161 ***
--- *** ). Tends to not occur with DPE motif (SO ***
--- *** :0000015).                               ***
--- ************************************************
---

CREATE VIEW e_box_motif AS
  SELECT
    feature_id AS e_box_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'E_box_motif';

--- ************************************************
--- *** relation: dmv5_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence element characteristic of som ***
--- *** e RNA polymerase II promoters, usually l ***
--- *** ocated between -50 and -10 relative to t ***
--- *** he TSS. Consensus sequence is KTYRGTATWT ***
--- *** TT. Tends to co-occur with DMv4 (SO:0001 ***
--- *** 157) . Tends to not occur with DPE motif ***
--- ***  (SO:0000015) or MTE (SO:0001162).       ***
--- ************************************************
---

CREATE VIEW dmv5_motif AS
  SELECT
    feature_id AS dmv5_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DMv5_motif';

--- ************************************************
--- *** relation: dmv3_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence element characteristic of som ***
--- *** e RNA polymerase II promoters, usually l ***
--- *** ocated between -30 and +15 relative to t ***
--- *** he TSS. Consensus sequence is KNNCAKCNCT ***
--- *** RNY. Tends to co-occur with DMv2 (SO:000 ***
--- *** 1161). Tends to not occur with DPE motif ***
--- ***  (SO:0000015) or MTE (0001162).          ***
--- ************************************************
---

CREATE VIEW dmv3_motif AS
  SELECT
    feature_id AS dmv3_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DMv3_motif';

--- ************************************************
--- *** relation: dmv2_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence element characteristic of som ***
--- *** e RNA polymerase II promoters, usually l ***
--- *** ocated between -60 and -45 relative to t ***
--- *** he TSS. Consensus sequence is MKSYGGCARC ***
--- *** GSYSS. Tends to co-occur with DMv3 (SO:0 ***
--- *** 001160). Tends to not occur with DPE mot ***
--- *** if (SO:0000015) or MTE (SO:0001162).     ***
--- ************************************************
---

CREATE VIEW dmv2_motif AS
  SELECT
    feature_id AS dmv2_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DMv2_motif';

--- ************************************************
--- *** relation: mte ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence element characteristic of som ***
--- *** e RNA polymerase II promoters, usually l ***
--- *** ocated between +20 and +30 relative to t ***
--- *** he TSS. Consensus sequence is CSARCSSAAC ***
--- *** GS. Tends to co-occur with INR motif (SO ***
--- *** :0000014). Tends to not occur with DPE m ***
--- *** otif (SO:0000015) or DMv5 (SO:0001159).  ***
--- ************************************************
---

CREATE VIEW mte AS
  SELECT
    feature_id AS mte_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'MTE';

--- ************************************************
--- *** relation: inr1_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A promoter motif with consensus sequence ***
--- ***  TCATTCG.                                ***
--- ************************************************
---

CREATE VIEW inr1_motif AS
  SELECT
    feature_id AS inr1_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'INR1_motif';

--- ************************************************
--- *** relation: dpe1_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A promoter motif with consensus sequence ***
--- ***  CGGACGT.                                ***
--- ************************************************
---

CREATE VIEW dpe1_motif AS
  SELECT
    feature_id AS dpe1_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DPE1_motif';

--- ************************************************
--- *** relation: dmv1_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A promoter motif with consensus sequence ***
--- ***  CARCCCT.                                ***
--- ************************************************
---

CREATE VIEW dmv1_motif AS
  SELECT
    feature_id AS dmv1_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DMv1_motif';

--- ************************************************
--- *** relation: gaga_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A non directional promoter motif with co ***
--- *** nsensus sequence GAGAGCG.                ***
--- ************************************************
---

CREATE VIEW gaga_motif AS
  SELECT
    feature_id AS gaga_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'GAGA_motif';

--- ************************************************
--- *** relation: ndm2_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A non directional promoter motif with co ***
--- *** nsensus CGMYGYCR.                        ***
--- ************************************************
---

CREATE VIEW ndm2_motif AS
  SELECT
    feature_id AS ndm2_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'NDM2_motif';

--- ************************************************
--- *** relation: ndm3_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A non directional promoter motif with co ***
--- *** nsensus sequence GAAAGCT.                ***
--- ************************************************
---

CREATE VIEW ndm3_motif AS
  SELECT
    feature_id AS ndm3_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'NDM3_motif';

--- ************************************************
--- *** relation: ds_rna_viral_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A ds_RNA_viral_sequence is a viral_seque ***
--- *** nce that is the sequence of a virus that ***
--- ***  exists as double stranded RNA.          ***
--- ************************************************
---

CREATE VIEW ds_rna_viral_sequence AS
  SELECT
    feature_id AS ds_rna_viral_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'ds_RNA_viral_sequence';

--- ************************************************
--- *** relation: polinton ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of DNA transposon that populates  ***
--- *** the genomes of protists, fungi, and anim ***
--- *** als, characterized by a unique set of pr ***
--- *** oteins necessary for their transposition ***
--- *** , including a protein-primed DNA polymer ***
--- *** ase B, retroviral integrase, cysteine pr ***
--- *** otease, and ATPase. Polintons are charac ***
--- *** terized by 6-bp target site duplications ***
--- *** , terminal-inverted repeats that are sev ***
--- *** eral hundred nucleotides long, and 5'-AG ***
--- ***  and TC-3' termini. Polintons exist as a ***
--- *** utonomous and nonautonomous elements.    ***
--- ************************************************
---

CREATE VIEW polinton AS
  SELECT
    feature_id AS polinton_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polinton';

--- ************************************************
--- *** relation: rrna_21s ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A component of the large ribosomal subun ***
--- *** it in mitochondrial rRNA.                ***
--- ************************************************
---

CREATE VIEW rrna_21s AS
  SELECT
    feature_id AS rrna_21s_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rRNA_21S';

--- ************************************************
--- *** relation: trna_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of a tRNA.                      ***
--- ************************************************
---

CREATE VIEW trna_region AS
  SELECT
    feature_id AS trna_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'anticodon_loop' OR cvterm.name = 'anticodon' OR cvterm.name = 'CCA_tail' OR cvterm.name = 'DHU_loop' OR cvterm.name = 'T_loop' OR cvterm.name = 'tRNA_region';

--- ************************************************
--- *** relation: anticodon_loop ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence of seven nucleotide bases in  ***
--- *** tRNA which contains the anticodon. It ha ***
--- *** s the sequence 5'-pyrimidine-purine-anti ***
--- *** codon-modified purine-any base-3.        ***
--- ************************************************
---

CREATE VIEW anticodon_loop AS
  SELECT
    feature_id AS anticodon_loop_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'anticodon_loop';

--- ************************************************
--- *** relation: anticodon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence of three nucleotide bases in  ***
--- *** tRNA which recognizes a codon in mRNA.   ***
--- ************************************************
---

CREATE VIEW anticodon AS
  SELECT
    feature_id AS anticodon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'anticodon';

--- ************************************************
--- *** relation: cca_tail ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Base sequence at the 3' end of a tRNA. T ***
--- *** he 3'-hydroxyl group on the terminal ade ***
--- *** nosine is the attachment point for the a ***
--- *** mino acid.                               ***
--- ************************************************
---

CREATE VIEW cca_tail AS
  SELECT
    feature_id AS cca_tail_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'CCA_tail';

--- ************************************************
--- *** relation: dhu_loop ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Non-base-paired sequence of nucleotide b ***
--- *** ases in tRNA. It contains several dihydr ***
--- *** ouracil residues.                        ***
--- ************************************************
---

CREATE VIEW dhu_loop AS
  SELECT
    feature_id AS dhu_loop_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DHU_loop';

--- ************************************************
--- *** relation: t_loop ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Non-base-paired sequence of three nucleo ***
--- *** tide bases in tRNA. It has sequence T-Ps ***
--- *** i-C.                                     ***
--- ************************************************
---

CREATE VIEW t_loop AS
  SELECT
    feature_id AS t_loop_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'T_loop';

--- ************************************************
--- *** relation: pyrrolysine_trna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding pyrrolysyl ***
--- ***  tRNA (SO:0000766).                      ***
--- ************************************************
---

CREATE VIEW pyrrolysine_trna_primary_transcript AS
  SELECT
    feature_id AS pyrrolysine_trna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pyrrolysine_tRNA_primary_transcript';

--- ************************************************
--- *** relation: u3_snorna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** U3 snoRNA is a member of the box C/D cla ***
--- *** ss of small nucleolar RNAs. The U3 snoRN ***
--- *** A secondary structure is characterised b ***
--- *** y a small 5' domain (with boxes A and A' ***
--- *** ), and a larger 3' domain (with boxes B, ***
--- ***  C, C', and D), the two domains being li ***
--- *** nked by a single-stranded hinge. Boxes B ***
--- ***  and C form the B/C motif, which appears ***
--- ***  to be exclusive to U3 snoRNAs, and boxe ***
--- *** s C' and D form the C'/D motif. The latt ***
--- *** er is functionally similar to the C/D mo ***
--- *** tifs found in other snoRNAs. The 5' doma ***
--- *** in and the hinge region act as a pre-rRN ***
--- *** A-binding domain. The 3' domain has cons ***
--- *** erved protein-binding sites. Both the bo ***
--- *** x B/C and box C'/D motifs are sufficient ***
--- ***  for nuclear retention of U3 snoRNA. The ***
--- ***  box C'/D motif is also necessary for nu ***
--- *** cleolar localization, stability and hype ***
--- *** rmethylation of U3 snoRNA. Both box B/C  ***
--- *** and C'/D motifs are involved in specific ***
--- ***  protein interactions and are necessary  ***
--- *** for the rRNA processing functions of U3  ***
--- *** snoRNA.                                  ***
--- ************************************************
---

CREATE VIEW u3_snorna AS
  SELECT
    feature_id AS u3_snorna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'U3_snoRNA';

--- ************************************************
--- *** relation: au_rich_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A cis-acting element found in the 3' UTR ***
--- ***  of some mRNA which is rich in AUUUA pen ***
--- *** tamers. Messenger RNAs bearing multiple  ***
--- *** AU-rich elements are often unstable.     ***
--- ************************************************
---

CREATE VIEW au_rich_element AS
  SELECT
    feature_id AS au_rich_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'AU_rich_element';

--- ************************************************
--- *** relation: bruno_response_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A cis-acting element found in the 3' UTR ***
--- ***  of some mRNA which is bound by the Dros ***
--- *** ophila Bruno protein and its homologs.   ***
--- ************************************************
---

CREATE VIEW bruno_response_element AS
  SELECT
    feature_id AS bruno_response_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'Bruno_response_element';

--- ************************************************
--- *** relation: iron_responsive_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A regulatory sequence found in the 5' an ***
--- *** d 3' UTRs of many mRNAs which encode iro ***
--- *** n-binding proteins. It has a hairpin str ***
--- *** ucture and is recognized by trans-acting ***
--- ***  proteins known as iron-regulatory prote ***
--- *** ins.                                     ***
--- ************************************************
---

CREATE VIEW iron_responsive_element AS
  SELECT
    feature_id AS iron_responsive_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'iron_responsive_element';

--- ************************************************
--- *** relation: morpholino_backbone ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a sequence compo ***
--- *** sed of nucleobases bound to a morpholino ***
--- ***  backbone. A morpholino backbone consist ***
--- *** s of morpholine (CHEBI:34856) rings conn ***
--- *** ected by phosphorodiamidate linkages.    ***
--- ************************************************
---

CREATE VIEW morpholino_backbone AS
  SELECT
    feature_id AS morpholino_backbone_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'morpholino_backbone';

--- ************************************************
--- *** relation: pna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a sequence compo ***
--- *** sed of peptide nucleic acid (CHEBI:48021 ***
--- *** ), a chemical consisting of nucleobases  ***
--- *** bound to a backbone composed of repeatin ***
--- *** g N-(2-aminoethyl)-glycine units linked  ***
--- *** by peptide bonds. The purine and pyrimid ***
--- *** ine bases are linked to the backbone by  ***
--- *** methylene carbonyl bonds.                ***
--- ************************************************
---

CREATE VIEW pna AS
  SELECT
    feature_id AS pna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'PNA';

--- ************************************************
--- *** relation: enzymatic ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing the sequence of  ***
--- *** a transcript that has catalytic activity ***
--- ***  with or without an associated ribonucle ***
--- *** oprotein.                                ***
--- ************************************************
---

CREATE VIEW enzymatic AS
  SELECT
    feature_id AS enzymatic_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'ribozymic' OR cvterm.name = 'enzymatic';

--- ************************************************
--- *** relation: ribozymic ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing the sequence of  ***
--- *** a transcript that has catalytic activity ***
--- ***  even without an associated ribonucleopr ***
--- *** otein.                                   ***
--- ************************************************
---

CREATE VIEW ribozymic AS
  SELECT
    feature_id AS ribozymic_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'ribozymic';

--- ************************************************
--- *** relation: pseudouridylation_guide_snorna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A snoRNA that specifies the site of pseu ***
--- *** douridylation in an RNA molecule by base ***
--- ***  pairing with a short sequence around th ***
--- *** e target residue.                        ***
--- ************************************************
---

CREATE VIEW pseudouridylation_guide_snorna AS
  SELECT
    feature_id AS pseudouridylation_guide_snorna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pseudouridylation_guide_snoRNA';

--- ************************************************
--- *** relation: lna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a sequence consi ***
--- *** sting of nucleobases attached to a repea ***
--- *** ting unit made of 'locked' deoxyribose r ***
--- *** ings connected to a phosphate backbone.  ***
--- *** The deoxyribose unit's conformation is ' ***
--- *** locked' by a 2'-C,4'-C-oxymethylene link ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW lna AS
  SELECT
    feature_id AS lna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'LNA';

--- ************************************************
--- *** relation: lna_oligo ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An oligo composed of LNA residues.       ***
--- ************************************************
---

CREATE VIEW lna_oligo AS
  SELECT
    feature_id AS lna_oligo_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'LNA_oligo';

--- ************************************************
--- *** relation: tna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a sequence consi ***
--- *** sting of nucleobases attached to a repea ***
--- *** ting unit made of threose rings connecte ***
--- *** d to a phosphate backbone.               ***
--- ************************************************
---

CREATE VIEW tna AS
  SELECT
    feature_id AS tna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'TNA';

--- ************************************************
--- *** relation: tna_oligo ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An oligo composed of TNA residues.       ***
--- ************************************************
---

CREATE VIEW tna_oligo AS
  SELECT
    feature_id AS tna_oligo_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'TNA_oligo';

--- ************************************************
--- *** relation: gna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a sequence consi ***
--- *** sting of nucleobases attached to a repea ***
--- *** ting unit made of an acyclic three-carbo ***
--- *** n propylene glycol connected to a phosph ***
--- *** ate backbone. It has two enantiomeric fo ***
--- *** rms, (R)-GNA and (S)-GNA.                ***
--- ************************************************
---

CREATE VIEW gna AS
  SELECT
    feature_id AS gna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'R_GNA' OR cvterm.name = 'S_GNA' OR cvterm.name = 'GNA';

--- ************************************************
--- *** relation: gna_oligo ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An oligo composed of GNA residues.       ***
--- ************************************************
---

CREATE VIEW gna_oligo AS
  SELECT
    feature_id AS gna_oligo_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'R_GNA_oligo' OR cvterm.name = 'S_GNA_oligo' OR cvterm.name = 'GNA_oligo';

--- ************************************************
--- *** relation: r_gna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a GNA sequence i ***
--- *** n the (R)-GNA enantiomer.                ***
--- ************************************************
---

CREATE VIEW r_gna AS
  SELECT
    feature_id AS r_gna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'R_GNA';

--- ************************************************
--- *** relation: r_gna_oligo ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An oligo composed of (R)-GNA residues.   ***
--- ************************************************
---

CREATE VIEW r_gna_oligo AS
  SELECT
    feature_id AS r_gna_oligo_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'R_GNA_oligo';

--- ************************************************
--- *** relation: s_gna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a GNA sequence i ***
--- *** n the (S)-GNA enantiomer.                ***
--- ************************************************
---

CREATE VIEW s_gna AS
  SELECT
    feature_id AS s_gna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'S_GNA';

--- ************************************************
--- *** relation: s_gna_oligo ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An oligo composed of (S)-GNA residues.   ***
--- ************************************************
---

CREATE VIEW s_gna_oligo AS
  SELECT
    feature_id AS s_gna_oligo_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'S_GNA_oligo';

--- ************************************************
--- *** relation: ds_dna_viral_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A ds_DNA_viral_sequence is a viral_seque ***
--- *** nce that is the sequence of a virus that ***
--- ***  exists as double stranded DNA.          ***
--- ************************************************
---

CREATE VIEW ds_dna_viral_sequence AS
  SELECT
    feature_id AS ds_dna_viral_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'ds_DNA_viral_sequence';

--- ************************************************
--- *** relation: ss_rna_viral_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A ss_RNA_viral_sequence is a viral_seque ***
--- *** nce that is the sequence of a virus that ***
--- ***  exists as single stranded RNA.          ***
--- ************************************************
---

CREATE VIEW ss_rna_viral_sequence AS
  SELECT
    feature_id AS ss_rna_viral_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'negative_sense_ssRNA_viral_sequence' OR cvterm.name = 'positive_sense_ssRNA_viral_sequence' OR cvterm.name = 'ambisense_ssRNA_viral_sequence' OR cvterm.name = 'ss_RNA_viral_sequence';

--- ************************************************
--- *** relation: negative_sense_ssrna_viral_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A negative_sense_RNA_viral_sequence is a ***
--- ***  ss_RNA_viral_sequence that is the seque ***
--- *** nce of a single stranded RNA virus that  ***
--- *** is complementary to mRNA and must be con ***
--- *** verted to positive sense RNA by RNA poly ***
--- *** merase before translation.               ***
--- ************************************************
---

CREATE VIEW negative_sense_ssrna_viral_sequence AS
  SELECT
    feature_id AS negative_sense_ssrna_viral_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'negative_sense_ssRNA_viral_sequence';

--- ************************************************
--- *** relation: positive_sense_ssrna_viral_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A positive_sense_RNA_viral_sequence is a ***
--- ***  ss_RNA_viral_sequence that is the seque ***
--- *** nce of a single stranded RNA virus that  ***
--- *** can be immediately translated by the hos ***
--- *** t.                                       ***
--- ************************************************
---

CREATE VIEW positive_sense_ssrna_viral_sequence AS
  SELECT
    feature_id AS positive_sense_ssrna_viral_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'positive_sense_ssRNA_viral_sequence';

--- ************************************************
--- *** relation: ambisense_ssrna_viral_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A ambisense_RNA_virus is a ss_RNA_viral_ ***
--- *** sequence that is the sequence of a singl ***
--- *** e stranded RNA virus with both messenger ***
--- ***  and anti messenger polarity.            ***
--- ************************************************
---

CREATE VIEW ambisense_ssrna_viral_sequence AS
  SELECT
    feature_id AS ambisense_ssrna_viral_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'ambisense_ssRNA_viral_sequence';

--- ************************************************
--- *** relation: rna_polymerase_promoter ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region (DNA) to which RNA polymerase b ***
--- *** inds, to begin transcription.            ***
--- ************************************************
---

CREATE VIEW rna_polymerase_promoter AS
  SELECT
    feature_id AS rna_polymerase_promoter_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RNApol_I_promoter' OR cvterm.name = 'RNApol_II_promoter' OR cvterm.name = 'RNApol_III_promoter' OR cvterm.name = 'bacterial_RNApol_promoter' OR cvterm.name = 'Phage_RNA_Polymerase_Promoter' OR cvterm.name = 'RNApol_II_core_promoter' OR cvterm.name = 'RNApol_III_promoter_type_1' OR cvterm.name = 'RNApol_III_promoter_type_2' OR cvterm.name = 'RNApol_III_promoter_type_3' OR cvterm.name = 'bacterial_RNApol_promoter_sigma_70' OR cvterm.name = 'bacterial_RNApol_promoter_sigma54' OR cvterm.name = 'SP6_RNA_Polymerase_Promoter' OR cvterm.name = 'T3_RNA_Polymerase_Promoter' OR cvterm.name = 'T7_RNA_Polymerase_Promoter' OR cvterm.name = 'RNA_polymerase_promoter';

--- ************************************************
--- *** relation: phage_rna_polymerase_promoter ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region (DNA) to which Bacteriophage RN ***
--- *** A polymerase binds, to begin transcripti ***
--- *** on.                                      ***
--- ************************************************
---

CREATE VIEW phage_rna_polymerase_promoter AS
  SELECT
    feature_id AS phage_rna_polymerase_promoter_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'SP6_RNA_Polymerase_Promoter' OR cvterm.name = 'T3_RNA_Polymerase_Promoter' OR cvterm.name = 'T7_RNA_Polymerase_Promoter' OR cvterm.name = 'Phage_RNA_Polymerase_Promoter';

--- ************************************************
--- *** relation: sp6_rna_polymerase_promoter ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region (DNA) to which the SP6 RNA poly ***
--- *** merase binds, to begin transcription.    ***
--- ************************************************
---

CREATE VIEW sp6_rna_polymerase_promoter AS
  SELECT
    feature_id AS sp6_rna_polymerase_promoter_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'SP6_RNA_Polymerase_Promoter';

--- ************************************************
--- *** relation: t3_rna_polymerase_promoter ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A DNA sequence to which the T3 RNA polym ***
--- *** erase binds, to begin transcription.     ***
--- ************************************************
---

CREATE VIEW t3_rna_polymerase_promoter AS
  SELECT
    feature_id AS t3_rna_polymerase_promoter_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'T3_RNA_Polymerase_Promoter';

--- ************************************************
--- *** relation: t7_rna_polymerase_promoter ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region (DNA) to which the T7 RNA polym ***
--- *** erase binds, to begin transcription.     ***
--- ************************************************
---

CREATE VIEW t7_rna_polymerase_promoter AS
  SELECT
    feature_id AS t7_rna_polymerase_promoter_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'T7_RNA_Polymerase_Promoter';

--- ************************************************
--- *** relation: five_prime_est ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An EST read from the 5' end of a transcr ***
--- *** ipt that usually codes for a protein. Th ***
--- *** ese regions tend to be conserved across  ***
--- *** species and do not change much within a  ***
--- *** gene family.                             ***
--- ************************************************
---

CREATE VIEW five_prime_est AS
  SELECT
    feature_id AS five_prime_est_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_EST';

--- ************************************************
--- *** relation: three_prime_est ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An EST read from the 3' end of a transcr ***
--- *** ipt. They are more likely to fall within ***
--- ***  non-coding, or untranslated regions(UTR ***
--- *** s).                                      ***
--- ************************************************
---

CREATE VIEW three_prime_est AS
  SELECT
    feature_id AS three_prime_est_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_EST';

--- ************************************************
--- *** relation: translational_frameshift ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The region of mRNA (not divisible by 3 b ***
--- *** ases) that is skipped during the process ***
--- ***  of translational frameshifting (GO:0006 ***
--- *** 452), causing the reading frame to be di ***
--- *** fferent.                                 ***
--- ************************************************
---

CREATE VIEW translational_frameshift AS
  SELECT
    feature_id AS translational_frameshift_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'plus_1_translational_frameshift' OR cvterm.name = 'plus_2_translational_frameshift' OR cvterm.name = 'translational_frameshift';

--- ************************************************
--- *** relation: plus_1_translational_frameshift ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The region of mRNA 1 base long that is s ***
--- *** kipped during the process of translation ***
--- *** al frameshifting (GO:0006452), causing t ***
--- *** he reading frame to be different.        ***
--- ************************************************
---

CREATE VIEW plus_1_translational_frameshift AS
  SELECT
    feature_id AS plus_1_translational_frameshift_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'plus_1_translational_frameshift';

--- ************************************************
--- *** relation: plus_2_translational_frameshift ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The region of mRNA 2 bases long that is  ***
--- *** skipped during the process of translatio ***
--- *** nal frameshifting (GO:0006452), causing  ***
--- *** the reading frame to be different.       ***
--- ************************************************
---

CREATE VIEW plus_2_translational_frameshift AS
  SELECT
    feature_id AS plus_2_translational_frameshift_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'plus_2_translational_frameshift';

--- ************************************************
--- *** relation: group_iii_intron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Group III introns are introns found in t ***
--- *** he mRNA of the plastids of euglenoid pro ***
--- *** tists. They are spliced by a two step tr ***
--- *** ansesterification with bulged adenosine  ***
--- *** as initiating nucleophile.               ***
--- ************************************************
---

CREATE VIEW group_iii_intron AS
  SELECT
    feature_id AS group_iii_intron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'group_III_intron';

--- ************************************************
--- *** relation: noncoding_region_of_exon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The maximal intersection of exon and UTR ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW noncoding_region_of_exon AS
  SELECT
    feature_id AS noncoding_region_of_exon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_coding_exon_noncoding_region' OR cvterm.name = 'five_prime_coding_exon_noncoding_region' OR cvterm.name = 'noncoding_region_of_exon';

--- ************************************************
--- *** relation: coding_region_of_exon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The region of an exon that encodes for p ***
--- *** rotein sequence.                         ***
--- ************************************************
---

CREATE VIEW coding_region_of_exon AS
  SELECT
    feature_id AS coding_region_of_exon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_coding_exon_coding_region' OR cvterm.name = 'three_prime_coding_exon_coding_region' OR cvterm.name = 'coding_region_of_exon';

--- ************************************************
--- *** relation: endonuclease_spliced_intron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An intron that spliced via endonucleolyt ***
--- *** ic cleavage and ligation rather than tra ***
--- *** nsesterification.                        ***
--- ************************************************
---

CREATE VIEW endonuclease_spliced_intron AS
  SELECT
    feature_id AS endonuclease_spliced_intron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'archaeal_intron' OR cvterm.name = 'tRNA_intron' OR cvterm.name = 'endonuclease_spliced_intron';

--- ************************************************
--- *** relation: protein_coding_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW protein_coding_gene AS
  SELECT
    feature_id AS protein_coding_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_with_polyadenylated_mRNA' OR cvterm.name = 'gene_with_mRNA_with_frameshift' OR cvterm.name = 'gene_with_edited_transcript' OR cvterm.name = 'gene_with_recoded_mRNA' OR cvterm.name = 'gene_with_stop_codon_read_through' OR cvterm.name = 'gene_with_mRNA_recoded_by_translational_bypass' OR cvterm.name = 'gene_with_transcript_with_translational_frameshift' OR cvterm.name = 'gene_with_stop_codon_redefined_as_pyrrolysine' OR cvterm.name = 'gene_with_stop_codon_redefined_as_selenocysteine' OR cvterm.name = 'protein_coding_gene';

--- ************************************************
--- *** relation: transgenic_insertion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An insertion that derives from another o ***
--- *** rganism, via the use of recombinant DNA  ***
--- *** technology.                              ***
--- ************************************************
---

CREATE VIEW transgenic_insertion AS
  SELECT
    feature_id AS transgenic_insertion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'transgenic_insertion';

--- ************************************************
--- *** relation: retrogene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW retrogene AS
  SELECT
    feature_id AS retrogene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'retrogene';

--- ************************************************
--- *** relation: silenced_by_rna_interference ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing an epigenetic pr ***
--- *** ocess where a gene is inactivated by RNA ***
--- ***  interference.                           ***
--- ************************************************
---

CREATE VIEW silenced_by_rna_interference AS
  SELECT
    feature_id AS silenced_by_rna_interference_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'silenced_by_RNA_interference';

--- ************************************************
--- *** relation: silenced_by_histone_modification ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing an epigenetic pr ***
--- *** ocess where a gene is inactivated by his ***
--- *** tone modification.                       ***
--- ************************************************
---

CREATE VIEW silenced_by_histone_modification AS
  SELECT
    feature_id AS silenced_by_histone_modification_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'silenced_by_histone_methylation' OR cvterm.name = 'silenced_by_histone_deacetylation' OR cvterm.name = 'silenced_by_histone_modification';

--- ************************************************
--- *** relation: silenced_by_histone_methylation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing an epigenetic pr ***
--- *** ocess where a gene is inactivated by his ***
--- *** tone methylation.                        ***
--- ************************************************
---

CREATE VIEW silenced_by_histone_methylation AS
  SELECT
    feature_id AS silenced_by_histone_methylation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'silenced_by_histone_methylation';

--- ************************************************
--- *** relation: silenced_by_histone_deacetylation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing an epigenetic pr ***
--- *** ocess where a gene is inactivated by his ***
--- *** tone deacetylation.                      ***
--- ************************************************
---

CREATE VIEW silenced_by_histone_deacetylation AS
  SELECT
    feature_id AS silenced_by_histone_deacetylation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'silenced_by_histone_deacetylation';

--- ************************************************
--- *** relation: gene_silenced_by_rna_interference ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is silenced by RNA interfere ***
--- *** nce.                                     ***
--- ************************************************
---

CREATE VIEW gene_silenced_by_rna_interference AS
  SELECT
    feature_id AS gene_silenced_by_rna_interference_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_silenced_by_RNA_interference';

--- ************************************************
--- *** relation: gene_silenced_by_histone_modification ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is silenced by histone modif ***
--- *** ication.                                 ***
--- ************************************************
---

CREATE VIEW gene_silenced_by_histone_modification AS
  SELECT
    feature_id AS gene_silenced_by_histone_modification_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_silenced_by_histone_methylation' OR cvterm.name = 'gene_silenced_by_histone_deacetylation' OR cvterm.name = 'gene_silenced_by_histone_modification';

--- ************************************************
--- *** relation: gene_silenced_by_histone_methylation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is silenced by histone methy ***
--- *** lation.                                  ***
--- ************************************************
---

CREATE VIEW gene_silenced_by_histone_methylation AS
  SELECT
    feature_id AS gene_silenced_by_histone_methylation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_silenced_by_histone_methylation';

--- ************************************************
--- *** relation: gene_silenced_by_histone_deacetylation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is silenced by histone deace ***
--- *** tylation.                                ***
--- ************************************************
---

CREATE VIEW gene_silenced_by_histone_deacetylation AS
  SELECT
    feature_id AS gene_silenced_by_histone_deacetylation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_silenced_by_histone_deacetylation';

--- ************************************************
--- *** relation: dihydrouridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A modified RNA base in which the 5,6-dih ***
--- *** ydrouracil is bound to the ribose ring.  ***
--- ************************************************
---

CREATE VIEW dihydrouridine AS
  SELECT
    feature_id AS dihydrouridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'dihydrouridine';

--- ************************************************
--- *** relation: pseudouridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A modified RNA base in which the 5- posi ***
--- *** tion of the uracil is bound to the ribos ***
--- *** e ring instead of the 4- position.       ***
--- ************************************************
---

CREATE VIEW pseudouridine AS
  SELECT
    feature_id AS pseudouridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pseudouridine';

--- ************************************************
--- *** relation: inosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A modified RNA base in which hypoxanthin ***
--- *** e is bound to the ribose ring.           ***
--- ************************************************
---

CREATE VIEW inosine AS
  SELECT
    feature_id AS inosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'modified_inosine' OR cvterm.name = 'methylinosine' OR cvterm.name = 'one_methylinosine' OR cvterm.name = 'one_two_prime_O_dimethylinosine' OR cvterm.name = 'two_prime_O_methylinosine' OR cvterm.name = 'inosine';

--- ************************************************
--- *** relation: seven_methylguanine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A modified RNA base in which guanine is  ***
--- *** methylated at the 7- position.           ***
--- ************************************************
---

CREATE VIEW seven_methylguanine AS
  SELECT
    feature_id AS seven_methylguanine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'seven_methylguanine';

--- ************************************************
--- *** relation: ribothymidine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A modified RNA base in which thymine is  ***
--- *** bound to the ribose ring.                ***
--- ************************************************
---

CREATE VIEW ribothymidine AS
  SELECT
    feature_id AS ribothymidine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'ribothymidine';

--- ************************************************
--- *** relation: methylinosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A modified RNA base in which methylhypox ***
--- *** anthine is bound to the ribose ring.     ***
--- ************************************************
---

CREATE VIEW methylinosine AS
  SELECT
    feature_id AS methylinosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'methylinosine';

--- ************************************************
--- *** relation: mobile ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a feature that h ***
--- *** as either intra-genome or intracellular  ***
--- *** mobility.                                ***
--- ************************************************
---

CREATE VIEW mobile AS
  SELECT
    feature_id AS mobile_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mobile';

--- ************************************************
--- *** relation: replicon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region containing at least one unique  ***
--- *** origin of replication and a unique termi ***
--- *** nation site.                             ***
--- ************************************************
---

CREATE VIEW replicon AS
  SELECT
    feature_id AS replicon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'plasmid' OR cvterm.name = 'chromosome' OR cvterm.name = 'vector_replicon' OR cvterm.name = 'maxicircle' OR cvterm.name = 'minicircle' OR cvterm.name = 'viral_sequence' OR cvterm.name = 'engineered_plasmid' OR cvterm.name = 'episome' OR cvterm.name = 'natural_plasmid' OR cvterm.name = 'engineered_episome' OR cvterm.name = 'gene_trap_construct' OR cvterm.name = 'promoter_trap_construct' OR cvterm.name = 'enhancer_trap_construct' OR cvterm.name = 'engineered_episome' OR cvterm.name = 'mitochondrial_chromosome' OR cvterm.name = 'chloroplast_chromosome' OR cvterm.name = 'chromoplast_chromosome' OR cvterm.name = 'cyanelle_chromosome' OR cvterm.name = 'leucoplast_chromosome' OR cvterm.name = 'macronuclear_chromosome' OR cvterm.name = 'micronuclear_chromosome' OR cvterm.name = 'nuclear_chromosome' OR cvterm.name = 'nucleomorphic_chromosome' OR cvterm.name = 'DNA_chromosome' OR cvterm.name = 'RNA_chromosome' OR cvterm.name = 'apicoplast_chromosome' OR cvterm.name = 'double_stranded_DNA_chromosome' OR cvterm.name = 'single_stranded_DNA_chromosome' OR cvterm.name = 'linear_double_stranded_DNA_chromosome' OR cvterm.name = 'circular_double_stranded_DNA_chromosome' OR cvterm.name = 'linear_single_stranded_DNA_chromosome' OR cvterm.name = 'circular_single_stranded_DNA_chromosome' OR cvterm.name = 'single_stranded_RNA_chromosome' OR cvterm.name = 'double_stranded_RNA_chromosome' OR cvterm.name = 'linear_single_stranded_RNA_chromosome' OR cvterm.name = 'circular_single_stranded_RNA_chromosome' OR cvterm.name = 'linear_double_stranded_RNA_chromosome' OR cvterm.name = 'circular_double_stranded_RNA_chromosome' OR cvterm.name = 'YAC' OR cvterm.name = 'BAC' OR cvterm.name = 'PAC' OR cvterm.name = 'cosmid' OR cvterm.name = 'phagemid' OR cvterm.name = 'fosmid' OR cvterm.name = 'lambda_vector' OR cvterm.name = 'plasmid_vector' OR cvterm.name = 'targeting_vector' OR cvterm.name = 'phage_sequence' OR cvterm.name = 'ds_RNA_viral_sequence' OR cvterm.name = 'ds_DNA_viral_sequence' OR cvterm.name = 'ss_RNA_viral_sequence' OR cvterm.name = 'negative_sense_ssRNA_viral_sequence' OR cvterm.name = 'positive_sense_ssRNA_viral_sequence' OR cvterm.name = 'ambisense_ssRNA_viral_sequence' OR cvterm.name = 'replicon';

--- ************************************************
--- *** relation: base ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A base is a sequence feature that corres ***
--- *** ponds to a single unit of a nucleotide p ***
--- *** olymer.                                  ***
--- ************************************************
---

CREATE VIEW base AS
  SELECT
    feature_id AS base_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'modified_RNA_base_feature' OR cvterm.name = 'inosine' OR cvterm.name = 'seven_methylguanine' OR cvterm.name = 'ribothymidine' OR cvterm.name = 'modified_adenosine' OR cvterm.name = 'modified_cytidine' OR cvterm.name = 'modified_guanosine' OR cvterm.name = 'modified_uridine' OR cvterm.name = 'modified_inosine' OR cvterm.name = 'methylinosine' OR cvterm.name = 'one_methylinosine' OR cvterm.name = 'one_two_prime_O_dimethylinosine' OR cvterm.name = 'two_prime_O_methylinosine' OR cvterm.name = 'one_methyladenosine' OR cvterm.name = 'two_methyladenosine' OR cvterm.name = 'N6_methyladenosine' OR cvterm.name = 'two_prime_O_methyladenosine' OR cvterm.name = 'two_methylthio_N6_methyladenosine' OR cvterm.name = 'N6_isopentenyladenosine' OR cvterm.name = 'two_methylthio_N6_isopentenyladenosine' OR cvterm.name = 'N6_cis_hydroxyisopentenyl_adenosine' OR cvterm.name = 'two_methylthio_N6_cis_hydroxyisopentenyl_adenosine' OR cvterm.name = 'N6_glycinylcarbamoyladenosine' OR cvterm.name = 'N6_threonylcarbamoyladenosine' OR cvterm.name = 'two_methylthio_N6_threonyl_carbamoyladenosine' OR cvterm.name = 'N6_methyl_N6_threonylcarbamoyladenosine' OR cvterm.name = 'N6_hydroxynorvalylcarbamoyladenosine' OR cvterm.name = 'two_methylthio_N6_hydroxynorvalyl_carbamoyladenosine' OR cvterm.name = 'two_prime_O_ribosyladenosine_phosphate' OR cvterm.name = 'N6_N6_dimethyladenosine' OR cvterm.name = 'N6_2_prime_O_dimethyladenosine' OR cvterm.name = 'N6_N6_2_prime_O_trimethyladenosine' OR cvterm.name = 'one_two_prime_O_dimethyladenosine' OR cvterm.name = 'N6_acetyladenosine' OR cvterm.name = 'three_methylcytidine' OR cvterm.name = 'five_methylcytidine' OR cvterm.name = 'two_prime_O_methylcytidine' OR cvterm.name = 'two_thiocytidine' OR cvterm.name = 'N4_acetylcytidine' OR cvterm.name = 'five_formylcytidine' OR cvterm.name = 'five_two_prime_O_dimethylcytidine' OR cvterm.name = 'N4_acetyl_2_prime_O_methylcytidine' OR cvterm.name = 'lysidine' OR cvterm.name = 'N4_methylcytidine' OR cvterm.name = 'N4_2_prime_O_dimethylcytidine' OR cvterm.name = 'five_hydroxymethylcytidine' OR cvterm.name = 'five_formyl_two_prime_O_methylcytidine' OR cvterm.name = 'N4_N4_2_prime_O_trimethylcytidine' OR cvterm.name = 'seven_deazaguanosine' OR cvterm.name = 'one_methylguanosine' OR cvterm.name = 'N2_methylguanosine' OR cvterm.name = 'seven_methylguanosine' OR cvterm.name = 'two_prime_O_methylguanosine' OR cvterm.name = 'N2_N2_dimethylguanosine' OR cvterm.name = 'N2_2_prime_O_dimethylguanosine' OR cvterm.name = 'N2_N2_2_prime_O_trimethylguanosine' OR cvterm.name = 'two_prime_O_ribosylguanosine_phosphate' OR cvterm.name = 'wybutosine' OR cvterm.name = 'peroxywybutosine' OR cvterm.name = 'hydroxywybutosine' OR cvterm.name = 'undermodified_hydroxywybutosine' OR cvterm.name = 'wyosine' OR cvterm.name = 'methylwyosine' OR cvterm.name = 'N2_7_dimethylguanosine' OR cvterm.name = 'N2_N2_7_trimethylguanosine' OR cvterm.name = 'one_two_prime_O_dimethylguanosine' OR cvterm.name = 'four_demethylwyosine' OR cvterm.name = 'isowyosine' OR cvterm.name = 'N2_7_2prirme_O_trimethylguanosine' OR cvterm.name = 'queuosine' OR cvterm.name = 'epoxyqueuosine' OR cvterm.name = 'galactosyl_queuosine' OR cvterm.name = 'mannosyl_queuosine' OR cvterm.name = 'seven_cyano_seven_deazaguanosine' OR cvterm.name = 'seven_aminomethyl_seven_deazaguanosine' OR cvterm.name = 'archaeosine' OR cvterm.name = 'dihydrouridine' OR cvterm.name = 'pseudouridine' OR cvterm.name = 'five_methyluridine' OR cvterm.name = 'two_prime_O_methyluridine' OR cvterm.name = 'five_two_prime_O_dimethyluridine' OR cvterm.name = 'one_methylpseudouridine' OR cvterm.name = 'two_prime_O_methylpseudouridine' OR cvterm.name = 'two_thiouridine' OR cvterm.name = 'four_thiouridine' OR cvterm.name = 'five_methyl_2_thiouridine' OR cvterm.name = 'two_thio_two_prime_O_methyluridine' OR cvterm.name = 'three_three_amino_three_carboxypropyl_uridine' OR cvterm.name = 'five_hydroxyuridine' OR cvterm.name = 'five_methoxyuridine' OR cvterm.name = 'uridine_five_oxyacetic_acid' OR cvterm.name = 'uridine_five_oxyacetic_acid_methyl_ester' OR cvterm.name = 'five_carboxyhydroxymethyl_uridine' OR cvterm.name = 'five_carboxyhydroxymethyl_uridine_methyl_ester' OR cvterm.name = 'five_methoxycarbonylmethyluridine' OR cvterm.name = 'five_methoxycarbonylmethyl_two_prime_O_methyluridine' OR cvterm.name = 'five_methoxycarbonylmethyl_two_thiouridine' OR cvterm.name = 'five_aminomethyl_two_thiouridine' OR cvterm.name = 'five_methylaminomethyluridine' OR cvterm.name = 'five_methylaminomethyl_two_thiouridine' OR cvterm.name = 'five_methylaminomethyl_two_selenouridine' OR cvterm.name = 'five_carbamoylmethyluridine' OR cvterm.name = 'five_carbamoylmethyl_two_prime_O_methyluridine' OR cvterm.name = 'five_carboxymethylaminomethyluridine' OR cvterm.name = 'five_carboxymethylaminomethyl_two_prime_O_methyluridine' OR cvterm.name = 'five_carboxymethylaminomethyl_two_thiouridine' OR cvterm.name = 'three_methyluridine' OR cvterm.name = 'one_methyl_three_three_amino_three_carboxypropyl_pseudouridine' OR cvterm.name = 'five_carboxymethyluridine' OR cvterm.name = 'three_two_prime_O_dimethyluridine' OR cvterm.name = 'five_methyldihydrouridine' OR cvterm.name = 'three_methylpseudouridine' OR cvterm.name = 'five_taurinomethyluridine' OR cvterm.name = 'five_taurinomethyl_two_thiouridine' OR cvterm.name = 'five_isopentenylaminomethyl_uridine' OR cvterm.name = 'five_isopentenylaminomethyl_two_thiouridine' OR cvterm.name = 'five_isopentenylaminomethyl_two_prime_O_methyluridine' OR cvterm.name = 'base';

--- ************************************************
--- *** relation: amino_acid ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence feature that corresponds to a ***
--- ***  single amino acid residue in a polypept ***
--- *** ide.                                     ***
--- ************************************************
---

CREATE VIEW amino_acid AS
  SELECT
    feature_id AS amino_acid_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'catalytic_residue' OR cvterm.name = 'modified_amino_acid_feature' OR cvterm.name = 'alanine' OR cvterm.name = 'valine' OR cvterm.name = 'leucine' OR cvterm.name = 'isoleucine' OR cvterm.name = 'proline' OR cvterm.name = 'tryptophan' OR cvterm.name = 'phenylalanine' OR cvterm.name = 'methionine' OR cvterm.name = 'glycine' OR cvterm.name = 'serine' OR cvterm.name = 'threonine' OR cvterm.name = 'tyrosine' OR cvterm.name = 'cysteine' OR cvterm.name = 'glutamine' OR cvterm.name = 'asparagine' OR cvterm.name = 'lysine' OR cvterm.name = 'arginine' OR cvterm.name = 'histidine' OR cvterm.name = 'aspartic_acid' OR cvterm.name = 'glutamic_acid' OR cvterm.name = 'selenocysteine' OR cvterm.name = 'pyrrolysine' OR cvterm.name = 'modified_glycine' OR cvterm.name = 'modified_L_alanine' OR cvterm.name = 'modified_L_asparagine' OR cvterm.name = 'modified_L_aspartic_acid' OR cvterm.name = 'modified_L_cysteine' OR cvterm.name = 'modified_L_glutamic_acid' OR cvterm.name = 'modified_L_threonine' OR cvterm.name = 'modified_L_tryptophan' OR cvterm.name = 'modified_L_glutamine' OR cvterm.name = 'modified_L_methionine' OR cvterm.name = 'modified_L_isoleucine' OR cvterm.name = 'modified_L_phenylalanine' OR cvterm.name = 'modified_L_histidine' OR cvterm.name = 'modified_L_serine' OR cvterm.name = 'modified_L_lysine' OR cvterm.name = 'modified_L_leucine' OR cvterm.name = 'modified_L_selenocysteine' OR cvterm.name = 'modified_L_valine' OR cvterm.name = 'modified_L_proline' OR cvterm.name = 'modified_L_tyrosine' OR cvterm.name = 'modified_L_arginine' OR cvterm.name = 'amino_acid';

--- ************************************************
--- *** relation: major_tss ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW major_tss AS
  SELECT
    feature_id AS major_tss_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'major_TSS';

--- ************************************************
--- *** relation: minor_tss ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW minor_tss AS
  SELECT
    feature_id AS minor_tss_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'minor_TSS';

--- ************************************************
--- *** relation: tss_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The region of a gene from the 5' most TS ***
--- *** S to the 3' TSS.                         ***
--- ************************************************
---

CREATE VIEW tss_region AS
  SELECT
    feature_id AS tss_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'TSS_region';

--- ************************************************
--- *** relation: encodes_alternate_transcription_start_sites ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW encodes_alternate_transcription_start_sites AS
  SELECT
    feature_id AS encodes_alternate_transcription_start_sites_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'encodes_alternate_transcription_start_sites';

--- ************************************************
--- *** relation: mirna_primary_transcript_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A part of an miRNA primary_transcript.   ***
--- ************************************************
---

CREATE VIEW mirna_primary_transcript_region AS
  SELECT
    feature_id AS mirna_primary_transcript_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pre_miRNA' OR cvterm.name = 'miRNA_stem' OR cvterm.name = 'miRNA_loop' OR cvterm.name = 'miRNA_antiguide' OR cvterm.name = 'miRNA_primary_transcript_region';

--- ************************************************
--- *** relation: pre_mirna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The 60-70 nucleotide region remain after ***
--- ***  Drosha processing of the primary transc ***
--- *** ript, that folds back upon itself to for ***
--- *** m a hairpin sructure.                    ***
--- ************************************************
---

CREATE VIEW pre_mirna AS
  SELECT
    feature_id AS pre_mirna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pre_miRNA';

--- ************************************************
--- *** relation: mirna_stem ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The stem of the hairpin loop formed by f ***
--- *** olding of the pre-miRNA.                 ***
--- ************************************************
---

CREATE VIEW mirna_stem AS
  SELECT
    feature_id AS mirna_stem_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'miRNA_stem';

--- ************************************************
--- *** relation: mirna_loop ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The loop of the hairpin loop formed by f ***
--- *** olding of the pre-miRNA.                 ***
--- ************************************************
---

CREATE VIEW mirna_loop AS
  SELECT
    feature_id AS mirna_loop_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'miRNA_loop';

--- ************************************************
--- *** relation: synthetic_oligo ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An oligo composed of synthetic nucleotid ***
--- *** es.                                      ***
--- ************************************************
---

CREATE VIEW synthetic_oligo AS
  SELECT
    feature_id AS synthetic_oligo_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'morpholino_oligo' OR cvterm.name = 'PNA_oligo' OR cvterm.name = 'LNA_oligo' OR cvterm.name = 'TNA_oligo' OR cvterm.name = 'GNA_oligo' OR cvterm.name = 'R_GNA_oligo' OR cvterm.name = 'S_GNA_oligo' OR cvterm.name = 'synthetic_oligo';

--- ************************************************
--- *** relation: assembly ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of the genome of known length t ***
--- *** hat is composed by ordering and aligning ***
--- ***  two or more different regions.          ***
--- ************************************************
---

CREATE VIEW assembly AS
  SELECT
    feature_id AS assembly_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'sequence_assembly' OR cvterm.name = 'fragment_assembly' OR cvterm.name = 'supercontig' OR cvterm.name = 'contig' OR cvterm.name = 'tiling_path' OR cvterm.name = 'virtual_sequence' OR cvterm.name = 'golden_path' OR cvterm.name = 'ultracontig' OR cvterm.name = 'expressed_sequence_assembly' OR cvterm.name = 'fingerprint_map' OR cvterm.name = 'STS_map' OR cvterm.name = 'RH_map' OR cvterm.name = 'assembly';

--- ************************************************
--- *** relation: fragment_assembly ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A fragment assembly is a genome assembly ***
--- ***  that orders overlapping fragments of th ***
--- *** e genome based on landmark sequences. Th ***
--- *** e base pair distance between the landmar ***
--- *** ks is known allowing additivity of lengt ***
--- *** hs.                                      ***
--- ************************************************
---

CREATE VIEW fragment_assembly AS
  SELECT
    feature_id AS fragment_assembly_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'fingerprint_map' OR cvterm.name = 'STS_map' OR cvterm.name = 'RH_map' OR cvterm.name = 'fragment_assembly';

--- ************************************************
--- *** relation: fingerprint_map ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A fingerprint_map is a physical map comp ***
--- *** osed of restriction fragments.           ***
--- ************************************************
---

CREATE VIEW fingerprint_map AS
  SELECT
    feature_id AS fingerprint_map_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'fingerprint_map';

--- ************************************************
--- *** relation: sts_map ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An STS map is a physical map organized b ***
--- *** y the unique STS landmarks.              ***
--- ************************************************
---

CREATE VIEW sts_map AS
  SELECT
    feature_id AS sts_map_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'STS_map';

--- ************************************************
--- *** relation: rh_map ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A radiation hybrid map is a physical map ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW rh_map AS
  SELECT
    feature_id AS rh_map_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RH_map';

--- ************************************************
--- *** relation: sonicate_fragment ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A DNA fragment generated by sonication.  ***
--- *** Sonication is a technique used to sheer  ***
--- *** DNA into smaller fragments.              ***
--- ************************************************
---

CREATE VIEW sonicate_fragment AS
  SELECT
    feature_id AS sonicate_fragment_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'sonicate_fragment';

--- ************************************************
--- *** relation: polyploid ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of chromosome variation where the ***
--- ***  chromosome complement is an exact multi ***
--- *** ple of the haploid number and is greater ***
--- ***  than the diploid number.                ***
--- ************************************************
---

CREATE VIEW polyploid AS
  SELECT
    feature_id AS polyploid_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'autopolyploid' OR cvterm.name = 'allopolyploid' OR cvterm.name = 'polyploid';

--- ************************************************
--- *** relation: autopolyploid ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A polyploid where the multiple chromosom ***
--- *** e set was derived from the same organism ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW autopolyploid AS
  SELECT
    feature_id AS autopolyploid_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'autopolyploid';

--- ************************************************
--- *** relation: allopolyploid ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A polyploid where the multiple chromosom ***
--- *** e set was derived from a different organ ***
--- *** ism.                                     ***
--- ************************************************
---

CREATE VIEW allopolyploid AS
  SELECT
    feature_id AS allopolyploid_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'allopolyploid';

--- ************************************************
--- *** relation: homing_endonuclease_binding_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The binding site (recognition site) of a ***
--- ***  homing endonuclease. The binding site i ***
--- *** s typically large.                       ***
--- ************************************************
---

CREATE VIEW homing_endonuclease_binding_site AS
  SELECT
    feature_id AS homing_endonuclease_binding_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'homing_endonuclease_binding_site';

--- ************************************************
--- *** relation: octamer_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence element characteristic of som ***
--- *** e RNA polymerase II promoters with seque ***
--- *** nce ATTGCAT that binds Pou-domain transc ***
--- *** ription factors.                         ***
--- ************************************************
---

CREATE VIEW octamer_motif AS
  SELECT
    feature_id AS octamer_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'octamer_motif';

--- ************************************************
--- *** relation: apicoplast_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosome originating in an apicoplas ***
--- *** t.                                       ***
--- ************************************************
---

CREATE VIEW apicoplast_chromosome AS
  SELECT
    feature_id AS apicoplast_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'apicoplast_chromosome';

--- ************************************************
--- *** relation: sequence_collection ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A collection of discontinuous sequences. ***
--- ************************************************
---

CREATE VIEW sequence_collection AS
  SELECT
    feature_id AS sequence_collection_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'kinetoplast' OR cvterm.name = 'genome' OR cvterm.name = 'contig_collection' OR cvterm.name = 'peptide_collection' OR cvterm.name = 'variant_collection' OR cvterm.name = 'kinetoplast' OR cvterm.name = 'reference_genome' OR cvterm.name = 'variant_genome' OR cvterm.name = 'chromosomally_aberrant_genome' OR cvterm.name = 'chromosome_variation' OR cvterm.name = 'allele' OR cvterm.name = 'haplotype' OR cvterm.name = 'genotype' OR cvterm.name = 'diplotype' OR cvterm.name = 'assortment_derived_variation' OR cvterm.name = 'chromosome_number_variation' OR cvterm.name = 'chromosome_structure_variation' OR cvterm.name = 'assortment_derived_duplication' OR cvterm.name = 'assortment_derived_deficiency_plus_duplication' OR cvterm.name = 'assortment_derived_deficiency' OR cvterm.name = 'assortment_derived_aneuploid' OR cvterm.name = 'aneuploid' OR cvterm.name = 'polyploid' OR cvterm.name = 'hyperploid' OR cvterm.name = 'hypoploid' OR cvterm.name = 'autopolyploid' OR cvterm.name = 'allopolyploid' OR cvterm.name = 'free_chromosome_arm' OR cvterm.name = 'chromosomal_transposition' OR cvterm.name = 'aneuploid_chromosome' OR cvterm.name = 'intrachromosomal_mutation' OR cvterm.name = 'interchromosomal_mutation' OR cvterm.name = 'chromosomal_duplication' OR cvterm.name = 'compound_chromosome' OR cvterm.name = 'autosynaptic_chromosome' OR cvterm.name = 'complex_chromosomal_mutation' OR cvterm.name = 'uncharacterised_chromosomal_mutation' OR cvterm.name = 'intrachromosomal_transposition' OR cvterm.name = 'interchromosomal_transposition' OR cvterm.name = 'deficient_intrachromosomal_transposition' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'uninverted_intrachromosomal_transposition' OR cvterm.name = 'unoriented_intrachromosomal_transposition' OR cvterm.name = 'deficient_interchromosomal_transposition' OR cvterm.name = 'inverted_interchromosomal_transposition' OR cvterm.name = 'uninverted_interchromosomal_transposition' OR cvterm.name = 'unoriented_interchromosomal_transposition' OR cvterm.name = 'inversion_derived_aneuploid_chromosome' OR cvterm.name = 'chromosomal_deletion' OR cvterm.name = 'chromosomal_inversion' OR cvterm.name = 'intrachromosomal_duplication' OR cvterm.name = 'ring_chromosome' OR cvterm.name = 'chromosome_fission' OR cvterm.name = 'deficient_intrachromosomal_transposition' OR cvterm.name = 'inversion_derived_bipartite_deficiency' OR cvterm.name = 'inversion_derived_deficiency_plus_duplication' OR cvterm.name = 'inversion_derived_deficiency_plus_aneuploid' OR cvterm.name = 'deficient_translocation' OR cvterm.name = 'deficient_inversion' OR cvterm.name = 'inverted_ring_chromosome' OR cvterm.name = 'pericentric_inversion' OR cvterm.name = 'paracentric_inversion' OR cvterm.name = 'inversion_cum_translocation' OR cvterm.name = 'bipartite_inversion' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'deficient_inversion' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'inversion_derived_deficiency_plus_duplication' OR cvterm.name = 'inversion_derived_bipartite_duplication' OR cvterm.name = 'inversion_derived_duplication_plus_aneuploid' OR cvterm.name = 'intrachromosomal_transposition' OR cvterm.name = 'bipartite_duplication' OR cvterm.name = 'deficient_intrachromosomal_transposition' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'uninverted_intrachromosomal_transposition' OR cvterm.name = 'unoriented_intrachromosomal_transposition' OR cvterm.name = 'inverted_ring_chromosome' OR cvterm.name = 'free_ring_duplication' OR cvterm.name = 'chromosomal_translocation' OR cvterm.name = 'bipartite_duplication' OR cvterm.name = 'interchromosomal_transposition' OR cvterm.name = 'translocation_element' OR cvterm.name = 'Robertsonian_fusion' OR cvterm.name = 'reciprocal_chromosomal_translocation' OR cvterm.name = 'deficient_translocation' OR cvterm.name = 'inversion_cum_translocation' OR cvterm.name = 'cyclic_translocation' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'deficient_interchromosomal_transposition' OR cvterm.name = 'inverted_interchromosomal_transposition' OR cvterm.name = 'uninverted_interchromosomal_transposition' OR cvterm.name = 'unoriented_interchromosomal_transposition' OR cvterm.name = 'interchromosomal_duplication' OR cvterm.name = 'intrachromosomal_duplication' OR cvterm.name = 'free_duplication' OR cvterm.name = 'insertional_duplication' OR cvterm.name = 'inversion_derived_deficiency_plus_duplication' OR cvterm.name = 'inversion_derived_bipartite_duplication' OR cvterm.name = 'inversion_derived_duplication_plus_aneuploid' OR cvterm.name = 'intrachromosomal_transposition' OR cvterm.name = 'bipartite_duplication' OR cvterm.name = 'deficient_intrachromosomal_transposition' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'uninverted_intrachromosomal_transposition' OR cvterm.name = 'unoriented_intrachromosomal_transposition' OR cvterm.name = 'free_ring_duplication' OR cvterm.name = 'uninverted_insertional_duplication' OR cvterm.name = 'inverted_insertional_duplication' OR cvterm.name = 'unoriented_insertional_duplication' OR cvterm.name = 'compound_chromosome_arm' OR cvterm.name = 'homo_compound_chromosome' OR cvterm.name = 'hetero_compound_chromosome' OR cvterm.name = 'dexstrosynaptic_chromosome' OR cvterm.name = 'laevosynaptic_chromosome' OR cvterm.name = 'partially_characterised_chromosomal_mutation' OR cvterm.name = 'polymorphic_sequence_variant' OR cvterm.name = 'sequence_collection';

--- ************************************************
--- *** relation: overlapping_feature_set ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A continuous region of sequence composed ***
--- ***  of the overlapping of multiple sequence ***
--- *** _features, which ultimately provides evi ***
--- *** dence for another sequence_feature.      ***
--- ************************************************
---

CREATE VIEW overlapping_feature_set AS
  SELECT
    feature_id AS overlapping_feature_set_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'overlapping_EST_set' OR cvterm.name = 'overlapping_feature_set';

--- ************************************************
--- *** relation: overlapping_est_set ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A continous experimental result region e ***
--- *** xtending the length of multiple overlapp ***
--- *** ing EST's.                               ***
--- ************************************************
---

CREATE VIEW overlapping_est_set AS
  SELECT
    feature_id AS overlapping_est_set_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'overlapping_EST_set';

--- ************************************************
--- *** relation: ncrna_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW ncrna_gene AS
  SELECT
    feature_id AS ncrna_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gRNA_gene' OR cvterm.name = 'miRNA_gene' OR cvterm.name = 'scRNA_gene' OR cvterm.name = 'snoRNA_gene' OR cvterm.name = 'snRNA_gene' OR cvterm.name = 'SRP_RNA_gene' OR cvterm.name = 'stRNA_gene' OR cvterm.name = 'tmRNA_gene' OR cvterm.name = 'tRNA_gene' OR cvterm.name = 'rRNA_gene' OR cvterm.name = 'piRNA_gene' OR cvterm.name = 'RNase_P_RNA_gene' OR cvterm.name = 'RNase_MRP_RNA_gene' OR cvterm.name = 'lincRNA_gene' OR cvterm.name = 'telomerase_RNA_gene' OR cvterm.name = 'ncRNA_gene';

--- ************************************************
--- *** relation: grna_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW grna_gene AS
  SELECT
    feature_id AS grna_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gRNA_gene';

--- ************************************************
--- *** relation: mirna_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW mirna_gene AS
  SELECT
    feature_id AS mirna_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'miRNA_gene';

--- ************************************************
--- *** relation: scrna_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW scrna_gene AS
  SELECT
    feature_id AS scrna_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'scRNA_gene';

--- ************************************************
--- *** relation: snorna_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW snorna_gene AS
  SELECT
    feature_id AS snorna_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'snoRNA_gene';

--- ************************************************
--- *** relation: snrna_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW snrna_gene AS
  SELECT
    feature_id AS snrna_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'snRNA_gene';

--- ************************************************
--- *** relation: srp_rna_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW srp_rna_gene AS
  SELECT
    feature_id AS srp_rna_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'SRP_RNA_gene';

--- ************************************************
--- *** relation: strna_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW strna_gene AS
  SELECT
    feature_id AS strna_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'stRNA_gene';

--- ************************************************
--- *** relation: tmrna_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW tmrna_gene AS
  SELECT
    feature_id AS tmrna_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tmRNA_gene';

--- ************************************************
--- *** relation: trna_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW trna_gene AS
  SELECT
    feature_id AS trna_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tRNA_gene';

--- ************************************************
--- *** relation: modified_adenosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A modified adenine is an adenine base fe ***
--- *** ature that has been altered.             ***
--- ************************************************
---

CREATE VIEW modified_adenosine AS
  SELECT
    feature_id AS modified_adenosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'one_methyladenosine' OR cvterm.name = 'two_methyladenosine' OR cvterm.name = 'N6_methyladenosine' OR cvterm.name = 'two_prime_O_methyladenosine' OR cvterm.name = 'two_methylthio_N6_methyladenosine' OR cvterm.name = 'N6_isopentenyladenosine' OR cvterm.name = 'two_methylthio_N6_isopentenyladenosine' OR cvterm.name = 'N6_cis_hydroxyisopentenyl_adenosine' OR cvterm.name = 'two_methylthio_N6_cis_hydroxyisopentenyl_adenosine' OR cvterm.name = 'N6_glycinylcarbamoyladenosine' OR cvterm.name = 'N6_threonylcarbamoyladenosine' OR cvterm.name = 'two_methylthio_N6_threonyl_carbamoyladenosine' OR cvterm.name = 'N6_methyl_N6_threonylcarbamoyladenosine' OR cvterm.name = 'N6_hydroxynorvalylcarbamoyladenosine' OR cvterm.name = 'two_methylthio_N6_hydroxynorvalyl_carbamoyladenosine' OR cvterm.name = 'two_prime_O_ribosyladenosine_phosphate' OR cvterm.name = 'N6_N6_dimethyladenosine' OR cvterm.name = 'N6_2_prime_O_dimethyladenosine' OR cvterm.name = 'N6_N6_2_prime_O_trimethyladenosine' OR cvterm.name = 'one_two_prime_O_dimethyladenosine' OR cvterm.name = 'N6_acetyladenosine' OR cvterm.name = 'modified_adenosine';

--- ************************************************
--- *** relation: modified_inosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A modified inosine is an inosine base fe ***
--- *** ature that has been altered.             ***
--- ************************************************
---

CREATE VIEW modified_inosine AS
  SELECT
    feature_id AS modified_inosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'methylinosine' OR cvterm.name = 'one_methylinosine' OR cvterm.name = 'one_two_prime_O_dimethylinosine' OR cvterm.name = 'two_prime_O_methylinosine' OR cvterm.name = 'modified_inosine';

--- ************************************************
--- *** relation: modified_cytidine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A modified cytidine is a cytidine base f ***
--- *** eature which has been altered.           ***
--- ************************************************
---

CREATE VIEW modified_cytidine AS
  SELECT
    feature_id AS modified_cytidine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_methylcytidine' OR cvterm.name = 'five_methylcytidine' OR cvterm.name = 'two_prime_O_methylcytidine' OR cvterm.name = 'two_thiocytidine' OR cvterm.name = 'N4_acetylcytidine' OR cvterm.name = 'five_formylcytidine' OR cvterm.name = 'five_two_prime_O_dimethylcytidine' OR cvterm.name = 'N4_acetyl_2_prime_O_methylcytidine' OR cvterm.name = 'lysidine' OR cvterm.name = 'N4_methylcytidine' OR cvterm.name = 'N4_2_prime_O_dimethylcytidine' OR cvterm.name = 'five_hydroxymethylcytidine' OR cvterm.name = 'five_formyl_two_prime_O_methylcytidine' OR cvterm.name = 'N4_N4_2_prime_O_trimethylcytidine' OR cvterm.name = 'modified_cytidine';

--- ************************************************
--- *** relation: modified_guanosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW modified_guanosine AS
  SELECT
    feature_id AS modified_guanosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'seven_deazaguanosine' OR cvterm.name = 'one_methylguanosine' OR cvterm.name = 'N2_methylguanosine' OR cvterm.name = 'seven_methylguanosine' OR cvterm.name = 'two_prime_O_methylguanosine' OR cvterm.name = 'N2_N2_dimethylguanosine' OR cvterm.name = 'N2_2_prime_O_dimethylguanosine' OR cvterm.name = 'N2_N2_2_prime_O_trimethylguanosine' OR cvterm.name = 'two_prime_O_ribosylguanosine_phosphate' OR cvterm.name = 'wybutosine' OR cvterm.name = 'peroxywybutosine' OR cvterm.name = 'hydroxywybutosine' OR cvterm.name = 'undermodified_hydroxywybutosine' OR cvterm.name = 'wyosine' OR cvterm.name = 'methylwyosine' OR cvterm.name = 'N2_7_dimethylguanosine' OR cvterm.name = 'N2_N2_7_trimethylguanosine' OR cvterm.name = 'one_two_prime_O_dimethylguanosine' OR cvterm.name = 'four_demethylwyosine' OR cvterm.name = 'isowyosine' OR cvterm.name = 'N2_7_2prirme_O_trimethylguanosine' OR cvterm.name = 'queuosine' OR cvterm.name = 'epoxyqueuosine' OR cvterm.name = 'galactosyl_queuosine' OR cvterm.name = 'mannosyl_queuosine' OR cvterm.name = 'seven_cyano_seven_deazaguanosine' OR cvterm.name = 'seven_aminomethyl_seven_deazaguanosine' OR cvterm.name = 'archaeosine' OR cvterm.name = 'modified_guanosine';

--- ************************************************
--- *** relation: modified_uridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW modified_uridine AS
  SELECT
    feature_id AS modified_uridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'dihydrouridine' OR cvterm.name = 'pseudouridine' OR cvterm.name = 'five_methyluridine' OR cvterm.name = 'two_prime_O_methyluridine' OR cvterm.name = 'five_two_prime_O_dimethyluridine' OR cvterm.name = 'one_methylpseudouridine' OR cvterm.name = 'two_prime_O_methylpseudouridine' OR cvterm.name = 'two_thiouridine' OR cvterm.name = 'four_thiouridine' OR cvterm.name = 'five_methyl_2_thiouridine' OR cvterm.name = 'two_thio_two_prime_O_methyluridine' OR cvterm.name = 'three_three_amino_three_carboxypropyl_uridine' OR cvterm.name = 'five_hydroxyuridine' OR cvterm.name = 'five_methoxyuridine' OR cvterm.name = 'uridine_five_oxyacetic_acid' OR cvterm.name = 'uridine_five_oxyacetic_acid_methyl_ester' OR cvterm.name = 'five_carboxyhydroxymethyl_uridine' OR cvterm.name = 'five_carboxyhydroxymethyl_uridine_methyl_ester' OR cvterm.name = 'five_methoxycarbonylmethyluridine' OR cvterm.name = 'five_methoxycarbonylmethyl_two_prime_O_methyluridine' OR cvterm.name = 'five_methoxycarbonylmethyl_two_thiouridine' OR cvterm.name = 'five_aminomethyl_two_thiouridine' OR cvterm.name = 'five_methylaminomethyluridine' OR cvterm.name = 'five_methylaminomethyl_two_thiouridine' OR cvterm.name = 'five_methylaminomethyl_two_selenouridine' OR cvterm.name = 'five_carbamoylmethyluridine' OR cvterm.name = 'five_carbamoylmethyl_two_prime_O_methyluridine' OR cvterm.name = 'five_carboxymethylaminomethyluridine' OR cvterm.name = 'five_carboxymethylaminomethyl_two_prime_O_methyluridine' OR cvterm.name = 'five_carboxymethylaminomethyl_two_thiouridine' OR cvterm.name = 'three_methyluridine' OR cvterm.name = 'one_methyl_three_three_amino_three_carboxypropyl_pseudouridine' OR cvterm.name = 'five_carboxymethyluridine' OR cvterm.name = 'three_two_prime_O_dimethyluridine' OR cvterm.name = 'five_methyldihydrouridine' OR cvterm.name = 'three_methylpseudouridine' OR cvterm.name = 'five_taurinomethyluridine' OR cvterm.name = 'five_taurinomethyl_two_thiouridine' OR cvterm.name = 'five_isopentenylaminomethyl_uridine' OR cvterm.name = 'five_isopentenylaminomethyl_two_thiouridine' OR cvterm.name = 'five_isopentenylaminomethyl_two_prime_O_methyluridine' OR cvterm.name = 'modified_uridine';

--- ************************************************
--- *** relation: one_methylinosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 1-methylinosine is a modified insosine.  ***
--- ************************************************
---

CREATE VIEW one_methylinosine AS
  SELECT
    feature_id AS one_methylinosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'one_methylinosine';

--- ************************************************
--- *** relation: one_two_prime_o_dimethylinosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 1,2'-O-dimethylinosine is a modified ino ***
--- *** sine.                                    ***
--- ************************************************
---

CREATE VIEW one_two_prime_o_dimethylinosine AS
  SELECT
    feature_id AS one_two_prime_o_dimethylinosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'one_two_prime_O_dimethylinosine';

--- ************************************************
--- *** relation: two_prime_o_methylinosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 2'-O-methylinosine is a modified inosine ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW two_prime_o_methylinosine AS
  SELECT
    feature_id AS two_prime_o_methylinosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'two_prime_O_methylinosine';

--- ************************************************
--- *** relation: three_methylcytidine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 3-methylcytidine is a modified cytidine. ***
--- ************************************************
---

CREATE VIEW three_methylcytidine AS
  SELECT
    feature_id AS three_methylcytidine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_methylcytidine';

--- ************************************************
--- *** relation: five_methylcytidine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5-methylcytidine is a modified cytidine. ***
--- ************************************************
---

CREATE VIEW five_methylcytidine AS
  SELECT
    feature_id AS five_methylcytidine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_methylcytidine';

--- ************************************************
--- *** relation: two_prime_o_methylcytidine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 2'-O-methylcytidine is a modified cytidi ***
--- *** ne.                                      ***
--- ************************************************
---

CREATE VIEW two_prime_o_methylcytidine AS
  SELECT
    feature_id AS two_prime_o_methylcytidine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'two_prime_O_methylcytidine';

--- ************************************************
--- *** relation: two_thiocytidine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 2-thiocytidine is a modified cytidine.   ***
--- ************************************************
---

CREATE VIEW two_thiocytidine AS
  SELECT
    feature_id AS two_thiocytidine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'two_thiocytidine';

--- ************************************************
--- *** relation: n4_acetylcytidine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** N4-acetylcytidine is a modified cytidine ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW n4_acetylcytidine AS
  SELECT
    feature_id AS n4_acetylcytidine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'N4_acetylcytidine';

--- ************************************************
--- *** relation: five_formylcytidine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5-formylcytidine is a modified cytidine. ***
--- ************************************************
---

CREATE VIEW five_formylcytidine AS
  SELECT
    feature_id AS five_formylcytidine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_formylcytidine';

--- ************************************************
--- *** relation: five_two_prime_o_dimethylcytidine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5,2'-O-dimethylcytidine is a modified cy ***
--- *** tidine.                                  ***
--- ************************************************
---

CREATE VIEW five_two_prime_o_dimethylcytidine AS
  SELECT
    feature_id AS five_two_prime_o_dimethylcytidine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_two_prime_O_dimethylcytidine';

--- ************************************************
--- *** relation: n4_acetyl_2_prime_o_methylcytidine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** N4-acetyl-2'-O-methylcytidine is a modif ***
--- *** ied cytidine.                            ***
--- ************************************************
---

CREATE VIEW n4_acetyl_2_prime_o_methylcytidine AS
  SELECT
    feature_id AS n4_acetyl_2_prime_o_methylcytidine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'N4_acetyl_2_prime_O_methylcytidine';

--- ************************************************
--- *** relation: lysidine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Lysidine is a modified cytidine.         ***
--- ************************************************
---

CREATE VIEW lysidine AS
  SELECT
    feature_id AS lysidine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'lysidine';

--- ************************************************
--- *** relation: n4_methylcytidine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** N4-methylcytidine is a modified cytidine ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW n4_methylcytidine AS
  SELECT
    feature_id AS n4_methylcytidine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'N4_methylcytidine';

--- ************************************************
--- *** relation: n4_2_prime_o_dimethylcytidine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** N4,2'-O-dimethylcytidine is a modified c ***
--- *** ytidine.                                 ***
--- ************************************************
---

CREATE VIEW n4_2_prime_o_dimethylcytidine AS
  SELECT
    feature_id AS n4_2_prime_o_dimethylcytidine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'N4_2_prime_O_dimethylcytidine';

--- ************************************************
--- *** relation: five_hydroxymethylcytidine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5-hydroxymethylcytidine is a modified cy ***
--- *** tidine.                                  ***
--- ************************************************
---

CREATE VIEW five_hydroxymethylcytidine AS
  SELECT
    feature_id AS five_hydroxymethylcytidine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_hydroxymethylcytidine';

--- ************************************************
--- *** relation: five_formyl_two_prime_o_methylcytidine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5-formyl-2'-O-methylcytidine is a modifi ***
--- *** ed cytidine.                             ***
--- ************************************************
---

CREATE VIEW five_formyl_two_prime_o_methylcytidine AS
  SELECT
    feature_id AS five_formyl_two_prime_o_methylcytidine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_formyl_two_prime_O_methylcytidine';

--- ************************************************
--- *** relation: n4_n4_2_prime_o_trimethylcytidine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** N4_N4_2_prime_O_trimethylcytidine is a m ***
--- *** odified cytidine.                        ***
--- ************************************************
---

CREATE VIEW n4_n4_2_prime_o_trimethylcytidine AS
  SELECT
    feature_id AS n4_n4_2_prime_o_trimethylcytidine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'N4_N4_2_prime_O_trimethylcytidine';

--- ************************************************
--- *** relation: one_methyladenosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 1_methyladenosine is a modified adenosin ***
--- *** e.                                       ***
--- ************************************************
---

CREATE VIEW one_methyladenosine AS
  SELECT
    feature_id AS one_methyladenosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'one_methyladenosine';

--- ************************************************
--- *** relation: two_methyladenosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 2_methyladenosine is a modified adenosin ***
--- *** e.                                       ***
--- ************************************************
---

CREATE VIEW two_methyladenosine AS
  SELECT
    feature_id AS two_methyladenosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'two_methyladenosine';

--- ************************************************
--- *** relation: n6_methyladenosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** N6_methyladenosine is a modified adenosi ***
--- *** ne.                                      ***
--- ************************************************
---

CREATE VIEW n6_methyladenosine AS
  SELECT
    feature_id AS n6_methyladenosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'N6_methyladenosine';

--- ************************************************
--- *** relation: two_prime_o_methyladenosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 2prime_O_methyladenosine is a modified a ***
--- *** denosine.                                ***
--- ************************************************
---

CREATE VIEW two_prime_o_methyladenosine AS
  SELECT
    feature_id AS two_prime_o_methyladenosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'two_prime_O_methyladenosine';

--- ************************************************
--- *** relation: two_methylthio_n6_methyladenosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 2_methylthio_N6_methyladenosine is a mod ***
--- *** ified adenosine.                         ***
--- ************************************************
---

CREATE VIEW two_methylthio_n6_methyladenosine AS
  SELECT
    feature_id AS two_methylthio_n6_methyladenosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'two_methylthio_N6_methyladenosine';

--- ************************************************
--- *** relation: n6_isopentenyladenosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** N6_isopentenyladenosine is a modified ad ***
--- *** enosine.                                 ***
--- ************************************************
---

CREATE VIEW n6_isopentenyladenosine AS
  SELECT
    feature_id AS n6_isopentenyladenosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'N6_isopentenyladenosine';

--- ************************************************
--- *** relation: two_methylthio_n6_isopentenyladenosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 2_methylthio_N6_isopentenyladenosine is  ***
--- *** a modified adenosine.                    ***
--- ************************************************
---

CREATE VIEW two_methylthio_n6_isopentenyladenosine AS
  SELECT
    feature_id AS two_methylthio_n6_isopentenyladenosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'two_methylthio_N6_isopentenyladenosine';

--- ************************************************
--- *** relation: n6_cis_hydroxyisopentenyl_adenosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** N6_cis_hydroxyisopentenyl_adenosine is a ***
--- ***  modified adenosine.                     ***
--- ************************************************
---

CREATE VIEW n6_cis_hydroxyisopentenyl_adenosine AS
  SELECT
    feature_id AS n6_cis_hydroxyisopentenyl_adenosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'N6_cis_hydroxyisopentenyl_adenosine';

--- ************************************************
--- *** relation: two_methylthio_n6_cis_hydroxyisopentenyl_adenosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 2_methylthio_N6_cis_hydroxyisopentenyl_a ***
--- *** denosine is a modified adenosine.        ***
--- ************************************************
---

CREATE VIEW two_methylthio_n6_cis_hydroxyisopentenyl_adenosine AS
  SELECT
    feature_id AS two_methylthio_n6_cis_hydroxyisopentenyl_adenosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'two_methylthio_N6_cis_hydroxyisopentenyl_adenosine';

--- ************************************************
--- *** relation: n6_glycinylcarbamoyladenosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** N6_glycinylcarbamoyladenosine is a modif ***
--- *** ied adenosine.                           ***
--- ************************************************
---

CREATE VIEW n6_glycinylcarbamoyladenosine AS
  SELECT
    feature_id AS n6_glycinylcarbamoyladenosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'N6_glycinylcarbamoyladenosine';

--- ************************************************
--- *** relation: n6_threonylcarbamoyladenosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** N6_threonylcarbamoyladenosine is a modif ***
--- *** ied adenosine.                           ***
--- ************************************************
---

CREATE VIEW n6_threonylcarbamoyladenosine AS
  SELECT
    feature_id AS n6_threonylcarbamoyladenosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'N6_threonylcarbamoyladenosine';

--- ************************************************
--- *** relation: two_methylthio_n6_threonyl_carbamoyladenosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 2_methylthio_N6_threonyl_carbamoyladenos ***
--- *** ine is a modified adenosine.             ***
--- ************************************************
---

CREATE VIEW two_methylthio_n6_threonyl_carbamoyladenosine AS
  SELECT
    feature_id AS two_methylthio_n6_threonyl_carbamoyladenosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'two_methylthio_N6_threonyl_carbamoyladenosine';

--- ************************************************
--- *** relation: n6_methyl_n6_threonylcarbamoyladenosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** N6_methyl_N6_threonylcarbamoyladenosine  ***
--- *** is a modified adenosine.                 ***
--- ************************************************
---

CREATE VIEW n6_methyl_n6_threonylcarbamoyladenosine AS
  SELECT
    feature_id AS n6_methyl_n6_threonylcarbamoyladenosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'N6_methyl_N6_threonylcarbamoyladenosine';

--- ************************************************
--- *** relation: n6_hydroxynorvalylcarbamoyladenosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** N6_hydroxynorvalylcarbamoyladenosine is  ***
--- *** a modified adenosine.                    ***
--- ************************************************
---

CREATE VIEW n6_hydroxynorvalylcarbamoyladenosine AS
  SELECT
    feature_id AS n6_hydroxynorvalylcarbamoyladenosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'N6_hydroxynorvalylcarbamoyladenosine';

--- ************************************************
--- *** relation: two_methylthio_n6_hydroxynorvalyl_carbamoyladenosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 2_methylthio_N6_hydroxynorvalyl_carbamoy ***
--- *** ladenosine is a modified adenosine.      ***
--- ************************************************
---

CREATE VIEW two_methylthio_n6_hydroxynorvalyl_carbamoyladenosine AS
  SELECT
    feature_id AS two_methylthio_n6_hydroxynorvalyl_carbamoyladenosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'two_methylthio_N6_hydroxynorvalyl_carbamoyladenosine';

--- ************************************************
--- *** relation: two_prime_o_riboA_phosphate ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 2prime_O_ribosyladenosine_phosphate is a ***
--- ***  modified adenosine.                     ***
--- ************************************************
---

CREATE VIEW two_prime_o_riboA_phosphate AS
  SELECT
    feature_id AS two_prime_o_riboA_phosphate_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'two_prime_O_ribosyladenosine_phosphate';

--- ************************************************
--- *** relation: n6_n6_dimethyladenosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** N6_N6_dimethyladenosine is a modified ad ***
--- *** enosine.                                 ***
--- ************************************************
---

CREATE VIEW n6_n6_dimethyladenosine AS
  SELECT
    feature_id AS n6_n6_dimethyladenosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'N6_N6_dimethyladenosine';

--- ************************************************
--- *** relation: n6_2_prime_o_dimethyladenosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** N6_2prime_O_dimethyladenosine is a modif ***
--- *** ied adenosine.                           ***
--- ************************************************
---

CREATE VIEW n6_2_prime_o_dimethyladenosine AS
  SELECT
    feature_id AS n6_2_prime_o_dimethyladenosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'N6_2_prime_O_dimethyladenosine';

--- ************************************************
--- *** relation: n6_n6_2_prime_o_trimethyladenosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** N6_N6_2prime_O_trimethyladenosine is a m ***
--- *** odified adenosine.                       ***
--- ************************************************
---

CREATE VIEW n6_n6_2_prime_o_trimethyladenosine AS
  SELECT
    feature_id AS n6_n6_2_prime_o_trimethyladenosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'N6_N6_2_prime_O_trimethyladenosine';

--- ************************************************
--- *** relation: one_two_prime_o_dimethyladenosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 1,2'-O-dimethyladenosine is a modified a ***
--- *** denosine.                                ***
--- ************************************************
---

CREATE VIEW one_two_prime_o_dimethyladenosine AS
  SELECT
    feature_id AS one_two_prime_o_dimethyladenosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'one_two_prime_O_dimethyladenosine';

--- ************************************************
--- *** relation: n6_acetyladenosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** N6_acetyladenosine is a modified adenosi ***
--- *** ne.                                      ***
--- ************************************************
---

CREATE VIEW n6_acetyladenosine AS
  SELECT
    feature_id AS n6_acetyladenosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'N6_acetyladenosine';

--- ************************************************
--- *** relation: seven_deazaguanosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 7-deazaguanosine is a moddified guanosin ***
--- *** e.                                       ***
--- ************************************************
---

CREATE VIEW seven_deazaguanosine AS
  SELECT
    feature_id AS seven_deazaguanosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'queuosine' OR cvterm.name = 'epoxyqueuosine' OR cvterm.name = 'galactosyl_queuosine' OR cvterm.name = 'mannosyl_queuosine' OR cvterm.name = 'seven_cyano_seven_deazaguanosine' OR cvterm.name = 'seven_aminomethyl_seven_deazaguanosine' OR cvterm.name = 'archaeosine' OR cvterm.name = 'seven_deazaguanosine';

--- ************************************************
--- *** relation: queuosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Queuosine is a modified 7-deazoguanosine ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW queuosine AS
  SELECT
    feature_id AS queuosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'queuosine';

--- ************************************************
--- *** relation: epoxyqueuosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Epoxyqueuosine is a modified 7-deazoguan ***
--- *** osine.                                   ***
--- ************************************************
---

CREATE VIEW epoxyqueuosine AS
  SELECT
    feature_id AS epoxyqueuosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'epoxyqueuosine';

--- ************************************************
--- *** relation: galactosyl_queuosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Galactosyl_queuosine is a modified 7-dea ***
--- *** zoguanosine.                             ***
--- ************************************************
---

CREATE VIEW galactosyl_queuosine AS
  SELECT
    feature_id AS galactosyl_queuosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'galactosyl_queuosine';

--- ************************************************
--- *** relation: mannosyl_queuosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Mannosyl_queuosine is a modified 7-deazo ***
--- *** guanosine.                               ***
--- ************************************************
---

CREATE VIEW mannosyl_queuosine AS
  SELECT
    feature_id AS mannosyl_queuosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mannosyl_queuosine';

--- ************************************************
--- *** relation: seven_cyano_seven_deazaguanosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 7_cyano_7_deazaguanosine is a modified 7 ***
--- *** -deazoguanosine.                         ***
--- ************************************************
---

CREATE VIEW seven_cyano_seven_deazaguanosine AS
  SELECT
    feature_id AS seven_cyano_seven_deazaguanosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'seven_cyano_seven_deazaguanosine';

--- ************************************************
--- *** relation: seven_aminomethyl_seven_deazaguanosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 7_aminomethyl_7_deazaguanosine is a modi ***
--- *** fied 7-deazoguanosine.                   ***
--- ************************************************
---

CREATE VIEW seven_aminomethyl_seven_deazaguanosine AS
  SELECT
    feature_id AS seven_aminomethyl_seven_deazaguanosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'seven_aminomethyl_seven_deazaguanosine';

--- ************************************************
--- *** relation: archaeosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Archaeosine is a modified 7-deazoguanosi ***
--- *** ne.                                      ***
--- ************************************************
---

CREATE VIEW archaeosine AS
  SELECT
    feature_id AS archaeosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'archaeosine';

--- ************************************************
--- *** relation: one_methylguanosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 1_methylguanosine is a modified guanosin ***
--- *** e base feature.                          ***
--- ************************************************
---

CREATE VIEW one_methylguanosine AS
  SELECT
    feature_id AS one_methylguanosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'one_methylguanosine';

--- ************************************************
--- *** relation: n2_methylguanosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** N2_methylguanosine is a modified guanosi ***
--- *** ne base feature.                         ***
--- ************************************************
---

CREATE VIEW n2_methylguanosine AS
  SELECT
    feature_id AS n2_methylguanosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'N2_methylguanosine';

--- ************************************************
--- *** relation: seven_methylguanosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 7_methylguanosine is a modified guanosin ***
--- *** e base feature.                          ***
--- ************************************************
---

CREATE VIEW seven_methylguanosine AS
  SELECT
    feature_id AS seven_methylguanosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'seven_methylguanosine';

--- ************************************************
--- *** relation: two_prime_o_methylguanosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 2prime_O_methylguanosine is a modified g ***
--- *** uanosine base feature.                   ***
--- ************************************************
---

CREATE VIEW two_prime_o_methylguanosine AS
  SELECT
    feature_id AS two_prime_o_methylguanosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'two_prime_O_methylguanosine';

--- ************************************************
--- *** relation: n2_n2_dimethylguanosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** N2_N2_dimethylguanosine is a modified gu ***
--- *** anosine base feature.                    ***
--- ************************************************
---

CREATE VIEW n2_n2_dimethylguanosine AS
  SELECT
    feature_id AS n2_n2_dimethylguanosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'N2_N2_dimethylguanosine';

--- ************************************************
--- *** relation: n2_2_prime_o_dimethylguanosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** N2_2prime_O_dimethylguanosine is a modif ***
--- *** ied guanosine base feature.              ***
--- ************************************************
---

CREATE VIEW n2_2_prime_o_dimethylguanosine AS
  SELECT
    feature_id AS n2_2_prime_o_dimethylguanosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'N2_2_prime_O_dimethylguanosine';

--- ************************************************
--- *** relation: n2_n2_2_prime_o_trimethylguanosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** N2_N2_2prime_O_trimethylguanosine is a m ***
--- *** odified guanosine base feature.          ***
--- ************************************************
---

CREATE VIEW n2_n2_2_prime_o_trimethylguanosine AS
  SELECT
    feature_id AS n2_n2_2_prime_o_trimethylguanosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'N2_N2_2_prime_O_trimethylguanosine';

--- ************************************************
--- *** relation: two_prime_o_ribosylguanosine_phosphate ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 2prime_O_ribosylguanosine_phosphate is a ***
--- ***  modified guanosine base feature.        ***
--- ************************************************
---

CREATE VIEW two_prime_o_ribosylguanosine_phosphate AS
  SELECT
    feature_id AS two_prime_o_ribosylguanosine_phosphate_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'two_prime_O_ribosylguanosine_phosphate';

--- ************************************************
--- *** relation: wybutosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Wybutosine is a modified guanosine base  ***
--- *** feature.                                 ***
--- ************************************************
---

CREATE VIEW wybutosine AS
  SELECT
    feature_id AS wybutosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'wybutosine';

--- ************************************************
--- *** relation: peroxywybutosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Peroxywybutosine is a modified guanosine ***
--- ***  base feature.                           ***
--- ************************************************
---

CREATE VIEW peroxywybutosine AS
  SELECT
    feature_id AS peroxywybutosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'peroxywybutosine';

--- ************************************************
--- *** relation: hydroxywybutosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Hydroxywybutosine is a modified guanosin ***
--- *** e base feature.                          ***
--- ************************************************
---

CREATE VIEW hydroxywybutosine AS
  SELECT
    feature_id AS hydroxywybutosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'hydroxywybutosine';

--- ************************************************
--- *** relation: undermodified_hydroxywybutosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Undermodified_hydroxywybutosine is a mod ***
--- *** ified guanosine base feature.            ***
--- ************************************************
---

CREATE VIEW undermodified_hydroxywybutosine AS
  SELECT
    feature_id AS undermodified_hydroxywybutosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'undermodified_hydroxywybutosine';

--- ************************************************
--- *** relation: wyosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Wyosine is a modified guanosine base fea ***
--- *** ture.                                    ***
--- ************************************************
---

CREATE VIEW wyosine AS
  SELECT
    feature_id AS wyosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'wyosine';

--- ************************************************
--- *** relation: methylwyosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Methylwyosine is a modified guanosine ba ***
--- *** se feature.                              ***
--- ************************************************
---

CREATE VIEW methylwyosine AS
  SELECT
    feature_id AS methylwyosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'methylwyosine';

--- ************************************************
--- *** relation: n2_7_dimethylguanosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** N2_7_dimethylguanosine is a modified gua ***
--- *** nosine base feature.                     ***
--- ************************************************
---

CREATE VIEW n2_7_dimethylguanosine AS
  SELECT
    feature_id AS n2_7_dimethylguanosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'N2_7_dimethylguanosine';

--- ************************************************
--- *** relation: n2_n2_7_trimethylguanosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** N2_N2_7_trimethylguanosine is a modified ***
--- ***  guanosine base feature.                 ***
--- ************************************************
---

CREATE VIEW n2_n2_7_trimethylguanosine AS
  SELECT
    feature_id AS n2_n2_7_trimethylguanosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'N2_N2_7_trimethylguanosine';

--- ************************************************
--- *** relation: one_two_prime_o_dimethylguanosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 1_2prime_O_dimethylguanosine is a modifi ***
--- *** ed guanosine base feature.               ***
--- ************************************************
---

CREATE VIEW one_two_prime_o_dimethylguanosine AS
  SELECT
    feature_id AS one_two_prime_o_dimethylguanosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'one_two_prime_O_dimethylguanosine';

--- ************************************************
--- *** relation: four_demethylwyosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 4_demethylwyosine is a modified guanosin ***
--- *** e base feature.                          ***
--- ************************************************
---

CREATE VIEW four_demethylwyosine AS
  SELECT
    feature_id AS four_demethylwyosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'four_demethylwyosine';

--- ************************************************
--- *** relation: isowyosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Isowyosine is a modified guanosine base  ***
--- *** feature.                                 ***
--- ************************************************
---

CREATE VIEW isowyosine AS
  SELECT
    feature_id AS isowyosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'isowyosine';

--- ************************************************
--- *** relation: n2_7_2prirme_o_trimethylguanosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** N2_7_2prirme_O_trimethylguanosine is a m ***
--- *** odified guanosine base feature.          ***
--- ************************************************
---

CREATE VIEW n2_7_2prirme_o_trimethylguanosine AS
  SELECT
    feature_id AS n2_7_2prirme_o_trimethylguanosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'N2_7_2prirme_O_trimethylguanosine';

--- ************************************************
--- *** relation: five_methyluridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5_methyluridine is a modified uridine ba ***
--- *** se feature.                              ***
--- ************************************************
---

CREATE VIEW five_methyluridine AS
  SELECT
    feature_id AS five_methyluridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_methyluridine';

--- ************************************************
--- *** relation: two_prime_o_methyluridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 2prime_O_methyluridine is a modified uri ***
--- *** dine base feature.                       ***
--- ************************************************
---

CREATE VIEW two_prime_o_methyluridine AS
  SELECT
    feature_id AS two_prime_o_methyluridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'two_prime_O_methyluridine';

--- ************************************************
--- *** relation: five_two_prime_o_dimethyluridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5_2_prime_O_dimethyluridine is a modifie ***
--- *** d uridine base feature.                  ***
--- ************************************************
---

CREATE VIEW five_two_prime_o_dimethyluridine AS
  SELECT
    feature_id AS five_two_prime_o_dimethyluridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_two_prime_O_dimethyluridine';

--- ************************************************
--- *** relation: one_methylpseudouridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 1_methylpseudouridine is a modified urid ***
--- *** ine base feature.                        ***
--- ************************************************
---

CREATE VIEW one_methylpseudouridine AS
  SELECT
    feature_id AS one_methylpseudouridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'one_methylpseudouridine';

--- ************************************************
--- *** relation: two_prime_o_methylpseudouridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 2prime_O_methylpseudouridine is a modifi ***
--- *** ed uridine base feature.                 ***
--- ************************************************
---

CREATE VIEW two_prime_o_methylpseudouridine AS
  SELECT
    feature_id AS two_prime_o_methylpseudouridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'two_prime_O_methylpseudouridine';

--- ************************************************
--- *** relation: two_thiouridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 2_thiouridine is a modified uridine base ***
--- ***  feature.                                ***
--- ************************************************
---

CREATE VIEW two_thiouridine AS
  SELECT
    feature_id AS two_thiouridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'two_thiouridine';

--- ************************************************
--- *** relation: four_thiouridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 4_thiouridine is a modified uridine base ***
--- ***  feature.                                ***
--- ************************************************
---

CREATE VIEW four_thiouridine AS
  SELECT
    feature_id AS four_thiouridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'four_thiouridine';

--- ************************************************
--- *** relation: five_methyl_2_thiouridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5_methyl_2_thiouridine is a modified uri ***
--- *** dine base feature.                       ***
--- ************************************************
---

CREATE VIEW five_methyl_2_thiouridine AS
  SELECT
    feature_id AS five_methyl_2_thiouridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_methyl_2_thiouridine';

--- ************************************************
--- *** relation: two_thio_two_prime_o_methyluridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 2_thio_2prime_O_methyluridine is a modif ***
--- *** ied uridine base feature.                ***
--- ************************************************
---

CREATE VIEW two_thio_two_prime_o_methyluridine AS
  SELECT
    feature_id AS two_thio_two_prime_o_methyluridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'two_thio_two_prime_O_methyluridine';

--- ************************************************
--- *** relation: three_three_amino_three_carboxypropyl_uridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 3_3_amino_3_carboxypropyl_uridine is a m ***
--- *** odified uridine base feature.            ***
--- ************************************************
---

CREATE VIEW three_three_amino_three_carboxypropyl_uridine AS
  SELECT
    feature_id AS three_three_amino_three_carboxypropyl_uridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_three_amino_three_carboxypropyl_uridine';

--- ************************************************
--- *** relation: five_hydroxyuridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5_hydroxyuridine is a modified uridine b ***
--- *** ase feature.                             ***
--- ************************************************
---

CREATE VIEW five_hydroxyuridine AS
  SELECT
    feature_id AS five_hydroxyuridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_hydroxyuridine';

--- ************************************************
--- *** relation: five_methoxyuridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5_methoxyuridine is a modified uridine b ***
--- *** ase feature.                             ***
--- ************************************************
---

CREATE VIEW five_methoxyuridine AS
  SELECT
    feature_id AS five_methoxyuridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_methoxyuridine';

--- ************************************************
--- *** relation: uridine_five_oxyacetic_acid ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Uridine_5_oxyacetic_acid is a modified u ***
--- *** ridine base feature.                     ***
--- ************************************************
---

CREATE VIEW uridine_five_oxyacetic_acid AS
  SELECT
    feature_id AS uridine_five_oxyacetic_acid_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'uridine_five_oxyacetic_acid';

--- ************************************************
--- *** relation: uridine_five_oxyacetic_acid_methyl_ester ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Uridine_5_oxyacetic_acid_methyl_ester is ***
--- ***  a modified uridine base feature.        ***
--- ************************************************
---

CREATE VIEW uridine_five_oxyacetic_acid_methyl_ester AS
  SELECT
    feature_id AS uridine_five_oxyacetic_acid_methyl_ester_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'uridine_five_oxyacetic_acid_methyl_ester';

--- ************************************************
--- *** relation: five_carboxyhydroxymethyl_uridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5_carboxyhydroxymethyl_uridine is a modi ***
--- *** fied uridine base feature.               ***
--- ************************************************
---

CREATE VIEW five_carboxyhydroxymethyl_uridine AS
  SELECT
    feature_id AS five_carboxyhydroxymethyl_uridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_carboxyhydroxymethyl_uridine';

--- ************************************************
--- *** relation: five_carboxyhydroxymethyl_uridine_methyl_ester ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5_carboxyhydroxymethyl_uridine_methyl_es ***
--- *** ter is a modified uridine base feature.  ***
--- ************************************************
---

CREATE VIEW five_carboxyhydroxymethyl_uridine_methyl_ester AS
  SELECT
    feature_id AS five_carboxyhydroxymethyl_uridine_methyl_ester_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_carboxyhydroxymethyl_uridine_methyl_ester';

--- ************************************************
--- *** relation: five_methoxycarbonylmethyluridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Five_methoxycarbonylmethyluridine is a m ***
--- *** odified uridine base feature.            ***
--- ************************************************
---

CREATE VIEW five_methoxycarbonylmethyluridine AS
  SELECT
    feature_id AS five_methoxycarbonylmethyluridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_methoxycarbonylmethyluridine';

--- ************************************************
--- *** relation: five_methoxycarbonylmethyl_two_prime_o_methyluridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Five_methoxycarbonylmethyl_2_prime_O_met ***
--- *** hyluridine is a modified uridine base fe ***
--- *** ature.                                   ***
--- ************************************************
---

CREATE VIEW five_methoxycarbonylmethyl_two_prime_o_methyluridine AS
  SELECT
    feature_id AS five_methoxycarbonylmethyl_two_prime_o_methyluridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_methoxycarbonylmethyl_two_prime_O_methyluridine';

--- ************************************************
--- *** relation: five_mcm_2_thiouridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5_methoxycarbonylmethyl_2_thiouridine is ***
--- ***  a modified uridine base feature.        ***
--- ************************************************
---

CREATE VIEW five_mcm_2_thiouridine AS
  SELECT
    feature_id AS five_mcm_2_thiouridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_methoxycarbonylmethyl_two_thiouridine';

--- ************************************************
--- *** relation: five_aminomethyl_two_thiouridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5_aminomethyl_2_thiouridine is a modifie ***
--- *** d uridine base feature.                  ***
--- ************************************************
---

CREATE VIEW five_aminomethyl_two_thiouridine AS
  SELECT
    feature_id AS five_aminomethyl_two_thiouridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_aminomethyl_two_thiouridine';

--- ************************************************
--- *** relation: five_methylaminomethyluridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5_methylaminomethyluridine is a modified ***
--- ***  uridine base feature.                   ***
--- ************************************************
---

CREATE VIEW five_methylaminomethyluridine AS
  SELECT
    feature_id AS five_methylaminomethyluridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_methylaminomethyluridine';

--- ************************************************
--- *** relation: five_mam_2_thiouridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5_methylaminomethyl_2_thiouridine is a m ***
--- *** odified uridine base feature.            ***
--- ************************************************
---

CREATE VIEW five_mam_2_thiouridine AS
  SELECT
    feature_id AS five_mam_2_thiouridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_methylaminomethyl_two_thiouridine';

--- ************************************************
--- *** relation: five_methylaminomethyl_two_selenouridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5_methylaminomethyl_2_selenouridine is a ***
--- ***  modified uridine base feature.          ***
--- ************************************************
---

CREATE VIEW five_methylaminomethyl_two_selenouridine AS
  SELECT
    feature_id AS five_methylaminomethyl_two_selenouridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_methylaminomethyl_two_selenouridine';

--- ************************************************
--- *** relation: five_carbamoylmethyluridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5_carbamoylmethyluridine is a modified u ***
--- *** ridine base feature.                     ***
--- ************************************************
---

CREATE VIEW five_carbamoylmethyluridine AS
  SELECT
    feature_id AS five_carbamoylmethyluridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_carbamoylmethyluridine';

--- ************************************************
--- *** relation: five_cm_2_prime_o_methU ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5_carbamoylmethyl_2_prime_O_methyluridin ***
--- *** e is a modified uridine base feature.    ***
--- ************************************************
---

CREATE VIEW five_cm_2_prime_o_methU AS
  SELECT
    feature_id AS five_cm_2_prime_o_methU_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_carbamoylmethyl_two_prime_O_methyluridine';

--- ************************************************
--- *** relation: five_carboxymethylaminomethyluridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5_carboxymethylaminomethyluridine is a m ***
--- *** odified uridine base feature.            ***
--- ************************************************
---

CREATE VIEW five_carboxymethylaminomethyluridine AS
  SELECT
    feature_id AS five_carboxymethylaminomethyluridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_carboxymethylaminomethyluridine';

--- ************************************************
--- *** relation: five_carboxymethylaminomethyl_two_prime_o_methyluridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5_carboxymethylaminomethyl_2_prime_O_met ***
--- *** hyluridine is a modified uridine base fe ***
--- *** ature.                                   ***
--- ************************************************
---

CREATE VIEW five_carboxymethylaminomethyl_two_prime_o_methyluridine AS
  SELECT
    feature_id AS five_carboxymethylaminomethyl_two_prime_o_methyluridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_carboxymethylaminomethyl_two_prime_O_methyluridine';

--- ************************************************
--- *** relation: five_carboxymethylaminomethyl_two_thiouridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5_carboxymethylaminomethyl_2_thiouridine ***
--- ***  is a modified uridine base feature.     ***
--- ************************************************
---

CREATE VIEW five_carboxymethylaminomethyl_two_thiouridine AS
  SELECT
    feature_id AS five_carboxymethylaminomethyl_two_thiouridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_carboxymethylaminomethyl_two_thiouridine';

--- ************************************************
--- *** relation: three_methyluridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 3_methyluridine is a modified uridine ba ***
--- *** se feature.                              ***
--- ************************************************
---

CREATE VIEW three_methyluridine AS
  SELECT
    feature_id AS three_methyluridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_methyluridine';

--- ************************************************
--- *** relation: one_methyl_3_3_amino_three_carboxypropyl_pseudouridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 1_methyl_3_3_amino_3_carboxypropyl_pseud ***
--- *** ouridine is a modified uridine base feat ***
--- *** ure.                                     ***
--- ************************************************
---

CREATE VIEW one_methyl_3_3_amino_three_carboxypropyl_pseudouridine AS
  SELECT
    feature_id AS one_methyl_3_3_amino_three_carboxypropyl_pseudouridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'one_methyl_three_three_amino_three_carboxypropyl_pseudouridine';

--- ************************************************
--- *** relation: five_carboxymethyluridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5_carboxymethyluridine is a modified uri ***
--- *** dine base feature.                       ***
--- ************************************************
---

CREATE VIEW five_carboxymethyluridine AS
  SELECT
    feature_id AS five_carboxymethyluridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_carboxymethyluridine';

--- ************************************************
--- *** relation: three_two_prime_o_dimethyluridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 3_2prime_O_dimethyluridine is a modified ***
--- ***  uridine base feature.                   ***
--- ************************************************
---

CREATE VIEW three_two_prime_o_dimethyluridine AS
  SELECT
    feature_id AS three_two_prime_o_dimethyluridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_two_prime_O_dimethyluridine';

--- ************************************************
--- *** relation: five_methyldihydrouridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5_methyldihydrouridine is a modified uri ***
--- *** dine base feature.                       ***
--- ************************************************
---

CREATE VIEW five_methyldihydrouridine AS
  SELECT
    feature_id AS five_methyldihydrouridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_methyldihydrouridine';

--- ************************************************
--- *** relation: three_methylpseudouridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 3_methylpseudouridine is a modified urid ***
--- *** ine base feature.                        ***
--- ************************************************
---

CREATE VIEW three_methylpseudouridine AS
  SELECT
    feature_id AS three_methylpseudouridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_methylpseudouridine';

--- ************************************************
--- *** relation: five_taurinomethyluridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5_taurinomethyluridine is a modified uri ***
--- *** dine base feature.                       ***
--- ************************************************
---

CREATE VIEW five_taurinomethyluridine AS
  SELECT
    feature_id AS five_taurinomethyluridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_taurinomethyluridine';

--- ************************************************
--- *** relation: five_taurinomethyl_two_thiouridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5_taurinomethyl_2_thiouridineis a modifi ***
--- *** ed uridine base feature.                 ***
--- ************************************************
---

CREATE VIEW five_taurinomethyl_two_thiouridine AS
  SELECT
    feature_id AS five_taurinomethyl_two_thiouridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_taurinomethyl_two_thiouridine';

--- ************************************************
--- *** relation: five_isopentenylaminomethyl_uridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5_isopentenylaminomethyl_uridine is a mo ***
--- *** dified uridine base feature.             ***
--- ************************************************
---

CREATE VIEW five_isopentenylaminomethyl_uridine AS
  SELECT
    feature_id AS five_isopentenylaminomethyl_uridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_isopentenylaminomethyl_uridine';

--- ************************************************
--- *** relation: five_isopentenylaminomethyl_two_thiouridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5_isopentenylaminomethyl_2_thiouridine i ***
--- *** s a modified uridine base feature.       ***
--- ************************************************
---

CREATE VIEW five_isopentenylaminomethyl_two_thiouridine AS
  SELECT
    feature_id AS five_isopentenylaminomethyl_two_thiouridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_isopentenylaminomethyl_two_thiouridine';

--- ************************************************
--- *** relation: five_isopentenylaminomethyl_two_prime_o_methyluridine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** 5_isopentenylaminomethyl_2prime_O_methyl ***
--- *** uridine is a modified uridine base featu ***
--- *** re.                                      ***
--- ************************************************
---

CREATE VIEW five_isopentenylaminomethyl_two_prime_o_methyluridine AS
  SELECT
    feature_id AS five_isopentenylaminomethyl_two_prime_o_methyluridine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_isopentenylaminomethyl_two_prime_O_methyluridine';

--- ************************************************
--- *** relation: histone_binding_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A binding site that, in the nucleotide m ***
--- *** olecule, interacts selectively and non-c ***
--- *** ovalently with polypeptide residues of a ***
--- ***  histone.                                ***
--- ************************************************
---

CREATE VIEW histone_binding_site AS
  SELECT
    feature_id AS histone_binding_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'histone_binding_site';

--- ************************************************
--- *** relation: cds_fragment ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW cds_fragment AS
  SELECT
    feature_id AS cds_fragment_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'CDS_fragment';

--- ************************************************
--- *** relation: modified_amino_acid_feature ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A post translationally modified amino ac ***
--- *** id feature.                              ***
--- ************************************************
---

CREATE VIEW modified_amino_acid_feature AS
  SELECT
    feature_id AS modified_amino_acid_feature_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'modified_glycine' OR cvterm.name = 'modified_L_alanine' OR cvterm.name = 'modified_L_asparagine' OR cvterm.name = 'modified_L_aspartic_acid' OR cvterm.name = 'modified_L_cysteine' OR cvterm.name = 'modified_L_glutamic_acid' OR cvterm.name = 'modified_L_threonine' OR cvterm.name = 'modified_L_tryptophan' OR cvterm.name = 'modified_L_glutamine' OR cvterm.name = 'modified_L_methionine' OR cvterm.name = 'modified_L_isoleucine' OR cvterm.name = 'modified_L_phenylalanine' OR cvterm.name = 'modified_L_histidine' OR cvterm.name = 'modified_L_serine' OR cvterm.name = 'modified_L_lysine' OR cvterm.name = 'modified_L_leucine' OR cvterm.name = 'modified_L_selenocysteine' OR cvterm.name = 'modified_L_valine' OR cvterm.name = 'modified_L_proline' OR cvterm.name = 'modified_L_tyrosine' OR cvterm.name = 'modified_L_arginine' OR cvterm.name = 'modified_amino_acid_feature';

--- ************************************************
--- *** relation: modified_glycine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A post translationally modified glycine  ***
--- *** amino acid feature.                      ***
--- ************************************************
---

CREATE VIEW modified_glycine AS
  SELECT
    feature_id AS modified_glycine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'modified_glycine';

--- ************************************************
--- *** relation: modified_l_alanine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A post translationally modified alanine  ***
--- *** amino acid feature.                      ***
--- ************************************************
---

CREATE VIEW modified_l_alanine AS
  SELECT
    feature_id AS modified_l_alanine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'modified_L_alanine';

--- ************************************************
--- *** relation: modified_l_asparagine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A post translationally modified asparagi ***
--- *** ne amino acid feature.                   ***
--- ************************************************
---

CREATE VIEW modified_l_asparagine AS
  SELECT
    feature_id AS modified_l_asparagine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'modified_L_asparagine';

--- ************************************************
--- *** relation: modified_l_aspartic_acid ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A post translationally modified aspartic ***
--- ***  acid amino acid feature.                ***
--- ************************************************
---

CREATE VIEW modified_l_aspartic_acid AS
  SELECT
    feature_id AS modified_l_aspartic_acid_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'modified_L_aspartic_acid';

--- ************************************************
--- *** relation: modified_l_cysteine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A post translationally modified cysteine ***
--- ***  amino acid feature.                     ***
--- ************************************************
---

CREATE VIEW modified_l_cysteine AS
  SELECT
    feature_id AS modified_l_cysteine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'modified_L_cysteine';

--- ************************************************
--- *** relation: modified_l_glutamic_acid ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW modified_l_glutamic_acid AS
  SELECT
    feature_id AS modified_l_glutamic_acid_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'modified_L_glutamic_acid';

--- ************************************************
--- *** relation: modified_l_threonine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A post translationally modified threonin ***
--- *** e amino acid feature.                    ***
--- ************************************************
---

CREATE VIEW modified_l_threonine AS
  SELECT
    feature_id AS modified_l_threonine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'modified_L_threonine';

--- ************************************************
--- *** relation: modified_l_tryptophan ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A post translationally modified tryptoph ***
--- *** an amino acid feature.                   ***
--- ************************************************
---

CREATE VIEW modified_l_tryptophan AS
  SELECT
    feature_id AS modified_l_tryptophan_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'modified_L_tryptophan';

--- ************************************************
--- *** relation: modified_l_glutamine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A post translationally modified glutamin ***
--- *** e amino acid feature.                    ***
--- ************************************************
---

CREATE VIEW modified_l_glutamine AS
  SELECT
    feature_id AS modified_l_glutamine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'modified_L_glutamine';

--- ************************************************
--- *** relation: modified_l_methionine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A post translationally modified methioni ***
--- *** ne amino acid feature.                   ***
--- ************************************************
---

CREATE VIEW modified_l_methionine AS
  SELECT
    feature_id AS modified_l_methionine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'modified_L_methionine';

--- ************************************************
--- *** relation: modified_l_isoleucine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A post translationally modified isoleuci ***
--- *** ne amino acid feature.                   ***
--- ************************************************
---

CREATE VIEW modified_l_isoleucine AS
  SELECT
    feature_id AS modified_l_isoleucine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'modified_L_isoleucine';

--- ************************************************
--- *** relation: modified_l_phenylalanine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A post translationally modified phenylal ***
--- *** anine amino acid feature.                ***
--- ************************************************
---

CREATE VIEW modified_l_phenylalanine AS
  SELECT
    feature_id AS modified_l_phenylalanine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'modified_L_phenylalanine';

--- ************************************************
--- *** relation: modified_l_histidine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A post translationally modified histidie ***
--- ***  amino acid feature.                     ***
--- ************************************************
---

CREATE VIEW modified_l_histidine AS
  SELECT
    feature_id AS modified_l_histidine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'modified_L_histidine';

--- ************************************************
--- *** relation: modified_l_serine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A post translationally modified serine a ***
--- *** mino acid feature.                       ***
--- ************************************************
---

CREATE VIEW modified_l_serine AS
  SELECT
    feature_id AS modified_l_serine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'modified_L_serine';

--- ************************************************
--- *** relation: modified_l_lysine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A post translationally modified lysine a ***
--- *** mino acid feature.                       ***
--- ************************************************
---

CREATE VIEW modified_l_lysine AS
  SELECT
    feature_id AS modified_l_lysine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'modified_L_lysine';

--- ************************************************
--- *** relation: modified_l_leucine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A post translationally modified leucine  ***
--- *** amino acid feature.                      ***
--- ************************************************
---

CREATE VIEW modified_l_leucine AS
  SELECT
    feature_id AS modified_l_leucine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'modified_L_leucine';

--- ************************************************
--- *** relation: modified_l_selenocysteine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A post translationally modified selenocy ***
--- *** steine amino acid feature.               ***
--- ************************************************
---

CREATE VIEW modified_l_selenocysteine AS
  SELECT
    feature_id AS modified_l_selenocysteine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'modified_L_selenocysteine';

--- ************************************************
--- *** relation: modified_l_valine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A post translationally modified valine a ***
--- *** mino acid feature.                       ***
--- ************************************************
---

CREATE VIEW modified_l_valine AS
  SELECT
    feature_id AS modified_l_valine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'modified_L_valine';

--- ************************************************
--- *** relation: modified_l_proline ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A post translationally modified proline  ***
--- *** amino acid feature.                      ***
--- ************************************************
---

CREATE VIEW modified_l_proline AS
  SELECT
    feature_id AS modified_l_proline_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'modified_L_proline';

--- ************************************************
--- *** relation: modified_l_tyrosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A post translationally modified tyrosine ***
--- ***  amino acid feature.                     ***
--- ************************************************
---

CREATE VIEW modified_l_tyrosine AS
  SELECT
    feature_id AS modified_l_tyrosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'modified_L_tyrosine';

--- ************************************************
--- *** relation: modified_l_arginine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A post translationally modified arginine ***
--- ***  amino acid feature.                     ***
--- ************************************************
---

CREATE VIEW modified_l_arginine AS
  SELECT
    feature_id AS modified_l_arginine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'modified_L_arginine';

--- ************************************************
--- *** relation: peptidyl ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing the nature of a  ***
--- *** proteinaceous polymer, where by the amin ***
--- *** o acid units are joined by peptide bonds ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW peptidyl AS
  SELECT
    feature_id AS peptidyl_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'peptidyl';

--- ************************************************
--- *** relation: cleaved_for_gpi_anchor_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The C-terminal residues of a polypeptide ***
--- ***  which are exchanged for a GPI-anchor.   ***
--- ************************************************
---

CREATE VIEW cleaved_for_gpi_anchor_region AS
  SELECT
    feature_id AS cleaved_for_gpi_anchor_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cleaved_for_gpi_anchor_region';

--- ************************************************
--- *** relation: biomaterial_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region which is intended for use in an ***
--- ***  experiment.                             ***
--- ************************************************
---

CREATE VIEW biomaterial_region AS
  SELECT
    feature_id AS biomaterial_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'reagent' OR cvterm.name = 'engineered_region' OR cvterm.name = 'PCR_product' OR cvterm.name = 'clone' OR cvterm.name = 'rescue_region' OR cvterm.name = 'oligo' OR cvterm.name = 'clone_insert' OR cvterm.name = 'cloned_region' OR cvterm.name = 'databank_entry' OR cvterm.name = 'RAPD' OR cvterm.name = 'genomic_clone' OR cvterm.name = 'cDNA_clone' OR cvterm.name = 'tiling_path_clone' OR cvterm.name = 'validated_cDNA_clone' OR cvterm.name = 'invalidated_cDNA_clone' OR cvterm.name = 'three_prime_RACE_clone' OR cvterm.name = 'chimeric_cDNA_clone' OR cvterm.name = 'genomically_contaminated_cDNA_clone' OR cvterm.name = 'polyA_primed_cDNA_clone' OR cvterm.name = 'partially_processed_cDNA_clone' OR cvterm.name = 'engineered_rescue_region' OR cvterm.name = 'aptamer' OR cvterm.name = 'probe' OR cvterm.name = 'tag' OR cvterm.name = 'ss_oligo' OR cvterm.name = 'ds_oligo' OR cvterm.name = 'DNAzyme' OR cvterm.name = 'synthetic_oligo' OR cvterm.name = 'DNA_aptamer' OR cvterm.name = 'RNA_aptamer' OR cvterm.name = 'microarray_oligo' OR cvterm.name = 'SAGE_tag' OR cvterm.name = 'STS' OR cvterm.name = 'EST' OR cvterm.name = 'engineered_tag' OR cvterm.name = 'five_prime_EST' OR cvterm.name = 'three_prime_EST' OR cvterm.name = 'UST' OR cvterm.name = 'RST' OR cvterm.name = 'three_prime_UST' OR cvterm.name = 'five_prime_UST' OR cvterm.name = 'three_prime_RST' OR cvterm.name = 'five_prime_RST' OR cvterm.name = 'primer' OR cvterm.name = 'sequencing_primer' OR cvterm.name = 'forward_primer' OR cvterm.name = 'reverse_primer' OR cvterm.name = 'ASPE_primer' OR cvterm.name = 'dCAPS_primer' OR cvterm.name = 'RNAi_reagent' OR cvterm.name = 'DNA_constraint_sequence' OR cvterm.name = 'morpholino_oligo' OR cvterm.name = 'PNA_oligo' OR cvterm.name = 'LNA_oligo' OR cvterm.name = 'TNA_oligo' OR cvterm.name = 'GNA_oligo' OR cvterm.name = 'R_GNA_oligo' OR cvterm.name = 'S_GNA_oligo' OR cvterm.name = 'cloned_cDNA_insert' OR cvterm.name = 'cloned_genomic_insert' OR cvterm.name = 'engineered_insert' OR cvterm.name = 'BAC_cloned_genomic_insert' OR cvterm.name = 'engineered_gene' OR cvterm.name = 'engineered_plasmid' OR cvterm.name = 'engineered_rescue_region' OR cvterm.name = 'engineered_transposable_element' OR cvterm.name = 'engineered_foreign_region' OR cvterm.name = 'engineered_tag' OR cvterm.name = 'engineered_insert' OR cvterm.name = 'targeting_vector' OR cvterm.name = 'engineered_foreign_gene' OR cvterm.name = 'engineered_fusion_gene' OR cvterm.name = 'engineered_foreign_transposable_element_gene' OR cvterm.name = 'engineered_episome' OR cvterm.name = 'gene_trap_construct' OR cvterm.name = 'promoter_trap_construct' OR cvterm.name = 'enhancer_trap_construct' OR cvterm.name = 'engineered_foreign_transposable_element' OR cvterm.name = 'engineered_foreign_gene' OR cvterm.name = 'engineered_foreign_repetitive_element' OR cvterm.name = 'engineered_foreign_transposable_element' OR cvterm.name = 'engineered_foreign_transposable_element_gene' OR cvterm.name = 'biomaterial_region';

--- ************************************************
--- *** relation: experimental_feature ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region which is the result of some arb ***
--- *** itrary experimental procedure. The proce ***
--- *** dure may be carried out with biological  ***
--- *** material or inside a computer.           ***
--- ************************************************
---

CREATE VIEW experimental_feature AS
  SELECT
    feature_id AS experimental_feature_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'match_part' OR cvterm.name = 'assembly_component' OR cvterm.name = 'conserved_region' OR cvterm.name = 'match' OR cvterm.name = 'remark' OR cvterm.name = 'reading_frame' OR cvterm.name = 'consensus_region' OR cvterm.name = 'low_complexity_region' OR cvterm.name = 'assembly' OR cvterm.name = 'transcribed_fragment' OR cvterm.name = 'transcribed_cluster' OR cvterm.name = 'high_identity_region' OR cvterm.name = 'mathematically_defined_repeat' OR cvterm.name = 'experimentally_defined_binding_region' OR cvterm.name = 'contig' OR cvterm.name = 'read' OR cvterm.name = 'restriction_fragment' OR cvterm.name = 'golden_path_fragment' OR cvterm.name = 'tiling_path_fragment' OR cvterm.name = 'gap' OR cvterm.name = 'sonicate_fragment' OR cvterm.name = 'paired_end_fragment' OR cvterm.name = 'read_pair' OR cvterm.name = 'contig_read' OR cvterm.name = 'BAC_end' OR cvterm.name = 'dye_terminator_read' OR cvterm.name = 'pyrosequenced_read' OR cvterm.name = 'ligation_based_read' OR cvterm.name = 'polymerase_synthesis_read' OR cvterm.name = 'PAC_end' OR cvterm.name = 'YAC_end' OR cvterm.name = 'clone_end' OR cvterm.name = 'RFLP_fragment' OR cvterm.name = 'tiling_path_clone' OR cvterm.name = 'coding_conserved_region' OR cvterm.name = 'nc_conserved_region' OR cvterm.name = 'RR_tract' OR cvterm.name = 'homologous_region' OR cvterm.name = 'centromere_DNA_Element_I' OR cvterm.name = 'centromere_DNA_Element_II' OR cvterm.name = 'centromere_DNA_Element_III' OR cvterm.name = 'X_element' OR cvterm.name = 'U_box' OR cvterm.name = 'regional_centromere_central_core' OR cvterm.name = 'syntenic_region' OR cvterm.name = 'paralogous_region' OR cvterm.name = 'orthologous_region' OR cvterm.name = 'nucleotide_match' OR cvterm.name = 'protein_match' OR cvterm.name = 'expressed_sequence_match' OR cvterm.name = 'cross_genome_match' OR cvterm.name = 'translated_nucleotide_match' OR cvterm.name = 'primer_match' OR cvterm.name = 'EST_match' OR cvterm.name = 'cDNA_match' OR cvterm.name = 'UST_match' OR cvterm.name = 'RST_match' OR cvterm.name = 'sequence_difference' OR cvterm.name = 'experimental_result_region' OR cvterm.name = 'polypeptide_sequencing_information' OR cvterm.name = 'possible_base_call_error' OR cvterm.name = 'possible_assembly_error' OR cvterm.name = 'assembly_error_correction' OR cvterm.name = 'base_call_error_correction' OR cvterm.name = 'overlapping_feature_set' OR cvterm.name = 'no_output' OR cvterm.name = 'overlapping_EST_set' OR cvterm.name = 'non_adjacent_residues' OR cvterm.name = 'non_terminal_residue' OR cvterm.name = 'sequence_conflict' OR cvterm.name = 'sequence_uncertainty' OR cvterm.name = 'contig_collection' OR cvterm.name = 'ORF' OR cvterm.name = 'blocked_reading_frame' OR cvterm.name = 'mini_gene' OR cvterm.name = 'rescue_mini_gene' OR cvterm.name = 'consensus_mRNA' OR cvterm.name = 'sequence_assembly' OR cvterm.name = 'fragment_assembly' OR cvterm.name = 'supercontig' OR cvterm.name = 'contig' OR cvterm.name = 'tiling_path' OR cvterm.name = 'virtual_sequence' OR cvterm.name = 'golden_path' OR cvterm.name = 'ultracontig' OR cvterm.name = 'expressed_sequence_assembly' OR cvterm.name = 'fingerprint_map' OR cvterm.name = 'STS_map' OR cvterm.name = 'RH_map' OR cvterm.name = 'unigene_cluster' OR cvterm.name = 'CHiP_seq_region' OR cvterm.name = 'experimental_feature';

--- ************************************************
--- *** relation: biological_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region defined by its disposition to b ***
--- *** e involved in a biological process.      ***
--- ************************************************
---

CREATE VIEW biological_region AS
  SELECT
    feature_id AS biological_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'sequence_secondary_structure' OR cvterm.name = 'linkage_group' OR cvterm.name = 'polypeptide' OR cvterm.name = 'deletion' OR cvterm.name = 'origin_of_replication' OR cvterm.name = 'recombination_feature' OR cvterm.name = 'CpG_island' OR cvterm.name = 'pseudogene' OR cvterm.name = 'binding_site' OR cvterm.name = 'pseudogenic_region' OR cvterm.name = 'cap' OR cvterm.name = 'intergenic_region' OR cvterm.name = 'oligo_U_tail' OR cvterm.name = 'polyA_sequence' OR cvterm.name = 'repeat_region' OR cvterm.name = 'insertion' OR cvterm.name = 'gene' OR cvterm.name = 'repeat_unit' OR cvterm.name = 'QTL' OR cvterm.name = 'chromosome_part' OR cvterm.name = 'gene_member_region' OR cvterm.name = 'transcript_region' OR cvterm.name = 'polypeptide_region' OR cvterm.name = 'gene_component_region' OR cvterm.name = 'mobile_genetic_element' OR cvterm.name = 'replicon' OR cvterm.name = 'base' OR cvterm.name = 'amino_acid' OR cvterm.name = 'genetic_marker' OR cvterm.name = 'sequence_motif' OR cvterm.name = 'restriction_enzyme_recognition_site' OR cvterm.name = 'restriction_enzyme_single_strand_overhang' OR cvterm.name = 'epigenetically_modified_region' OR cvterm.name = 'open_chromatin_region' OR cvterm.name = 'gene_group' OR cvterm.name = 'substitution' OR cvterm.name = 'inversion' OR cvterm.name = 'retron' OR cvterm.name = 'G_quartet' OR cvterm.name = 'base_pair' OR cvterm.name = 'RNA_sequence_secondary_structure' OR cvterm.name = 'DNA_sequence_secondary_structure' OR cvterm.name = 'pseudoknot' OR cvterm.name = 'WC_base_pair' OR cvterm.name = 'sugar_edge_base_pair' OR cvterm.name = 'Hoogsteen_base_pair' OR cvterm.name = 'reverse_Hoogsteen_base_pair' OR cvterm.name = 'wobble_base_pair' OR cvterm.name = 'stem_loop' OR cvterm.name = 'tetraloop' OR cvterm.name = 'i_motif' OR cvterm.name = 'recoding_pseudoknot' OR cvterm.name = 'H_pseudoknot' OR cvterm.name = 'D_loop' OR cvterm.name = 'ARS' OR cvterm.name = 'oriT' OR cvterm.name = 'amplification_origin' OR cvterm.name = 'oriV' OR cvterm.name = 'oriC' OR cvterm.name = 'recombination_hotspot' OR cvterm.name = 'haplotype_block' OR cvterm.name = 'sequence_rearrangement_feature' OR cvterm.name = 'iDNA' OR cvterm.name = 'specific_recombination_site' OR cvterm.name = 'chromosome_breakage_sequence' OR cvterm.name = 'internal_eliminated_sequence' OR cvterm.name = 'macronucleus_destined_segment' OR cvterm.name = 'recombination_feature_of_rearranged_gene' OR cvterm.name = 'site_specific_recombination_target_region' OR cvterm.name = 'recombination_signal_sequence' OR cvterm.name = 'vertebrate_immune_system_gene_recombination_feature' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_segment' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_gene_cluster' OR cvterm.name = 'vertebrate_immune_system_gene_recombination_spacer' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_rearranged_segment' OR cvterm.name = 'vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster' OR cvterm.name = 'vertebrate_immune_system_gene_recombination_signal_feature' OR cvterm.name = 'D_gene' OR cvterm.name = 'V_gene' OR cvterm.name = 'J_gene' OR cvterm.name = 'C_gene' OR cvterm.name = 'D_J_C_cluster' OR cvterm.name = 'J_C_cluster' OR cvterm.name = 'J_cluster' OR cvterm.name = 'V_cluster' OR cvterm.name = 'V_J_cluster' OR cvterm.name = 'V_J_C_cluster' OR cvterm.name = 'C_cluster' OR cvterm.name = 'D_cluster' OR cvterm.name = 'D_J_cluster' OR cvterm.name = 'three_prime_D_spacer' OR cvterm.name = 'five_prime_D_spacer' OR cvterm.name = 'J_spacer' OR cvterm.name = 'V_spacer' OR cvterm.name = 'VD_gene' OR cvterm.name = 'DJ_gene' OR cvterm.name = 'VDJ_gene' OR cvterm.name = 'VJ_gene' OR cvterm.name = 'DJ_J_cluster' OR cvterm.name = 'VDJ_J_C_cluster' OR cvterm.name = 'VDJ_J_cluster' OR cvterm.name = 'VJ_C_cluster' OR cvterm.name = 'VJ_J_C_cluster' OR cvterm.name = 'VJ_J_cluster' OR cvterm.name = 'D_DJ_C_cluster' OR cvterm.name = 'D_DJ_cluster' OR cvterm.name = 'D_DJ_J_C_cluster' OR cvterm.name = 'D_DJ_J_cluster' OR cvterm.name = 'V_DJ_cluster' OR cvterm.name = 'V_DJ_J_cluster' OR cvterm.name = 'V_VDJ_C_cluster' OR cvterm.name = 'V_VDJ_cluster' OR cvterm.name = 'V_VDJ_J_cluster' OR cvterm.name = 'V_VJ_C_cluster' OR cvterm.name = 'V_VJ_cluster' OR cvterm.name = 'V_VJ_J_cluster' OR cvterm.name = 'V_D_DJ_C_cluster' OR cvterm.name = 'V_D_DJ_cluster' OR cvterm.name = 'V_D_DJ_J_C_cluster' OR cvterm.name = 'V_D_DJ_J_cluster' OR cvterm.name = 'V_D_J_C_cluster' OR cvterm.name = 'V_D_J_cluster' OR cvterm.name = 'DJ_C_cluster' OR cvterm.name = 'DJ_J_C_cluster' OR cvterm.name = 'VDJ_C_cluster' OR cvterm.name = 'V_DJ_C_cluster' OR cvterm.name = 'V_DJ_J_C_cluster' OR cvterm.name = 'V_VDJ_J_C_cluster' OR cvterm.name = 'V_VJ_J_C_cluster' OR cvterm.name = 'J_gene_recombination_feature' OR cvterm.name = 'D_gene_recombination_feature' OR cvterm.name = 'V_gene_recombination_feature' OR cvterm.name = 'heptamer_of_recombination_feature_of_vertebrate_immune_system_gene' OR cvterm.name = 'nonamer_of_recombination_feature_of_vertebrate_immune_system_gene' OR cvterm.name = 'five_prime_D_recombination_signal_sequence' OR cvterm.name = 'three_prime_D_recombination_signal_sequence' OR cvterm.name = 'three_prime_D_heptamer' OR cvterm.name = 'five_prime_D_heptamer' OR cvterm.name = 'J_heptamer' OR cvterm.name = 'V_heptamer' OR cvterm.name = 'three_prime_D_nonamer' OR cvterm.name = 'five_prime_D_nonamer' OR cvterm.name = 'J_nonamer' OR cvterm.name = 'V_nonamer' OR cvterm.name = 'integration_excision_site' OR cvterm.name = 'resolution_site' OR cvterm.name = 'inversion_site' OR cvterm.name = 'inversion_site_part' OR cvterm.name = 'attI_site' OR cvterm.name = 'attP_site' OR cvterm.name = 'attB_site' OR cvterm.name = 'attL_site' OR cvterm.name = 'attR_site' OR cvterm.name = 'attC_site' OR cvterm.name = 'attCtn_site' OR cvterm.name = 'loxP_site' OR cvterm.name = 'dif_site' OR cvterm.name = 'FRT_site' OR cvterm.name = 'IRLinv_site' OR cvterm.name = 'IRRinv_site' OR cvterm.name = 'processed_pseudogene' OR cvterm.name = 'non_processed_pseudogene' OR cvterm.name = 'pseudogene_by_unequal_crossing_over' OR cvterm.name = 'nuclear_mt_pseudogene' OR cvterm.name = 'cassette_pseudogene' OR cvterm.name = 'duplicated_pseudogene' OR cvterm.name = 'unitary_pseudogene' OR cvterm.name = 'protein_binding_site' OR cvterm.name = 'epitope' OR cvterm.name = 'nucleotide_binding_site' OR cvterm.name = 'metal_binding_site' OR cvterm.name = 'ligand_binding_site' OR cvterm.name = 'protein_protein_contact' OR cvterm.name = 'nucleotide_to_protein_binding_site' OR cvterm.name = 'nuclease_binding_site' OR cvterm.name = 'TF_binding_site' OR cvterm.name = 'histone_binding_site' OR cvterm.name = 'insulator_binding_site' OR cvterm.name = 'enhancer_binding_site' OR cvterm.name = 'restriction_enzyme_binding_site' OR cvterm.name = 'nuclease_sensitive_site' OR cvterm.name = 'homing_endonuclease_binding_site' OR cvterm.name = 'nuclease_hypersensitive_site' OR cvterm.name = 'group_1_intron_homing_endonuclease_target_region' OR cvterm.name = 'DNAseI_hypersensitive_site' OR cvterm.name = 'miRNA_target_site' OR cvterm.name = 'DNA_binding_site' OR cvterm.name = 'primer_binding_site' OR cvterm.name = 'polypeptide_DNA_contact' OR cvterm.name = 'polypeptide_metal_contact' OR cvterm.name = 'polypeptide_calcium_ion_contact_site' OR cvterm.name = 'polypeptide_cobalt_ion_contact_site' OR cvterm.name = 'polypeptide_copper_ion_contact_site' OR cvterm.name = 'polypeptide_iron_ion_contact_site' OR cvterm.name = 'polypeptide_magnesium_ion_contact_site' OR cvterm.name = 'polypeptide_manganese_ion_contact_site' OR cvterm.name = 'polypeptide_molybdenum_ion_contact_site' OR cvterm.name = 'polypeptide_nickel_ion_contact_site' OR cvterm.name = 'polypeptide_tungsten_ion_contact_site' OR cvterm.name = 'polypeptide_zinc_ion_contact_site' OR cvterm.name = 'polypeptide_ligand_contact' OR cvterm.name = 'decayed_exon' OR cvterm.name = 'pseudogenic_exon' OR cvterm.name = 'pseudogenic_transcript' OR cvterm.name = 'pseudogenic_rRNA' OR cvterm.name = 'pseudogenic_tRNA' OR cvterm.name = 'long_terminal_repeat' OR cvterm.name = 'engineered_foreign_repetitive_element' OR cvterm.name = 'inverted_repeat' OR cvterm.name = 'direct_repeat' OR cvterm.name = 'non_LTR_retrotransposon_polymeric_tract' OR cvterm.name = 'dispersed_repeat' OR cvterm.name = 'tandem_repeat' OR cvterm.name = 'X_element_combinatorial_repeat' OR cvterm.name = 'Y_prime_element' OR cvterm.name = 'telomeric_repeat' OR cvterm.name = 'nested_repeat' OR cvterm.name = 'centromeric_repeat' OR cvterm.name = 'five_prime_LTR' OR cvterm.name = 'three_prime_LTR' OR cvterm.name = 'solo_LTR' OR cvterm.name = 'terminal_inverted_repeat' OR cvterm.name = 'five_prime_terminal_inverted_repeat' OR cvterm.name = 'three_prime_terminal_inverted_repeat' OR cvterm.name = 'target_site_duplication' OR cvterm.name = 'CRISPR' OR cvterm.name = 'satellite_DNA' OR cvterm.name = 'microsatellite' OR cvterm.name = 'minisatellite' OR cvterm.name = 'dinucleotide_repeat_microsatellite_feature' OR cvterm.name = 'trinucleotide_repeat_microsatellite_feature' OR cvterm.name = 'tetranucleotide_repeat_microsatellite_feature' OR cvterm.name = 'nested_tandem_repeat' OR cvterm.name = 'regional_centromere_inner_repeat_region' OR cvterm.name = 'regional_centromere_outer_repeat_region' OR cvterm.name = 'transgenic_insertion' OR cvterm.name = 'duplication' OR cvterm.name = 'tandem_duplication' OR cvterm.name = 'direct_tandem_duplication' OR cvterm.name = 'inverted_tandem_duplication' OR cvterm.name = 'nuclear_gene' OR cvterm.name = 'mt_gene' OR cvterm.name = 'plastid_gene' OR cvterm.name = 'nucleomorph_gene' OR cvterm.name = 'plasmid_gene' OR cvterm.name = 'proviral_gene' OR cvterm.name = 'transposable_element_gene' OR cvterm.name = 'silenced_gene' OR cvterm.name = 'engineered_gene' OR cvterm.name = 'foreign_gene' OR cvterm.name = 'fusion_gene' OR cvterm.name = 'recombinationally_rearranged_gene' OR cvterm.name = 'gene_with_trans_spliced_transcript' OR cvterm.name = 'gene_with_polycistronic_transcript' OR cvterm.name = 'rescue_gene' OR cvterm.name = 'post_translationally_regulated_gene' OR cvterm.name = 'negatively_autoregulated_gene' OR cvterm.name = 'positively_autoregulated_gene' OR cvterm.name = 'translationally_regulated_gene' OR cvterm.name = 'epigenetically_modified_gene' OR cvterm.name = 'transgene' OR cvterm.name = 'predicted_gene' OR cvterm.name = 'protein_coding_gene' OR cvterm.name = 'retrogene' OR cvterm.name = 'ncRNA_gene' OR cvterm.name = 'cryptic_gene' OR cvterm.name = 'gene_with_non_canonical_start_codon' OR cvterm.name = 'gene_cassette' OR cvterm.name = 'kinetoplast_gene' OR cvterm.name = 'maxicircle_gene' OR cvterm.name = 'minicircle_gene' OR cvterm.name = 'cryptogene' OR cvterm.name = 'apicoplast_gene' OR cvterm.name = 'ct_gene' OR cvterm.name = 'chromoplast_gene' OR cvterm.name = 'cyanelle_gene' OR cvterm.name = 'leucoplast_gene' OR cvterm.name = 'proplastid_gene' OR cvterm.name = 'endogenous_retroviral_gene' OR cvterm.name = 'engineered_foreign_transposable_element_gene' OR cvterm.name = 'gene_silenced_by_DNA_modification' OR cvterm.name = 'gene_silenced_by_RNA_interference' OR cvterm.name = 'gene_silenced_by_histone_modification' OR cvterm.name = 'gene_silenced_by_DNA_methylation' OR cvterm.name = 'gene_silenced_by_histone_methylation' OR cvterm.name = 'gene_silenced_by_histone_deacetylation' OR cvterm.name = 'engineered_foreign_gene' OR cvterm.name = 'engineered_fusion_gene' OR cvterm.name = 'engineered_foreign_transposable_element_gene' OR cvterm.name = 'engineered_foreign_gene' OR cvterm.name = 'engineered_foreign_transposable_element_gene' OR cvterm.name = 'engineered_fusion_gene' OR cvterm.name = 'recombinationally_inverted_gene' OR cvterm.name = 'recombinationally_rearranged_vertebrate_immune_system_gene' OR cvterm.name = 'gene_with_dicistronic_transcript' OR cvterm.name = 'gene_with_dicistronic_primary_transcript' OR cvterm.name = 'gene_with_dicistronic_mRNA' OR cvterm.name = 'wild_type_rescue_gene' OR cvterm.name = 'gene_rearranged_at_DNA_level' OR cvterm.name = 'maternally_imprinted_gene' OR cvterm.name = 'paternally_imprinted_gene' OR cvterm.name = 'allelically_excluded_gene' OR cvterm.name = 'floxed_gene' OR cvterm.name = 'gene_with_polyadenylated_mRNA' OR cvterm.name = 'gene_with_mRNA_with_frameshift' OR cvterm.name = 'gene_with_edited_transcript' OR cvterm.name = 'gene_with_recoded_mRNA' OR cvterm.name = 'gene_with_stop_codon_read_through' OR cvterm.name = 'gene_with_mRNA_recoded_by_translational_bypass' OR cvterm.name = 'gene_with_transcript_with_translational_frameshift' OR cvterm.name = 'gene_with_stop_codon_redefined_as_pyrrolysine' OR cvterm.name = 'gene_with_stop_codon_redefined_as_selenocysteine' OR cvterm.name = 'gRNA_gene' OR cvterm.name = 'miRNA_gene' OR cvterm.name = 'scRNA_gene' OR cvterm.name = 'snoRNA_gene' OR cvterm.name = 'snRNA_gene' OR cvterm.name = 'SRP_RNA_gene' OR cvterm.name = 'stRNA_gene' OR cvterm.name = 'tmRNA_gene' OR cvterm.name = 'tRNA_gene' OR cvterm.name = 'rRNA_gene' OR cvterm.name = 'piRNA_gene' OR cvterm.name = 'RNase_P_RNA_gene' OR cvterm.name = 'RNase_MRP_RNA_gene' OR cvterm.name = 'lincRNA_gene' OR cvterm.name = 'telomerase_RNA_gene' OR cvterm.name = 'cryptogene' OR cvterm.name = 'gene_with_start_codon_CUG' OR cvterm.name = 'chromosome_arm' OR cvterm.name = 'chromosome_band' OR cvterm.name = 'interband' OR cvterm.name = 'chromosomal_regulatory_element' OR cvterm.name = 'chromosomal_structural_element' OR cvterm.name = 'introgressed_chromosome_region' OR cvterm.name = 'matrix_attachment_site' OR cvterm.name = 'centromere' OR cvterm.name = 'telomere' OR cvterm.name = 'point_centromere' OR cvterm.name = 'regional_centromere' OR cvterm.name = 'transcript' OR cvterm.name = 'regulatory_region' OR cvterm.name = 'polycistronic_transcript' OR cvterm.name = 'transcript_with_translational_frameshift' OR cvterm.name = 'primary_transcript' OR cvterm.name = 'mature_transcript' OR cvterm.name = 'transcript_bound_by_nucleic_acid' OR cvterm.name = 'transcript_bound_by_protein' OR cvterm.name = 'enzymatic_RNA' OR cvterm.name = 'trans_spliced_transcript' OR cvterm.name = 'monocistronic_transcript' OR cvterm.name = 'aberrant_processed_transcript' OR cvterm.name = 'edited_transcript' OR cvterm.name = 'processed_transcript' OR cvterm.name = 'alternatively_spliced_transcript' OR cvterm.name = 'dicistronic_transcript' OR cvterm.name = 'polycistronic_primary_transcript' OR cvterm.name = 'polycistronic_mRNA' OR cvterm.name = 'dicistronic_mRNA' OR cvterm.name = 'dicistronic_primary_transcript' OR cvterm.name = 'dicistronic_primary_transcript' OR cvterm.name = 'dicistronic_mRNA' OR cvterm.name = 'protein_coding_primary_transcript' OR cvterm.name = 'nc_primary_transcript' OR cvterm.name = 'polycistronic_primary_transcript' OR cvterm.name = 'monocistronic_primary_transcript' OR cvterm.name = 'mini_exon_donor_RNA' OR cvterm.name = 'antisense_primary_transcript' OR cvterm.name = 'capped_primary_transcript' OR cvterm.name = 'pre_edited_mRNA' OR cvterm.name = 'scRNA_primary_transcript' OR cvterm.name = 'rRNA_primary_transcript' OR cvterm.name = 'tRNA_primary_transcript' OR cvterm.name = 'snRNA_primary_transcript' OR cvterm.name = 'snoRNA_primary_transcript' OR cvterm.name = 'tmRNA_primary_transcript' OR cvterm.name = 'SRP_RNA_primary_transcript' OR cvterm.name = 'miRNA_primary_transcript' OR cvterm.name = 'tasiRNA_primary_transcript' OR cvterm.name = 'rRNA_small_subunit_primary_transcript' OR cvterm.name = 'rRNA_large_subunit_primary_transcript' OR cvterm.name = 'alanine_tRNA_primary_transcript' OR cvterm.name = 'arginine_tRNA_primary_transcript' OR cvterm.name = 'asparagine_tRNA_primary_transcript' OR cvterm.name = 'aspartic_acid_tRNA_primary_transcript' OR cvterm.name = 'cysteine_tRNA_primary_transcript' OR cvterm.name = 'glutamic_acid_tRNA_primary_transcript' OR cvterm.name = 'glutamine_tRNA_primary_transcript' OR cvterm.name = 'glycine_tRNA_primary_transcript' OR cvterm.name = 'histidine_tRNA_primary_transcript' OR cvterm.name = 'isoleucine_tRNA_primary_transcript' OR cvterm.name = 'leucine_tRNA_primary_transcript' OR cvterm.name = 'lysine_tRNA_primary_transcript' OR cvterm.name = 'methionine_tRNA_primary_transcript' OR cvterm.name = 'phenylalanine_tRNA_primary_transcript' OR cvterm.name = 'proline_tRNA_primary_transcript' OR cvterm.name = 'serine_tRNA_primary_transcript' OR cvterm.name = 'threonine_tRNA_primary_transcript' OR cvterm.name = 'tryptophan_tRNA_primary_transcript' OR cvterm.name = 'tyrosine_tRNA_primary_transcript' OR cvterm.name = 'valine_tRNA_primary_transcript' OR cvterm.name = 'pyrrolysine_tRNA_primary_transcript' OR cvterm.name = 'selenocysteine_tRNA_primary_transcript' OR cvterm.name = 'methylation_guide_snoRNA_primary_transcript' OR cvterm.name = 'rRNA_cleavage_snoRNA_primary_transcript' OR cvterm.name = 'C_D_box_snoRNA_primary_transcript' OR cvterm.name = 'H_ACA_box_snoRNA_primary_transcript' OR cvterm.name = 'U14_snoRNA_primary_transcript' OR cvterm.name = 'stRNA_primary_transcript' OR cvterm.name = 'dicistronic_primary_transcript' OR cvterm.name = 'mRNA' OR cvterm.name = 'ncRNA' OR cvterm.name = 'mRNA_with_frameshift' OR cvterm.name = 'monocistronic_mRNA' OR cvterm.name = 'polycistronic_mRNA' OR cvterm.name = 'exemplar_mRNA' OR cvterm.name = 'capped_mRNA' OR cvterm.name = 'polyadenylated_mRNA' OR cvterm.name = 'trans_spliced_mRNA' OR cvterm.name = 'edited_mRNA' OR cvterm.name = 'consensus_mRNA' OR cvterm.name = 'recoded_mRNA' OR cvterm.name = 'mRNA_with_minus_1_frameshift' OR cvterm.name = 'mRNA_with_plus_1_frameshift' OR cvterm.name = 'mRNA_with_plus_2_frameshift' OR cvterm.name = 'mRNA_with_minus_2_frameshift' OR cvterm.name = 'dicistronic_mRNA' OR cvterm.name = 'mRNA_recoded_by_translational_bypass' OR cvterm.name = 'mRNA_recoded_by_codon_redefinition' OR cvterm.name = 'scRNA' OR cvterm.name = 'rRNA' OR cvterm.name = 'tRNA' OR cvterm.name = 'snRNA' OR cvterm.name = 'snoRNA' OR cvterm.name = 'small_regulatory_ncRNA' OR cvterm.name = 'RNase_MRP_RNA' OR cvterm.name = 'RNase_P_RNA' OR cvterm.name = 'telomerase_RNA' OR cvterm.name = 'vault_RNA' OR cvterm.name = 'Y_RNA' OR cvterm.name = 'rasiRNA' OR cvterm.name = 'SRP_RNA' OR cvterm.name = 'guide_RNA' OR cvterm.name = 'antisense_RNA' OR cvterm.name = 'siRNA' OR cvterm.name = 'stRNA' OR cvterm.name = 'class_II_RNA' OR cvterm.name = 'class_I_RNA' OR cvterm.name = 'piRNA' OR cvterm.name = 'lincRNA' OR cvterm.name = 'tasiRNA' OR cvterm.name = 'rRNA_cleavage_RNA' OR cvterm.name = 'small_subunit_rRNA' OR cvterm.name = 'large_subunit_rRNA' OR cvterm.name = 'rRNA_18S' OR cvterm.name = 'rRNA_16S' OR cvterm.name = 'rRNA_5_8S' OR cvterm.name = 'rRNA_5S' OR cvterm.name = 'rRNA_28S' OR cvterm.name = 'rRNA_23S' OR cvterm.name = 'rRNA_25S' OR cvterm.name = 'rRNA_21S' OR cvterm.name = 'alanyl_tRNA' OR cvterm.name = 'asparaginyl_tRNA' OR cvterm.name = 'aspartyl_tRNA' OR cvterm.name = 'cysteinyl_tRNA' OR cvterm.name = 'glutaminyl_tRNA' OR cvterm.name = 'glutamyl_tRNA' OR cvterm.name = 'glycyl_tRNA' OR cvterm.name = 'histidyl_tRNA' OR cvterm.name = 'isoleucyl_tRNA' OR cvterm.name = 'leucyl_tRNA' OR cvterm.name = 'lysyl_tRNA' OR cvterm.name = 'methionyl_tRNA' OR cvterm.name = 'phenylalanyl_tRNA' OR cvterm.name = 'prolyl_tRNA' OR cvterm.name = 'seryl_tRNA' OR cvterm.name = 'threonyl_tRNA' OR cvterm.name = 'tryptophanyl_tRNA' OR cvterm.name = 'tyrosyl_tRNA' OR cvterm.name = 'valyl_tRNA' OR cvterm.name = 'pyrrolysyl_tRNA' OR cvterm.name = 'arginyl_tRNA' OR cvterm.name = 'selenocysteinyl_tRNA' OR cvterm.name = 'U1_snRNA' OR cvterm.name = 'U2_snRNA' OR cvterm.name = 'U4_snRNA' OR cvterm.name = 'U4atac_snRNA' OR cvterm.name = 'U5_snRNA' OR cvterm.name = 'U6_snRNA' OR cvterm.name = 'U6atac_snRNA' OR cvterm.name = 'U11_snRNA' OR cvterm.name = 'U12_snRNA' OR cvterm.name = 'C_D_box_snoRNA' OR cvterm.name = 'H_ACA_box_snoRNA' OR cvterm.name = 'U14_snoRNA' OR cvterm.name = 'U3_snoRNA' OR cvterm.name = 'methylation_guide_snoRNA' OR cvterm.name = 'pseudouridylation_guide_snoRNA' OR cvterm.name = 'miRNA' OR cvterm.name = 'RNA_6S' OR cvterm.name = 'CsrB_RsmB_RNA' OR cvterm.name = 'DsrA_RNA' OR cvterm.name = 'OxyS_RNA' OR cvterm.name = 'RprA_RNA' OR cvterm.name = 'RRE_RNA' OR cvterm.name = 'spot_42_RNA' OR cvterm.name = 'tmRNA' OR cvterm.name = 'GcvB_RNA' OR cvterm.name = 'MicF_RNA' OR cvterm.name = 'ribozyme' OR cvterm.name = 'trans_spliced_mRNA' OR cvterm.name = 'monocistronic_primary_transcript' OR cvterm.name = 'monocistronic_mRNA' OR cvterm.name = 'edited_transcript_by_A_to_I_substitution' OR cvterm.name = 'edited_mRNA' OR cvterm.name = 'transcription_regulatory_region' OR cvterm.name = 'translation_regulatory_region' OR cvterm.name = 'recombination_regulatory_region' OR cvterm.name = 'replication_regulatory_region' OR cvterm.name = 'terminator' OR cvterm.name = 'TF_binding_site' OR cvterm.name = 'polyA_signal_sequence' OR cvterm.name = 'gene_group_regulatory_region' OR cvterm.name = 'transcriptional_cis_regulatory_region' OR cvterm.name = 'splicing_regulatory_region' OR cvterm.name = 'cis_regulatory_frameshift_element' OR cvterm.name = 'intronic_regulatory_region' OR cvterm.name = 'bacterial_terminator' OR cvterm.name = 'eukaryotic_terminator' OR cvterm.name = 'rho_dependent_bacterial_terminator' OR cvterm.name = 'rho_independent_bacterial_terminator' OR cvterm.name = 'terminator_of_type_2_RNApol_III_promoter' OR cvterm.name = 'operator' OR cvterm.name = 'bacterial_RNApol_promoter' OR cvterm.name = 'bacterial_terminator' OR cvterm.name = 'bacterial_RNApol_promoter_sigma_70' OR cvterm.name = 'bacterial_RNApol_promoter_sigma54' OR cvterm.name = 'rho_dependent_bacterial_terminator' OR cvterm.name = 'rho_independent_bacterial_terminator' OR cvterm.name = 'promoter' OR cvterm.name = 'insulator' OR cvterm.name = 'CRM' OR cvterm.name = 'promoter_targeting_sequence' OR cvterm.name = 'ISRE' OR cvterm.name = 'bidirectional_promoter' OR cvterm.name = 'RNA_polymerase_promoter' OR cvterm.name = 'RNApol_I_promoter' OR cvterm.name = 'RNApol_II_promoter' OR cvterm.name = 'RNApol_III_promoter' OR cvterm.name = 'bacterial_RNApol_promoter' OR cvterm.name = 'Phage_RNA_Polymerase_Promoter' OR cvterm.name = 'RNApol_II_core_promoter' OR cvterm.name = 'RNApol_III_promoter_type_1' OR cvterm.name = 'RNApol_III_promoter_type_2' OR cvterm.name = 'RNApol_III_promoter_type_3' OR cvterm.name = 'bacterial_RNApol_promoter_sigma_70' OR cvterm.name = 'bacterial_RNApol_promoter_sigma54' OR cvterm.name = 'SP6_RNA_Polymerase_Promoter' OR cvterm.name = 'T3_RNA_Polymerase_Promoter' OR cvterm.name = 'T7_RNA_Polymerase_Promoter' OR cvterm.name = 'locus_control_region' OR cvterm.name = 'enhancer' OR cvterm.name = 'silencer' OR cvterm.name = 'enhancer_bound_by_factor' OR cvterm.name = 'shadow_enhancer' OR cvterm.name = 'splice_enhancer' OR cvterm.name = 'intronic_splice_enhancer' OR cvterm.name = 'exonic_splice_enhancer' OR cvterm.name = 'attenuator' OR cvterm.name = 'exon' OR cvterm.name = 'edited_transcript_feature' OR cvterm.name = 'mature_transcript_region' OR cvterm.name = 'primary_transcript_region' OR cvterm.name = 'exon_region' OR cvterm.name = 'anchor_binding_site' OR cvterm.name = 'coding_exon' OR cvterm.name = 'noncoding_exon' OR cvterm.name = 'interior_exon' OR cvterm.name = 'exon_of_single_exon_gene' OR cvterm.name = 'interior_coding_exon' OR cvterm.name = 'five_prime_coding_exon' OR cvterm.name = 'three_prime_coding_exon' OR cvterm.name = 'three_prime_noncoding_exon' OR cvterm.name = 'five_prime_noncoding_exon' OR cvterm.name = 'pre_edited_region' OR cvterm.name = 'editing_block' OR cvterm.name = 'editing_domain' OR cvterm.name = 'unedited_region' OR cvterm.name = 'mRNA_region' OR cvterm.name = 'tmRNA_region' OR cvterm.name = 'guide_RNA_region' OR cvterm.name = 'tRNA_region' OR cvterm.name = 'riboswitch' OR cvterm.name = 'ribosome_entry_site' OR cvterm.name = 'UTR' OR cvterm.name = 'CDS' OR cvterm.name = 'five_prime_open_reading_frame' OR cvterm.name = 'UTR_region' OR cvterm.name = 'CDS_region' OR cvterm.name = 'translational_frameshift' OR cvterm.name = 'recoding_stimulatory_region' OR cvterm.name = 'internal_ribosome_entry_site' OR cvterm.name = 'Shine_Dalgarno_sequence' OR cvterm.name = 'kozak_sequence' OR cvterm.name = 'internal_Shine_Dalgarno_sequence' OR cvterm.name = 'five_prime_UTR' OR cvterm.name = 'three_prime_UTR' OR cvterm.name = 'internal_UTR' OR cvterm.name = 'untranslated_region_polycistronic_mRNA' OR cvterm.name = 'edited_CDS' OR cvterm.name = 'CDS_fragment' OR cvterm.name = 'CDS_independently_known' OR cvterm.name = 'CDS_predicted' OR cvterm.name = 'orphan_CDS' OR cvterm.name = 'CDS_supported_by_sequence_similarity_data' OR cvterm.name = 'CDS_supported_by_domain_match_data' OR cvterm.name = 'CDS_supported_by_EST_or_cDNA_data' OR cvterm.name = 'upstream_AUG_codon' OR cvterm.name = 'AU_rich_element' OR cvterm.name = 'Bruno_response_element' OR cvterm.name = 'iron_responsive_element' OR cvterm.name = 'coding_start' OR cvterm.name = 'coding_end' OR cvterm.name = 'codon' OR cvterm.name = 'recoded_codon' OR cvterm.name = 'start_codon' OR cvterm.name = 'stop_codon' OR cvterm.name = 'stop_codon_read_through' OR cvterm.name = 'stop_codon_redefined_as_pyrrolysine' OR cvterm.name = 'stop_codon_redefined_as_selenocysteine' OR cvterm.name = 'non_canonical_start_codon' OR cvterm.name = 'four_bp_start_codon' OR cvterm.name = 'CTG_start_codon' OR cvterm.name = 'plus_1_translational_frameshift' OR cvterm.name = 'plus_2_translational_frameshift' OR cvterm.name = 'internal_Shine_Dalgarno_sequence' OR cvterm.name = 'SECIS_element' OR cvterm.name = 'three_prime_recoding_site' OR cvterm.name = 'five_prime_recoding_site' OR cvterm.name = 'stop_codon_signal' OR cvterm.name = 'three_prime_stem_loop_structure' OR cvterm.name = 'flanking_three_prime_quadruplet_recoding_signal' OR cvterm.name = 'three_prime_repeat_recoding_signal' OR cvterm.name = 'distant_three_prime_recoding_signal' OR cvterm.name = 'UAG_stop_codon_signal' OR cvterm.name = 'UAA_stop_codon_signal' OR cvterm.name = 'UGA_stop_codon_signal' OR cvterm.name = 'tmRNA_coding_piece' OR cvterm.name = 'tmRNA_acceptor_piece' OR cvterm.name = 'anchor_region' OR cvterm.name = 'template_region' OR cvterm.name = 'anticodon_loop' OR cvterm.name = 'anticodon' OR cvterm.name = 'CCA_tail' OR cvterm.name = 'DHU_loop' OR cvterm.name = 'T_loop' OR cvterm.name = 'splice_site' OR cvterm.name = 'intron' OR cvterm.name = 'clip' OR cvterm.name = 'TSS' OR cvterm.name = 'transcription_end_site' OR cvterm.name = 'spliced_leader_RNA' OR cvterm.name = 'rRNA_primary_transcript_region' OR cvterm.name = 'spliceosomal_intron_region' OR cvterm.name = 'intron_domain' OR cvterm.name = 'miRNA_primary_transcript_region' OR cvterm.name = 'outron' OR cvterm.name = 'cis_splice_site' OR cvterm.name = 'trans_splice_site' OR cvterm.name = 'cryptic_splice_site' OR cvterm.name = 'five_prime_cis_splice_site' OR cvterm.name = 'three_prime_cis_splice_site' OR cvterm.name = 'recursive_splice_site' OR cvterm.name = 'canonical_five_prime_splice_site' OR cvterm.name = 'non_canonical_five_prime_splice_site' OR cvterm.name = 'canonical_three_prime_splice_site' OR cvterm.name = 'non_canonical_three_prime_splice_site' OR cvterm.name = 'trans_splice_acceptor_site' OR cvterm.name = 'trans_splice_donor_site' OR cvterm.name = 'SL1_acceptor_site' OR cvterm.name = 'SL2_acceptor_site' OR cvterm.name = 'SL3_acceptor_site' OR cvterm.name = 'SL4_acceptor_site' OR cvterm.name = 'SL5_acceptor_site' OR cvterm.name = 'SL6_acceptor_site' OR cvterm.name = 'SL7_acceptor_site' OR cvterm.name = 'SL8_acceptor_site' OR cvterm.name = 'SL9_acceptor_site' OR cvterm.name = 'SL10_accceptor_site' OR cvterm.name = 'SL11_acceptor_site' OR cvterm.name = 'SL12_acceptor_site' OR cvterm.name = 'five_prime_intron' OR cvterm.name = 'interior_intron' OR cvterm.name = 'three_prime_intron' OR cvterm.name = 'twintron' OR cvterm.name = 'UTR_intron' OR cvterm.name = 'autocatalytically_spliced_intron' OR cvterm.name = 'spliceosomal_intron' OR cvterm.name = 'mobile_intron' OR cvterm.name = 'endonuclease_spliced_intron' OR cvterm.name = 'five_prime_UTR_intron' OR cvterm.name = 'three_prime_UTR_intron' OR cvterm.name = 'group_I_intron' OR cvterm.name = 'group_II_intron' OR cvterm.name = 'group_III_intron' OR cvterm.name = 'group_IIA_intron' OR cvterm.name = 'group_IIB_intron' OR cvterm.name = 'U2_intron' OR cvterm.name = 'U12_intron' OR cvterm.name = 'archaeal_intron' OR cvterm.name = 'tRNA_intron' OR cvterm.name = 'five_prime_clip' OR cvterm.name = 'three_prime_clip' OR cvterm.name = 'major_TSS' OR cvterm.name = 'minor_TSS' OR cvterm.name = 'transcribed_spacer_region' OR cvterm.name = 'internal_transcribed_spacer_region' OR cvterm.name = 'external_transcribed_spacer_region' OR cvterm.name = 'intronic_splice_enhancer' OR cvterm.name = 'branch_site' OR cvterm.name = 'polypyrimidine_tract' OR cvterm.name = 'internal_guide_sequence' OR cvterm.name = 'mirtron' OR cvterm.name = 'pre_miRNA' OR cvterm.name = 'miRNA_stem' OR cvterm.name = 'miRNA_loop' OR cvterm.name = 'miRNA_antiguide' OR cvterm.name = 'noncoding_region_of_exon' OR cvterm.name = 'coding_region_of_exon' OR cvterm.name = 'three_prime_coding_exon_noncoding_region' OR cvterm.name = 'five_prime_coding_exon_noncoding_region' OR cvterm.name = 'five_prime_coding_exon_coding_region' OR cvterm.name = 'three_prime_coding_exon_coding_region' OR cvterm.name = 'mature_protein_region' OR cvterm.name = 'immature_peptide_region' OR cvterm.name = 'compositionally_biased_region_of_peptide' OR cvterm.name = 'polypeptide_structural_region' OR cvterm.name = 'polypeptide_variation_site' OR cvterm.name = 'peptide_localization_signal' OR cvterm.name = 'cleaved_peptide_region' OR cvterm.name = 'hydrophobic_region_of_peptide' OR cvterm.name = 'polypeptide_conserved_region' OR cvterm.name = 'active_peptide' OR cvterm.name = 'polypeptide_domain' OR cvterm.name = 'membrane_structure' OR cvterm.name = 'extramembrane_polypeptide_region' OR cvterm.name = 'intramembrane_polypeptide_region' OR cvterm.name = 'polypeptide_secondary_structure' OR cvterm.name = 'polypeptide_structural_motif' OR cvterm.name = 'intrinsically_unstructured_polypeptide_region' OR cvterm.name = 'cytoplasmic_polypeptide_region' OR cvterm.name = 'non_cytoplasmic_polypeptide_region' OR cvterm.name = 'membrane_peptide_loop' OR cvterm.name = 'transmembrane_polypeptide_region' OR cvterm.name = 'asx_motif' OR cvterm.name = 'beta_bulge' OR cvterm.name = 'beta_bulge_loop' OR cvterm.name = 'beta_strand' OR cvterm.name = 'peptide_helix' OR cvterm.name = 'polypeptide_nest_motif' OR cvterm.name = 'schellmann_loop' OR cvterm.name = 'serine_threonine_motif' OR cvterm.name = 'serine_threonine_staple_motif' OR cvterm.name = 'polypeptide_turn_motif' OR cvterm.name = 'catmat_left_handed_three' OR cvterm.name = 'catmat_left_handed_four' OR cvterm.name = 'catmat_right_handed_three' OR cvterm.name = 'catmat_right_handed_four' OR cvterm.name = 'alpha_beta_motif' OR cvterm.name = 'peptide_coil' OR cvterm.name = 'beta_bulge_loop_five' OR cvterm.name = 'beta_bulge_loop_six' OR cvterm.name = 'antiparallel_beta_strand' OR cvterm.name = 'parallel_beta_strand' OR cvterm.name = 'left_handed_peptide_helix' OR cvterm.name = 'right_handed_peptide_helix' OR cvterm.name = 'alpha_helix' OR cvterm.name = 'pi_helix' OR cvterm.name = 'three_ten_helix' OR cvterm.name = 'polypeptide_nest_left_right_motif' OR cvterm.name = 'polypeptide_nest_right_left_motif' OR cvterm.name = 'schellmann_loop_seven' OR cvterm.name = 'schellmann_loop_six' OR cvterm.name = 'asx_turn' OR cvterm.name = 'beta_turn' OR cvterm.name = 'gamma_turn' OR cvterm.name = 'serine_threonine_turn' OR cvterm.name = 'asx_turn_left_handed_type_one' OR cvterm.name = 'asx_turn_left_handed_type_two' OR cvterm.name = 'asx_turn_right_handed_type_two' OR cvterm.name = 'asx_turn_right_handed_type_one' OR cvterm.name = 'beta_turn_left_handed_type_one' OR cvterm.name = 'beta_turn_left_handed_type_two' OR cvterm.name = 'beta_turn_right_handed_type_one' OR cvterm.name = 'beta_turn_right_handed_type_two' OR cvterm.name = 'beta_turn_type_six' OR cvterm.name = 'beta_turn_type_eight' OR cvterm.name = 'beta_turn_type_six_a' OR cvterm.name = 'beta_turn_type_six_b' OR cvterm.name = 'beta_turn_type_six_a_one' OR cvterm.name = 'beta_turn_type_six_a_two' OR cvterm.name = 'gamma_turn_classic' OR cvterm.name = 'gamma_turn_inverse' OR cvterm.name = 'st_turn_left_handed_type_one' OR cvterm.name = 'st_turn_left_handed_type_two' OR cvterm.name = 'st_turn_right_handed_type_one' OR cvterm.name = 'st_turn_right_handed_type_two' OR cvterm.name = 'coiled_coil' OR cvterm.name = 'helix_turn_helix' OR cvterm.name = 'natural_variant_site' OR cvterm.name = 'mutated_variant_site' OR cvterm.name = 'alternate_sequence_site' OR cvterm.name = 'signal_peptide' OR cvterm.name = 'transit_peptide' OR cvterm.name = 'nuclear_localization_signal' OR cvterm.name = 'endosomal_localization_signal' OR cvterm.name = 'lysosomal_localization_signal' OR cvterm.name = 'nuclear_export_signal' OR cvterm.name = 'nuclear_rim_localization_signal' OR cvterm.name = 'cleaved_initiator_methionine' OR cvterm.name = 'intein' OR cvterm.name = 'propeptide_cleavage_site' OR cvterm.name = 'propeptide' OR cvterm.name = 'cleaved_for_gpi_anchor_region' OR cvterm.name = 'lipoprotein_signal_peptide' OR cvterm.name = 'n_terminal_region' OR cvterm.name = 'c_terminal_region' OR cvterm.name = 'central_hydrophobic_region_of_signal_peptide' OR cvterm.name = 'polypeptide_domain' OR cvterm.name = 'polypeptide_motif' OR cvterm.name = 'polypeptide_repeat' OR cvterm.name = 'biochemical_region_of_peptide' OR cvterm.name = 'polypeptide_conserved_motif' OR cvterm.name = 'post_translationally_modified_region' OR cvterm.name = 'conformational_switch' OR cvterm.name = 'molecular_contact_region' OR cvterm.name = 'polypeptide_binding_motif' OR cvterm.name = 'polypeptide_catalytic_motif' OR cvterm.name = 'histone_modification' OR cvterm.name = 'histone_methylation_site' OR cvterm.name = 'histone_acetylation_site' OR cvterm.name = 'histone_ubiqitination_site' OR cvterm.name = 'histone_acylation_region' OR cvterm.name = 'H4K20_monomethylation_site' OR cvterm.name = 'H2BK5_monomethylation_site' OR cvterm.name = 'H3K27_methylation_site' OR cvterm.name = 'H3K36_methylation_site' OR cvterm.name = 'H3K4_methylation_site' OR cvterm.name = 'H3K79_methylation_site' OR cvterm.name = 'H3K9_methylation_site' OR cvterm.name = 'H3K27_monomethylation_site' OR cvterm.name = 'H3K27_trimethylation_site' OR cvterm.name = 'H3K27_dimethylation_site' OR cvterm.name = 'H3K36_monomethylation_site' OR cvterm.name = 'H3K36_dimethylation_site' OR cvterm.name = 'H3K36_trimethylation_site' OR cvterm.name = 'H3K4_monomethylation_site' OR cvterm.name = 'H3K4_trimethylation' OR cvterm.name = 'H3K4_dimethylation_site' OR cvterm.name = 'H3K79_monomethylation_site' OR cvterm.name = 'H3K79_dimethylation_site' OR cvterm.name = 'H3K79_trimethylation_site' OR cvterm.name = 'H3K9_trimethylation_site' OR cvterm.name = 'H3K9_monomethylation_site' OR cvterm.name = 'H3K9_dimethylation_site' OR cvterm.name = 'H3K9_acetylation_site' OR cvterm.name = 'H3K14_acetylation_site' OR cvterm.name = 'H3K18_acetylation_site' OR cvterm.name = 'H3K23_acylation site' OR cvterm.name = 'H3K27_acylation_site' OR cvterm.name = 'H4K16_acylation_site' OR cvterm.name = 'H4K5_acylation_site' OR cvterm.name = 'H4K8_acylation site' OR cvterm.name = 'H2B_ubiquitination_site' OR cvterm.name = 'H4K_acylation_region' OR cvterm.name = 'polypeptide_metal_contact' OR cvterm.name = 'protein_protein_contact' OR cvterm.name = 'polypeptide_ligand_contact' OR cvterm.name = 'polypeptide_DNA_contact' OR cvterm.name = 'polypeptide_calcium_ion_contact_site' OR cvterm.name = 'polypeptide_cobalt_ion_contact_site' OR cvterm.name = 'polypeptide_copper_ion_contact_site' OR cvterm.name = 'polypeptide_iron_ion_contact_site' OR cvterm.name = 'polypeptide_magnesium_ion_contact_site' OR cvterm.name = 'polypeptide_manganese_ion_contact_site' OR cvterm.name = 'polypeptide_molybdenum_ion_contact_site' OR cvterm.name = 'polypeptide_nickel_ion_contact_site' OR cvterm.name = 'polypeptide_tungsten_ion_contact_site' OR cvterm.name = 'polypeptide_zinc_ion_contact_site' OR cvterm.name = 'non_transcribed_region' OR cvterm.name = 'gene_fragment' OR cvterm.name = 'TSS_region' OR cvterm.name = 'gene_segment' OR cvterm.name = 'pseudogenic_gene_segment' OR cvterm.name = 'mobile_intron' OR cvterm.name = 'extrachromosomal_mobile_genetic_element' OR cvterm.name = 'integrated_mobile_genetic_element' OR cvterm.name = 'natural_transposable_element' OR cvterm.name = 'viral_sequence' OR cvterm.name = 'natural_plasmid' OR cvterm.name = 'phage_sequence' OR cvterm.name = 'ds_RNA_viral_sequence' OR cvterm.name = 'ds_DNA_viral_sequence' OR cvterm.name = 'ss_RNA_viral_sequence' OR cvterm.name = 'negative_sense_ssRNA_viral_sequence' OR cvterm.name = 'positive_sense_ssRNA_viral_sequence' OR cvterm.name = 'ambisense_ssRNA_viral_sequence' OR cvterm.name = 'transposable_element' OR cvterm.name = 'proviral_region' OR cvterm.name = 'integron' OR cvterm.name = 'genomic_island' OR cvterm.name = 'integrated_plasmid' OR cvterm.name = 'cointegrated_plasmid' OR cvterm.name = 'retrotransposon' OR cvterm.name = 'DNA_transposon' OR cvterm.name = 'foreign_transposable_element' OR cvterm.name = 'transgenic_transposable_element' OR cvterm.name = 'natural_transposable_element' OR cvterm.name = 'engineered_transposable_element' OR cvterm.name = 'nested_transposon' OR cvterm.name = 'LTR_retrotransposon' OR cvterm.name = 'non_LTR_retrotransposon' OR cvterm.name = 'LINE_element' OR cvterm.name = 'SINE_element' OR cvterm.name = 'terminal_inverted_repeat_element' OR cvterm.name = 'foldback_element' OR cvterm.name = 'conjugative_transposon' OR cvterm.name = 'helitron' OR cvterm.name = 'p_element' OR cvterm.name = 'MITE' OR cvterm.name = 'insertion_sequence' OR cvterm.name = 'polinton' OR cvterm.name = 'engineered_foreign_transposable_element' OR cvterm.name = 'engineered_foreign_transposable_element' OR cvterm.name = 'prophage' OR cvterm.name = 'pathogenic_island' OR cvterm.name = 'metabolic_island' OR cvterm.name = 'adaptive_island' OR cvterm.name = 'symbiosis_island' OR cvterm.name = 'cryptic_prophage' OR cvterm.name = 'defective_conjugative_transposon' OR cvterm.name = 'plasmid' OR cvterm.name = 'chromosome' OR cvterm.name = 'vector_replicon' OR cvterm.name = 'maxicircle' OR cvterm.name = 'minicircle' OR cvterm.name = 'viral_sequence' OR cvterm.name = 'engineered_plasmid' OR cvterm.name = 'episome' OR cvterm.name = 'natural_plasmid' OR cvterm.name = 'engineered_episome' OR cvterm.name = 'gene_trap_construct' OR cvterm.name = 'promoter_trap_construct' OR cvterm.name = 'enhancer_trap_construct' OR cvterm.name = 'engineered_episome' OR cvterm.name = 'mitochondrial_chromosome' OR cvterm.name = 'chloroplast_chromosome' OR cvterm.name = 'chromoplast_chromosome' OR cvterm.name = 'cyanelle_chromosome' OR cvterm.name = 'leucoplast_chromosome' OR cvterm.name = 'macronuclear_chromosome' OR cvterm.name = 'micronuclear_chromosome' OR cvterm.name = 'nuclear_chromosome' OR cvterm.name = 'nucleomorphic_chromosome' OR cvterm.name = 'DNA_chromosome' OR cvterm.name = 'RNA_chromosome' OR cvterm.name = 'apicoplast_chromosome' OR cvterm.name = 'double_stranded_DNA_chromosome' OR cvterm.name = 'single_stranded_DNA_chromosome' OR cvterm.name = 'linear_double_stranded_DNA_chromosome' OR cvterm.name = 'circular_double_stranded_DNA_chromosome' OR cvterm.name = 'linear_single_stranded_DNA_chromosome' OR cvterm.name = 'circular_single_stranded_DNA_chromosome' OR cvterm.name = 'single_stranded_RNA_chromosome' OR cvterm.name = 'double_stranded_RNA_chromosome' OR cvterm.name = 'linear_single_stranded_RNA_chromosome' OR cvterm.name = 'circular_single_stranded_RNA_chromosome' OR cvterm.name = 'linear_double_stranded_RNA_chromosome' OR cvterm.name = 'circular_double_stranded_RNA_chromosome' OR cvterm.name = 'YAC' OR cvterm.name = 'BAC' OR cvterm.name = 'PAC' OR cvterm.name = 'cosmid' OR cvterm.name = 'phagemid' OR cvterm.name = 'fosmid' OR cvterm.name = 'lambda_vector' OR cvterm.name = 'plasmid_vector' OR cvterm.name = 'targeting_vector' OR cvterm.name = 'phage_sequence' OR cvterm.name = 'ds_RNA_viral_sequence' OR cvterm.name = 'ds_DNA_viral_sequence' OR cvterm.name = 'ss_RNA_viral_sequence' OR cvterm.name = 'negative_sense_ssRNA_viral_sequence' OR cvterm.name = 'positive_sense_ssRNA_viral_sequence' OR cvterm.name = 'ambisense_ssRNA_viral_sequence' OR cvterm.name = 'modified_RNA_base_feature' OR cvterm.name = 'inosine' OR cvterm.name = 'seven_methylguanine' OR cvterm.name = 'ribothymidine' OR cvterm.name = 'modified_adenosine' OR cvterm.name = 'modified_cytidine' OR cvterm.name = 'modified_guanosine' OR cvterm.name = 'modified_uridine' OR cvterm.name = 'modified_inosine' OR cvterm.name = 'methylinosine' OR cvterm.name = 'one_methylinosine' OR cvterm.name = 'one_two_prime_O_dimethylinosine' OR cvterm.name = 'two_prime_O_methylinosine' OR cvterm.name = 'one_methyladenosine' OR cvterm.name = 'two_methyladenosine' OR cvterm.name = 'N6_methyladenosine' OR cvterm.name = 'two_prime_O_methyladenosine' OR cvterm.name = 'two_methylthio_N6_methyladenosine' OR cvterm.name = 'N6_isopentenyladenosine' OR cvterm.name = 'two_methylthio_N6_isopentenyladenosine' OR cvterm.name = 'N6_cis_hydroxyisopentenyl_adenosine' OR cvterm.name = 'two_methylthio_N6_cis_hydroxyisopentenyl_adenosine' OR cvterm.name = 'N6_glycinylcarbamoyladenosine' OR cvterm.name = 'N6_threonylcarbamoyladenosine' OR cvterm.name = 'two_methylthio_N6_threonyl_carbamoyladenosine' OR cvterm.name = 'N6_methyl_N6_threonylcarbamoyladenosine' OR cvterm.name = 'N6_hydroxynorvalylcarbamoyladenosine' OR cvterm.name = 'two_methylthio_N6_hydroxynorvalyl_carbamoyladenosine' OR cvterm.name = 'two_prime_O_ribosyladenosine_phosphate' OR cvterm.name = 'N6_N6_dimethyladenosine' OR cvterm.name = 'N6_2_prime_O_dimethyladenosine' OR cvterm.name = 'N6_N6_2_prime_O_trimethyladenosine' OR cvterm.name = 'one_two_prime_O_dimethyladenosine' OR cvterm.name = 'N6_acetyladenosine' OR cvterm.name = 'three_methylcytidine' OR cvterm.name = 'five_methylcytidine' OR cvterm.name = 'two_prime_O_methylcytidine' OR cvterm.name = 'two_thiocytidine' OR cvterm.name = 'N4_acetylcytidine' OR cvterm.name = 'five_formylcytidine' OR cvterm.name = 'five_two_prime_O_dimethylcytidine' OR cvterm.name = 'N4_acetyl_2_prime_O_methylcytidine' OR cvterm.name = 'lysidine' OR cvterm.name = 'N4_methylcytidine' OR cvterm.name = 'N4_2_prime_O_dimethylcytidine' OR cvterm.name = 'five_hydroxymethylcytidine' OR cvterm.name = 'five_formyl_two_prime_O_methylcytidine' OR cvterm.name = 'N4_N4_2_prime_O_trimethylcytidine' OR cvterm.name = 'seven_deazaguanosine' OR cvterm.name = 'one_methylguanosine' OR cvterm.name = 'N2_methylguanosine' OR cvterm.name = 'seven_methylguanosine' OR cvterm.name = 'two_prime_O_methylguanosine' OR cvterm.name = 'N2_N2_dimethylguanosine' OR cvterm.name = 'N2_2_prime_O_dimethylguanosine' OR cvterm.name = 'N2_N2_2_prime_O_trimethylguanosine' OR cvterm.name = 'two_prime_O_ribosylguanosine_phosphate' OR cvterm.name = 'wybutosine' OR cvterm.name = 'peroxywybutosine' OR cvterm.name = 'hydroxywybutosine' OR cvterm.name = 'undermodified_hydroxywybutosine' OR cvterm.name = 'wyosine' OR cvterm.name = 'methylwyosine' OR cvterm.name = 'N2_7_dimethylguanosine' OR cvterm.name = 'N2_N2_7_trimethylguanosine' OR cvterm.name = 'one_two_prime_O_dimethylguanosine' OR cvterm.name = 'four_demethylwyosine' OR cvterm.name = 'isowyosine' OR cvterm.name = 'N2_7_2prirme_O_trimethylguanosine' OR cvterm.name = 'queuosine' OR cvterm.name = 'epoxyqueuosine' OR cvterm.name = 'galactosyl_queuosine' OR cvterm.name = 'mannosyl_queuosine' OR cvterm.name = 'seven_cyano_seven_deazaguanosine' OR cvterm.name = 'seven_aminomethyl_seven_deazaguanosine' OR cvterm.name = 'archaeosine' OR cvterm.name = 'dihydrouridine' OR cvterm.name = 'pseudouridine' OR cvterm.name = 'five_methyluridine' OR cvterm.name = 'two_prime_O_methyluridine' OR cvterm.name = 'five_two_prime_O_dimethyluridine' OR cvterm.name = 'one_methylpseudouridine' OR cvterm.name = 'two_prime_O_methylpseudouridine' OR cvterm.name = 'two_thiouridine' OR cvterm.name = 'four_thiouridine' OR cvterm.name = 'five_methyl_2_thiouridine' OR cvterm.name = 'two_thio_two_prime_O_methyluridine' OR cvterm.name = 'three_three_amino_three_carboxypropyl_uridine' OR cvterm.name = 'five_hydroxyuridine' OR cvterm.name = 'five_methoxyuridine' OR cvterm.name = 'uridine_five_oxyacetic_acid' OR cvterm.name = 'uridine_five_oxyacetic_acid_methyl_ester' OR cvterm.name = 'five_carboxyhydroxymethyl_uridine' OR cvterm.name = 'five_carboxyhydroxymethyl_uridine_methyl_ester' OR cvterm.name = 'five_methoxycarbonylmethyluridine' OR cvterm.name = 'five_methoxycarbonylmethyl_two_prime_O_methyluridine' OR cvterm.name = 'five_methoxycarbonylmethyl_two_thiouridine' OR cvterm.name = 'five_aminomethyl_two_thiouridine' OR cvterm.name = 'five_methylaminomethyluridine' OR cvterm.name = 'five_methylaminomethyl_two_thiouridine' OR cvterm.name = 'five_methylaminomethyl_two_selenouridine' OR cvterm.name = 'five_carbamoylmethyluridine' OR cvterm.name = 'five_carbamoylmethyl_two_prime_O_methyluridine' OR cvterm.name = 'five_carboxymethylaminomethyluridine' OR cvterm.name = 'five_carboxymethylaminomethyl_two_prime_O_methyluridine' OR cvterm.name = 'five_carboxymethylaminomethyl_two_thiouridine' OR cvterm.name = 'three_methyluridine' OR cvterm.name = 'one_methyl_three_three_amino_three_carboxypropyl_pseudouridine' OR cvterm.name = 'five_carboxymethyluridine' OR cvterm.name = 'three_two_prime_O_dimethyluridine' OR cvterm.name = 'five_methyldihydrouridine' OR cvterm.name = 'three_methylpseudouridine' OR cvterm.name = 'five_taurinomethyluridine' OR cvterm.name = 'five_taurinomethyl_two_thiouridine' OR cvterm.name = 'five_isopentenylaminomethyl_uridine' OR cvterm.name = 'five_isopentenylaminomethyl_two_thiouridine' OR cvterm.name = 'five_isopentenylaminomethyl_two_prime_O_methyluridine' OR cvterm.name = 'catalytic_residue' OR cvterm.name = 'modified_amino_acid_feature' OR cvterm.name = 'alanine' OR cvterm.name = 'valine' OR cvterm.name = 'leucine' OR cvterm.name = 'isoleucine' OR cvterm.name = 'proline' OR cvterm.name = 'tryptophan' OR cvterm.name = 'phenylalanine' OR cvterm.name = 'methionine' OR cvterm.name = 'glycine' OR cvterm.name = 'serine' OR cvterm.name = 'threonine' OR cvterm.name = 'tyrosine' OR cvterm.name = 'cysteine' OR cvterm.name = 'glutamine' OR cvterm.name = 'asparagine' OR cvterm.name = 'lysine' OR cvterm.name = 'arginine' OR cvterm.name = 'histidine' OR cvterm.name = 'aspartic_acid' OR cvterm.name = 'glutamic_acid' OR cvterm.name = 'selenocysteine' OR cvterm.name = 'pyrrolysine' OR cvterm.name = 'modified_glycine' OR cvterm.name = 'modified_L_alanine' OR cvterm.name = 'modified_L_asparagine' OR cvterm.name = 'modified_L_aspartic_acid' OR cvterm.name = 'modified_L_cysteine' OR cvterm.name = 'modified_L_glutamic_acid' OR cvterm.name = 'modified_L_threonine' OR cvterm.name = 'modified_L_tryptophan' OR cvterm.name = 'modified_L_glutamine' OR cvterm.name = 'modified_L_methionine' OR cvterm.name = 'modified_L_isoleucine' OR cvterm.name = 'modified_L_phenylalanine' OR cvterm.name = 'modified_L_histidine' OR cvterm.name = 'modified_L_serine' OR cvterm.name = 'modified_L_lysine' OR cvterm.name = 'modified_L_leucine' OR cvterm.name = 'modified_L_selenocysteine' OR cvterm.name = 'modified_L_valine' OR cvterm.name = 'modified_L_proline' OR cvterm.name = 'modified_L_tyrosine' OR cvterm.name = 'modified_L_arginine' OR cvterm.name = 'heritable_phenotypic_marker' OR cvterm.name = 'DArT_marker' OR cvterm.name = 'nucleotide_motif' OR cvterm.name = 'DNA_motif' OR cvterm.name = 'RNA_motif' OR cvterm.name = 'PSE_motif' OR cvterm.name = 'CAAT_signal' OR cvterm.name = 'minus_10_signal' OR cvterm.name = 'minus_35_signal' OR cvterm.name = 'DRE_motif' OR cvterm.name = 'E_box_motif' OR cvterm.name = 'INR1_motif' OR cvterm.name = 'GAGA_motif' OR cvterm.name = 'octamer_motif' OR cvterm.name = 'retinoic_acid_responsive_element' OR cvterm.name = 'promoter_element' OR cvterm.name = 'DCE_SI' OR cvterm.name = 'DCE_SII' OR cvterm.name = 'DCE_SIII' OR cvterm.name = 'minus_12_signal' OR cvterm.name = 'minus_24_signal' OR cvterm.name = 'GC_rich_promoter_region' OR cvterm.name = 'DMv4_motif' OR cvterm.name = 'DMv5_motif' OR cvterm.name = 'DMv3_motif' OR cvterm.name = 'DMv2_motif' OR cvterm.name = 'DPE1_motif' OR cvterm.name = 'DMv1_motif' OR cvterm.name = 'NDM2_motif' OR cvterm.name = 'NDM3_motif' OR cvterm.name = 'core_promoter_element' OR cvterm.name = 'regulatory_promoter_element' OR cvterm.name = 'INR_motif' OR cvterm.name = 'DPE_motif' OR cvterm.name = 'BREu_motif' OR cvterm.name = 'TATA_box' OR cvterm.name = 'A_box' OR cvterm.name = 'B_box' OR cvterm.name = 'C_box' OR cvterm.name = 'MTE' OR cvterm.name = 'BREd_motif' OR cvterm.name = 'DCE' OR cvterm.name = 'intermediate_element' OR cvterm.name = 'RNA_polymerase_II_TATA_box' OR cvterm.name = 'RNA_polymerase_III_TATA_box' OR cvterm.name = 'A_box_type_1' OR cvterm.name = 'A_box_type_2' OR cvterm.name = 'proximal_promoter_element' OR cvterm.name = 'distal_promoter_element' OR cvterm.name = 'RNA_internal_loop' OR cvterm.name = 'A_minor_RNA_motif' OR cvterm.name = 'RNA_junction_loop' OR cvterm.name = 'hammerhead_ribozyme' OR cvterm.name = 'asymmetric_RNA_internal_loop' OR cvterm.name = 'symmetric_RNA_internal_loop' OR cvterm.name = 'K_turn_RNA_motif' OR cvterm.name = 'sarcin_like_RNA_motif' OR cvterm.name = 'RNA_hook_turn' OR cvterm.name = 'blunt_end_restriction_enzyme_cleavage_site' OR cvterm.name = 'sticky_end_restriction_enzyme_cleavage_site' OR cvterm.name = 'modified_base' OR cvterm.name = 'epigenetically_modified_gene' OR cvterm.name = 'histone_modification' OR cvterm.name = 'methylated_base_feature' OR cvterm.name = 'methylated_C' OR cvterm.name = 'methylated_A' OR cvterm.name = 'gene_rearranged_at_DNA_level' OR cvterm.name = 'maternally_imprinted_gene' OR cvterm.name = 'paternally_imprinted_gene' OR cvterm.name = 'allelically_excluded_gene' OR cvterm.name = 'histone_methylation_site' OR cvterm.name = 'histone_acetylation_site' OR cvterm.name = 'histone_ubiqitination_site' OR cvterm.name = 'histone_acylation_region' OR cvterm.name = 'H4K20_monomethylation_site' OR cvterm.name = 'H2BK5_monomethylation_site' OR cvterm.name = 'H3K27_methylation_site' OR cvterm.name = 'H3K36_methylation_site' OR cvterm.name = 'H3K4_methylation_site' OR cvterm.name = 'H3K79_methylation_site' OR cvterm.name = 'H3K9_methylation_site' OR cvterm.name = 'H3K27_monomethylation_site' OR cvterm.name = 'H3K27_trimethylation_site' OR cvterm.name = 'H3K27_dimethylation_site' OR cvterm.name = 'H3K36_monomethylation_site' OR cvterm.name = 'H3K36_dimethylation_site' OR cvterm.name = 'H3K36_trimethylation_site' OR cvterm.name = 'H3K4_monomethylation_site' OR cvterm.name = 'H3K4_trimethylation' OR cvterm.name = 'H3K4_dimethylation_site' OR cvterm.name = 'H3K79_monomethylation_site' OR cvterm.name = 'H3K79_dimethylation_site' OR cvterm.name = 'H3K79_trimethylation_site' OR cvterm.name = 'H3K9_trimethylation_site' OR cvterm.name = 'H3K9_monomethylation_site' OR cvterm.name = 'H3K9_dimethylation_site' OR cvterm.name = 'H3K9_acetylation_site' OR cvterm.name = 'H3K14_acetylation_site' OR cvterm.name = 'H3K18_acetylation_site' OR cvterm.name = 'H3K23_acylation site' OR cvterm.name = 'H3K27_acylation_site' OR cvterm.name = 'H4K16_acylation_site' OR cvterm.name = 'H4K5_acylation_site' OR cvterm.name = 'H4K8_acylation site' OR cvterm.name = 'H2B_ubiquitination_site' OR cvterm.name = 'H4K_acylation_region' OR cvterm.name = 'operon' OR cvterm.name = 'mating_type_region' OR cvterm.name = 'gene_array' OR cvterm.name = 'gene_subarray' OR cvterm.name = 'gene_cassette_array' OR cvterm.name = 'regulon' OR cvterm.name = 'sequence_length_variation' OR cvterm.name = 'MNP' OR cvterm.name = 'SNV' OR cvterm.name = 'complex_substitution' OR cvterm.name = 'simple_sequence_length_variation' OR cvterm.name = 'SNP' OR cvterm.name = 'point_mutation' OR cvterm.name = 'transition' OR cvterm.name = 'transversion' OR cvterm.name = 'pyrimidine_transition' OR cvterm.name = 'purine_transition' OR cvterm.name = 'C_to_T_transition' OR cvterm.name = 'T_to_C_transition' OR cvterm.name = 'C_to_T_transition_at_pCpG_site' OR cvterm.name = 'A_to_G_transition' OR cvterm.name = 'G_to_A_transition' OR cvterm.name = 'pyrimidine_to_purine_transversion' OR cvterm.name = 'purine_to_pyrimidine_transversion' OR cvterm.name = 'C_to_A_transversion' OR cvterm.name = 'C_to_G_transversion' OR cvterm.name = 'T_to_A_transversion' OR cvterm.name = 'T_to_G_transversion' OR cvterm.name = 'A_to_C_transversion' OR cvterm.name = 'A_to_T_transversion' OR cvterm.name = 'G_to_C_transversion' OR cvterm.name = 'G_to_T_transversion' OR cvterm.name = 'biological_region';

--- ************************************************
--- *** relation: topologically_defined_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region that is defined according to it ***
--- *** s relations with other regions within th ***
--- *** e same sequence.                         ***
--- ************************************************
---

CREATE VIEW topologically_defined_region AS
  SELECT
    feature_id AS topologically_defined_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'flanking_region' OR cvterm.name = 'repeat_component' OR cvterm.name = 'transposable_element_flanking_region' OR cvterm.name = 'five_prime_flanking_region' OR cvterm.name = 'three_prime_flanking_region' OR cvterm.name = 'non_LTR_retrotransposon_polymeric_tract' OR cvterm.name = 'LTR_component' OR cvterm.name = 'repeat_fragment' OR cvterm.name = 'transposon_fragment' OR cvterm.name = 'U5_LTR_region' OR cvterm.name = 'R_LTR_region' OR cvterm.name = 'U3_LTR_region' OR cvterm.name = 'three_prime_LTR_component' OR cvterm.name = 'five_prime_LTR_component' OR cvterm.name = 'U5_five_prime_LTR_region' OR cvterm.name = 'R_five_prime_LTR_region' OR cvterm.name = 'U3_five_prime_LTR_region' OR cvterm.name = 'R_three_prime_LTR_region' OR cvterm.name = 'U3_three_prime_LTR_region' OR cvterm.name = 'U5_three_prime_LTR_region' OR cvterm.name = 'R_five_prime_LTR_region' OR cvterm.name = 'U5_five_prime_LTR_region' OR cvterm.name = 'U3_five_prime_LTR_region' OR cvterm.name = 'topologically_defined_region';

--- ************************************************
--- *** relation: translocation_breakpoint ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The point within a chromosome where a tr ***
--- *** anslocation begins or ends.              ***
--- ************************************************
---

CREATE VIEW translocation_breakpoint AS
  SELECT
    feature_id AS translocation_breakpoint_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'translocation_breakpoint';

--- ************************************************
--- *** relation: insertion_breakpoint ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The point within a chromosome where a in ***
--- *** sertion begins or ends.                  ***
--- ************************************************
---

CREATE VIEW insertion_breakpoint AS
  SELECT
    feature_id AS insertion_breakpoint_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'insertion_breakpoint';

--- ************************************************
--- *** relation: deletion_breakpoint ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The point within a chromosome where a de ***
--- *** letion begins or ends.                   ***
--- ************************************************
---

CREATE VIEW deletion_breakpoint AS
  SELECT
    feature_id AS deletion_breakpoint_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'deletion_breakpoint';

--- ************************************************
--- *** relation: five_prime_flanking_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A flanking region located five prime of  ***
--- *** a specific region.                       ***
--- ************************************************
---

CREATE VIEW five_prime_flanking_region AS
  SELECT
    feature_id AS five_prime_flanking_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_flanking_region';

--- ************************************************
--- *** relation: three_prime_flanking_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A flanking region located three prime of ***
--- ***  a specific region.                      ***
--- ************************************************
---

CREATE VIEW three_prime_flanking_region AS
  SELECT
    feature_id AS three_prime_flanking_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_flanking_region';

--- ************************************************
--- *** relation: transcribed_fragment ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An experimental region, defined by a til ***
--- *** ing array experiment to be transcribed a ***
--- *** t some level.                            ***
--- ************************************************
---

CREATE VIEW transcribed_fragment AS
  SELECT
    feature_id AS transcribed_fragment_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'transcribed_fragment';

--- ************************************************
--- *** relation: cis_splice_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Intronic 2 bp region bordering exon. A s ***
--- *** plice_site that adjacent_to exon and ove ***
--- *** rlaps intron.                            ***
--- ************************************************
---

CREATE VIEW cis_splice_site AS
  SELECT
    feature_id AS cis_splice_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_cis_splice_site' OR cvterm.name = 'three_prime_cis_splice_site' OR cvterm.name = 'recursive_splice_site' OR cvterm.name = 'canonical_five_prime_splice_site' OR cvterm.name = 'non_canonical_five_prime_splice_site' OR cvterm.name = 'canonical_three_prime_splice_site' OR cvterm.name = 'non_canonical_three_prime_splice_site' OR cvterm.name = 'cis_splice_site';

--- ************************************************
--- *** relation: trans_splice_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Primary transcript region bordering tran ***
--- *** s-splice junction.                       ***
--- ************************************************
---

CREATE VIEW trans_splice_site AS
  SELECT
    feature_id AS trans_splice_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'trans_splice_acceptor_site' OR cvterm.name = 'trans_splice_donor_site' OR cvterm.name = 'SL1_acceptor_site' OR cvterm.name = 'SL2_acceptor_site' OR cvterm.name = 'SL3_acceptor_site' OR cvterm.name = 'SL4_acceptor_site' OR cvterm.name = 'SL5_acceptor_site' OR cvterm.name = 'SL6_acceptor_site' OR cvterm.name = 'SL7_acceptor_site' OR cvterm.name = 'SL8_acceptor_site' OR cvterm.name = 'SL9_acceptor_site' OR cvterm.name = 'SL10_accceptor_site' OR cvterm.name = 'SL11_acceptor_site' OR cvterm.name = 'SL12_acceptor_site' OR cvterm.name = 'trans_splice_site';

--- ************************************************
--- *** relation: splice_junction ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The boundary between an intron and an ex ***
--- *** on.                                      ***
--- ************************************************
---

CREATE VIEW splice_junction AS
  SELECT
    feature_id AS splice_junction_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'splice_junction';

--- ************************************************
--- *** relation: conformational_switch ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of a polypeptide, involved in t ***
--- *** he transition from one conformational st ***
--- *** ate to another.                          ***
--- ************************************************
---

CREATE VIEW conformational_switch AS
  SELECT
    feature_id AS conformational_switch_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'conformational_switch';

--- ************************************************
--- *** relation: dye_terminator_read ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A read produced by the dye terminator me ***
--- *** thod of sequencing.                      ***
--- ************************************************
---

CREATE VIEW dye_terminator_read AS
  SELECT
    feature_id AS dye_terminator_read_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'dye_terminator_read';

--- ************************************************
--- *** relation: pyrosequenced_read ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A read produced by pyrosequencing techno ***
--- *** logy.                                    ***
--- ************************************************
---

CREATE VIEW pyrosequenced_read AS
  SELECT
    feature_id AS pyrosequenced_read_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pyrosequenced_read';

--- ************************************************
--- *** relation: ligation_based_read ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A read produced by ligation based sequen ***
--- *** cing technologies.                       ***
--- ************************************************
---

CREATE VIEW ligation_based_read AS
  SELECT
    feature_id AS ligation_based_read_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'ligation_based_read';

--- ************************************************
--- *** relation: polymerase_synthesis_read ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A read produced by the polymerase based  ***
--- *** sequence by synthesis method.            ***
--- ************************************************
---

CREATE VIEW polymerase_synthesis_read AS
  SELECT
    feature_id AS polymerase_synthesis_read_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polymerase_synthesis_read';

--- ************************************************
--- *** relation: cis_regulatory_frameshift_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A structural region in an RNA molecule w ***
--- *** hich promotes ribosomal frameshifting of ***
--- ***  cis coding sequence.                    ***
--- ************************************************
---

CREATE VIEW cis_regulatory_frameshift_element AS
  SELECT
    feature_id AS cis_regulatory_frameshift_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cis_regulatory_frameshift_element';

--- ************************************************
--- *** relation: expressed_sequence_assembly ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence assembly derived from express ***
--- *** ed sequences.                            ***
--- ************************************************
---

CREATE VIEW expressed_sequence_assembly AS
  SELECT
    feature_id AS expressed_sequence_assembly_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'expressed_sequence_assembly';

--- ************************************************
--- *** relation: dna_binding_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A binding site that, in the molecule, in ***
--- *** teracts selectively and non-covalently w ***
--- *** ith DNA.                                 ***
--- ************************************************
---

CREATE VIEW dna_binding_site AS
  SELECT
    feature_id AS dna_binding_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_DNA_contact' OR cvterm.name = 'DNA_binding_site';

--- ************************************************
--- *** relation: cryptic_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is not transcribed under nor ***
--- *** mal conditions and is not critical to no ***
--- *** rmal cellular functioning.               ***
--- ************************************************
---

CREATE VIEW cryptic_gene AS
  SELECT
    feature_id AS cryptic_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cryptogene' OR cvterm.name = 'cryptic_gene';

--- ************************************************
--- *** relation: three_prime_race_clone ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A three prime RACE (Rapid Amplification  ***
--- *** of cDNA Ends) clone is a cDNA clone copi ***
--- *** ed from the 3' end of an mRNA (using a p ***
--- *** oly-dT primer to capture the polyA tail  ***
--- *** and a gene-specific or randomly primed 5 ***
--- *** ' primer), and spliced into a vector for ***
--- ***  propagation in a suitable host.         ***
--- ************************************************
---

CREATE VIEW three_prime_race_clone AS
  SELECT
    feature_id AS three_prime_race_clone_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_RACE_clone';

--- ************************************************
--- *** relation: cassette_pseudogene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A cassette pseudogene is a kind of gene  ***
--- *** in an inactive form which may recombine  ***
--- *** at a telomeric locus to form a functiona ***
--- *** l copy.                                  ***
--- ************************************************
---

CREATE VIEW cassette_pseudogene AS
  SELECT
    feature_id AS cassette_pseudogene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cassette_pseudogene';

--- ************************************************
--- *** relation: alanine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW alanine AS
  SELECT
    feature_id AS alanine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'alanine';

--- ************************************************
--- *** relation: valine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW valine AS
  SELECT
    feature_id AS valine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'valine';

--- ************************************************
--- *** relation: leucine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW leucine AS
  SELECT
    feature_id AS leucine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'leucine';

--- ************************************************
--- *** relation: isoleucine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW isoleucine AS
  SELECT
    feature_id AS isoleucine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'isoleucine';

--- ************************************************
--- *** relation: proline ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW proline AS
  SELECT
    feature_id AS proline_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'proline';

--- ************************************************
--- *** relation: tryptophan ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW tryptophan AS
  SELECT
    feature_id AS tryptophan_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tryptophan';

--- ************************************************
--- *** relation: phenylalanine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW phenylalanine AS
  SELECT
    feature_id AS phenylalanine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'phenylalanine';

--- ************************************************
--- *** relation: methionine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW methionine AS
  SELECT
    feature_id AS methionine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'methionine';

--- ************************************************
--- *** relation: glycine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW glycine AS
  SELECT
    feature_id AS glycine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'glycine';

--- ************************************************
--- *** relation: serine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW serine AS
  SELECT
    feature_id AS serine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'serine';

--- ************************************************
--- *** relation: threonine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW threonine AS
  SELECT
    feature_id AS threonine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'threonine';

--- ************************************************
--- *** relation: tyrosine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW tyrosine AS
  SELECT
    feature_id AS tyrosine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tyrosine';

--- ************************************************
--- *** relation: cysteine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW cysteine AS
  SELECT
    feature_id AS cysteine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cysteine';

--- ************************************************
--- *** relation: glutamine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW glutamine AS
  SELECT
    feature_id AS glutamine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'glutamine';

--- ************************************************
--- *** relation: asparagine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW asparagine AS
  SELECT
    feature_id AS asparagine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'asparagine';

--- ************************************************
--- *** relation: lysine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW lysine AS
  SELECT
    feature_id AS lysine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'lysine';

--- ************************************************
--- *** relation: arginine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW arginine AS
  SELECT
    feature_id AS arginine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'arginine';

--- ************************************************
--- *** relation: histidine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW histidine AS
  SELECT
    feature_id AS histidine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'histidine';

--- ************************************************
--- *** relation: aspartic_acid ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW aspartic_acid AS
  SELECT
    feature_id AS aspartic_acid_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'aspartic_acid';

--- ************************************************
--- *** relation: glutamic_acid ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW glutamic_acid AS
  SELECT
    feature_id AS glutamic_acid_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'glutamic_acid';

--- ************************************************
--- *** relation: selenocysteine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW selenocysteine AS
  SELECT
    feature_id AS selenocysteine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'selenocysteine';

--- ************************************************
--- *** relation: pyrrolysine ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW pyrrolysine AS
  SELECT
    feature_id AS pyrrolysine_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pyrrolysine';

--- ************************************************
--- *** relation: transcribed_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region defined by a set of transcribed ***
--- ***  sequences from the same gene or express ***
--- *** ed pseudogene.                           ***
--- ************************************************
---

CREATE VIEW transcribed_cluster AS
  SELECT
    feature_id AS transcribed_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'unigene_cluster' OR cvterm.name = 'transcribed_cluster';

--- ************************************************
--- *** relation: unigene_cluster ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of transcribed_cluster defined by ***
--- ***  a set of transcribed sequences from the ***
--- ***  a unique gene.                          ***
--- ************************************************
---

CREATE VIEW unigene_cluster AS
  SELECT
    feature_id AS unigene_cluster_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'unigene_cluster';

--- ************************************************
--- *** relation: crispr ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Clustered Palindromic Repeats interspers ***
--- *** ed with bacteriophage derived spacer seq ***
--- *** uences.                                  ***
--- ************************************************
---

CREATE VIEW crispr AS
  SELECT
    feature_id AS crispr_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'CRISPR';

--- ************************************************
--- *** relation: insulator_binding_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A binding site that, in an insulator reg ***
--- *** ion of a nucleotide molecule, interacts  ***
--- *** selectively and non-covalently with poly ***
--- *** peptide residues.                        ***
--- ************************************************
---

CREATE VIEW insulator_binding_site AS
  SELECT
    feature_id AS insulator_binding_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'insulator_binding_site';

--- ************************************************
--- *** relation: enhancer_binding_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A binding site that, in the enhancer reg ***
--- *** ion of a nucleotide molecule, interacts  ***
--- *** selectively and non-covalently with poly ***
--- *** peptide residues.                        ***
--- ************************************************
---

CREATE VIEW enhancer_binding_site AS
  SELECT
    feature_id AS enhancer_binding_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'enhancer_binding_site';

--- ************************************************
--- *** relation: contig_collection ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A collection of contigs.                 ***
--- ************************************************
---

CREATE VIEW contig_collection AS
  SELECT
    feature_id AS contig_collection_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'contig_collection';

--- ************************************************
--- *** relation: lincrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A multiexonic non-coding RNA transcribed ***
--- ***  by RNA polymerase II.                   ***
--- ************************************************
---

CREATE VIEW lincrna AS
  SELECT
    feature_id AS lincrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'lincRNA';

--- ************************************************
--- *** relation: ust ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An EST spanning part or all of the untra ***
--- *** nslated regions of a protein-coding tran ***
--- *** script.                                  ***
--- ************************************************
---

CREATE VIEW ust AS
  SELECT
    feature_id AS ust_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_UST' OR cvterm.name = 'five_prime_UST' OR cvterm.name = 'UST';

--- ************************************************
--- *** relation: three_prime_ust ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A UST located in the 3'UTR of a protein- ***
--- *** coding transcript.                       ***
--- ************************************************
---

CREATE VIEW three_prime_ust AS
  SELECT
    feature_id AS three_prime_ust_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_UST';

--- ************************************************
--- *** relation: five_prime_ust ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An UST located in the 5'UTR of a protein ***
--- *** -coding transcript.                      ***
--- ************************************************
---

CREATE VIEW five_prime_ust AS
  SELECT
    feature_id AS five_prime_ust_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_UST';

--- ************************************************
--- *** relation: rst ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tag produced from a single sequencing  ***
--- *** read from a RACE product; typically a fe ***
--- *** w hundred base pairs long.               ***
--- ************************************************
---

CREATE VIEW rst AS
  SELECT
    feature_id AS rst_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_RST' OR cvterm.name = 'five_prime_RST' OR cvterm.name = 'RST';

--- ************************************************
--- *** relation: three_prime_rst ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tag produced from a single sequencing  ***
--- *** read from a 3'-RACE product; typically a ***
--- ***  few hundred base pairs long.            ***
--- ************************************************
---

CREATE VIEW three_prime_rst AS
  SELECT
    feature_id AS three_prime_rst_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_RST';

--- ************************************************
--- *** relation: five_prime_rst ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tag produced from a single sequencing  ***
--- *** read from a 5'-RACE product; typically a ***
--- ***  few hundred base pairs long.            ***
--- ************************************************
---

CREATE VIEW five_prime_rst AS
  SELECT
    feature_id AS five_prime_rst_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_RST';

--- ************************************************
--- *** relation: ust_match ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A match against an UST sequence.         ***
--- ************************************************
---

CREATE VIEW ust_match AS
  SELECT
    feature_id AS ust_match_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'UST_match';

--- ************************************************
--- *** relation: rst_match ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A match against an RST sequence.         ***
--- ************************************************
---

CREATE VIEW rst_match AS
  SELECT
    feature_id AS rst_match_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RST_match';

--- ************************************************
--- *** relation: primer_match ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A nucleotide match to a primer sequence. ***
--- ************************************************
---

CREATE VIEW primer_match AS
  SELECT
    feature_id AS primer_match_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'primer_match';

--- ************************************************
--- *** relation: mirna_antiguide ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of the pri miRNA that basepairs ***
--- ***  with the guide to form the hairpin.     ***
--- ************************************************
---

CREATE VIEW mirna_antiguide AS
  SELECT
    feature_id AS mirna_antiguide_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'miRNA_antiguide';

--- ************************************************
--- *** relation: trans_splice_junction ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The boundary between the spliced leader  ***
--- *** and the first exon of the mRNA.          ***
--- ************************************************
---

CREATE VIEW trans_splice_junction AS
  SELECT
    feature_id AS trans_splice_junction_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'trans_splice_junction';

--- ************************************************
--- *** relation: outron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of a primary transcript, that i ***
--- *** s removed via trans splicing.            ***
--- ************************************************
---

CREATE VIEW outron AS
  SELECT
    feature_id AS outron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'outron';

--- ************************************************
--- *** relation: natural_plasmid ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A plasmid that occurs naturally.         ***
--- ************************************************
---

CREATE VIEW natural_plasmid AS
  SELECT
    feature_id AS natural_plasmid_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'natural_plasmid';

--- ************************************************
--- *** relation: gene_trap_construct ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene trap construct is a type of engin ***
--- *** eered plasmid which is designed to integ ***
--- *** rate into a genome and produce a fusion  ***
--- *** transcript between exons of the gene int ***
--- *** o which it inserts and a reporter elemen ***
--- *** t in the construct. Gene traps contain a ***
--- ***  splice acceptor, do not contain promote ***
--- *** r elements for the reporter, and are mut ***
--- *** agenic. Gene traps may be bicistronic wi ***
--- *** th the second cassette containing a prom ***
--- *** oter driving an a selectable marker.     ***
--- ************************************************
---

CREATE VIEW gene_trap_construct AS
  SELECT
    feature_id AS gene_trap_construct_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_trap_construct';

--- ************************************************
--- *** relation: promoter_trap_construct ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A promoter trap construct is a type of e ***
--- *** ngineered plasmid which is designed to i ***
--- *** ntegrate into a genome and express a rep ***
--- *** orter when inserted in close proximity t ***
--- *** o a promoter element. Promoter traps typ ***
--- *** ically do not contain promoter elements  ***
--- *** and are mutagenic.                       ***
--- ************************************************
---

CREATE VIEW promoter_trap_construct AS
  SELECT
    feature_id AS promoter_trap_construct_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'promoter_trap_construct';

--- ************************************************
--- *** relation: enhancer_trap_construct ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An enhancer trap construct is a type of  ***
--- *** engineered plasmid which is designed to  ***
--- *** integrate into a genome and express a re ***
--- *** porter when the expression from a basic  ***
--- *** minimal promoter is enhanced by genomic  ***
--- *** enhancer elements. Enhancer traps contai ***
--- *** n promoter elements and are not usually  ***
--- *** mutagenic.                               ***
--- ************************************************
---

CREATE VIEW enhancer_trap_construct AS
  SELECT
    feature_id AS enhancer_trap_construct_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'enhancer_trap_construct';

--- ************************************************
--- *** relation: pac_end ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of sequence from the end of a P ***
--- *** AC clone that may provide a highly speci ***
--- *** fic marker.                              ***
--- ************************************************
---

CREATE VIEW pac_end AS
  SELECT
    feature_id AS pac_end_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'PAC_end';

--- ************************************************
--- *** relation: rapd ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** RAPD is a 'PCR product' where a sequence ***
--- ***  variant is identified through the use o ***
--- *** f PCR with random primers.               ***
--- ************************************************
---

CREATE VIEW rapd AS
  SELECT
    feature_id AS rapd_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RAPD';

--- ************************************************
--- *** relation: shadow_enhancer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW shadow_enhancer AS
  SELECT
    feature_id AS shadow_enhancer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'shadow_enhancer';

--- ************************************************
--- *** relation: snv ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** SNVs are single nucleotide positions in  ***
--- *** genomic DNA at which different sequence  ***
--- *** alternatives exist.                      ***
--- ************************************************
---

CREATE VIEW snv AS
  SELECT
    feature_id AS snv_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'SNP' OR cvterm.name = 'point_mutation' OR cvterm.name = 'transition' OR cvterm.name = 'transversion' OR cvterm.name = 'pyrimidine_transition' OR cvterm.name = 'purine_transition' OR cvterm.name = 'C_to_T_transition' OR cvterm.name = 'T_to_C_transition' OR cvterm.name = 'C_to_T_transition_at_pCpG_site' OR cvterm.name = 'A_to_G_transition' OR cvterm.name = 'G_to_A_transition' OR cvterm.name = 'pyrimidine_to_purine_transversion' OR cvterm.name = 'purine_to_pyrimidine_transversion' OR cvterm.name = 'C_to_A_transversion' OR cvterm.name = 'C_to_G_transversion' OR cvterm.name = 'T_to_A_transversion' OR cvterm.name = 'T_to_G_transversion' OR cvterm.name = 'A_to_C_transversion' OR cvterm.name = 'A_to_T_transversion' OR cvterm.name = 'G_to_C_transversion' OR cvterm.name = 'G_to_T_transversion' OR cvterm.name = 'SNV';

--- ************************************************
--- *** relation: x_element_combinatorial_repeat ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An X element combinatorial repeat is a r ***
--- *** epeat region located between the X eleme ***
--- *** nt and the telomere or adjacent Y' eleme ***
--- *** nt.                                      ***
--- ************************************************
---

CREATE VIEW x_element_combinatorial_repeat AS
  SELECT
    feature_id AS x_element_combinatorial_repeat_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'X_element_combinatorial_repeat';

--- ************************************************
--- *** relation: y_prime_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A Y' element is a repeat region (SO:0000 ***
--- *** 657) located adjacent to telomeric repea ***
--- *** ts or X element combinatorial repeats, e ***
--- *** ither as a single copy or tandem repeat  ***
--- *** of two to four copies.                   ***
--- ************************************************
---

CREATE VIEW y_prime_element AS
  SELECT
    feature_id AS y_prime_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'Y_prime_element';

--- ************************************************
--- *** relation: standard_draft ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The status of a whole genome sequence, w ***
--- *** here the data is minimally filtered or u ***
--- *** n-filtered, from any number of sequencin ***
--- *** g platforms, and is assembled into conti ***
--- *** gs. Genome sequence of this quality may  ***
--- *** harbour regions of poor quality and can  ***
--- *** be relatively incomplete.                ***
--- ************************************************
---

CREATE VIEW standard_draft AS
  SELECT
    feature_id AS standard_draft_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'standard_draft';

--- ************************************************
--- *** relation: high_quality_draft ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The status of a whole genome sequence, w ***
--- *** here overall coverage represents at leas ***
--- *** t 90 percent of the genome.              ***
--- ************************************************
---

CREATE VIEW high_quality_draft AS
  SELECT
    feature_id AS high_quality_draft_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'high_quality_draft';

--- ************************************************
--- *** relation: improved_high_quality_draft ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The status of a whole genome sequence, w ***
--- *** here additional work has been performed, ***
--- ***  using either manual or automated method ***
--- *** s, such as gap resolution.               ***
--- ************************************************
---

CREATE VIEW improved_high_quality_draft AS
  SELECT
    feature_id AS improved_high_quality_draft_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'improved_high_quality_draft';

--- ************************************************
--- *** relation: annotation_directed_improved_draft ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The status of a whole genome sequence,wh ***
--- *** ere annotation, and verification of codi ***
--- *** ng regions has occurred.                 ***
--- ************************************************
---

CREATE VIEW annotation_directed_improved_draft AS
  SELECT
    feature_id AS annotation_directed_improved_draft_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'annotation_directed_improved_draft';

--- ************************************************
--- *** relation: noncontiguous_finished ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The status of a whole genome sequence, w ***
--- *** here the assembly is high quality, closu ***
--- *** re approaches have been successful for m ***
--- *** ost gaps, misassemblies and low quality  ***
--- *** regions.                                 ***
--- ************************************************
---

CREATE VIEW noncontiguous_finished AS
  SELECT
    feature_id AS noncontiguous_finished_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'noncontiguous_finished';

--- ************************************************
--- *** relation: finished_genome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The status of a whole genome sequence, w ***
--- *** ith less than 1 error per 100,000 base p ***
--- *** airs.                                    ***
--- ************************************************
---

CREATE VIEW finished_genome AS
  SELECT
    feature_id AS finished_genome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'finished_genome';

--- ************************************************
--- *** relation: intronic_regulatory_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A regulatory region that is part of an i ***
--- *** ntron.                                   ***
--- ************************************************
---

CREATE VIEW intronic_regulatory_region AS
  SELECT
    feature_id AS intronic_regulatory_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'intronic_regulatory_region';

--- ************************************************
--- *** relation: centromere_dna_element_i ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A centromere DNA Element I (CDEI) is a c ***
--- *** onserved region, part of the centromere, ***
--- ***  consisting of a consensus region compos ***
--- *** ed of 8-11bp which enables binding by th ***
--- *** e centromere binding factor 1(Cbf1p).    ***
--- ************************************************
---

CREATE VIEW centromere_dna_element_i AS
  SELECT
    feature_id AS centromere_dna_element_i_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'centromere_DNA_Element_I';

--- ************************************************
--- *** relation: centromere_dna_element_ii ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A centromere DNA Element II (CDEII) is p ***
--- *** art a conserved region of the centromere ***
--- *** , consisting of a consensus region that  ***
--- *** is AT-rich and ~ 75-100 bp in length.    ***
--- ************************************************
---

CREATE VIEW centromere_dna_element_ii AS
  SELECT
    feature_id AS centromere_dna_element_ii_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'centromere_DNA_Element_II';

--- ************************************************
--- *** relation: centromere_dna_element_iii ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A centromere DNA Element I (CDEI) is a c ***
--- *** onserved region, part of the centromere, ***
--- ***  consisting of a consensus region that c ***
--- *** onsists of a 25-bp which enables binding ***
--- ***  by the centromere DNA binding factor 3  ***
--- *** (CBF3) complex.                          ***
--- ************************************************
---

CREATE VIEW centromere_dna_element_iii AS
  SELECT
    feature_id AS centromere_dna_element_iii_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'centromere_DNA_Element_III';

--- ************************************************
--- *** relation: telomeric_repeat ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The telomeric repeat is a repeat region, ***
--- ***  part of the chromosome, which in yeast, ***
--- ***  is a G-rich terminal sequence of the fo ***
--- *** rm (TG(1-3))n or more precisely ((TG)(1- ***
--- *** 6)TG(2-3))n.                             ***
--- ************************************************
---

CREATE VIEW telomeric_repeat AS
  SELECT
    feature_id AS telomeric_repeat_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'telomeric_repeat';

--- ************************************************
--- *** relation: x_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The X element is a conserved region, of  ***
--- *** the telomere, of ~475 bp that contains a ***
--- *** n ARS sequence and in most cases an Abf1 ***
--- *** p binding site.                          ***
--- ************************************************
---

CREATE VIEW x_element AS
  SELECT
    feature_id AS x_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'X_element';

--- ************************************************
--- *** relation: yac_end ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of sequence from the end of a Y ***
--- *** AC clone that may provide a highly speci ***
--- *** fic marker.                              ***
--- ************************************************
---

CREATE VIEW yac_end AS
  SELECT
    feature_id AS yac_end_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'YAC_end';

--- ************************************************
--- *** relation: whole_genome_sequence_status ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The status of whole genome sequence.     ***
--- ************************************************
---

CREATE VIEW whole_genome_sequence_status AS
  SELECT
    feature_id AS whole_genome_sequence_status_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'standard_draft' OR cvterm.name = 'high_quality_draft' OR cvterm.name = 'improved_high_quality_draft' OR cvterm.name = 'annotation_directed_improved_draft' OR cvterm.name = 'noncontiguous_finished' OR cvterm.name = 'finished_genome' OR cvterm.name = 'whole_genome_sequence_status';

--- ************************************************
--- *** relation: heritable_phenotypic_marker ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A biological_region characterized as a s ***
--- *** ingle heritable trait in a phenotype scr ***
--- *** een. The heritable phenotype may be mapp ***
--- *** ed to a chromosome but generally has not ***
--- ***  been characterized to a specific gene l ***
--- *** ocus.                                    ***
--- ************************************************
---

CREATE VIEW heritable_phenotypic_marker AS
  SELECT
    feature_id AS heritable_phenotypic_marker_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'heritable_phenotypic_marker';

--- ************************************************
--- *** relation: peptide_collection ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A collection of peptide sequences.       ***
--- ************************************************
---

CREATE VIEW peptide_collection AS
  SELECT
    feature_id AS peptide_collection_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'peptide_collection';

--- ************************************************
--- *** relation: high_identity_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An experimental feature with high sequen ***
--- *** ce identity to another sequence.         ***
--- ************************************************
---

CREATE VIEW high_identity_region AS
  SELECT
    feature_id AS high_identity_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'high_identity_region';

--- ************************************************
--- *** relation: processed_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transcript for which no open reading f ***
--- *** rame has been identified and for which n ***
--- *** o other function has been determined.    ***
--- ************************************************
---

CREATE VIEW processed_transcript AS
  SELECT
    feature_id AS processed_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'processed_transcript';

--- ************************************************
--- *** relation: assortment_derived_variation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosome variation derived from an e ***
--- *** vent during meiosis.                     ***
--- ************************************************
---

CREATE VIEW assortment_derived_variation AS
  SELECT
    feature_id AS assortment_derived_variation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'assortment_derived_duplication' OR cvterm.name = 'assortment_derived_deficiency_plus_duplication' OR cvterm.name = 'assortment_derived_deficiency' OR cvterm.name = 'assortment_derived_aneuploid' OR cvterm.name = 'assortment_derived_variation';

--- ************************************************
--- *** relation: reference_genome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A collection of sequences (often chromos ***
--- *** omes) taken as the standard for a given  ***
--- *** organism and genome assembly.            ***
--- ************************************************
---

CREATE VIEW reference_genome AS
  SELECT
    feature_id AS reference_genome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'reference_genome';

--- ************************************************
--- *** relation: variant_genome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A collection of sequences (often chromos ***
--- *** omes) of an individual.                  ***
--- ************************************************
---

CREATE VIEW variant_genome AS
  SELECT
    feature_id AS variant_genome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'chromosomally_aberrant_genome' OR cvterm.name = 'variant_genome';

--- ************************************************
--- *** relation: variant_collection ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A collection of one or more sequences of ***
--- ***  an individual.                          ***
--- ************************************************
---

CREATE VIEW variant_collection AS
  SELECT
    feature_id AS variant_collection_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'chromosome_variation' OR cvterm.name = 'allele' OR cvterm.name = 'haplotype' OR cvterm.name = 'genotype' OR cvterm.name = 'diplotype' OR cvterm.name = 'assortment_derived_variation' OR cvterm.name = 'chromosome_number_variation' OR cvterm.name = 'chromosome_structure_variation' OR cvterm.name = 'assortment_derived_duplication' OR cvterm.name = 'assortment_derived_deficiency_plus_duplication' OR cvterm.name = 'assortment_derived_deficiency' OR cvterm.name = 'assortment_derived_aneuploid' OR cvterm.name = 'aneuploid' OR cvterm.name = 'polyploid' OR cvterm.name = 'hyperploid' OR cvterm.name = 'hypoploid' OR cvterm.name = 'autopolyploid' OR cvterm.name = 'allopolyploid' OR cvterm.name = 'free_chromosome_arm' OR cvterm.name = 'chromosomal_transposition' OR cvterm.name = 'aneuploid_chromosome' OR cvterm.name = 'intrachromosomal_mutation' OR cvterm.name = 'interchromosomal_mutation' OR cvterm.name = 'chromosomal_duplication' OR cvterm.name = 'compound_chromosome' OR cvterm.name = 'autosynaptic_chromosome' OR cvterm.name = 'complex_chromosomal_mutation' OR cvterm.name = 'uncharacterised_chromosomal_mutation' OR cvterm.name = 'intrachromosomal_transposition' OR cvterm.name = 'interchromosomal_transposition' OR cvterm.name = 'deficient_intrachromosomal_transposition' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'uninverted_intrachromosomal_transposition' OR cvterm.name = 'unoriented_intrachromosomal_transposition' OR cvterm.name = 'deficient_interchromosomal_transposition' OR cvterm.name = 'inverted_interchromosomal_transposition' OR cvterm.name = 'uninverted_interchromosomal_transposition' OR cvterm.name = 'unoriented_interchromosomal_transposition' OR cvterm.name = 'inversion_derived_aneuploid_chromosome' OR cvterm.name = 'chromosomal_deletion' OR cvterm.name = 'chromosomal_inversion' OR cvterm.name = 'intrachromosomal_duplication' OR cvterm.name = 'ring_chromosome' OR cvterm.name = 'chromosome_fission' OR cvterm.name = 'deficient_intrachromosomal_transposition' OR cvterm.name = 'inversion_derived_bipartite_deficiency' OR cvterm.name = 'inversion_derived_deficiency_plus_duplication' OR cvterm.name = 'inversion_derived_deficiency_plus_aneuploid' OR cvterm.name = 'deficient_translocation' OR cvterm.name = 'deficient_inversion' OR cvterm.name = 'inverted_ring_chromosome' OR cvterm.name = 'pericentric_inversion' OR cvterm.name = 'paracentric_inversion' OR cvterm.name = 'inversion_cum_translocation' OR cvterm.name = 'bipartite_inversion' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'deficient_inversion' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'inversion_derived_deficiency_plus_duplication' OR cvterm.name = 'inversion_derived_bipartite_duplication' OR cvterm.name = 'inversion_derived_duplication_plus_aneuploid' OR cvterm.name = 'intrachromosomal_transposition' OR cvterm.name = 'bipartite_duplication' OR cvterm.name = 'deficient_intrachromosomal_transposition' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'uninverted_intrachromosomal_transposition' OR cvterm.name = 'unoriented_intrachromosomal_transposition' OR cvterm.name = 'inverted_ring_chromosome' OR cvterm.name = 'free_ring_duplication' OR cvterm.name = 'chromosomal_translocation' OR cvterm.name = 'bipartite_duplication' OR cvterm.name = 'interchromosomal_transposition' OR cvterm.name = 'translocation_element' OR cvterm.name = 'Robertsonian_fusion' OR cvterm.name = 'reciprocal_chromosomal_translocation' OR cvterm.name = 'deficient_translocation' OR cvterm.name = 'inversion_cum_translocation' OR cvterm.name = 'cyclic_translocation' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'deficient_interchromosomal_transposition' OR cvterm.name = 'inverted_interchromosomal_transposition' OR cvterm.name = 'uninverted_interchromosomal_transposition' OR cvterm.name = 'unoriented_interchromosomal_transposition' OR cvterm.name = 'interchromosomal_duplication' OR cvterm.name = 'intrachromosomal_duplication' OR cvterm.name = 'free_duplication' OR cvterm.name = 'insertional_duplication' OR cvterm.name = 'inversion_derived_deficiency_plus_duplication' OR cvterm.name = 'inversion_derived_bipartite_duplication' OR cvterm.name = 'inversion_derived_duplication_plus_aneuploid' OR cvterm.name = 'intrachromosomal_transposition' OR cvterm.name = 'bipartite_duplication' OR cvterm.name = 'deficient_intrachromosomal_transposition' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'uninverted_intrachromosomal_transposition' OR cvterm.name = 'unoriented_intrachromosomal_transposition' OR cvterm.name = 'free_ring_duplication' OR cvterm.name = 'uninverted_insertional_duplication' OR cvterm.name = 'inverted_insertional_duplication' OR cvterm.name = 'unoriented_insertional_duplication' OR cvterm.name = 'compound_chromosome_arm' OR cvterm.name = 'homo_compound_chromosome' OR cvterm.name = 'hetero_compound_chromosome' OR cvterm.name = 'dexstrosynaptic_chromosome' OR cvterm.name = 'laevosynaptic_chromosome' OR cvterm.name = 'partially_characterised_chromosomal_mutation' OR cvterm.name = 'polymorphic_sequence_variant' OR cvterm.name = 'variant_collection';

--- ************************************************
--- *** relation: alteration_attribute ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW alteration_attribute AS
  SELECT
    feature_id AS alteration_attribute_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'chromosomal_variation_attribute' OR cvterm.name = 'insertion_attribute' OR cvterm.name = 'inversion_attribute' OR cvterm.name = 'translocaton_attribute' OR cvterm.name = 'duplication_attribute' OR cvterm.name = 'intrachromosomal' OR cvterm.name = 'interchromosomal' OR cvterm.name = 'tandem' OR cvterm.name = 'direct' OR cvterm.name = 'inverted' OR cvterm.name = 'pericentric' OR cvterm.name = 'paracentric' OR cvterm.name = 'reciprocal' OR cvterm.name = 'insertional' OR cvterm.name = 'free' OR cvterm.name = 'alteration_attribute';

--- ************************************************
--- *** relation: chromosomal_variation_attribute ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW chromosomal_variation_attribute AS
  SELECT
    feature_id AS chromosomal_variation_attribute_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'intrachromosomal' OR cvterm.name = 'interchromosomal' OR cvterm.name = 'chromosomal_variation_attribute';

--- ************************************************
--- *** relation: intrachromosomal ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW intrachromosomal AS
  SELECT
    feature_id AS intrachromosomal_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'intrachromosomal';

--- ************************************************
--- *** relation: interchromosomal ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW interchromosomal AS
  SELECT
    feature_id AS interchromosomal_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'interchromosomal';

--- ************************************************
--- *** relation: insertion_attribute ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A quality of a chromosomal insertion,.   ***
--- ************************************************
---

CREATE VIEW insertion_attribute AS
  SELECT
    feature_id AS insertion_attribute_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tandem' OR cvterm.name = 'direct' OR cvterm.name = 'inverted' OR cvterm.name = 'insertion_attribute';

--- ************************************************
--- *** relation: tandem ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW tandem AS
  SELECT
    feature_id AS tandem_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tandem';

--- ************************************************
--- *** relation: direct ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A quality of an insertion where the inse ***
--- *** rt is not in a cytologically inverted or ***
--- *** ientation.                               ***
--- ************************************************
---

CREATE VIEW direct AS
  SELECT
    feature_id AS direct_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'direct';

--- ************************************************
--- *** relation: inverted ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A quality of an insertion where the inse ***
--- *** rt is in a cytologically inverted orient ***
--- *** ation.                                   ***
--- ************************************************
---

CREATE VIEW inverted AS
  SELECT
    feature_id AS inverted_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inverted';

--- ************************************************
--- *** relation: free ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The quality of a duplication where the n ***
--- *** ew region exists independently of the or ***
--- *** iginal.                                  ***
--- ************************************************
---

CREATE VIEW free AS
  SELECT
    feature_id AS free_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'free';

--- ************************************************
--- *** relation: inversion_attribute ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW inversion_attribute AS
  SELECT
    feature_id AS inversion_attribute_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pericentric' OR cvterm.name = 'paracentric' OR cvterm.name = 'inversion_attribute';

--- ************************************************
--- *** relation: pericentric ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW pericentric AS
  SELECT
    feature_id AS pericentric_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pericentric';

--- ************************************************
--- *** relation: paracentric ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW paracentric AS
  SELECT
    feature_id AS paracentric_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'paracentric';

--- ************************************************
--- *** relation: translocaton_attribute ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW translocaton_attribute AS
  SELECT
    feature_id AS translocaton_attribute_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'reciprocal' OR cvterm.name = 'insertional' OR cvterm.name = 'translocaton_attribute';

--- ************************************************
--- *** relation: reciprocal ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW reciprocal AS
  SELECT
    feature_id AS reciprocal_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'reciprocal';

--- ************************************************
--- *** relation: insertional ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW insertional AS
  SELECT
    feature_id AS insertional_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'insertional';

--- ************************************************
--- *** relation: duplication_attribute ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW duplication_attribute AS
  SELECT
    feature_id AS duplication_attribute_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'free' OR cvterm.name = 'duplication_attribute';

--- ************************************************
--- *** relation: chromosomally_aberrant_genome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW chromosomally_aberrant_genome AS
  SELECT
    feature_id AS chromosomally_aberrant_genome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'chromosomally_aberrant_genome';

--- ************************************************
--- *** relation: assembly_error_correction ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of sequence where the final nuc ***
--- *** leotide assignment differs from the orig ***
--- *** inal assembly due to an improvement that ***
--- ***  replaces a mistake.                     ***
--- ************************************************
---

CREATE VIEW assembly_error_correction AS
  SELECT
    feature_id AS assembly_error_correction_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'assembly_error_correction';

--- ************************************************
--- *** relation: base_call_error_correction ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of sequence where the final nuc ***
--- *** leotide assignment is different from tha ***
--- *** t given by the base caller due to an imp ***
--- *** rovement that replaces a mistake.        ***
--- ************************************************
---

CREATE VIEW base_call_error_correction AS
  SELECT
    feature_id AS base_call_error_correction_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'base_call_error_correction';

--- ************************************************
--- *** relation: peptide_localization_signal ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of peptide sequence used to tar ***
--- *** get the polypeptide molecule to a specif ***
--- *** ic organelle.                            ***
--- ************************************************
---

CREATE VIEW peptide_localization_signal AS
  SELECT
    feature_id AS peptide_localization_signal_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'signal_peptide' OR cvterm.name = 'transit_peptide' OR cvterm.name = 'nuclear_localization_signal' OR cvterm.name = 'endosomal_localization_signal' OR cvterm.name = 'lysosomal_localization_signal' OR cvterm.name = 'nuclear_export_signal' OR cvterm.name = 'nuclear_rim_localization_signal' OR cvterm.name = 'peptide_localization_signal';

--- ************************************************
--- *** relation: nuclear_localization_signal ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A polypeptide region that targets a poly ***
--- *** peptide to the nucleus.                  ***
--- ************************************************
---

CREATE VIEW nuclear_localization_signal AS
  SELECT
    feature_id AS nuclear_localization_signal_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'nuclear_localization_signal';

--- ************************************************
--- *** relation: endosomal_localization_signal ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A polypeptide region that targets a poly ***
--- *** peptide to the endosome.                 ***
--- ************************************************
---

CREATE VIEW endosomal_localization_signal AS
  SELECT
    feature_id AS endosomal_localization_signal_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'endosomal_localization_signal';

--- ************************************************
--- *** relation: lysosomal_localization_signal ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A polypeptide region that targets a poly ***
--- *** peptide to the lysosome.                 ***
--- ************************************************
---

CREATE VIEW lysosomal_localization_signal AS
  SELECT
    feature_id AS lysosomal_localization_signal_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'lysosomal_localization_signal';

--- ************************************************
--- *** relation: nuclear_export_signal ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A polypeptide region that targets a poly ***
--- *** peptide to he cytoplasm.                 ***
--- ************************************************
---

CREATE VIEW nuclear_export_signal AS
  SELECT
    feature_id AS nuclear_export_signal_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'nuclear_export_signal';

--- ************************************************
--- *** relation: recombination_signal_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region recognized by a recombinase.    ***
--- ************************************************
---

CREATE VIEW recombination_signal_sequence AS
  SELECT
    feature_id AS recombination_signal_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'recombination_signal_sequence';

--- ************************************************
--- *** relation: cryptic_splice_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A splice site that is in part of the tra ***
--- *** nscript not normally spliced. They occur ***
--- ***  via mutation or transcriptional error.  ***
--- ************************************************
---

CREATE VIEW cryptic_splice_site AS
  SELECT
    feature_id AS cryptic_splice_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cryptic_splice_site';

--- ************************************************
--- *** relation: nuclear_rim_localization_signal ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A polypeptide region that targets a poly ***
--- *** peptide to the nuclear rim.              ***
--- ************************************************
---

CREATE VIEW nuclear_rim_localization_signal AS
  SELECT
    feature_id AS nuclear_rim_localization_signal_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'nuclear_rim_localization_signal';

--- ************************************************
--- *** relation: p_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A P_element is a DNA transposon responsi ***
--- *** ble for hybrid dysgenesis.               ***
--- ************************************************
---

CREATE VIEW p_element AS
  SELECT
    feature_id AS p_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'p_element';

--- ************************************************
--- *** relation: functional_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant in which the function ***
--- ***  of a gene product is altered with respe ***
--- *** ct to a reference.                       ***
--- ************************************************
---

CREATE VIEW functional_variant AS
  SELECT
    feature_id AS functional_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'transcript_function_variant' OR cvterm.name = 'translational_product_function_variant' OR cvterm.name = 'level_of_transcript_variant' OR cvterm.name = 'transcript_processing_variant' OR cvterm.name = 'transcript_stability_variant' OR cvterm.name = 'transcription_variant' OR cvterm.name = 'decreased_transcript_level_variant' OR cvterm.name = 'increased_transcript_level_variant' OR cvterm.name = 'editing_variant' OR cvterm.name = 'polyadenylation_variant' OR cvterm.name = 'increased_polyadenylation_variant' OR cvterm.name = 'decreased_polyadenylation_variant' OR cvterm.name = 'decreased_transcript_stability_variant' OR cvterm.name = 'increased_transcript_stability_variant' OR cvterm.name = 'rate_of_transcription_variant' OR cvterm.name = 'increased_transcription_rate_variant' OR cvterm.name = 'decreased_transcription_rate_variant' OR cvterm.name = 'translational_product_level_variant' OR cvterm.name = 'polypeptide_function_variant' OR cvterm.name = 'decreased_translational_product_level' OR cvterm.name = 'increased_translational_product_level' OR cvterm.name = 'polypeptide_gain_of_function_variant' OR cvterm.name = 'polypeptide_localization_variant' OR cvterm.name = 'polypeptide_loss_of_function_variant' OR cvterm.name = 'polypeptide_post_translational_processing_variant' OR cvterm.name = 'inactive_ligand_binding_site' OR cvterm.name = 'polypeptide_partial_loss_of_function' OR cvterm.name = 'inactive_catalytic_site' OR cvterm.name = 'functional_variant';

--- ************************************************
--- *** relation: structural_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that changes one or m ***
--- *** ore sequence features.                   ***
--- ************************************************
---

CREATE VIEW structural_variant AS
  SELECT
    feature_id AS structural_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'silent_mutation' OR cvterm.name = 'copy_number_change' OR cvterm.name = 'gene_variant' OR cvterm.name = 'regulatory_region_variant' OR cvterm.name = 'intergenic_variant' OR cvterm.name = 'upstream_gene_variant' OR cvterm.name = 'downstream_gene_variant' OR cvterm.name = 'gene_fusion' OR cvterm.name = 'splicing_variant' OR cvterm.name = 'transcript_variant' OR cvterm.name = 'translational_product_structure_variant' OR cvterm.name = 'cryptic_splice_site_variant' OR cvterm.name = 'exon_loss' OR cvterm.name = 'intron_gain' OR cvterm.name = 'splice_region_variant' OR cvterm.name = 'cryptic_splice_acceptor' OR cvterm.name = 'cryptic_splice_donor' OR cvterm.name = 'complex_change_in_transcript' OR cvterm.name = 'transcript_secondary_structure_variant' OR cvterm.name = 'nc_transcript_variant' OR cvterm.name = 'NMD_transcript_variant' OR cvterm.name = 'UTR_variant' OR cvterm.name = 'intron_variant' OR cvterm.name = 'exon_variant' OR cvterm.name = 'compensatory_transcript_secondary_structure_variant' OR cvterm.name = 'mature_miRNA_variant' OR cvterm.name = '5_prime_UTR_variant' OR cvterm.name = '3_prime_UTR_variant' OR cvterm.name = 'splice_site_variant' OR cvterm.name = 'splice_acceptor_variant' OR cvterm.name = 'splice_donor_variant' OR cvterm.name = 'splice_donor_5th_base_variant' OR cvterm.name = 'coding_sequence_variant' OR cvterm.name = 'non_coding_exon_variant' OR cvterm.name = 'codon_variant' OR cvterm.name = 'frameshift_variant' OR cvterm.name = 'inframe_variant' OR cvterm.name = 'initiator_codon_change' OR cvterm.name = 'non_synonymous_codon' OR cvterm.name = 'synonymous_codon' OR cvterm.name = 'terminal_codon_variant' OR cvterm.name = 'stop_gained' OR cvterm.name = 'missense_codon' OR cvterm.name = 'conservative_missense_codon' OR cvterm.name = 'non_conservative_missense_codon' OR cvterm.name = 'terminator_codon_variant' OR cvterm.name = 'incomplete_terminal_codon_variant' OR cvterm.name = 'stop_retained_variant' OR cvterm.name = 'stop_lost' OR cvterm.name = 'frame_restoring_variant' OR cvterm.name = 'minus_1_frameshift_variant' OR cvterm.name = 'minus_2_frameshift_variant' OR cvterm.name = 'plus_1_frameshift_variant' OR cvterm.name = 'plus_2_frameshift variant' OR cvterm.name = 'inframe_codon_gain' OR cvterm.name = 'inframe_codon_loss' OR cvterm.name = '3D_polypeptide_structure_variant' OR cvterm.name = 'complex_change_of_translational_product_variant' OR cvterm.name = 'polypeptide_sequence_variant' OR cvterm.name = 'complex_3D_structural_variant' OR cvterm.name = 'conformational_change_variant' OR cvterm.name = 'amino_acid_deletion' OR cvterm.name = 'amino_acid_insertion' OR cvterm.name = 'amino_acid_substitution' OR cvterm.name = 'elongated_polypeptide' OR cvterm.name = 'polypeptide_fusion' OR cvterm.name = 'polypeptide_truncation' OR cvterm.name = 'conservative_amino_acid_substitution' OR cvterm.name = 'non_conservative_amino_acid_substitution' OR cvterm.name = 'elongated_polypeptide_C_terminal' OR cvterm.name = 'elongated_polypeptide_N_terminal' OR cvterm.name = 'elongated_in_frame_polypeptide_C_terminal' OR cvterm.name = 'elongated_out_of_frame_polypeptide_C_terminal' OR cvterm.name = 'elongated_in_frame_polypeptide_N_terminal_elongation' OR cvterm.name = 'elongated_out_of_frame_polypeptide_N_terminal' OR cvterm.name = 'TF_binding_site_variant' OR cvterm.name = '5KB_upstream_variant' OR cvterm.name = '2KB_upstream_variant' OR cvterm.name = '5KB_downstream_variant' OR cvterm.name = '500B_downstream_variant' OR cvterm.name = 'structural_variant';

--- ************************************************
--- *** relation: transcript_function_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant which alters the func ***
--- *** tioning of a transcript with respect to  ***
--- *** a reference sequence.                    ***
--- ************************************************
---

CREATE VIEW transcript_function_variant AS
  SELECT
    feature_id AS transcript_function_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'level_of_transcript_variant' OR cvterm.name = 'transcript_processing_variant' OR cvterm.name = 'transcript_stability_variant' OR cvterm.name = 'transcription_variant' OR cvterm.name = 'decreased_transcript_level_variant' OR cvterm.name = 'increased_transcript_level_variant' OR cvterm.name = 'editing_variant' OR cvterm.name = 'polyadenylation_variant' OR cvterm.name = 'increased_polyadenylation_variant' OR cvterm.name = 'decreased_polyadenylation_variant' OR cvterm.name = 'decreased_transcript_stability_variant' OR cvterm.name = 'increased_transcript_stability_variant' OR cvterm.name = 'rate_of_transcription_variant' OR cvterm.name = 'increased_transcription_rate_variant' OR cvterm.name = 'decreased_transcription_rate_variant' OR cvterm.name = 'transcript_function_variant';

--- ************************************************
--- *** relation: translational_product_function_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that affects the func ***
--- *** tioning of a translational product with  ***
--- *** respect to a reference sequence.         ***
--- ************************************************
---

CREATE VIEW translational_product_function_variant AS
  SELECT
    feature_id AS translational_product_function_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'translational_product_level_variant' OR cvterm.name = 'polypeptide_function_variant' OR cvterm.name = 'decreased_translational_product_level' OR cvterm.name = 'increased_translational_product_level' OR cvterm.name = 'polypeptide_gain_of_function_variant' OR cvterm.name = 'polypeptide_localization_variant' OR cvterm.name = 'polypeptide_loss_of_function_variant' OR cvterm.name = 'polypeptide_post_translational_processing_variant' OR cvterm.name = 'inactive_ligand_binding_site' OR cvterm.name = 'polypeptide_partial_loss_of_function' OR cvterm.name = 'inactive_catalytic_site' OR cvterm.name = 'translational_product_function_variant';

--- ************************************************
--- *** relation: level_of_transcript_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant which alters the leve ***
--- *** l of a transcript.                       ***
--- ************************************************
---

CREATE VIEW level_of_transcript_variant AS
  SELECT
    feature_id AS level_of_transcript_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'decreased_transcript_level_variant' OR cvterm.name = 'increased_transcript_level_variant' OR cvterm.name = 'level_of_transcript_variant';

--- ************************************************
--- *** relation: decreased_transcript_level_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that increases the le ***
--- *** vel of mature, spliced and processed RNA ***
--- ***  with respect to a reference sequence.   ***
--- ************************************************
---

CREATE VIEW decreased_transcript_level_variant AS
  SELECT
    feature_id AS decreased_transcript_level_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'decreased_transcript_level_variant';

--- ************************************************
--- *** relation: increased_transcript_level_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that increases the le ***
--- *** vel of mature, spliced and processed RNA ***
--- ***  with respect to a reference sequence.   ***
--- ************************************************
---

CREATE VIEW increased_transcript_level_variant AS
  SELECT
    feature_id AS increased_transcript_level_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'increased_transcript_level_variant';

--- ************************************************
--- *** relation: transcript_processing_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that affects the post ***
--- ***  transcriptional processing of a transcr ***
--- *** ipt with respect to a reference sequence ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW transcript_processing_variant AS
  SELECT
    feature_id AS transcript_processing_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'editing_variant' OR cvterm.name = 'polyadenylation_variant' OR cvterm.name = 'increased_polyadenylation_variant' OR cvterm.name = 'decreased_polyadenylation_variant' OR cvterm.name = 'transcript_processing_variant';

--- ************************************************
--- *** relation: editing_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transcript processing variant whereby  ***
--- *** the process of editing is disrupted with ***
--- ***  respect to the reference.               ***
--- ************************************************
---

CREATE VIEW editing_variant AS
  SELECT
    feature_id AS editing_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'editing_variant';

--- ************************************************
--- *** relation: polyadenylation_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that changes polyaden ***
--- *** ylation with respect to a reference sequ ***
--- *** ence.                                    ***
--- ************************************************
---

CREATE VIEW polyadenylation_variant AS
  SELECT
    feature_id AS polyadenylation_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'increased_polyadenylation_variant' OR cvterm.name = 'decreased_polyadenylation_variant' OR cvterm.name = 'polyadenylation_variant';

--- ************************************************
--- *** relation: transcript_stability_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A variant that changes the stability of  ***
--- *** a transcript with respect to a reference ***
--- ***  sequence.                               ***
--- ************************************************
---

CREATE VIEW transcript_stability_variant AS
  SELECT
    feature_id AS transcript_stability_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'decreased_transcript_stability_variant' OR cvterm.name = 'increased_transcript_stability_variant' OR cvterm.name = 'transcript_stability_variant';

--- ************************************************
--- *** relation: decreased_transcript_stability_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that decreases transc ***
--- *** ript stability with respect to a referen ***
--- *** ce sequence.                             ***
--- ************************************************
---

CREATE VIEW decreased_transcript_stability_variant AS
  SELECT
    feature_id AS decreased_transcript_stability_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'decreased_transcript_stability_variant';

--- ************************************************
--- *** relation: increased_transcript_stability_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that increases transc ***
--- *** ript stability with respect to a referen ***
--- *** ce sequence.                             ***
--- ************************************************
---

CREATE VIEW increased_transcript_stability_variant AS
  SELECT
    feature_id AS increased_transcript_stability_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'increased_transcript_stability_variant';

--- ************************************************
--- *** relation: transcription_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A variant that changes alters the transc ***
--- *** ription of a transcript with respect to  ***
--- *** a reference sequence.                    ***
--- ************************************************
---

CREATE VIEW transcription_variant AS
  SELECT
    feature_id AS transcription_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rate_of_transcription_variant' OR cvterm.name = 'increased_transcription_rate_variant' OR cvterm.name = 'decreased_transcription_rate_variant' OR cvterm.name = 'transcription_variant';

--- ************************************************
--- *** relation: rate_of_transcription_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that changes the rate ***
--- ***  of transcription with respect to a refe ***
--- *** rence sequence.                          ***
--- ************************************************
---

CREATE VIEW rate_of_transcription_variant AS
  SELECT
    feature_id AS rate_of_transcription_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'increased_transcription_rate_variant' OR cvterm.name = 'decreased_transcription_rate_variant' OR cvterm.name = 'rate_of_transcription_variant';

--- ************************************************
--- *** relation: increased_transcription_rate_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that increases the ra ***
--- *** te of transcription with respect to a re ***
--- *** ference sequence.                        ***
--- ************************************************
---

CREATE VIEW increased_transcription_rate_variant AS
  SELECT
    feature_id AS increased_transcription_rate_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'increased_transcription_rate_variant';

--- ************************************************
--- *** relation: decreased_transcription_rate_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that decreases the ra ***
--- *** te of transcription with respect to a re ***
--- *** ference sequence.                        ***
--- ************************************************
---

CREATE VIEW decreased_transcription_rate_variant AS
  SELECT
    feature_id AS decreased_transcription_rate_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'decreased_transcription_rate_variant';

--- ************************************************
--- *** relation: translational_product_level_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A functional variant that changes the tr ***
--- *** anslational product level with respect t ***
--- *** o a reference sequence.                  ***
--- ************************************************
---

CREATE VIEW translational_product_level_variant AS
  SELECT
    feature_id AS translational_product_level_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'decreased_translational_product_level' OR cvterm.name = 'increased_translational_product_level' OR cvterm.name = 'translational_product_level_variant';

--- ************************************************
--- *** relation: polypeptide_function_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant which changes polypep ***
--- *** tide functioning with respect to a refer ***
--- *** ence sequence.                           ***
--- ************************************************
---

CREATE VIEW polypeptide_function_variant AS
  SELECT
    feature_id AS polypeptide_function_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_gain_of_function_variant' OR cvterm.name = 'polypeptide_localization_variant' OR cvterm.name = 'polypeptide_loss_of_function_variant' OR cvterm.name = 'polypeptide_post_translational_processing_variant' OR cvterm.name = 'inactive_ligand_binding_site' OR cvterm.name = 'polypeptide_partial_loss_of_function' OR cvterm.name = 'inactive_catalytic_site' OR cvterm.name = 'polypeptide_function_variant';

--- ************************************************
--- *** relation: decreased_translational_product_level ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant which decreases the t ***
--- *** ranslational product level with respect  ***
--- *** to a reference sequence.                 ***
--- ************************************************
---

CREATE VIEW decreased_translational_product_level AS
  SELECT
    feature_id AS decreased_translational_product_level_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'decreased_translational_product_level';

--- ************************************************
--- *** relation: increased_translational_product_level ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant which increases the t ***
--- *** ranslational product level with respect  ***
--- *** to a reference sequence.                 ***
--- ************************************************
---

CREATE VIEW increased_translational_product_level AS
  SELECT
    feature_id AS increased_translational_product_level_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'increased_translational_product_level';

--- ************************************************
--- *** relation: polypeptide_gain_of_function_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant which causes gain of  ***
--- *** polypeptide function with respect to a r ***
--- *** eference sequence.                       ***
--- ************************************************
---

CREATE VIEW polypeptide_gain_of_function_variant AS
  SELECT
    feature_id AS polypeptide_gain_of_function_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_gain_of_function_variant';

--- ************************************************
--- *** relation: polypeptide_localization_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant which changes the loc ***
--- *** alization of a polypeptide with respect  ***
--- *** to a reference sequence.                 ***
--- ************************************************
---

CREATE VIEW polypeptide_localization_variant AS
  SELECT
    feature_id AS polypeptide_localization_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_localization_variant';

--- ************************************************
--- *** relation: polypeptide_loss_of_function_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that causes the loss  ***
--- *** of a polypeptide function with respect t ***
--- *** o a reference sequence.                  ***
--- ************************************************
---

CREATE VIEW polypeptide_loss_of_function_variant AS
  SELECT
    feature_id AS polypeptide_loss_of_function_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inactive_ligand_binding_site' OR cvterm.name = 'polypeptide_partial_loss_of_function' OR cvterm.name = 'inactive_catalytic_site' OR cvterm.name = 'polypeptide_loss_of_function_variant';

--- ************************************************
--- *** relation: inactive_ligand_binding_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that causes the inact ***
--- *** ivation of a ligand binding site with re ***
--- *** spect to a reference sequence.           ***
--- ************************************************
---

CREATE VIEW inactive_ligand_binding_site AS
  SELECT
    feature_id AS inactive_ligand_binding_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inactive_catalytic_site' OR cvterm.name = 'inactive_ligand_binding_site';

--- ************************************************
--- *** relation: polypeptide_partial_loss_of_function ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that causes some but  ***
--- *** not all loss of polypeptide function wit ***
--- *** h respect to a reference sequence.       ***
--- ************************************************
---

CREATE VIEW polypeptide_partial_loss_of_function AS
  SELECT
    feature_id AS polypeptide_partial_loss_of_function_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_partial_loss_of_function';

--- ************************************************
--- *** relation: polypeptide_post_translational_processing_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that causes a change  ***
--- *** in post translational processing of the  ***
--- *** peptide with respect to a reference sequ ***
--- *** ence.                                    ***
--- ************************************************
---

CREATE VIEW polypeptide_post_translational_processing_variant AS
  SELECT
    feature_id AS polypeptide_post_translational_processing_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_post_translational_processing_variant';

--- ************************************************
--- *** relation: copy_number_change ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant where copies of a fea ***
--- *** ture (CNV) are either increased or decre ***
--- *** ased.                                    ***
--- ************************************************
---

CREATE VIEW copy_number_change AS
  SELECT
    feature_id AS copy_number_change_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'copy_number_change';

--- ************************************************
--- *** relation: gene_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant where the structure o ***
--- *** f the gene is changed.                   ***
--- ************************************************
---

CREATE VIEW gene_variant AS
  SELECT
    feature_id AS gene_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_fusion' OR cvterm.name = 'splicing_variant' OR cvterm.name = 'transcript_variant' OR cvterm.name = 'translational_product_structure_variant' OR cvterm.name = 'cryptic_splice_site_variant' OR cvterm.name = 'exon_loss' OR cvterm.name = 'intron_gain' OR cvterm.name = 'splice_region_variant' OR cvterm.name = 'cryptic_splice_acceptor' OR cvterm.name = 'cryptic_splice_donor' OR cvterm.name = 'complex_change_in_transcript' OR cvterm.name = 'transcript_secondary_structure_variant' OR cvterm.name = 'nc_transcript_variant' OR cvterm.name = 'NMD_transcript_variant' OR cvterm.name = 'UTR_variant' OR cvterm.name = 'intron_variant' OR cvterm.name = 'exon_variant' OR cvterm.name = 'compensatory_transcript_secondary_structure_variant' OR cvterm.name = 'mature_miRNA_variant' OR cvterm.name = '5_prime_UTR_variant' OR cvterm.name = '3_prime_UTR_variant' OR cvterm.name = 'splice_site_variant' OR cvterm.name = 'splice_acceptor_variant' OR cvterm.name = 'splice_donor_variant' OR cvterm.name = 'splice_donor_5th_base_variant' OR cvterm.name = 'coding_sequence_variant' OR cvterm.name = 'non_coding_exon_variant' OR cvterm.name = 'codon_variant' OR cvterm.name = 'frameshift_variant' OR cvterm.name = 'inframe_variant' OR cvterm.name = 'initiator_codon_change' OR cvterm.name = 'non_synonymous_codon' OR cvterm.name = 'synonymous_codon' OR cvterm.name = 'terminal_codon_variant' OR cvterm.name = 'stop_gained' OR cvterm.name = 'missense_codon' OR cvterm.name = 'conservative_missense_codon' OR cvterm.name = 'non_conservative_missense_codon' OR cvterm.name = 'terminator_codon_variant' OR cvterm.name = 'incomplete_terminal_codon_variant' OR cvterm.name = 'stop_retained_variant' OR cvterm.name = 'stop_lost' OR cvterm.name = 'frame_restoring_variant' OR cvterm.name = 'minus_1_frameshift_variant' OR cvterm.name = 'minus_2_frameshift_variant' OR cvterm.name = 'plus_1_frameshift_variant' OR cvterm.name = 'plus_2_frameshift variant' OR cvterm.name = 'inframe_codon_gain' OR cvterm.name = 'inframe_codon_loss' OR cvterm.name = '3D_polypeptide_structure_variant' OR cvterm.name = 'complex_change_of_translational_product_variant' OR cvterm.name = 'polypeptide_sequence_variant' OR cvterm.name = 'complex_3D_structural_variant' OR cvterm.name = 'conformational_change_variant' OR cvterm.name = 'amino_acid_deletion' OR cvterm.name = 'amino_acid_insertion' OR cvterm.name = 'amino_acid_substitution' OR cvterm.name = 'elongated_polypeptide' OR cvterm.name = 'polypeptide_fusion' OR cvterm.name = 'polypeptide_truncation' OR cvterm.name = 'conservative_amino_acid_substitution' OR cvterm.name = 'non_conservative_amino_acid_substitution' OR cvterm.name = 'elongated_polypeptide_C_terminal' OR cvterm.name = 'elongated_polypeptide_N_terminal' OR cvterm.name = 'elongated_in_frame_polypeptide_C_terminal' OR cvterm.name = 'elongated_out_of_frame_polypeptide_C_terminal' OR cvterm.name = 'elongated_in_frame_polypeptide_N_terminal_elongation' OR cvterm.name = 'elongated_out_of_frame_polypeptide_N_terminal' OR cvterm.name = 'gene_variant';

--- ************************************************
--- *** relation: gene_fusion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant whereby a two genes h ***
--- *** ave become joined.                       ***
--- ************************************************
---

CREATE VIEW gene_fusion AS
  SELECT
    feature_id AS gene_fusion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_fusion';

--- ************************************************
--- *** relation: regulatory_region_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant located within a regu ***
--- *** latory region.                           ***
--- ************************************************
---

CREATE VIEW regulatory_region_variant AS
  SELECT
    feature_id AS regulatory_region_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'TF_binding_site_variant' OR cvterm.name = 'regulatory_region_variant';

--- ************************************************
--- *** relation: stop_retained_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant where at least one ba ***
--- *** se in the terminator codon is changed, b ***
--- *** ut the terminator remains.               ***
--- ************************************************
---

CREATE VIEW stop_retained_variant AS
  SELECT
    feature_id AS stop_retained_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'stop_retained_variant';

--- ************************************************
--- *** relation: splicing_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that changes the proc ***
--- *** ess of splicing.                         ***
--- ************************************************
---

CREATE VIEW splicing_variant AS
  SELECT
    feature_id AS splicing_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cryptic_splice_site_variant' OR cvterm.name = 'exon_loss' OR cvterm.name = 'intron_gain' OR cvterm.name = 'splice_region_variant' OR cvterm.name = 'cryptic_splice_acceptor' OR cvterm.name = 'cryptic_splice_donor' OR cvterm.name = 'splicing_variant';

--- ************************************************
--- *** relation: cryptic_splice_site_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant causing a new (functi ***
--- *** onal) splice site.                       ***
--- ************************************************
---

CREATE VIEW cryptic_splice_site_variant AS
  SELECT
    feature_id AS cryptic_splice_site_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cryptic_splice_acceptor' OR cvterm.name = 'cryptic_splice_donor' OR cvterm.name = 'cryptic_splice_site_variant';

--- ************************************************
--- *** relation: cryptic_splice_acceptor ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant whereby a new splice  ***
--- *** site is created due to the activation of ***
--- ***  a new acceptor.                         ***
--- ************************************************
---

CREATE VIEW cryptic_splice_acceptor AS
  SELECT
    feature_id AS cryptic_splice_acceptor_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cryptic_splice_acceptor';

--- ************************************************
--- *** relation: cryptic_splice_donor ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant whereby a new splice  ***
--- *** site is created due to the activation of ***
--- ***  a new donor.                            ***
--- ************************************************
---

CREATE VIEW cryptic_splice_donor AS
  SELECT
    feature_id AS cryptic_splice_donor_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cryptic_splice_donor';

--- ************************************************
--- *** relation: exon_loss ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant whereby an exon is lo ***
--- *** st from the transcript.                  ***
--- ************************************************
---

CREATE VIEW exon_loss AS
  SELECT
    feature_id AS exon_loss_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'exon_loss';

--- ************************************************
--- *** relation: intron_gain ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant whereby an intron is  ***
--- *** gained by the processed transcript; usua ***
--- *** lly a result of an alteration of the don ***
--- *** or or acceptor.                          ***
--- ************************************************
---

CREATE VIEW intron_gain AS
  SELECT
    feature_id AS intron_gain_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'intron_gain';

--- ************************************************
--- *** relation: splice_acceptor_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A splice variant that changes the 2 base ***
--- ***  region at the 3' end of an intron.      ***
--- ************************************************
---

CREATE VIEW splice_acceptor_variant AS
  SELECT
    feature_id AS splice_acceptor_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'splice_acceptor_variant';

--- ************************************************
--- *** relation: splice_donor_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A splice variant that changes the2 base  ***
--- *** region at the 5' end of an intron.       ***
--- ************************************************
---

CREATE VIEW splice_donor_variant AS
  SELECT
    feature_id AS splice_donor_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'splice_donor_variant';

--- ************************************************
--- *** relation: transcript_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that changes the stru ***
--- *** cture of the transcript.                 ***
--- ************************************************
---

CREATE VIEW transcript_variant AS
  SELECT
    feature_id AS transcript_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'complex_change_in_transcript' OR cvterm.name = 'transcript_secondary_structure_variant' OR cvterm.name = 'nc_transcript_variant' OR cvterm.name = 'NMD_transcript_variant' OR cvterm.name = 'UTR_variant' OR cvterm.name = 'intron_variant' OR cvterm.name = 'exon_variant' OR cvterm.name = 'compensatory_transcript_secondary_structure_variant' OR cvterm.name = 'mature_miRNA_variant' OR cvterm.name = '5_prime_UTR_variant' OR cvterm.name = '3_prime_UTR_variant' OR cvterm.name = 'splice_site_variant' OR cvterm.name = 'splice_acceptor_variant' OR cvterm.name = 'splice_donor_variant' OR cvterm.name = 'splice_donor_5th_base_variant' OR cvterm.name = 'coding_sequence_variant' OR cvterm.name = 'non_coding_exon_variant' OR cvterm.name = 'codon_variant' OR cvterm.name = 'frameshift_variant' OR cvterm.name = 'inframe_variant' OR cvterm.name = 'initiator_codon_change' OR cvterm.name = 'non_synonymous_codon' OR cvterm.name = 'synonymous_codon' OR cvterm.name = 'terminal_codon_variant' OR cvterm.name = 'stop_gained' OR cvterm.name = 'missense_codon' OR cvterm.name = 'conservative_missense_codon' OR cvterm.name = 'non_conservative_missense_codon' OR cvterm.name = 'terminator_codon_variant' OR cvterm.name = 'incomplete_terminal_codon_variant' OR cvterm.name = 'stop_retained_variant' OR cvterm.name = 'stop_lost' OR cvterm.name = 'frame_restoring_variant' OR cvterm.name = 'minus_1_frameshift_variant' OR cvterm.name = 'minus_2_frameshift_variant' OR cvterm.name = 'plus_1_frameshift_variant' OR cvterm.name = 'plus_2_frameshift variant' OR cvterm.name = 'inframe_codon_gain' OR cvterm.name = 'inframe_codon_loss' OR cvterm.name = 'transcript_variant';

--- ************************************************
--- *** relation: complex_change_in_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transcript variant with a complex INDE ***
--- *** L- Insertion or deletion that spans an e ***
--- *** xon/intron border or a coding sequence/U ***
--- *** TR border.                               ***
--- ************************************************
---

CREATE VIEW complex_change_in_transcript AS
  SELECT
    feature_id AS complex_change_in_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'complex_change_in_transcript';

--- ************************************************
--- *** relation: stop_lost ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant where at least one ba ***
--- *** se of the terminator codon (stop) is cha ***
--- *** nged, resulting in an elongated transcri ***
--- *** pt.                                      ***
--- ************************************************
---

CREATE VIEW stop_lost AS
  SELECT
    feature_id AS stop_lost_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'stop_lost';

--- ************************************************
--- *** relation: coding_sequence_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that changes the codi ***
--- *** ng sequence.                             ***
--- ************************************************
---

CREATE VIEW coding_sequence_variant AS
  SELECT
    feature_id AS coding_sequence_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'codon_variant' OR cvterm.name = 'frameshift_variant' OR cvterm.name = 'inframe_variant' OR cvterm.name = 'initiator_codon_change' OR cvterm.name = 'non_synonymous_codon' OR cvterm.name = 'synonymous_codon' OR cvterm.name = 'terminal_codon_variant' OR cvterm.name = 'stop_gained' OR cvterm.name = 'missense_codon' OR cvterm.name = 'conservative_missense_codon' OR cvterm.name = 'non_conservative_missense_codon' OR cvterm.name = 'terminator_codon_variant' OR cvterm.name = 'incomplete_terminal_codon_variant' OR cvterm.name = 'stop_retained_variant' OR cvterm.name = 'stop_lost' OR cvterm.name = 'frame_restoring_variant' OR cvterm.name = 'minus_1_frameshift_variant' OR cvterm.name = 'minus_2_frameshift_variant' OR cvterm.name = 'plus_1_frameshift_variant' OR cvterm.name = 'plus_2_frameshift variant' OR cvterm.name = 'inframe_codon_gain' OR cvterm.name = 'inframe_codon_loss' OR cvterm.name = 'coding_sequence_variant';

--- ************************************************
--- *** relation: codon_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that changes at least ***
--- ***  one base in a codon.                    ***
--- ************************************************
---

CREATE VIEW codon_variant AS
  SELECT
    feature_id AS codon_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'initiator_codon_change' OR cvterm.name = 'non_synonymous_codon' OR cvterm.name = 'synonymous_codon' OR cvterm.name = 'terminal_codon_variant' OR cvterm.name = 'stop_gained' OR cvterm.name = 'missense_codon' OR cvterm.name = 'conservative_missense_codon' OR cvterm.name = 'non_conservative_missense_codon' OR cvterm.name = 'terminator_codon_variant' OR cvterm.name = 'incomplete_terminal_codon_variant' OR cvterm.name = 'stop_retained_variant' OR cvterm.name = 'stop_lost' OR cvterm.name = 'codon_variant';

--- ************************************************
--- *** relation: initiator_codon_change ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A codon variant that changes at least on ***
--- *** e base of the first codon of a transcrip ***
--- *** t.                                       ***
--- ************************************************
---

CREATE VIEW initiator_codon_change AS
  SELECT
    feature_id AS initiator_codon_change_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'initiator_codon_change';

--- ************************************************
--- *** relation: non_synonymous_codon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant whereby at least one  ***
--- *** base of a codon is changed resulting in  ***
--- *** a codon that encodes for a different ami ***
--- *** no acid or stop codon.                   ***
--- ************************************************
---

CREATE VIEW non_synonymous_codon AS
  SELECT
    feature_id AS non_synonymous_codon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'stop_gained' OR cvterm.name = 'missense_codon' OR cvterm.name = 'conservative_missense_codon' OR cvterm.name = 'non_conservative_missense_codon' OR cvterm.name = 'non_synonymous_codon';

--- ************************************************
--- *** relation: conservative_missense_codon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant whereby at least one  ***
--- *** base of a codon is changed resulting in  ***
--- *** a codon that encodes for a different but ***
--- ***  similar amino acid. These variants may  ***
--- *** or may not be deleterious.               ***
--- ************************************************
---

CREATE VIEW conservative_missense_codon AS
  SELECT
    feature_id AS conservative_missense_codon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'conservative_missense_codon';

--- ************************************************
--- *** relation: non_conservative_missense_codon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant whereby at least one  ***
--- *** base of a codon is changed resulting in  ***
--- *** a codon that encodes for an amino acid w ***
--- *** ith different biochemical properties.    ***
--- ************************************************
---

CREATE VIEW non_conservative_missense_codon AS
  SELECT
    feature_id AS non_conservative_missense_codon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'non_conservative_missense_codon';

--- ************************************************
--- *** relation: stop_gained ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant whereby at least one  ***
--- *** base of a codon is changed, resulting in ***
--- ***  a premature stop codon, leading to a sh ***
--- *** ortened transcript.                      ***
--- ************************************************
---

CREATE VIEW stop_gained AS
  SELECT
    feature_id AS stop_gained_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'stop_gained';

--- ************************************************
--- *** relation: synonymous_codon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant whereby a base of a c ***
--- *** odon is changed, but there is no resulti ***
--- *** ng change to the encoded amino acid.     ***
--- ************************************************
---

CREATE VIEW synonymous_codon AS
  SELECT
    feature_id AS synonymous_codon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'synonymous_codon';

--- ************************************************
--- *** relation: frameshift_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant which causes a disrup ***
--- *** tion of the translational reading frame, ***
--- ***  because the number of nucleotides inser ***
--- *** ted or deleted is not a multiple of thre ***
--- *** e.                                       ***
--- ************************************************
---

CREATE VIEW frameshift_variant AS
  SELECT
    feature_id AS frameshift_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'frame_restoring_variant' OR cvterm.name = 'minus_1_frameshift_variant' OR cvterm.name = 'minus_2_frameshift_variant' OR cvterm.name = 'plus_1_frameshift_variant' OR cvterm.name = 'plus_2_frameshift variant' OR cvterm.name = 'frameshift_variant';

--- ************************************************
--- *** relation: terminator_codon_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant whereby at least one  ***
--- *** of the bases in the terminator codon is  ***
--- *** changed.                                 ***
--- ************************************************
---

CREATE VIEW terminator_codon_variant AS
  SELECT
    feature_id AS terminator_codon_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'stop_retained_variant' OR cvterm.name = 'stop_lost' OR cvterm.name = 'terminator_codon_variant';

--- ************************************************
--- *** relation: frame_restoring_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that reverts the sequ ***
--- *** ence of a previous frameshift mutation b ***
--- *** ack to the initial frame.                ***
--- ************************************************
---

CREATE VIEW frame_restoring_variant AS
  SELECT
    feature_id AS frame_restoring_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'frame_restoring_variant';

--- ************************************************
--- *** relation: minus_1_frameshift_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant which causes a disrup ***
--- *** tion of the translational reading frame, ***
--- ***  by shifting one base ahead.             ***
--- ************************************************
---

CREATE VIEW minus_1_frameshift_variant AS
  SELECT
    feature_id AS minus_1_frameshift_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'minus_1_frameshift_variant';

--- ************************************************
--- *** relation: minus_2_frameshift_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW minus_2_frameshift_variant AS
  SELECT
    feature_id AS minus_2_frameshift_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'minus_2_frameshift_variant';

--- ************************************************
--- *** relation: plus_1_frameshift_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant which causes a disrup ***
--- *** tion of the translational reading frame, ***
--- ***  by shifting one base backward.          ***
--- ************************************************
---

CREATE VIEW plus_1_frameshift_variant AS
  SELECT
    feature_id AS plus_1_frameshift_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'plus_1_frameshift_variant';

--- ************************************************
--- *** relation: plus_2_frameshift_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW plus_2_frameshift_variant AS
  SELECT
    feature_id AS plus_2_frameshift_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'plus_2_frameshift variant';

--- ************************************************
--- *** relation: transcript_secondary_structure_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant within a transcript t ***
--- *** hat changes the secondary structure of t ***
--- *** he RNA product.                          ***
--- ************************************************
---

CREATE VIEW transcript_secondary_structure_variant AS
  SELECT
    feature_id AS transcript_secondary_structure_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'compensatory_transcript_secondary_structure_variant' OR cvterm.name = 'transcript_secondary_structure_variant';

--- ************************************************
--- *** relation: compensatory_transcript_secondary_structure_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A secondary structure variant that compe ***
--- *** nsate for the change made by a previous  ***
--- *** variant.                                 ***
--- ************************************************
---

CREATE VIEW compensatory_transcript_secondary_structure_variant AS
  SELECT
    feature_id AS compensatory_transcript_secondary_structure_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'compensatory_transcript_secondary_structure_variant';

--- ************************************************
--- *** relation: translational_product_structure_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant within the transcript ***
--- ***  that changes the structure of the trans ***
--- *** lational product.                        ***
--- ************************************************
---

CREATE VIEW translational_product_structure_variant AS
  SELECT
    feature_id AS translational_product_structure_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = '3D_polypeptide_structure_variant' OR cvterm.name = 'complex_change_of_translational_product_variant' OR cvterm.name = 'polypeptide_sequence_variant' OR cvterm.name = 'complex_3D_structural_variant' OR cvterm.name = 'conformational_change_variant' OR cvterm.name = 'amino_acid_deletion' OR cvterm.name = 'amino_acid_insertion' OR cvterm.name = 'amino_acid_substitution' OR cvterm.name = 'elongated_polypeptide' OR cvterm.name = 'polypeptide_fusion' OR cvterm.name = 'polypeptide_truncation' OR cvterm.name = 'conservative_amino_acid_substitution' OR cvterm.name = 'non_conservative_amino_acid_substitution' OR cvterm.name = 'elongated_polypeptide_C_terminal' OR cvterm.name = 'elongated_polypeptide_N_terminal' OR cvterm.name = 'elongated_in_frame_polypeptide_C_terminal' OR cvterm.name = 'elongated_out_of_frame_polypeptide_C_terminal' OR cvterm.name = 'elongated_in_frame_polypeptide_N_terminal_elongation' OR cvterm.name = 'elongated_out_of_frame_polypeptide_N_terminal' OR cvterm.name = 'translational_product_structure_variant';

--- ************************************************
--- *** relation: threed_polypeptide_structure_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that changes the resu ***
--- *** lting polypeptide structure.             ***
--- ************************************************
---

CREATE VIEW threed_polypeptide_structure_variant AS
  SELECT
    feature_id AS threed_polypeptide_structure_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'complex_3D_structural_variant' OR cvterm.name = 'conformational_change_variant' OR cvterm.name = '3D_polypeptide_structure_variant';

--- ************************************************
--- *** relation: complex_3d_structural_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that changes the resu ***
--- *** lting polypeptide structure.             ***
--- ************************************************
---

CREATE VIEW complex_3d_structural_variant AS
  SELECT
    feature_id AS complex_3d_structural_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'complex_3D_structural_variant';

--- ************************************************
--- *** relation: conformational_change_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant in the CDS region tha ***
--- *** t causes a conformational change in the  ***
--- *** resulting polypeptide sequence.          ***
--- ************************************************
---

CREATE VIEW conformational_change_variant AS
  SELECT
    feature_id AS conformational_change_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'conformational_change_variant';

--- ************************************************
--- *** relation: complex_change_of_translational_product_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW complex_change_of_translational_product_variant AS
  SELECT
    feature_id AS complex_change_of_translational_product_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'complex_change_of_translational_product_variant';

--- ************************************************
--- *** relation: polypeptide_sequence_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant with in the CDS that  ***
--- *** causes a change in the resulting polypep ***
--- *** tide sequence.                           ***
--- ************************************************
---

CREATE VIEW polypeptide_sequence_variant AS
  SELECT
    feature_id AS polypeptide_sequence_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'amino_acid_deletion' OR cvterm.name = 'amino_acid_insertion' OR cvterm.name = 'amino_acid_substitution' OR cvterm.name = 'elongated_polypeptide' OR cvterm.name = 'polypeptide_fusion' OR cvterm.name = 'polypeptide_truncation' OR cvterm.name = 'conservative_amino_acid_substitution' OR cvterm.name = 'non_conservative_amino_acid_substitution' OR cvterm.name = 'elongated_polypeptide_C_terminal' OR cvterm.name = 'elongated_polypeptide_N_terminal' OR cvterm.name = 'elongated_in_frame_polypeptide_C_terminal' OR cvterm.name = 'elongated_out_of_frame_polypeptide_C_terminal' OR cvterm.name = 'elongated_in_frame_polypeptide_N_terminal_elongation' OR cvterm.name = 'elongated_out_of_frame_polypeptide_N_terminal' OR cvterm.name = 'polypeptide_sequence_variant';

--- ************************************************
--- *** relation: amino_acid_deletion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant within a CDS resultin ***
--- *** g in the loss of an amino acid from the  ***
--- *** resulting polypeptide.                   ***
--- ************************************************
---

CREATE VIEW amino_acid_deletion AS
  SELECT
    feature_id AS amino_acid_deletion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'amino_acid_deletion';

--- ************************************************
--- *** relation: amino_acid_insertion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant within a CDS resultin ***
--- *** g in the gain of an amino acid to the re ***
--- *** sulting polypeptide.                     ***
--- ************************************************
---

CREATE VIEW amino_acid_insertion AS
  SELECT
    feature_id AS amino_acid_insertion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'amino_acid_insertion';

--- ************************************************
--- *** relation: amino_acid_substitution ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant of a codon resulting  ***
--- *** in the substitution of one amino acid fo ***
--- *** r another in the resulting polypeptide.  ***
--- ************************************************
---

CREATE VIEW amino_acid_substitution AS
  SELECT
    feature_id AS amino_acid_substitution_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'conservative_amino_acid_substitution' OR cvterm.name = 'non_conservative_amino_acid_substitution' OR cvterm.name = 'amino_acid_substitution';

--- ************************************************
--- *** relation: conservative_amino_acid_substitution ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant of a codon causing th ***
--- *** e substitution of a similar amino acid f ***
--- *** or another in the resulting polypeptide. ***
--- ************************************************
---

CREATE VIEW conservative_amino_acid_substitution AS
  SELECT
    feature_id AS conservative_amino_acid_substitution_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'conservative_amino_acid_substitution';

--- ************************************************
--- *** relation: non_conservative_amino_acid_substitution ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant of a codon causing th ***
--- *** e substitution of a non conservative ami ***
--- *** no acid for another in the resulting pol ***
--- *** ypeptide.                                ***
--- ************************************************
---

CREATE VIEW non_conservative_amino_acid_substitution AS
  SELECT
    feature_id AS non_conservative_amino_acid_substitution_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'non_conservative_amino_acid_substitution';

--- ************************************************
--- *** relation: elongated_polypeptide ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant with in the CDS that  ***
--- *** causes elongation of the resulting polyp ***
--- *** eptide sequence.                         ***
--- ************************************************
---

CREATE VIEW elongated_polypeptide AS
  SELECT
    feature_id AS elongated_polypeptide_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'elongated_polypeptide_C_terminal' OR cvterm.name = 'elongated_polypeptide_N_terminal' OR cvterm.name = 'elongated_in_frame_polypeptide_C_terminal' OR cvterm.name = 'elongated_out_of_frame_polypeptide_C_terminal' OR cvterm.name = 'elongated_in_frame_polypeptide_N_terminal_elongation' OR cvterm.name = 'elongated_out_of_frame_polypeptide_N_terminal' OR cvterm.name = 'elongated_polypeptide';

--- ************************************************
--- *** relation: elongated_polypeptide_c_terminal ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant with in the CDS that  ***
--- *** causes elongation of the resulting polyp ***
--- *** eptide sequence at the C terminus.       ***
--- ************************************************
---

CREATE VIEW elongated_polypeptide_c_terminal AS
  SELECT
    feature_id AS elongated_polypeptide_c_terminal_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'elongated_in_frame_polypeptide_C_terminal' OR cvterm.name = 'elongated_out_of_frame_polypeptide_C_terminal' OR cvterm.name = 'elongated_polypeptide_C_terminal';

--- ************************************************
--- *** relation: elongated_polypeptide_n_terminal ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant with in the CDS that  ***
--- *** causes elongation of the resulting polyp ***
--- *** eptide sequence at the N terminus.       ***
--- ************************************************
---

CREATE VIEW elongated_polypeptide_n_terminal AS
  SELECT
    feature_id AS elongated_polypeptide_n_terminal_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'elongated_in_frame_polypeptide_N_terminal_elongation' OR cvterm.name = 'elongated_out_of_frame_polypeptide_N_terminal' OR cvterm.name = 'elongated_polypeptide_N_terminal';

--- ************************************************
--- *** relation: elongated_in_frame_polypeptide_c_terminal ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant with in the CDS that  ***
--- *** causes in frame elongation of the result ***
--- *** ing polypeptide sequence at the C termin ***
--- *** us.                                      ***
--- ************************************************
---

CREATE VIEW elongated_in_frame_polypeptide_c_terminal AS
  SELECT
    feature_id AS elongated_in_frame_polypeptide_c_terminal_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'elongated_in_frame_polypeptide_C_terminal';

--- ************************************************
--- *** relation: elongated_out_of_frame_polypeptide_c_terminal ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant with in the CDS that  ***
--- *** causes out of frame elongation of the re ***
--- *** sulting polypeptide sequence at the C te ***
--- *** rminus.                                  ***
--- ************************************************
---

CREATE VIEW elongated_out_of_frame_polypeptide_c_terminal AS
  SELECT
    feature_id AS elongated_out_of_frame_polypeptide_c_terminal_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'elongated_out_of_frame_polypeptide_C_terminal';

--- ************************************************
--- *** relation: elongated_in_frame_polypeptide_n_terminal_elongation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant with in the CDS that  ***
--- *** causes in frame elongation of the result ***
--- *** ing polypeptide sequence at the N termin ***
--- *** us.                                      ***
--- ************************************************
---

CREATE VIEW elongated_in_frame_polypeptide_n_terminal_elongation AS
  SELECT
    feature_id AS elongated_in_frame_polypeptide_n_terminal_elongation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'elongated_in_frame_polypeptide_N_terminal_elongation';

--- ************************************************
--- *** relation: elongated_out_of_frame_polypeptide_n_terminal ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant with in the CDS that  ***
--- *** causes out of frame elongation of the re ***
--- *** sulting polypeptide sequence at the N te ***
--- *** rminus.                                  ***
--- ************************************************
---

CREATE VIEW elongated_out_of_frame_polypeptide_n_terminal AS
  SELECT
    feature_id AS elongated_out_of_frame_polypeptide_n_terminal_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'elongated_out_of_frame_polypeptide_N_terminal';

--- ************************************************
--- *** relation: polypeptide_fusion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that causes a fusion  ***
--- *** of two polypeptide sequences.            ***
--- ************************************************
---

CREATE VIEW polypeptide_fusion AS
  SELECT
    feature_id AS polypeptide_fusion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_fusion';

--- ************************************************
--- *** relation: polypeptide_truncation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant of the CD that causes ***
--- ***  a truncation of the resulting polypepti ***
--- *** de.                                      ***
--- ************************************************
---

CREATE VIEW polypeptide_truncation AS
  SELECT
    feature_id AS polypeptide_truncation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_truncation';

--- ************************************************
--- *** relation: inactive_catalytic_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that causes the inact ***
--- *** ivation of a catalytic site with respect ***
--- ***  to a reference sequence.                ***
--- ************************************************
---

CREATE VIEW inactive_catalytic_site AS
  SELECT
    feature_id AS inactive_catalytic_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inactive_catalytic_site';

--- ************************************************
--- *** relation: nc_transcript_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transcript variant of a non coding RNA ***
--- ***  gene.                                   ***
--- ************************************************
---

CREATE VIEW nc_transcript_variant AS
  SELECT
    feature_id AS nc_transcript_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mature_miRNA_variant' OR cvterm.name = 'nc_transcript_variant';

--- ************************************************
--- *** relation: mature_mirna_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transcript variant located with the se ***
--- *** quence of the mature miRNA.              ***
--- ************************************************
---

CREATE VIEW mature_mirna_variant AS
  SELECT
    feature_id AS mature_mirna_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mature_miRNA_variant';

--- ************************************************
--- *** relation: nmd_transcript_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A variant in a transcript that is the ta ***
--- *** rget of NMD.                             ***
--- ************************************************
---

CREATE VIEW nmd_transcript_variant AS
  SELECT
    feature_id AS nmd_transcript_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'NMD_transcript_variant';

--- ************************************************
--- *** relation: utr_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transcript variant that is located wit ***
--- *** hin the UTR.                             ***
--- ************************************************
---

CREATE VIEW utr_variant AS
  SELECT
    feature_id AS utr_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = '5_prime_UTR_variant' OR cvterm.name = '3_prime_UTR_variant' OR cvterm.name = 'UTR_variant';

--- ************************************************
--- *** relation: five_prime_utr_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A UTR variant of the 5' UTR.             ***
--- ************************************************
---

CREATE VIEW five_prime_utr_variant AS
  SELECT
    feature_id AS five_prime_utr_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = '5_prime_UTR_variant';

--- ************************************************
--- *** relation: three_prime_utr_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A UTR variant of the 3' UTR.             ***
--- ************************************************
---

CREATE VIEW three_prime_utr_variant AS
  SELECT
    feature_id AS three_prime_utr_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = '3_prime_UTR_variant';

--- ************************************************
--- *** relation: terminal_codon_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A codon variant that changes at least on ***
--- *** e base of the last codon of the transcri ***
--- *** pt.                                      ***
--- ************************************************
---

CREATE VIEW terminal_codon_variant AS
  SELECT
    feature_id AS terminal_codon_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'terminator_codon_variant' OR cvterm.name = 'incomplete_terminal_codon_variant' OR cvterm.name = 'stop_retained_variant' OR cvterm.name = 'stop_lost' OR cvterm.name = 'terminal_codon_variant';

--- ************************************************
--- *** relation: incomplete_terminal_codon_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant where at least one ba ***
--- *** se of the final codon of an incompletely ***
--- ***  annotated transcript is changed.        ***
--- ************************************************
---

CREATE VIEW incomplete_terminal_codon_variant AS
  SELECT
    feature_id AS incomplete_terminal_codon_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'incomplete_terminal_codon_variant';

--- ************************************************
--- *** relation: intron_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transcript variant occurring within an ***
--- ***  intron.                                 ***
--- ************************************************
---

CREATE VIEW intron_variant AS
  SELECT
    feature_id AS intron_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'splice_site_variant' OR cvterm.name = 'splice_acceptor_variant' OR cvterm.name = 'splice_donor_variant' OR cvterm.name = 'splice_donor_5th_base_variant' OR cvterm.name = 'intron_variant';

--- ************************************************
--- *** relation: intergenic_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant located in the interg ***
--- *** enic region, between genes.              ***
--- ************************************************
---

CREATE VIEW intergenic_variant AS
  SELECT
    feature_id AS intergenic_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'intergenic_variant';

--- ************************************************
--- *** relation: splice_site_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that changes the firs ***
--- *** t two or last two bases of an intron, or ***
--- ***  the 5th base from the start of the intr ***
--- *** on in the orientation of the transcript. ***
--- ************************************************
---

CREATE VIEW splice_site_variant AS
  SELECT
    feature_id AS splice_site_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'splice_acceptor_variant' OR cvterm.name = 'splice_donor_variant' OR cvterm.name = 'splice_donor_5th_base_variant' OR cvterm.name = 'splice_site_variant';

--- ************************************************
--- *** relation: splice_region_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant in which a change has ***
--- ***  occurred within the region of the splic ***
--- *** e site, either within 1-3 bases of the e ***
--- *** xon or 3-8 bases of the intron.          ***
--- ************************************************
---

CREATE VIEW splice_region_variant AS
  SELECT
    feature_id AS splice_region_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'splice_region_variant';

--- ************************************************
--- *** relation: upstream_gene_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant located 5' of a gene. ***
--- ************************************************
---

CREATE VIEW upstream_gene_variant AS
  SELECT
    feature_id AS upstream_gene_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = '5KB_upstream_variant' OR cvterm.name = '2KB_upstream_variant' OR cvterm.name = 'upstream_gene_variant';

--- ************************************************
--- *** relation: downstream_gene_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant located 3' of a gene. ***
--- ************************************************
---

CREATE VIEW downstream_gene_variant AS
  SELECT
    feature_id AS downstream_gene_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = '5KB_downstream_variant' OR cvterm.name = '500B_downstream_variant' OR cvterm.name = 'downstream_gene_variant';

--- ************************************************
--- *** relation: fivekb_downstream_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant located within 5 KB o ***
--- *** f the end of a gene.                     ***
--- ************************************************
---

CREATE VIEW fivekb_downstream_variant AS
  SELECT
    feature_id AS fivekb_downstream_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = '500B_downstream_variant' OR cvterm.name = '5KB_downstream_variant';

--- ************************************************
--- *** relation: fivehundred_b_downstream_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant located within a half ***
--- ***  KB of the end of a gene.                ***
--- ************************************************
---

CREATE VIEW fivehundred_b_downstream_variant AS
  SELECT
    feature_id AS fivehundred_b_downstream_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = '500B_downstream_variant';

--- ************************************************
--- *** relation: fivekb_upstream_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant located within 5KB 5' ***
--- ***  of a gene.                              ***
--- ************************************************
---

CREATE VIEW fivekb_upstream_variant AS
  SELECT
    feature_id AS fivekb_upstream_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = '2KB_upstream_variant' OR cvterm.name = '5KB_upstream_variant';

--- ************************************************
--- *** relation: twokb_upstream_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant located within 2KB 5' ***
--- ***  of a gene.                              ***
--- ************************************************
---

CREATE VIEW twokb_upstream_variant AS
  SELECT
    feature_id AS twokb_upstream_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = '2KB_upstream_variant';

--- ************************************************
--- *** relation: rrna_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that encodes for ribosomal RNA.   ***
--- ************************************************
---

CREATE VIEW rrna_gene AS
  SELECT
    feature_id AS rrna_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rRNA_gene';

--- ************************************************
--- *** relation: pirna_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that encodes for an piwi associat ***
--- *** ed RNA.                                  ***
--- ************************************************
---

CREATE VIEW pirna_gene AS
  SELECT
    feature_id AS pirna_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'piRNA_gene';

--- ************************************************
--- *** relation: rnase_p_rna_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that encodes an RNase P RNA.      ***
--- ************************************************
---

CREATE VIEW rnase_p_rna_gene AS
  SELECT
    feature_id AS rnase_p_rna_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RNase_P_RNA_gene';

--- ************************************************
--- *** relation: rnase_mrp_rna_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that encodes a RNase_MRP_RNA.     ***
--- ************************************************
---

CREATE VIEW rnase_mrp_rna_gene AS
  SELECT
    feature_id AS rnase_mrp_rna_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RNase_MRP_RNA_gene';

--- ************************************************
--- *** relation: lincrna_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that encodes large intervening no ***
--- *** n-coding RNA.                            ***
--- ************************************************
---

CREATE VIEW lincrna_gene AS
  SELECT
    feature_id AS lincrna_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'lincRNA_gene';

--- ************************************************
--- *** relation: mathematically_defined_repeat ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A mathematically defined repeat (MDR) is ***
--- ***  a experimental feature that is determin ***
--- *** ed by querying overlapping oligomers of  ***
--- *** length k against a database of shotgun s ***
--- *** equence data and identifying regions in  ***
--- *** the query sequence that exceed a statist ***
--- *** ically determined threshold of repetitiv ***
--- *** eness.                                   ***
--- ************************************************
---

CREATE VIEW mathematically_defined_repeat AS
  SELECT
    feature_id AS mathematically_defined_repeat_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mathematically_defined_repeat';

--- ************************************************
--- *** relation: telomerase_rna_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A telomerase RNA gene is a non coding RN ***
--- *** A gene the RNA product of which is a com ***
--- *** ponent of telomerase.                    ***
--- ************************************************
---

CREATE VIEW telomerase_rna_gene AS
  SELECT
    feature_id AS telomerase_rna_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'telomerase_RNA_gene';

--- ************************************************
--- *** relation: targeting_vector ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An engineered vector that is able to tak ***
--- *** e part in homologous recombination in a  ***
--- *** host with the intent of introducing site ***
--- ***  specific genomic modifications.         ***
--- ************************************************
---

CREATE VIEW targeting_vector AS
  SELECT
    feature_id AS targeting_vector_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'targeting_vector';

--- ************************************************
--- *** relation: genetic_marker ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A measurable sequence feature that varie ***
--- *** s within a population.                   ***
--- ************************************************
---

CREATE VIEW genetic_marker AS
  SELECT
    feature_id AS genetic_marker_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'heritable_phenotypic_marker' OR cvterm.name = 'DArT_marker' OR cvterm.name = 'genetic_marker';

--- ************************************************
--- *** relation: dart_marker ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A genetic marker, discovered using Diver ***
--- *** sity Arrays Technology (DArT) technology ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW dart_marker AS
  SELECT
    feature_id AS dart_marker_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DArT_marker';

--- ************************************************
--- *** relation: kozak_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of ribosome entry site, specific  ***
--- *** to Eukaryotic organisms that overlaps pa ***
--- *** rt of both 5' UTR and CDS sequence.      ***
--- ************************************************
---

CREATE VIEW kozak_sequence AS
  SELECT
    feature_id AS kozak_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'kozak_sequence';

--- ************************************************
--- *** relation: nested_transposon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transposon that is disrupted by the in ***
--- *** sertion of another element.              ***
--- ************************************************
---

CREATE VIEW nested_transposon AS
  SELECT
    feature_id AS nested_transposon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'nested_transposon';

--- ************************************************
--- *** relation: nested_repeat ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A repeat that is disrupted by the insert ***
--- *** ion of another element.                  ***
--- ************************************************
---

CREATE VIEW nested_repeat AS
  SELECT
    feature_id AS nested_repeat_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'nested_tandem_repeat' OR cvterm.name = 'nested_repeat';

--- ************************************************
--- *** relation: inframe_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant which does not cause  ***
--- *** a disruption of the translational readin ***
--- *** g frame.                                 ***
--- ************************************************
---

CREATE VIEW inframe_variant AS
  SELECT
    feature_id AS inframe_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inframe_codon_gain' OR cvterm.name = 'inframe_codon_loss' OR cvterm.name = 'inframe_variant';

--- ************************************************
--- *** relation: inframe_codon_gain ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant which gains a codon,  ***
--- *** and does not cause a disruption of the t ***
--- *** ranslational reading frame.              ***
--- ************************************************
---

CREATE VIEW inframe_codon_gain AS
  SELECT
    feature_id AS inframe_codon_gain_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inframe_codon_gain';

--- ************************************************
--- *** relation: inframe_codon_loss ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant which loses a codon,  ***
--- *** and does not cause a disruption of the t ***
--- *** ranslational reading frame.              ***
--- ************************************************
---

CREATE VIEW inframe_codon_loss AS
  SELECT
    feature_id AS inframe_codon_loss_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inframe_codon_loss';

--- ************************************************
--- *** relation: retinoic_acid_responsive_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transcription factor binding site of v ***
--- *** ariable direct repeats of the sequence P ***
--- *** uGGTCA spaced by five nucleotides (DR5)  ***
--- *** found in the promoters of retinoic acid- ***
--- *** responsive genes, to which retinoic acid ***
--- ***  receptors bind.                         ***
--- ************************************************
---

CREATE VIEW retinoic_acid_responsive_element AS
  SELECT
    feature_id AS retinoic_acid_responsive_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'retinoic_acid_responsive_element';

--- ************************************************
--- *** relation: nucleotide_to_protein_binding_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A binding site that, in the nucleotide m ***
--- *** olecule, interacts selectively and non-c ***
--- *** ovalently with polypeptide residues.     ***
--- ************************************************
---

CREATE VIEW nucleotide_to_protein_binding_site AS
  SELECT
    feature_id AS nucleotide_to_protein_binding_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'nuclease_binding_site' OR cvterm.name = 'TF_binding_site' OR cvterm.name = 'histone_binding_site' OR cvterm.name = 'insulator_binding_site' OR cvterm.name = 'enhancer_binding_site' OR cvterm.name = 'restriction_enzyme_binding_site' OR cvterm.name = 'nuclease_sensitive_site' OR cvterm.name = 'homing_endonuclease_binding_site' OR cvterm.name = 'nuclease_hypersensitive_site' OR cvterm.name = 'group_1_intron_homing_endonuclease_target_region' OR cvterm.name = 'DNAseI_hypersensitive_site' OR cvterm.name = 'nucleotide_to_protein_binding_site';

--- ************************************************
--- *** relation: nucleotide_binding_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A binding site that, in the molecule, in ***
--- *** teracts selectively and non-covalently w ***
--- *** ith nucleotide residues.                 ***
--- ************************************************
---

CREATE VIEW nucleotide_binding_site AS
  SELECT
    feature_id AS nucleotide_binding_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'miRNA_target_site' OR cvterm.name = 'DNA_binding_site' OR cvterm.name = 'primer_binding_site' OR cvterm.name = 'polypeptide_DNA_contact' OR cvterm.name = 'nucleotide_binding_site';

--- ************************************************
--- *** relation: metal_binding_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A binding site that, in the molecule, in ***
--- *** teracts selectively and non-covalently w ***
--- *** ith metal ions.                          ***
--- ************************************************
---

CREATE VIEW metal_binding_site AS
  SELECT
    feature_id AS metal_binding_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_metal_contact' OR cvterm.name = 'polypeptide_calcium_ion_contact_site' OR cvterm.name = 'polypeptide_cobalt_ion_contact_site' OR cvterm.name = 'polypeptide_copper_ion_contact_site' OR cvterm.name = 'polypeptide_iron_ion_contact_site' OR cvterm.name = 'polypeptide_magnesium_ion_contact_site' OR cvterm.name = 'polypeptide_manganese_ion_contact_site' OR cvterm.name = 'polypeptide_molybdenum_ion_contact_site' OR cvterm.name = 'polypeptide_nickel_ion_contact_site' OR cvterm.name = 'polypeptide_tungsten_ion_contact_site' OR cvterm.name = 'polypeptide_zinc_ion_contact_site' OR cvterm.name = 'metal_binding_site';

--- ************************************************
--- *** relation: ligand_binding_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A binding site that, in the molecule, in ***
--- *** teracts selectively and non-covalently w ***
--- *** ith a small molecule such as a drug, or  ***
--- *** hormone.                                 ***
--- ************************************************
---

CREATE VIEW ligand_binding_site AS
  SELECT
    feature_id AS ligand_binding_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_ligand_contact' OR cvterm.name = 'ligand_binding_site';

--- ************************************************
--- *** relation: nested_tandem_repeat ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An NTR is a nested repeat of two distinc ***
--- *** t tandem motifs interspersed with each o ***
--- *** ther.                                    ***
--- ************************************************
---

CREATE VIEW nested_tandem_repeat AS
  SELECT
    feature_id AS nested_tandem_repeat_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'nested_tandem_repeat';

--- ************************************************
--- *** relation: promoter_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW promoter_element AS
  SELECT
    feature_id AS promoter_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'GC_rich_promoter_region' OR cvterm.name = 'DMv4_motif' OR cvterm.name = 'DMv5_motif' OR cvterm.name = 'DMv3_motif' OR cvterm.name = 'DMv2_motif' OR cvterm.name = 'DPE1_motif' OR cvterm.name = 'DMv1_motif' OR cvterm.name = 'NDM2_motif' OR cvterm.name = 'NDM3_motif' OR cvterm.name = 'core_promoter_element' OR cvterm.name = 'regulatory_promoter_element' OR cvterm.name = 'INR_motif' OR cvterm.name = 'DPE_motif' OR cvterm.name = 'BREu_motif' OR cvterm.name = 'TATA_box' OR cvterm.name = 'A_box' OR cvterm.name = 'B_box' OR cvterm.name = 'C_box' OR cvterm.name = 'MTE' OR cvterm.name = 'BREd_motif' OR cvterm.name = 'DCE' OR cvterm.name = 'intermediate_element' OR cvterm.name = 'RNA_polymerase_II_TATA_box' OR cvterm.name = 'RNA_polymerase_III_TATA_box' OR cvterm.name = 'A_box_type_1' OR cvterm.name = 'A_box_type_2' OR cvterm.name = 'proximal_promoter_element' OR cvterm.name = 'distal_promoter_element' OR cvterm.name = 'promoter_element';

--- ************************************************
--- *** relation: core_promoter_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW core_promoter_element AS
  SELECT
    feature_id AS core_promoter_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'INR_motif' OR cvterm.name = 'DPE_motif' OR cvterm.name = 'BREu_motif' OR cvterm.name = 'TATA_box' OR cvterm.name = 'A_box' OR cvterm.name = 'B_box' OR cvterm.name = 'C_box' OR cvterm.name = 'MTE' OR cvterm.name = 'BREd_motif' OR cvterm.name = 'DCE' OR cvterm.name = 'intermediate_element' OR cvterm.name = 'RNA_polymerase_II_TATA_box' OR cvterm.name = 'RNA_polymerase_III_TATA_box' OR cvterm.name = 'A_box_type_1' OR cvterm.name = 'A_box_type_2' OR cvterm.name = 'core_promoter_element';

--- ************************************************
--- *** relation: rna_polymerase_ii_tata_box ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A TATA box core promoter of a gene trans ***
--- *** cribed by RNA polymerase II.             ***
--- ************************************************
---

CREATE VIEW rna_polymerase_ii_tata_box AS
  SELECT
    feature_id AS rna_polymerase_ii_tata_box_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RNA_polymerase_II_TATA_box';

--- ************************************************
--- *** relation: rna_polymerase_iii_tata_box ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A TATA box core promoter of a gene trans ***
--- *** cribed by RNA polymerase III.            ***
--- ************************************************
---

CREATE VIEW rna_polymerase_iii_tata_box AS
  SELECT
    feature_id AS rna_polymerase_iii_tata_box_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RNA_polymerase_III_TATA_box';

--- ************************************************
--- *** relation: bred_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A core TRNA polymerase II promoter eleme ***
--- *** nt with consensus (G/A)T(T/G/A)(T/A)(G/T ***
--- *** )(T/G)(T/G).                             ***
--- ************************************************
---

CREATE VIEW bred_motif AS
  SELECT
    feature_id AS bred_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'BREd_motif';

--- ************************************************
--- *** relation: dce ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A discontinuous core element of RNA poly ***
--- *** merase II transcribed genes, situated do ***
--- *** wnstream of the TSS. It is composed of t ***
--- *** hree sub elements: SI, SII and SIII.     ***
--- ************************************************
---

CREATE VIEW dce AS
  SELECT
    feature_id AS dce_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DCE';

--- ************************************************
--- *** relation: dce_si ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sub element of the DCE core promoter e ***
--- *** lement, with consensus sequence CTTC.    ***
--- ************************************************
---

CREATE VIEW dce_si AS
  SELECT
    feature_id AS dce_si_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DCE_SI';

--- ************************************************
--- *** relation: dce_sii ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sub element of the DCE core promoter e ***
--- *** lement with consensus sequence CTGT.     ***
--- ************************************************
---

CREATE VIEW dce_sii AS
  SELECT
    feature_id AS dce_sii_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DCE_SII';

--- ************************************************
--- *** relation: dce_siii ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sub element of the DCE core promoter e ***
--- *** lement with consensus sequence AGC.      ***
--- ************************************************
---

CREATE VIEW dce_siii AS
  SELECT
    feature_id AS dce_siii_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'DCE_SIII';

--- ************************************************
--- *** relation: proximal_promoter_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW proximal_promoter_element AS
  SELECT
    feature_id AS proximal_promoter_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'proximal_promoter_element';

--- ************************************************
--- *** relation: rnapol_ii_core_promoter ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The minimal portion of the promoter requ ***
--- *** ired to properly initiate transcription  ***
--- *** in RNA polymerase II transcribed genes.  ***
--- ************************************************
---

CREATE VIEW rnapol_ii_core_promoter AS
  SELECT
    feature_id AS rnapol_ii_core_promoter_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'RNApol_II_core_promoter';

--- ************************************************
--- *** relation: distal_promoter_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW distal_promoter_element AS
  SELECT
    feature_id AS distal_promoter_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'distal_promoter_element';

--- ************************************************
--- *** relation: bacterial_rnapol_promoter_sigma_70 ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW bacterial_rnapol_promoter_sigma_70 AS
  SELECT
    feature_id AS bacterial_rnapol_promoter_sigma_70_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'bacterial_RNApol_promoter_sigma_70';

--- ************************************************
--- *** relation: bacterial_rnapol_promoter_sigma54 ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW bacterial_rnapol_promoter_sigma54 AS
  SELECT
    feature_id AS bacterial_rnapol_promoter_sigma54_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'bacterial_RNApol_promoter_sigma54';

--- ************************************************
--- *** relation: minus_12_signal ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A conserved region about 12-bp upstream  ***
--- *** of the start point of bacterial transcri ***
--- *** ption units, involved with sigma factor  ***
--- *** 54.                                      ***
--- ************************************************
---

CREATE VIEW minus_12_signal AS
  SELECT
    feature_id AS minus_12_signal_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'minus_12_signal';

--- ************************************************
--- *** relation: minus_24_signal ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A conserved region about 12-bp upstream  ***
--- *** of the start point of bacterial transcri ***
--- *** ption units, involved with sigma factor  ***
--- *** 54.                                      ***
--- ************************************************
---

CREATE VIEW minus_24_signal AS
  SELECT
    feature_id AS minus_24_signal_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'minus_24_signal';

--- ************************************************
--- *** relation: a_box_type_1 ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An A box within an RNA polymerase III ty ***
--- *** pe 1 promoter.                           ***
--- ************************************************
---

CREATE VIEW a_box_type_1 AS
  SELECT
    feature_id AS a_box_type_1_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'A_box_type_1';

--- ************************************************
--- *** relation: a_box_type_2 ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An A box within an RNA polymerase III ty ***
--- *** pe 2 promoter.                           ***
--- ************************************************
---

CREATE VIEW a_box_type_2 AS
  SELECT
    feature_id AS a_box_type_2_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'A_box_type_2';

--- ************************************************
--- *** relation: intermediate_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A core promoter region of RNA polymerase ***
--- ***  III type 1 promoters.                   ***
--- ************************************************
---

CREATE VIEW intermediate_element AS
  SELECT
    feature_id AS intermediate_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'intermediate_element';

--- ************************************************
--- *** relation: regulatory_promoter_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A promoter element that is not part of t ***
--- *** he core promoter, but provides the promo ***
--- *** ter with a specific regulatory region.   ***
--- ************************************************
---

CREATE VIEW regulatory_promoter_element AS
  SELECT
    feature_id AS regulatory_promoter_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'proximal_promoter_element' OR cvterm.name = 'distal_promoter_element' OR cvterm.name = 'regulatory_promoter_element';

--- ************************************************
--- *** relation: transcription_regulatory_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A regulatory region that is involved in  ***
--- *** the control of the process of transcript ***
--- *** ion.                                     ***
--- ************************************************
---

CREATE VIEW transcription_regulatory_region AS
  SELECT
    feature_id AS transcription_regulatory_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'terminator' OR cvterm.name = 'TF_binding_site' OR cvterm.name = 'polyA_signal_sequence' OR cvterm.name = 'gene_group_regulatory_region' OR cvterm.name = 'transcriptional_cis_regulatory_region' OR cvterm.name = 'splicing_regulatory_region' OR cvterm.name = 'cis_regulatory_frameshift_element' OR cvterm.name = 'intronic_regulatory_region' OR cvterm.name = 'bacterial_terminator' OR cvterm.name = 'eukaryotic_terminator' OR cvterm.name = 'rho_dependent_bacterial_terminator' OR cvterm.name = 'rho_independent_bacterial_terminator' OR cvterm.name = 'terminator_of_type_2_RNApol_III_promoter' OR cvterm.name = 'operator' OR cvterm.name = 'bacterial_RNApol_promoter' OR cvterm.name = 'bacterial_terminator' OR cvterm.name = 'bacterial_RNApol_promoter_sigma_70' OR cvterm.name = 'bacterial_RNApol_promoter_sigma54' OR cvterm.name = 'rho_dependent_bacterial_terminator' OR cvterm.name = 'rho_independent_bacterial_terminator' OR cvterm.name = 'promoter' OR cvterm.name = 'insulator' OR cvterm.name = 'CRM' OR cvterm.name = 'promoter_targeting_sequence' OR cvterm.name = 'ISRE' OR cvterm.name = 'bidirectional_promoter' OR cvterm.name = 'RNA_polymerase_promoter' OR cvterm.name = 'RNApol_I_promoter' OR cvterm.name = 'RNApol_II_promoter' OR cvterm.name = 'RNApol_III_promoter' OR cvterm.name = 'bacterial_RNApol_promoter' OR cvterm.name = 'Phage_RNA_Polymerase_Promoter' OR cvterm.name = 'RNApol_II_core_promoter' OR cvterm.name = 'RNApol_III_promoter_type_1' OR cvterm.name = 'RNApol_III_promoter_type_2' OR cvterm.name = 'RNApol_III_promoter_type_3' OR cvterm.name = 'bacterial_RNApol_promoter_sigma_70' OR cvterm.name = 'bacterial_RNApol_promoter_sigma54' OR cvterm.name = 'SP6_RNA_Polymerase_Promoter' OR cvterm.name = 'T3_RNA_Polymerase_Promoter' OR cvterm.name = 'T7_RNA_Polymerase_Promoter' OR cvterm.name = 'locus_control_region' OR cvterm.name = 'enhancer' OR cvterm.name = 'silencer' OR cvterm.name = 'enhancer_bound_by_factor' OR cvterm.name = 'shadow_enhancer' OR cvterm.name = 'splice_enhancer' OR cvterm.name = 'intronic_splice_enhancer' OR cvterm.name = 'exonic_splice_enhancer' OR cvterm.name = 'transcription_regulatory_region';

--- ************************************************
--- *** relation: translation_regulatory_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A regulatory region that is involved in  ***
--- *** the control of the process of translatio ***
--- *** n.                                       ***
--- ************************************************
---

CREATE VIEW translation_regulatory_region AS
  SELECT
    feature_id AS translation_regulatory_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'attenuator' OR cvterm.name = 'translation_regulatory_region';

--- ************************************************
--- *** relation: recombination_regulatory_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A regulatory region that is involved in  ***
--- *** the control of the process of recombinat ***
--- *** ion.                                     ***
--- ************************************************
---

CREATE VIEW recombination_regulatory_region AS
  SELECT
    feature_id AS recombination_regulatory_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'recombination_regulatory_region';

--- ************************************************
--- *** relation: replication_regulatory_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A regulatory region that is involved in  ***
--- *** the control of the process of nucleotide ***
--- ***  replication.                            ***
--- ************************************************
---

CREATE VIEW replication_regulatory_region AS
  SELECT
    feature_id AS replication_regulatory_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'replication_regulatory_region';

--- ************************************************
--- *** relation: sequence_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence motif is a nucleotide or amin ***
--- *** o-acid sequence pattern that may have bi ***
--- *** ological significance.                   ***
--- ************************************************
---

CREATE VIEW sequence_motif AS
  SELECT
    feature_id AS sequence_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'nucleotide_motif' OR cvterm.name = 'DNA_motif' OR cvterm.name = 'RNA_motif' OR cvterm.name = 'PSE_motif' OR cvterm.name = 'CAAT_signal' OR cvterm.name = 'minus_10_signal' OR cvterm.name = 'minus_35_signal' OR cvterm.name = 'DRE_motif' OR cvterm.name = 'E_box_motif' OR cvterm.name = 'INR1_motif' OR cvterm.name = 'GAGA_motif' OR cvterm.name = 'octamer_motif' OR cvterm.name = 'retinoic_acid_responsive_element' OR cvterm.name = 'promoter_element' OR cvterm.name = 'DCE_SI' OR cvterm.name = 'DCE_SII' OR cvterm.name = 'DCE_SIII' OR cvterm.name = 'minus_12_signal' OR cvterm.name = 'minus_24_signal' OR cvterm.name = 'GC_rich_promoter_region' OR cvterm.name = 'DMv4_motif' OR cvterm.name = 'DMv5_motif' OR cvterm.name = 'DMv3_motif' OR cvterm.name = 'DMv2_motif' OR cvterm.name = 'DPE1_motif' OR cvterm.name = 'DMv1_motif' OR cvterm.name = 'NDM2_motif' OR cvterm.name = 'NDM3_motif' OR cvterm.name = 'core_promoter_element' OR cvterm.name = 'regulatory_promoter_element' OR cvterm.name = 'INR_motif' OR cvterm.name = 'DPE_motif' OR cvterm.name = 'BREu_motif' OR cvterm.name = 'TATA_box' OR cvterm.name = 'A_box' OR cvterm.name = 'B_box' OR cvterm.name = 'C_box' OR cvterm.name = 'MTE' OR cvterm.name = 'BREd_motif' OR cvterm.name = 'DCE' OR cvterm.name = 'intermediate_element' OR cvterm.name = 'RNA_polymerase_II_TATA_box' OR cvterm.name = 'RNA_polymerase_III_TATA_box' OR cvterm.name = 'A_box_type_1' OR cvterm.name = 'A_box_type_2' OR cvterm.name = 'proximal_promoter_element' OR cvterm.name = 'distal_promoter_element' OR cvterm.name = 'RNA_internal_loop' OR cvterm.name = 'A_minor_RNA_motif' OR cvterm.name = 'RNA_junction_loop' OR cvterm.name = 'hammerhead_ribozyme' OR cvterm.name = 'asymmetric_RNA_internal_loop' OR cvterm.name = 'symmetric_RNA_internal_loop' OR cvterm.name = 'K_turn_RNA_motif' OR cvterm.name = 'sarcin_like_RNA_motif' OR cvterm.name = 'RNA_hook_turn' OR cvterm.name = 'sequence_motif';

--- ************************************************
--- *** relation: experimental_feature_attribute ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute of an experimentally derive ***
--- *** d feature.                               ***
--- ************************************************
---

CREATE VIEW experimental_feature_attribute AS
  SELECT
    feature_id AS experimental_feature_attribute_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'score' OR cvterm.name = 'quality_value' OR cvterm.name = 'experimental_feature_attribute';

--- ************************************************
--- *** relation: score ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The score of an experimentally derived f ***
--- *** eature such as a p-value.                ***
--- ************************************************
---

CREATE VIEW score AS
  SELECT
    feature_id AS score_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'score';

--- ************************************************
--- *** relation: quality_value ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An experimental feature attribute that d ***
--- *** efines the quality of the feature in a q ***
--- *** uantitative way, such as a phred quality ***
--- ***  score.                                  ***
--- ************************************************
---

CREATE VIEW quality_value AS
  SELECT
    feature_id AS quality_value_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'quality_value';

--- ************************************************
--- *** relation: restriction_enzyme_recognition_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The nucleotide region (usually a palindr ***
--- *** ome) that is recognized by a restriction ***
--- ***  enzyme. This may or may not be equal to ***
--- ***  the restriction enzyme binding site.    ***
--- ************************************************
---

CREATE VIEW restriction_enzyme_recognition_site AS
  SELECT
    feature_id AS restriction_enzyme_recognition_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'blunt_end_restriction_enzyme_cleavage_site' OR cvterm.name = 'sticky_end_restriction_enzyme_cleavage_site' OR cvterm.name = 'restriction_enzyme_recognition_site';

--- ************************************************
--- *** relation: restriction_enzyme_cleavage_junction ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The boundary at which a restriction enzy ***
--- *** me breaks the nucleotide sequence.       ***
--- ************************************************
---

CREATE VIEW restriction_enzyme_cleavage_junction AS
  SELECT
    feature_id AS restriction_enzyme_cleavage_junction_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'blunt_end_restriction_enzyme_cleavage_junction' OR cvterm.name = 'single_strand_restriction_enzyme_cleavage_site' OR cvterm.name = 'five_prime_restriction_enzyme_junction' OR cvterm.name = 'three_prime_restriction_enzyme_junction' OR cvterm.name = 'restriction_enzyme_cleavage_junction';

--- ************************************************
--- *** relation: five_prime_restriction_enzyme_junction ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The restriction enzyme cleavage junction ***
--- ***  on the 5' strand of the nucleotide sequ ***
--- *** ence.                                    ***
--- ************************************************
---

CREATE VIEW five_prime_restriction_enzyme_junction AS
  SELECT
    feature_id AS five_prime_restriction_enzyme_junction_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_restriction_enzyme_junction';

--- ************************************************
--- *** relation: three_prime_restriction_enzyme_junction ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW three_prime_restriction_enzyme_junction AS
  SELECT
    feature_id AS three_prime_restriction_enzyme_junction_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_restriction_enzyme_junction';

--- ************************************************
--- *** relation: blunt_end_restriction_enzyme_cleavage_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW blunt_end_restriction_enzyme_cleavage_site AS
  SELECT
    feature_id AS blunt_end_restriction_enzyme_cleavage_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'blunt_end_restriction_enzyme_cleavage_site';

--- ************************************************
--- *** relation: sticky_end_restriction_enzyme_cleavage_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW sticky_end_restriction_enzyme_cleavage_site AS
  SELECT
    feature_id AS sticky_end_restriction_enzyme_cleavage_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'sticky_end_restriction_enzyme_cleavage_site';

--- ************************************************
--- *** relation: blunt_end_restriction_enzyme_cleavage_junction ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A restriction enzyme cleavage site where ***
--- ***  both strands are cut at the same positi ***
--- *** on.                                      ***
--- ************************************************
---

CREATE VIEW blunt_end_restriction_enzyme_cleavage_junction AS
  SELECT
    feature_id AS blunt_end_restriction_enzyme_cleavage_junction_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'blunt_end_restriction_enzyme_cleavage_junction';

--- ************************************************
--- *** relation: single_strand_restriction_enzyme_cleavage_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A restriction enzyme cleavage site where ***
--- *** by only one strand is cut.               ***
--- ************************************************
---

CREATE VIEW single_strand_restriction_enzyme_cleavage_site AS
  SELECT
    feature_id AS single_strand_restriction_enzyme_cleavage_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_restriction_enzyme_junction' OR cvterm.name = 'three_prime_restriction_enzyme_junction' OR cvterm.name = 'single_strand_restriction_enzyme_cleavage_site';

--- ************************************************
--- *** relation: restriction_enzyme_single_strand_overhang ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A terminal region of DNA sequence where  ***
--- *** the end of the region is not blunt ended ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW restriction_enzyme_single_strand_overhang AS
  SELECT
    feature_id AS restriction_enzyme_single_strand_overhang_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'restriction_enzyme_single_strand_overhang';

--- ************************************************
--- *** relation: experimentally_defined_binding_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region that has been implicated in bin ***
--- *** ding although the exact coordinates of b ***
--- *** inding may be unknown.                   ***
--- ************************************************
---

CREATE VIEW experimentally_defined_binding_region AS
  SELECT
    feature_id AS experimentally_defined_binding_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'CHiP_seq_region' OR cvterm.name = 'experimentally_defined_binding_region';

--- ************************************************
--- *** relation: chip_seq_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of sequence identified by CHiP  ***
--- *** seq technology to contain a protein bind ***
--- *** ing site.                                ***
--- ************************************************
---

CREATE VIEW chip_seq_region AS
  SELECT
    feature_id AS chip_seq_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'CHiP_seq_region';

--- ************************************************
--- *** relation: aspe_primer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** "A primer containing an SNV at the 3' en ***
--- *** d for accurate genotyping.               ***
--- ************************************************
---

CREATE VIEW aspe_primer AS
  SELECT
    feature_id AS aspe_primer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'ASPE_primer';

--- ************************************************
--- *** relation: dcaps_primer ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primer with one or more mis-matches to ***
--- ***  the DNA template corresponding to a pos ***
--- *** ition within a restriction enzyme recogn ***
--- *** ition site.                              ***
--- ************************************************
---

CREATE VIEW dcaps_primer AS
  SELECT
    feature_id AS dcaps_primer_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'dCAPS_primer';

--- ************************************************
--- *** relation: histone_modification ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Histone modification is a post translati ***
--- *** onally modified region whereby residues  ***
--- *** of the histone protein are modified by m ***
--- *** ethylation, acetylation, phosphorylation ***
--- *** , ubiquitination, sumoylation, citrullin ***
--- *** ation, or ADP-ribosylation.              ***
--- ************************************************
---

CREATE VIEW histone_modification AS
  SELECT
    feature_id AS histone_modification_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'histone_methylation_site' OR cvterm.name = 'histone_acetylation_site' OR cvterm.name = 'histone_ubiqitination_site' OR cvterm.name = 'histone_acylation_region' OR cvterm.name = 'H4K20_monomethylation_site' OR cvterm.name = 'H2BK5_monomethylation_site' OR cvterm.name = 'H3K27_methylation_site' OR cvterm.name = 'H3K36_methylation_site' OR cvterm.name = 'H3K4_methylation_site' OR cvterm.name = 'H3K79_methylation_site' OR cvterm.name = 'H3K9_methylation_site' OR cvterm.name = 'H3K27_monomethylation_site' OR cvterm.name = 'H3K27_trimethylation_site' OR cvterm.name = 'H3K27_dimethylation_site' OR cvterm.name = 'H3K36_monomethylation_site' OR cvterm.name = 'H3K36_dimethylation_site' OR cvterm.name = 'H3K36_trimethylation_site' OR cvterm.name = 'H3K4_monomethylation_site' OR cvterm.name = 'H3K4_trimethylation' OR cvterm.name = 'H3K4_dimethylation_site' OR cvterm.name = 'H3K79_monomethylation_site' OR cvterm.name = 'H3K79_dimethylation_site' OR cvterm.name = 'H3K79_trimethylation_site' OR cvterm.name = 'H3K9_trimethylation_site' OR cvterm.name = 'H3K9_monomethylation_site' OR cvterm.name = 'H3K9_dimethylation_site' OR cvterm.name = 'H3K9_acetylation_site' OR cvterm.name = 'H3K14_acetylation_site' OR cvterm.name = 'H3K18_acetylation_site' OR cvterm.name = 'H3K23_acylation site' OR cvterm.name = 'H3K27_acylation_site' OR cvterm.name = 'H4K16_acylation_site' OR cvterm.name = 'H4K5_acylation_site' OR cvterm.name = 'H4K8_acylation site' OR cvterm.name = 'H2B_ubiquitination_site' OR cvterm.name = 'H4K_acylation_region' OR cvterm.name = 'histone_modification';

--- ************************************************
--- *** relation: histone_methylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A histone modification site where the mo ***
--- *** dification is the methylation of the res ***
--- *** idue.                                    ***
--- ************************************************
---

CREATE VIEW histone_methylation_site AS
  SELECT
    feature_id AS histone_methylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H4K20_monomethylation_site' OR cvterm.name = 'H2BK5_monomethylation_site' OR cvterm.name = 'H3K27_methylation_site' OR cvterm.name = 'H3K36_methylation_site' OR cvterm.name = 'H3K4_methylation_site' OR cvterm.name = 'H3K79_methylation_site' OR cvterm.name = 'H3K9_methylation_site' OR cvterm.name = 'H3K27_monomethylation_site' OR cvterm.name = 'H3K27_trimethylation_site' OR cvterm.name = 'H3K27_dimethylation_site' OR cvterm.name = 'H3K36_monomethylation_site' OR cvterm.name = 'H3K36_dimethylation_site' OR cvterm.name = 'H3K36_trimethylation_site' OR cvterm.name = 'H3K4_monomethylation_site' OR cvterm.name = 'H3K4_trimethylation' OR cvterm.name = 'H3K4_dimethylation_site' OR cvterm.name = 'H3K79_monomethylation_site' OR cvterm.name = 'H3K79_dimethylation_site' OR cvterm.name = 'H3K79_trimethylation_site' OR cvterm.name = 'H3K9_trimethylation_site' OR cvterm.name = 'H3K9_monomethylation_site' OR cvterm.name = 'H3K9_dimethylation_site' OR cvterm.name = 'histone_methylation_site';

--- ************************************************
--- *** relation: histone_acetylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A histone modification where the modific ***
--- *** ation is the acylation of the residue.   ***
--- ************************************************
---

CREATE VIEW histone_acetylation_site AS
  SELECT
    feature_id AS histone_acetylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H3K9_acetylation_site' OR cvterm.name = 'H3K14_acetylation_site' OR cvterm.name = 'H3K18_acetylation_site' OR cvterm.name = 'H3K23_acylation site' OR cvterm.name = 'H3K27_acylation_site' OR cvterm.name = 'H4K16_acylation_site' OR cvterm.name = 'H4K5_acylation_site' OR cvterm.name = 'H4K8_acylation site' OR cvterm.name = 'histone_acetylation_site';

--- ************************************************
--- *** relation: h3k9_acetylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 9th residue (a lysine), from th ***
--- *** e start of the H3 histone protein is acy ***
--- *** lated.                                   ***
--- ************************************************
---

CREATE VIEW h3k9_acetylation_site AS
  SELECT
    feature_id AS h3k9_acetylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H3K9_acetylation_site';

--- ************************************************
--- *** relation: h3k14_acetylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 14th residue (a lysine), from t ***
--- *** he start of the H3 histone protein is ac ***
--- *** ylated.                                  ***
--- ************************************************
---

CREATE VIEW h3k14_acetylation_site AS
  SELECT
    feature_id AS h3k14_acetylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H3K14_acetylation_site';

--- ************************************************
--- *** relation: h3k4_monomethylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification, whereby  ***
--- *** the 4th residue (a lysine), from the sta ***
--- *** rt of the H3 protein is mono-methylated. ***
--- ************************************************
---

CREATE VIEW h3k4_monomethylation_site AS
  SELECT
    feature_id AS h3k4_monomethylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H3K4_monomethylation_site';

--- ************************************************
--- *** relation: h3k4_trimethylation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 4th residue (a lysine), from th ***
--- *** e start of the H3 protein is tri-methyla ***
--- *** ted.                                     ***
--- ************************************************
---

CREATE VIEW h3k4_trimethylation AS
  SELECT
    feature_id AS h3k4_trimethylation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H3K4_trimethylation';

--- ************************************************
--- *** relation: h3k9_trimethylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 9th residue (a lysine), from th ***
--- *** e start of the H3 histone protein is tri ***
--- *** -methylated.                             ***
--- ************************************************
---

CREATE VIEW h3k9_trimethylation_site AS
  SELECT
    feature_id AS h3k9_trimethylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H3K9_trimethylation_site';

--- ************************************************
--- *** relation: h3k27_monomethylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 27th residue (a lysine), from t ***
--- *** he start of the H3 histone protein is mo ***
--- *** no-methylated.                           ***
--- ************************************************
---

CREATE VIEW h3k27_monomethylation_site AS
  SELECT
    feature_id AS h3k27_monomethylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H3K27_monomethylation_site';

--- ************************************************
--- *** relation: h3k27_trimethylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 27th residue (a lysine), from t ***
--- *** he start of the H3 histone protein is tr ***
--- *** i-methylated.                            ***
--- ************************************************
---

CREATE VIEW h3k27_trimethylation_site AS
  SELECT
    feature_id AS h3k27_trimethylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H3K27_trimethylation_site';

--- ************************************************
--- *** relation: h3k79_monomethylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 79th residue (a lysine), from t ***
--- *** he start of the H3 histone protein is mo ***
--- *** no- methylated.                          ***
--- ************************************************
---

CREATE VIEW h3k79_monomethylation_site AS
  SELECT
    feature_id AS h3k79_monomethylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H3K79_monomethylation_site';

--- ************************************************
--- *** relation: h3k79_dimethylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 79th residue (a lysine), from t ***
--- *** he start of the H3 histone protein is di ***
--- *** -methylated.                             ***
--- ************************************************
---

CREATE VIEW h3k79_dimethylation_site AS
  SELECT
    feature_id AS h3k79_dimethylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H3K79_dimethylation_site';

--- ************************************************
--- *** relation: h3k79_trimethylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 79th residue (a lysine), from t ***
--- *** he start of the H3 histone protein is tr ***
--- *** i-methylated.                            ***
--- ************************************************
---

CREATE VIEW h3k79_trimethylation_site AS
  SELECT
    feature_id AS h3k79_trimethylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H3K79_trimethylation_site';

--- ************************************************
--- *** relation: h4k20_monomethylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 20th residue (a lysine), from t ***
--- *** he start of the H34histone protein is mo ***
--- *** no-methylated.                           ***
--- ************************************************
---

CREATE VIEW h4k20_monomethylation_site AS
  SELECT
    feature_id AS h4k20_monomethylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H4K20_monomethylation_site';

--- ************************************************
--- *** relation: h2bk5_monomethylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 5th residue (a lysine), from th ***
--- *** e start of the H2B protein is methylated ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW h2bk5_monomethylation_site AS
  SELECT
    feature_id AS h2bk5_monomethylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H2BK5_monomethylation_site';

--- ************************************************
--- *** relation: isre ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An ISRE is a transcriptional cis regulat ***
--- *** ory region, containing the consensus reg ***
--- *** ion: YAGTTTC(A/T)YTTTYCC, responsible fo ***
--- *** r increased transcription via interferon ***
--- ***  binding.                                ***
--- ************************************************
---

CREATE VIEW isre AS
  SELECT
    feature_id AS isre_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'ISRE';

--- ************************************************
--- *** relation: histone_ubiqitination_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A histone modification site where ubiqui ***
--- *** tin may be added.                        ***
--- ************************************************
---

CREATE VIEW histone_ubiqitination_site AS
  SELECT
    feature_id AS histone_ubiqitination_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H2B_ubiquitination_site' OR cvterm.name = 'histone_ubiqitination_site';

--- ************************************************
--- *** relation: h2b_ubiquitination_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A histone modification site on H2B where ***
--- ***  ubiquitin may be added.                 ***
--- ************************************************
---

CREATE VIEW h2b_ubiquitination_site AS
  SELECT
    feature_id AS h2b_ubiquitination_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H2B_ubiquitination_site';

--- ************************************************
--- *** relation: h3k18_acetylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 14th residue (a lysine), from t ***
--- *** he start of the H3 histone protein is ac ***
--- *** ylated.                                  ***
--- ************************************************
---

CREATE VIEW h3k18_acetylation_site AS
  SELECT
    feature_id AS h3k18_acetylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H3K18_acetylation_site';

--- ************************************************
--- *** relation: h3k23_acylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification, whereby  ***
--- *** the 23rd residue (a lysine), from the st ***
--- *** art of the H3 histone protein is acylate ***
--- *** d.                                       ***
--- ************************************************
---

CREATE VIEW h3k23_acylation_site AS
  SELECT
    feature_id AS h3k23_acylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H3K23_acylation site';

--- ************************************************
--- *** relation: epigenetically_modified_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A biological region implicated in inheri ***
--- *** ted changes caused by mechanisms other t ***
--- *** han changes in the underlying DNA sequen ***
--- *** ce.                                      ***
--- ************************************************
---

CREATE VIEW epigenetically_modified_region AS
  SELECT
    feature_id AS epigenetically_modified_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'modified_base' OR cvterm.name = 'epigenetically_modified_gene' OR cvterm.name = 'histone_modification' OR cvterm.name = 'methylated_base_feature' OR cvterm.name = 'methylated_C' OR cvterm.name = 'methylated_A' OR cvterm.name = 'gene_rearranged_at_DNA_level' OR cvterm.name = 'maternally_imprinted_gene' OR cvterm.name = 'paternally_imprinted_gene' OR cvterm.name = 'allelically_excluded_gene' OR cvterm.name = 'histone_methylation_site' OR cvterm.name = 'histone_acetylation_site' OR cvterm.name = 'histone_ubiqitination_site' OR cvterm.name = 'histone_acylation_region' OR cvterm.name = 'H4K20_monomethylation_site' OR cvterm.name = 'H2BK5_monomethylation_site' OR cvterm.name = 'H3K27_methylation_site' OR cvterm.name = 'H3K36_methylation_site' OR cvterm.name = 'H3K4_methylation_site' OR cvterm.name = 'H3K79_methylation_site' OR cvterm.name = 'H3K9_methylation_site' OR cvterm.name = 'H3K27_monomethylation_site' OR cvterm.name = 'H3K27_trimethylation_site' OR cvterm.name = 'H3K27_dimethylation_site' OR cvterm.name = 'H3K36_monomethylation_site' OR cvterm.name = 'H3K36_dimethylation_site' OR cvterm.name = 'H3K36_trimethylation_site' OR cvterm.name = 'H3K4_monomethylation_site' OR cvterm.name = 'H3K4_trimethylation' OR cvterm.name = 'H3K4_dimethylation_site' OR cvterm.name = 'H3K79_monomethylation_site' OR cvterm.name = 'H3K79_dimethylation_site' OR cvterm.name = 'H3K79_trimethylation_site' OR cvterm.name = 'H3K9_trimethylation_site' OR cvterm.name = 'H3K9_monomethylation_site' OR cvterm.name = 'H3K9_dimethylation_site' OR cvterm.name = 'H3K9_acetylation_site' OR cvterm.name = 'H3K14_acetylation_site' OR cvterm.name = 'H3K18_acetylation_site' OR cvterm.name = 'H3K23_acylation site' OR cvterm.name = 'H3K27_acylation_site' OR cvterm.name = 'H4K16_acylation_site' OR cvterm.name = 'H4K5_acylation_site' OR cvterm.name = 'H4K8_acylation site' OR cvterm.name = 'H2B_ubiquitination_site' OR cvterm.name = 'H4K_acylation_region' OR cvterm.name = 'epigenetically_modified_region';

--- ************************************************
--- *** relation: h3k27_acylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 27th residue (a lysine), from t ***
--- *** he start of the H3 histone protein is ac ***
--- *** ylated.                                  ***
--- ************************************************
---

CREATE VIEW h3k27_acylation_site AS
  SELECT
    feature_id AS h3k27_acylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H3K27_acylation_site';

--- ************************************************
--- *** relation: h3k36_monomethylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 36th residue (a lysine), from t ***
--- *** he start of the H3 histone protein is mo ***
--- *** no-methylated.                           ***
--- ************************************************
---

CREATE VIEW h3k36_monomethylation_site AS
  SELECT
    feature_id AS h3k36_monomethylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H3K36_monomethylation_site';

--- ************************************************
--- *** relation: h3k36_dimethylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 36th residue (a lysine), from t ***
--- *** he start of the H3 histone protein is di ***
--- *** methylated.                              ***
--- ************************************************
---

CREATE VIEW h3k36_dimethylation_site AS
  SELECT
    feature_id AS h3k36_dimethylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H3K36_dimethylation_site';

--- ************************************************
--- *** relation: h3k36_trimethylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 36th residue (a lysine), from t ***
--- *** he start of the H3 histone protein is tr ***
--- *** i-methylated.                            ***
--- ************************************************
---

CREATE VIEW h3k36_trimethylation_site AS
  SELECT
    feature_id AS h3k36_trimethylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H3K36_trimethylation_site';

--- ************************************************
--- *** relation: h3k4_dimethylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 4th residue (a lysine), from th ***
--- *** e start of the H3 histone protein is di- ***
--- *** methylated.                              ***
--- ************************************************
---

CREATE VIEW h3k4_dimethylation_site AS
  SELECT
    feature_id AS h3k4_dimethylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H3K4_dimethylation_site';

--- ************************************************
--- *** relation: h3k27_dimethylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 27th residue (a lysine), from t ***
--- *** he start of the H3 histone protein is di ***
--- *** -methylated.                             ***
--- ************************************************
---

CREATE VIEW h3k27_dimethylation_site AS
  SELECT
    feature_id AS h3k27_dimethylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H3K27_dimethylation_site';

--- ************************************************
--- *** relation: h3k9_monomethylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 9th residue (a lysine), from th ***
--- *** e start of the H3 histone protein is mon ***
--- *** o-methylated.                            ***
--- ************************************************
---

CREATE VIEW h3k9_monomethylation_site AS
  SELECT
    feature_id AS h3k9_monomethylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H3K9_monomethylation_site';

--- ************************************************
--- *** relation: h3k9_dimethylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 9th residue (a lysine), from th ***
--- *** e start of the H3 histone protein may be ***
--- ***  dimethylated.                           ***
--- ************************************************
---

CREATE VIEW h3k9_dimethylation_site AS
  SELECT
    feature_id AS h3k9_dimethylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H3K9_dimethylation_site';

--- ************************************************
--- *** relation: h4k16_acylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 16th residue (a lysine), from t ***
--- *** he start of the H4 histone protein is ac ***
--- *** ylated.                                  ***
--- ************************************************
---

CREATE VIEW h4k16_acylation_site AS
  SELECT
    feature_id AS h4k16_acylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H4K16_acylation_site';

--- ************************************************
--- *** relation: h4k5_acylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 5th residue (a lysine), from th ***
--- *** e start of the H4 histone protein is acy ***
--- *** lated.                                   ***
--- ************************************************
---

CREATE VIEW h4k5_acylation_site AS
  SELECT
    feature_id AS h4k5_acylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H4K5_acylation_site';

--- ************************************************
--- *** relation: h4k8_acylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 8th residue (a lysine), from th ***
--- *** e start of the H4 histone protein is acy ***
--- *** lated.                                   ***
--- ************************************************
---

CREATE VIEW h4k8_acylation_site AS
  SELECT
    feature_id AS h4k8_acylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H4K8_acylation site';

--- ************************************************
--- *** relation: h3k27_methylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 27th residue (a lysine), from t ***
--- *** he start of the H3 histone protein is me ***
--- *** thylated.                                ***
--- ************************************************
---

CREATE VIEW h3k27_methylation_site AS
  SELECT
    feature_id AS h3k27_methylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H3K27_monomethylation_site' OR cvterm.name = 'H3K27_trimethylation_site' OR cvterm.name = 'H3K27_dimethylation_site' OR cvterm.name = 'H3K27_methylation_site';

--- ************************************************
--- *** relation: h3k36_methylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 36th residue (a lysine), from t ***
--- *** he start of the H3 histone protein is me ***
--- *** thylated.                                ***
--- ************************************************
---

CREATE VIEW h3k36_methylation_site AS
  SELECT
    feature_id AS h3k36_methylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H3K36_monomethylation_site' OR cvterm.name = 'H3K36_dimethylation_site' OR cvterm.name = 'H3K36_trimethylation_site' OR cvterm.name = 'H3K36_methylation_site';

--- ************************************************
--- *** relation: h3k4_methylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification, whereby  ***
--- *** the 4th residue (a lysine), from the sta ***
--- *** rt of the H3 protein is methylated.      ***
--- ************************************************
---

CREATE VIEW h3k4_methylation_site AS
  SELECT
    feature_id AS h3k4_methylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H3K4_monomethylation_site' OR cvterm.name = 'H3K4_trimethylation' OR cvterm.name = 'H3K4_dimethylation_site' OR cvterm.name = 'H3K4_methylation_site';

--- ************************************************
--- *** relation: h3k79_methylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 79th residue (a lysine), from t ***
--- *** he start of the H3 histone protein is me ***
--- *** thylated.                                ***
--- ************************************************
---

CREATE VIEW h3k79_methylation_site AS
  SELECT
    feature_id AS h3k79_methylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H3K79_monomethylation_site' OR cvterm.name = 'H3K79_dimethylation_site' OR cvterm.name = 'H3K79_trimethylation_site' OR cvterm.name = 'H3K79_methylation_site';

--- ************************************************
--- *** relation: h3k9_methylation_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of histone modification site, whe ***
--- *** reby the 9th residue (a lysine), from th ***
--- *** e start of the H3 histone protein is met ***
--- *** hylated.                                 ***
--- ************************************************
---

CREATE VIEW h3k9_methylation_site AS
  SELECT
    feature_id AS h3k9_methylation_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H3K9_trimethylation_site' OR cvterm.name = 'H3K9_monomethylation_site' OR cvterm.name = 'H3K9_dimethylation_site' OR cvterm.name = 'H3K9_methylation_site';

--- ************************************************
--- *** relation: histone_acylation_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A histone modification, whereby the hist ***
--- *** one protein is acylated at multiple site ***
--- *** s in a region.                           ***
--- ************************************************
---

CREATE VIEW histone_acylation_region AS
  SELECT
    feature_id AS histone_acylation_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H4K_acylation_region' OR cvterm.name = 'histone_acylation_region';

--- ************************************************
--- *** relation: h4k_acylation_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of the H4 histone whereby multi ***
--- *** ple lysines are acylated.                ***
--- ************************************************
---

CREATE VIEW h4k_acylation_region AS
  SELECT
    feature_id AS h4k_acylation_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'H4K_acylation_region';

--- ************************************************
--- *** relation: gene_with_non_canonical_start_codon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene with a start codon other than AUG ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW gene_with_non_canonical_start_codon AS
  SELECT
    feature_id AS gene_with_non_canonical_start_codon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_with_start_codon_CUG' OR cvterm.name = 'gene_with_non_canonical_start_codon';

--- ************************************************
--- *** relation: gene_with_start_codon_cug ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene with a translational start codon  ***
--- *** of CUG.                                  ***
--- ************************************************
---

CREATE VIEW gene_with_start_codon_cug AS
  SELECT
    feature_id AS gene_with_start_codon_cug_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_with_start_codon_CUG';

--- ************************************************
--- *** relation: pseudogenic_gene_segment ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene segment which when incorporated b ***
--- *** y somatic recombination in the final gen ***
--- *** e transcript results in a nonfunctional  ***
--- *** product.                                 ***
--- ************************************************
---

CREATE VIEW pseudogenic_gene_segment AS
  SELECT
    feature_id AS pseudogenic_gene_segment_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pseudogenic_gene_segment';

--- ************************************************
--- *** relation: copy_number_gain ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence alteration whereby the copy n ***
--- *** umber of a given regions is greater than ***
--- ***  the reference sequence.                 ***
--- ************************************************
---

CREATE VIEW copy_number_gain AS
  SELECT
    feature_id AS copy_number_gain_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'copy_number_gain';

--- ************************************************
--- *** relation: copy_number_loss ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence alteration whereby the copy n ***
--- *** umber of a given region is less than the ***
--- ***  reference sequence.                     ***
--- ************************************************
---

CREATE VIEW copy_number_loss AS
  SELECT
    feature_id AS copy_number_loss_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'copy_number_loss';

--- ************************************************
--- *** relation: upd ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Uniparental disomy is a sequence_alterat ***
--- *** ion where a diploid individual receives  ***
--- *** two copies for all or part of a chromoso ***
--- *** me from one parent and no copies of the  ***
--- *** same chromosome or region from the other ***
--- ***  parent.                                 ***
--- ************************************************
---

CREATE VIEW upd AS
  SELECT
    feature_id AS upd_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'maternal_uniparental_disomy' OR cvterm.name = 'paternal_uniparental_disomy' OR cvterm.name = 'UPD';

--- ************************************************
--- *** relation: maternal_uniparental_disomy ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Uniparental disomy is a sequence_alterat ***
--- *** ion where a diploid individual receives  ***
--- *** two copies for all or part of a chromoso ***
--- *** me from the mother and no copies of the  ***
--- *** same chromosome or region from the fathe ***
--- *** r.                                       ***
--- ************************************************
---

CREATE VIEW maternal_uniparental_disomy AS
  SELECT
    feature_id AS maternal_uniparental_disomy_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'maternal_uniparental_disomy';

--- ************************************************
--- *** relation: paternal_uniparental_disomy ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Uniparental disomy is a sequence_alterat ***
--- *** ion where a diploid individual receives  ***
--- *** two copies for all or part of a chromoso ***
--- *** me from the father and no copies of the  ***
--- *** same chromosome or region from the mothe ***
--- *** r.                                       ***
--- ************************************************
---

CREATE VIEW paternal_uniparental_disomy AS
  SELECT
    feature_id AS paternal_uniparental_disomy_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'paternal_uniparental_disomy';

--- ************************************************
--- *** relation: open_chromatin_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A DNA sequence that in the normal state  ***
--- *** of the chromosome corresponds to an unfo ***
--- *** lded, un-complexed stretch of double-str ***
--- *** anded DNA.                               ***
--- ************************************************
---

CREATE VIEW open_chromatin_region AS
  SELECT
    feature_id AS open_chromatin_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'open_chromatin_region';

--- ************************************************
--- *** relation: sl3_acceptor_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A SL2_acceptor_site which appends the SL ***
--- *** 3 RNA leader sequence to the 5' end of a ***
--- *** n mRNA. SL3 acceptor sites occur in gene ***
--- *** s in internal segments of polycistronic  ***
--- *** transcripts.                             ***
--- ************************************************
---

CREATE VIEW sl3_acceptor_site AS
  SELECT
    feature_id AS sl3_acceptor_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'SL3_acceptor_site';

--- ************************************************
--- *** relation: sl4_acceptor_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A SL2_acceptor_site which appends the SL ***
--- *** 4 RNA leader sequence to the 5' end of a ***
--- *** n mRNA. SL4 acceptor sites occur in gene ***
--- *** s in internal segments of polycistronic  ***
--- *** transcripts.                             ***
--- ************************************************
---

CREATE VIEW sl4_acceptor_site AS
  SELECT
    feature_id AS sl4_acceptor_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'SL4_acceptor_site';

--- ************************************************
--- *** relation: sl5_acceptor_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A SL2_acceptor_site which appends the SL ***
--- *** 5 RNA leader sequence to the 5' end of a ***
--- *** n mRNA. SL5 acceptor sites occur in gene ***
--- *** s in internal segments of polycistronic  ***
--- *** transcripts.                             ***
--- ************************************************
---

CREATE VIEW sl5_acceptor_site AS
  SELECT
    feature_id AS sl5_acceptor_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'SL5_acceptor_site';

--- ************************************************
--- *** relation: sl6_acceptor_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A SL2_acceptor_site which appends the SL ***
--- *** 6 RNA leader sequence to the 5' end of a ***
--- *** n mRNA. SL6 acceptor sites occur in gene ***
--- *** s in internal segments of polycistronic  ***
--- *** transcripts.                             ***
--- ************************************************
---

CREATE VIEW sl6_acceptor_site AS
  SELECT
    feature_id AS sl6_acceptor_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'SL6_acceptor_site';

--- ************************************************
--- *** relation: sl7_acceptor_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A SL2_acceptor_site which appends the SL ***
--- *** 7 RNA leader sequence to the 5' end of a ***
--- *** n mRNA. SL7 acceptor sites occur in gene ***
--- *** s in internal segments of polycistronic  ***
--- *** transcripts.                             ***
--- ************************************************
---

CREATE VIEW sl7_acceptor_site AS
  SELECT
    feature_id AS sl7_acceptor_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'SL7_acceptor_site';

--- ************************************************
--- *** relation: sl8_acceptor_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A SL2_acceptor_site which appends the SL ***
--- *** 8 RNA leader sequence to the 5' end of a ***
--- *** n mRNA. SL8 acceptor sites occur in gene ***
--- *** s in internal segments of polycistronic  ***
--- *** transcripts.                             ***
--- ************************************************
---

CREATE VIEW sl8_acceptor_site AS
  SELECT
    feature_id AS sl8_acceptor_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'SL8_acceptor_site';

--- ************************************************
--- *** relation: sl9_acceptor_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A SL2_acceptor_site which appends the SL ***
--- *** 9 RNA leader sequence to the 5' end of a ***
--- *** n mRNA. SL9 acceptor sites occur in gene ***
--- *** s in internal segments of polycistronic  ***
--- *** transcripts.                             ***
--- ************************************************
---

CREATE VIEW sl9_acceptor_site AS
  SELECT
    feature_id AS sl9_acceptor_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'SL9_acceptor_site';

--- ************************************************
--- *** relation: sl10_accceptor_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A SL2_acceptor_site which appends the SL ***
--- *** 10 RNA leader sequence to the 5' end of  ***
--- *** an mRNA. SL10 acceptor sites occur in ge ***
--- *** nes in internal segments of polycistroni ***
--- *** c transcripts.                           ***
--- ************************************************
---

CREATE VIEW sl10_accceptor_site AS
  SELECT
    feature_id AS sl10_accceptor_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'SL10_accceptor_site';

--- ************************************************
--- *** relation: sl11_acceptor_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A SL2_acceptor_site which appends the SL ***
--- *** 11 RNA leader sequence to the 5' end of  ***
--- *** an mRNA. SL11 acceptor sites occur in ge ***
--- *** nes in internal segments of polycistroni ***
--- *** c transcripts.                           ***
--- ************************************************
---

CREATE VIEW sl11_acceptor_site AS
  SELECT
    feature_id AS sl11_acceptor_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'SL11_acceptor_site';

--- ************************************************
--- *** relation: sl12_acceptor_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A SL2_acceptor_site which appends the SL ***
--- *** 12 RNA leader sequence to the 5' end of  ***
--- *** an mRNA. SL12 acceptor sites occur in ge ***
--- *** nes in internal segments of polycistroni ***
--- *** c transcripts.                           ***
--- ************************************************
---

CREATE VIEW sl12_acceptor_site AS
  SELECT
    feature_id AS sl12_acceptor_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'SL12_acceptor_site';

--- ************************************************
--- *** relation: duplicated_pseudogene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A pseudogene that arose via gene duplica ***
--- *** tion. Generally duplicated pseudogenes h ***
--- *** ave the same structure as the original g ***
--- *** ene, including intron-exon structure and ***
--- ***  some regulatory sequence.               ***
--- ************************************************
---

CREATE VIEW duplicated_pseudogene AS
  SELECT
    feature_id AS duplicated_pseudogene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'duplicated_pseudogene';

--- ************************************************
--- *** relation: unitary_pseudogene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A pseudogene, deactivated from original  ***
--- *** state by mutation, fixed in a population ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW unitary_pseudogene AS
  SELECT
    feature_id AS unitary_pseudogene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'unitary_pseudogene';

--- ************************************************
--- *** relation: non_processed_pseudogene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A pseudogene that arose from a means oth ***
--- *** er than retrotransposition.              ***
--- ************************************************
---

CREATE VIEW non_processed_pseudogene AS
  SELECT
    feature_id AS non_processed_pseudogene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pseudogene_by_unequal_crossing_over' OR cvterm.name = 'nuclear_mt_pseudogene' OR cvterm.name = 'cassette_pseudogene' OR cvterm.name = 'duplicated_pseudogene' OR cvterm.name = 'unitary_pseudogene' OR cvterm.name = 'non_processed_pseudogene';

--- ************************************************
--- *** relation: variant_quality ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A dependent entity that inheres in a bea ***
--- *** rer, a sequence variant.                 ***
--- ************************************************
---

CREATE VIEW variant_quality AS
  SELECT
    feature_id AS variant_quality_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'variant_origin' OR cvterm.name = 'variant_frequency' OR cvterm.name = 'variant_phenotype' OR cvterm.name = 'maternal_variant' OR cvterm.name = 'paternal_variant' OR cvterm.name = 'somatic_variant' OR cvterm.name = 'germline_variant' OR cvterm.name = 'pedigree_specific_variant' OR cvterm.name = 'population_specific_variant' OR cvterm.name = 'de_novo_variant' OR cvterm.name = 'unique_variant' OR cvterm.name = 'rare_variant' OR cvterm.name = 'polymorphic_variant' OR cvterm.name = 'common_variant' OR cvterm.name = 'fixed_variant' OR cvterm.name = 'benign_variant' OR cvterm.name = 'disease_associated_variant' OR cvterm.name = 'disease_causing_variant' OR cvterm.name = 'lethal_variant' OR cvterm.name = 'quantitative_variant' OR cvterm.name = 'variant_quality';

--- ************************************************
--- *** relation: variant_origin ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A quality inhering in a variant by virtu ***
--- *** e of its origin.                         ***
--- ************************************************
---

CREATE VIEW variant_origin AS
  SELECT
    feature_id AS variant_origin_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'maternal_variant' OR cvterm.name = 'paternal_variant' OR cvterm.name = 'somatic_variant' OR cvterm.name = 'germline_variant' OR cvterm.name = 'pedigree_specific_variant' OR cvterm.name = 'population_specific_variant' OR cvterm.name = 'de_novo_variant' OR cvterm.name = 'variant_origin';

--- ************************************************
--- *** relation: variant_frequency ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A physical quality which inheres to the  ***
--- *** variant by virtue of the number instance ***
--- *** s of the variant within a population.    ***
--- ************************************************
---

CREATE VIEW variant_frequency AS
  SELECT
    feature_id AS variant_frequency_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'unique_variant' OR cvterm.name = 'rare_variant' OR cvterm.name = 'polymorphic_variant' OR cvterm.name = 'common_variant' OR cvterm.name = 'fixed_variant' OR cvterm.name = 'variant_frequency';

--- ************************************************
--- *** relation: unique_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A physical quality which inheres to the  ***
--- *** variant by virtue of the number instance ***
--- *** s of the variant within a population.    ***
--- ************************************************
---

CREATE VIEW unique_variant AS
  SELECT
    feature_id AS unique_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'unique_variant';

--- ************************************************
--- *** relation: rare_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW rare_variant AS
  SELECT
    feature_id AS rare_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rare_variant';

--- ************************************************
--- *** relation: polymorphic_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW polymorphic_variant AS
  SELECT
    feature_id AS polymorphic_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polymorphic_variant';

--- ************************************************
--- *** relation: common_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW common_variant AS
  SELECT
    feature_id AS common_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'common_variant';

--- ************************************************
--- *** relation: fixed_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW fixed_variant AS
  SELECT
    feature_id AS fixed_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'fixed_variant';

--- ************************************************
--- *** relation: variant_phenotype ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A quality inhering in a variant by virtu ***
--- *** e of its phenotype.                      ***
--- ************************************************
---

CREATE VIEW variant_phenotype AS
  SELECT
    feature_id AS variant_phenotype_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'benign_variant' OR cvterm.name = 'disease_associated_variant' OR cvterm.name = 'disease_causing_variant' OR cvterm.name = 'lethal_variant' OR cvterm.name = 'quantitative_variant' OR cvterm.name = 'variant_phenotype';

--- ************************************************
--- *** relation: benign_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW benign_variant AS
  SELECT
    feature_id AS benign_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'benign_variant';

--- ************************************************
--- *** relation: disease_associated_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW disease_associated_variant AS
  SELECT
    feature_id AS disease_associated_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'disease_associated_variant';

--- ************************************************
--- *** relation: disease_causing_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW disease_causing_variant AS
  SELECT
    feature_id AS disease_causing_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'disease_causing_variant';

--- ************************************************
--- *** relation: lethal_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW lethal_variant AS
  SELECT
    feature_id AS lethal_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'lethal_variant';

--- ************************************************
--- *** relation: quantitative_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW quantitative_variant AS
  SELECT
    feature_id AS quantitative_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'quantitative_variant';

--- ************************************************
--- *** relation: maternal_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW maternal_variant AS
  SELECT
    feature_id AS maternal_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'maternal_variant';

--- ************************************************
--- *** relation: paternal_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW paternal_variant AS
  SELECT
    feature_id AS paternal_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'paternal_variant';

--- ************************************************
--- *** relation: somatic_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW somatic_variant AS
  SELECT
    feature_id AS somatic_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'somatic_variant';

--- ************************************************
--- *** relation: germline_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW germline_variant AS
  SELECT
    feature_id AS germline_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'germline_variant';

--- ************************************************
--- *** relation: pedigree_specific_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW pedigree_specific_variant AS
  SELECT
    feature_id AS pedigree_specific_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pedigree_specific_variant';

--- ************************************************
--- *** relation: population_specific_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW population_specific_variant AS
  SELECT
    feature_id AS population_specific_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'population_specific_variant';

--- ************************************************
--- *** relation: de_novo_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW de_novo_variant AS
  SELECT
    feature_id AS de_novo_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'de_novo_variant';

--- ************************************************
--- *** relation: tf_binding_site_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant located within a tran ***
--- *** scription factor binding site.           ***
--- ************************************************
---

CREATE VIEW tf_binding_site_variant AS
  SELECT
    feature_id AS tf_binding_site_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'TF_binding_site_variant';

--- ************************************************
--- *** relation: missense_codon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant whereby at least one  ***
--- *** base of a codon is changed resulting in  ***
--- *** a codon that encodes for a different ami ***
--- *** no acid.                                 ***
--- ************************************************
---

CREATE VIEW missense_codon AS
  SELECT
    feature_id AS missense_codon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'conservative_missense_codon' OR cvterm.name = 'non_conservative_missense_codon' OR cvterm.name = 'missense_codon';

--- ************************************************
--- *** relation: complex_structural_alteration ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A structural sequence alteration where t ***
--- *** here are multiple equally plausible expl ***
--- *** anations for the change.                 ***
--- ************************************************
---

CREATE VIEW complex_structural_alteration AS
  SELECT
    feature_id AS complex_structural_alteration_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'complex_structural_alteration';

--- ************************************************
--- *** relation: structural_alteration ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW structural_alteration AS
  SELECT
    feature_id AS structural_alteration_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'complex_structural_alteration' OR cvterm.name = 'structural_alteration';

--- ************************************************
--- *** relation: loss_of_heterozygosity ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW loss_of_heterozygosity AS
  SELECT
    feature_id AS loss_of_heterozygosity_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'loss_of_heterozygosity';

--- ************************************************
--- *** relation: splice_donor_5th_base_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that causes a change  ***
--- *** at the 5th base pair after the start of  ***
--- *** the intron in the orientation of the tra ***
--- *** nscript.                                 ***
--- ************************************************
---

CREATE VIEW splice_donor_5th_base_variant AS
  SELECT
    feature_id AS splice_donor_5th_base_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'splice_donor_5th_base_variant';

--- ************************************************
--- *** relation: u_box ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An U-box is a conserved T-rich region up ***
--- *** stream of a retroviral polypurine tract  ***
--- *** that is involved in PPT primer creation  ***
--- *** during reverse transcription.            ***
--- ************************************************
---

CREATE VIEW u_box AS
  SELECT
    feature_id AS u_box_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'U_box';

--- ************************************************
--- *** relation: mating_type_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A specialized region in the genomes of s ***
--- *** ome yeast and fungi, the genes of which  ***
--- *** regulate mating type.                    ***
--- ************************************************
---

CREATE VIEW mating_type_region AS
  SELECT
    feature_id AS mating_type_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mating_type_region';

--- ************************************************
--- *** relation: paired_end_fragment ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An assembly region that has been sequenc ***
--- *** ed from both ends resulting in a read_pa ***
--- *** ir (mate_pair).                          ***
--- ************************************************
---

CREATE VIEW paired_end_fragment AS
  SELECT
    feature_id AS paired_end_fragment_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'paired_end_fragment';

--- ************************************************
--- *** relation: exon_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that changes exon seq ***
--- *** uence.                                   ***
--- ************************************************
---

CREATE VIEW exon_variant AS
  SELECT
    feature_id AS exon_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'coding_sequence_variant' OR cvterm.name = 'non_coding_exon_variant' OR cvterm.name = 'codon_variant' OR cvterm.name = 'frameshift_variant' OR cvterm.name = 'inframe_variant' OR cvterm.name = 'initiator_codon_change' OR cvterm.name = 'non_synonymous_codon' OR cvterm.name = 'synonymous_codon' OR cvterm.name = 'terminal_codon_variant' OR cvterm.name = 'stop_gained' OR cvterm.name = 'missense_codon' OR cvterm.name = 'conservative_missense_codon' OR cvterm.name = 'non_conservative_missense_codon' OR cvterm.name = 'terminator_codon_variant' OR cvterm.name = 'incomplete_terminal_codon_variant' OR cvterm.name = 'stop_retained_variant' OR cvterm.name = 'stop_lost' OR cvterm.name = 'frame_restoring_variant' OR cvterm.name = 'minus_1_frameshift_variant' OR cvterm.name = 'minus_2_frameshift_variant' OR cvterm.name = 'plus_1_frameshift_variant' OR cvterm.name = 'plus_2_frameshift variant' OR cvterm.name = 'inframe_codon_gain' OR cvterm.name = 'inframe_codon_loss' OR cvterm.name = 'exon_variant';

--- ************************************************
--- *** relation: non_coding_exon_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence variant that changes non-codi ***
--- *** ng exon sequence.                        ***
--- ************************************************
---

CREATE VIEW non_coding_exon_variant AS
  SELECT
    feature_id AS non_coding_exon_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'non_coding_exon_variant';

--- ************************************************
--- *** relation: clone_end ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A read from an end of the clone sequence ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW clone_end AS
  SELECT
    feature_id AS clone_end_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'clone_end';

--- ************************************************
--- *** relation: point_centromere ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A point centromere is a relatively small ***
--- ***  centromere (about 125 bp DNA) in discre ***
--- *** te sequence, found in some yeast includi ***
--- *** ng S. cerevisiae.                        ***
--- ************************************************
---

CREATE VIEW point_centromere AS
  SELECT
    feature_id AS point_centromere_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'point_centromere';

--- ************************************************
--- *** relation: regional_centromere ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A regional centromere is a large modular ***
--- ***  centromere found in fission yeast and h ***
--- *** igher eukaryotes. It consist of a centra ***
--- *** l core region flanked by inverted inner  ***
--- *** and outer repeat regions.                ***
--- ************************************************
---

CREATE VIEW regional_centromere AS
  SELECT
    feature_id AS regional_centromere_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'regional_centromere';

--- ************************************************
--- *** relation: regional_centromere_central_core ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A conserved region within the central re ***
--- *** gion of a modular centromere, where the  ***
--- *** kinetochore is formed.                   ***
--- ************************************************
---

CREATE VIEW regional_centromere_central_core AS
  SELECT
    feature_id AS regional_centromere_central_core_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'regional_centromere_central_core';

--- ************************************************
--- *** relation: centromeric_repeat ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A repeat region found within the modular ***
--- ***  centromere.                             ***
--- ************************************************
---

CREATE VIEW centromeric_repeat AS
  SELECT
    feature_id AS centromeric_repeat_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'regional_centromere_inner_repeat_region' OR cvterm.name = 'regional_centromere_outer_repeat_region' OR cvterm.name = 'centromeric_repeat';

--- ************************************************
--- *** relation: regional_centromere_inner_repeat_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The inner repeat region of a modular cen ***
--- *** tromere. This region is adjacent to the  ***
--- *** central core, on each chromosome arm.    ***
--- ************************************************
---

CREATE VIEW regional_centromere_inner_repeat_region AS
  SELECT
    feature_id AS regional_centromere_inner_repeat_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'regional_centromere_inner_repeat_region';

--- ************************************************
--- *** relation: regional_centromere_outer_repeat_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The heterochromatic outer repeat region  ***
--- *** of a modular centromere. These repeats e ***
--- *** xist in tandem arrays on both chromosome ***
--- ***  arms.                                   ***
--- ************************************************
---

CREATE VIEW regional_centromere_outer_repeat_region AS
  SELECT
    feature_id AS regional_centromere_outer_repeat_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'regional_centromere_outer_repeat_region';

--- ************************************************
--- *** relation: tasirna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The sequence of a 21 nucleotide double s ***
--- *** tranded, polyadenylated non coding RNA,  ***
--- *** transcribed from the TAS gene.           ***
--- ************************************************
---

CREATE VIEW tasirna AS
  SELECT
    feature_id AS tasirna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tasiRNA';

--- ************************************************
--- *** relation: tasirna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding a tasiRNA. ***
--- ************************************************
---

CREATE VIEW tasirna_primary_transcript AS
  SELECT
    feature_id AS tasirna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tasiRNA_primary_transcript';

--- ************************************************
--- *** relation: increased_polyadenylation_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transcript processing variant whereby  ***
--- *** polyadenylation of the encoded transcrip ***
--- *** t is increased with respect to the refer ***
--- *** ence.                                    ***
--- ************************************************
---

CREATE VIEW increased_polyadenylation_variant AS
  SELECT
    feature_id AS increased_polyadenylation_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'increased_polyadenylation_variant';

--- ************************************************
--- *** relation: decreased_polyadenylation_variant ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transcript processing variant whereby  ***
--- *** polyadenylation of the encoded transcrip ***
--- *** t is decreased with respect to the refer ***
--- *** ence.                                    ***
--- ************************************************
---

CREATE VIEW decreased_polyadenylation_variant AS
  SELECT
    feature_id AS decreased_polyadenylation_variant_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'decreased_polyadenylation_variant';

--- ************************************************
--- *** relation: regulatory_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of sequence that is involved in ***
--- ***  the control of a biological process.    ***
--- ************************************************
---

CREATE VIEW regulatory_region AS
  SELECT
    feature_id AS regulatory_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'transcription_regulatory_region' OR cvterm.name = 'translation_regulatory_region' OR cvterm.name = 'recombination_regulatory_region' OR cvterm.name = 'replication_regulatory_region' OR cvterm.name = 'terminator' OR cvterm.name = 'TF_binding_site' OR cvterm.name = 'polyA_signal_sequence' OR cvterm.name = 'gene_group_regulatory_region' OR cvterm.name = 'transcriptional_cis_regulatory_region' OR cvterm.name = 'splicing_regulatory_region' OR cvterm.name = 'cis_regulatory_frameshift_element' OR cvterm.name = 'intronic_regulatory_region' OR cvterm.name = 'bacterial_terminator' OR cvterm.name = 'eukaryotic_terminator' OR cvterm.name = 'rho_dependent_bacterial_terminator' OR cvterm.name = 'rho_independent_bacterial_terminator' OR cvterm.name = 'terminator_of_type_2_RNApol_III_promoter' OR cvterm.name = 'operator' OR cvterm.name = 'bacterial_RNApol_promoter' OR cvterm.name = 'bacterial_terminator' OR cvterm.name = 'bacterial_RNApol_promoter_sigma_70' OR cvterm.name = 'bacterial_RNApol_promoter_sigma54' OR cvterm.name = 'rho_dependent_bacterial_terminator' OR cvterm.name = 'rho_independent_bacterial_terminator' OR cvterm.name = 'promoter' OR cvterm.name = 'insulator' OR cvterm.name = 'CRM' OR cvterm.name = 'promoter_targeting_sequence' OR cvterm.name = 'ISRE' OR cvterm.name = 'bidirectional_promoter' OR cvterm.name = 'RNA_polymerase_promoter' OR cvterm.name = 'RNApol_I_promoter' OR cvterm.name = 'RNApol_II_promoter' OR cvterm.name = 'RNApol_III_promoter' OR cvterm.name = 'bacterial_RNApol_promoter' OR cvterm.name = 'Phage_RNA_Polymerase_Promoter' OR cvterm.name = 'RNApol_II_core_promoter' OR cvterm.name = 'RNApol_III_promoter_type_1' OR cvterm.name = 'RNApol_III_promoter_type_2' OR cvterm.name = 'RNApol_III_promoter_type_3' OR cvterm.name = 'bacterial_RNApol_promoter_sigma_70' OR cvterm.name = 'bacterial_RNApol_promoter_sigma54' OR cvterm.name = 'SP6_RNA_Polymerase_Promoter' OR cvterm.name = 'T3_RNA_Polymerase_Promoter' OR cvterm.name = 'T7_RNA_Polymerase_Promoter' OR cvterm.name = 'locus_control_region' OR cvterm.name = 'enhancer' OR cvterm.name = 'silencer' OR cvterm.name = 'enhancer_bound_by_factor' OR cvterm.name = 'shadow_enhancer' OR cvterm.name = 'splice_enhancer' OR cvterm.name = 'intronic_splice_enhancer' OR cvterm.name = 'exonic_splice_enhancer' OR cvterm.name = 'attenuator' OR cvterm.name = 'regulatory_region';

--- ************************************************
--- *** relation: u14_snorna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The primary transcript of an evolutionar ***
--- *** ily conserved eukaryotic low molecular w ***
--- *** eight RNA capable of intermolecular hybr ***
--- *** idization with both homologous and heter ***
--- *** ologous 18S rRNA.                        ***
--- ************************************************
---

CREATE VIEW u14_snorna_primary_transcript AS
  SELECT
    feature_id AS u14_snorna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'U14_snoRNA_primary_transcript';

--- ************************************************
--- *** relation: methylation_guide_snorna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A snoRNA that specifies the site of 2'-O ***
--- *** -ribose methylation in an RNA molecule b ***
--- *** y base pairing with a short sequence aro ***
--- *** und the target residue.                  ***
--- ************************************************
---

CREATE VIEW methylation_guide_snorna AS
  SELECT
    feature_id AS methylation_guide_snorna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'methylation_guide_snoRNA';

--- ************************************************
--- *** relation: rrna_cleavage_rna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An ncRNA that is part of a ribonucleopro ***
--- *** tein that cleaves the primary pre-rRNA t ***
--- *** ranscript in the process of producing ma ***
--- *** ture rRNA molecules.                     ***
--- ************************************************
---

CREATE VIEW rrna_cleavage_rna AS
  SELECT
    feature_id AS rrna_cleavage_rna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'rRNA_cleavage_RNA';

--- ************************************************
--- *** relation: exon_of_single_exon_gene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An exon that is the only exon in a gene. ***
--- ************************************************
---

CREATE VIEW exon_of_single_exon_gene AS
  SELECT
    feature_id AS exon_of_single_exon_gene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'exon_of_single_exon_gene';

--- ************************************************
--- *** relation: cassette_array_member ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW cassette_array_member AS
  SELECT
    feature_id AS cassette_array_member_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cassette_array_member';

--- ************************************************
--- *** relation: gene_cassette_member ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW gene_cassette_member AS
  SELECT
    feature_id AS gene_cassette_member_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cassette_array_member' OR cvterm.name = 'gene_cassette_member';

--- ************************************************
--- *** relation: gene_subarray_member ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW gene_subarray_member AS
  SELECT
    feature_id AS gene_subarray_member_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_subarray_member';

--- ************************************************
--- *** relation: primer_binding_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Non-covalent primer binding site for ini ***
--- *** tiation of replication, transcription, o ***
--- *** r reverse transcription.                 ***
--- ************************************************
---

CREATE VIEW primer_binding_site AS
  SELECT
    feature_id AS primer_binding_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'primer_binding_site';

--- ************************************************
--- *** relation: gene_array ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An array includes two or more genes, or  ***
--- *** two or more gene subarrays, contiguously ***
--- ***  arranged where the individual genes, or ***
--- ***  subarrays, are either identical in sequ ***
--- *** ence, or essentially so.                 ***
--- ************************************************
---

CREATE VIEW gene_array AS
  SELECT
    feature_id AS gene_array_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_array';

--- ************************************************
--- *** relation: gene_subarray ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A subarray is, by defintition, a member  ***
--- *** of a gene array (SO:0005851); the member ***
--- *** s of a subarray may differ substantially ***
--- ***  in sequence, but are closely related in ***
--- ***  function.                               ***
--- ************************************************
---

CREATE VIEW gene_subarray AS
  SELECT
    feature_id AS gene_subarray_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_subarray';

--- ************************************************
--- *** relation: gene_cassette ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that can be substituted for a rel ***
--- *** ated gene at a different site in the gen ***
--- *** ome.                                     ***
--- ************************************************
---

CREATE VIEW gene_cassette AS
  SELECT
    feature_id AS gene_cassette_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_cassette';

--- ************************************************
--- *** relation: gene_cassette_array ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An array of non-functional genes whose m ***
--- *** embers, when captured by recombination f ***
--- *** orm functional genes.                    ***
--- ************************************************
---

CREATE VIEW gene_cassette_array AS
  SELECT
    feature_id AS gene_cassette_array_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'gene_cassette_array';

--- ************************************************
--- *** relation: gene_group ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A collection of related genes.           ***
--- ************************************************
---

CREATE VIEW gene_group AS
  SELECT
    feature_id AS gene_group_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'operon' OR cvterm.name = 'mating_type_region' OR cvterm.name = 'gene_array' OR cvterm.name = 'gene_subarray' OR cvterm.name = 'gene_cassette_array' OR cvterm.name = 'regulon' OR cvterm.name = 'gene_group';

--- ************************************************
--- *** relation: selenocysteine_trna_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript encoding seryl tRNA ***
--- ***  (SO:000269).                            ***
--- ************************************************
---

CREATE VIEW selenocysteine_trna_primary_transcript AS
  SELECT
    feature_id AS selenocysteine_trna_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'selenocysteine_tRNA_primary_transcript';

--- ************************************************
--- *** relation: selenocysteinyl_trna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tRNA sequence that has a selenocystein ***
--- *** e anticodon, and a 3' selenocysteine bin ***
--- *** ding region.                             ***
--- ************************************************
---

CREATE VIEW selenocysteinyl_trna AS
  SELECT
    feature_id AS selenocysteinyl_trna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'selenocysteinyl_tRNA';

--- ************************************************
--- *** relation: syntenic_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region in which two or more pairs of h ***
--- *** omologous markers occur on the same chro ***
--- *** mosome in two or more species.           ***
--- ************************************************
---

CREATE VIEW syntenic_region AS
  SELECT
    feature_id AS syntenic_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'syntenic_region';

--- ************************************************
--- *** relation: biochemical_region_of_peptide ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of a peptide that is involved i ***
--- *** n a biochemical function.                ***
--- ************************************************
---

CREATE VIEW biochemical_region_of_peptide AS
  SELECT
    feature_id AS biochemical_region_of_peptide_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'post_translationally_modified_region' OR cvterm.name = 'conformational_switch' OR cvterm.name = 'molecular_contact_region' OR cvterm.name = 'polypeptide_binding_motif' OR cvterm.name = 'polypeptide_catalytic_motif' OR cvterm.name = 'histone_modification' OR cvterm.name = 'histone_methylation_site' OR cvterm.name = 'histone_acetylation_site' OR cvterm.name = 'histone_ubiqitination_site' OR cvterm.name = 'histone_acylation_region' OR cvterm.name = 'H4K20_monomethylation_site' OR cvterm.name = 'H2BK5_monomethylation_site' OR cvterm.name = 'H3K27_methylation_site' OR cvterm.name = 'H3K36_methylation_site' OR cvterm.name = 'H3K4_methylation_site' OR cvterm.name = 'H3K79_methylation_site' OR cvterm.name = 'H3K9_methylation_site' OR cvterm.name = 'H3K27_monomethylation_site' OR cvterm.name = 'H3K27_trimethylation_site' OR cvterm.name = 'H3K27_dimethylation_site' OR cvterm.name = 'H3K36_monomethylation_site' OR cvterm.name = 'H3K36_dimethylation_site' OR cvterm.name = 'H3K36_trimethylation_site' OR cvterm.name = 'H3K4_monomethylation_site' OR cvterm.name = 'H3K4_trimethylation' OR cvterm.name = 'H3K4_dimethylation_site' OR cvterm.name = 'H3K79_monomethylation_site' OR cvterm.name = 'H3K79_dimethylation_site' OR cvterm.name = 'H3K79_trimethylation_site' OR cvterm.name = 'H3K9_trimethylation_site' OR cvterm.name = 'H3K9_monomethylation_site' OR cvterm.name = 'H3K9_dimethylation_site' OR cvterm.name = 'H3K9_acetylation_site' OR cvterm.name = 'H3K14_acetylation_site' OR cvterm.name = 'H3K18_acetylation_site' OR cvterm.name = 'H3K23_acylation site' OR cvterm.name = 'H3K27_acylation_site' OR cvterm.name = 'H4K16_acylation_site' OR cvterm.name = 'H4K5_acylation_site' OR cvterm.name = 'H4K8_acylation site' OR cvterm.name = 'H2B_ubiquitination_site' OR cvterm.name = 'H4K_acylation_region' OR cvterm.name = 'polypeptide_metal_contact' OR cvterm.name = 'protein_protein_contact' OR cvterm.name = 'polypeptide_ligand_contact' OR cvterm.name = 'polypeptide_DNA_contact' OR cvterm.name = 'polypeptide_calcium_ion_contact_site' OR cvterm.name = 'polypeptide_cobalt_ion_contact_site' OR cvterm.name = 'polypeptide_copper_ion_contact_site' OR cvterm.name = 'polypeptide_iron_ion_contact_site' OR cvterm.name = 'polypeptide_magnesium_ion_contact_site' OR cvterm.name = 'polypeptide_manganese_ion_contact_site' OR cvterm.name = 'polypeptide_molybdenum_ion_contact_site' OR cvterm.name = 'polypeptide_nickel_ion_contact_site' OR cvterm.name = 'polypeptide_tungsten_ion_contact_site' OR cvterm.name = 'polypeptide_zinc_ion_contact_site' OR cvterm.name = 'biochemical_region_of_peptide';

--- ************************************************
--- *** relation: molecular_contact_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region that is involved a contact with ***
--- ***  another molecule.                       ***
--- ************************************************
---

CREATE VIEW molecular_contact_region AS
  SELECT
    feature_id AS molecular_contact_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_metal_contact' OR cvterm.name = 'protein_protein_contact' OR cvterm.name = 'polypeptide_ligand_contact' OR cvterm.name = 'polypeptide_DNA_contact' OR cvterm.name = 'polypeptide_calcium_ion_contact_site' OR cvterm.name = 'polypeptide_cobalt_ion_contact_site' OR cvterm.name = 'polypeptide_copper_ion_contact_site' OR cvterm.name = 'polypeptide_iron_ion_contact_site' OR cvterm.name = 'polypeptide_magnesium_ion_contact_site' OR cvterm.name = 'polypeptide_manganese_ion_contact_site' OR cvterm.name = 'polypeptide_molybdenum_ion_contact_site' OR cvterm.name = 'polypeptide_nickel_ion_contact_site' OR cvterm.name = 'polypeptide_tungsten_ion_contact_site' OR cvterm.name = 'polypeptide_zinc_ion_contact_site' OR cvterm.name = 'molecular_contact_region';

--- ************************************************
--- *** relation: intrinsically_unstructured_polypeptide_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A region of polypeptide chain with high  ***
--- *** conformational flexibility.              ***
--- ************************************************
---

CREATE VIEW intrinsically_unstructured_polypeptide_region AS
  SELECT
    feature_id AS intrinsically_unstructured_polypeptide_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'intrinsically_unstructured_polypeptide_region';

--- ************************************************
--- *** relation: catmat_left_handed_three ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A motif of 3 consecutive residues with d ***
--- *** ihedral angles as follows: res i: phi -9 ***
--- *** 0 bounds -120 to -60, res i: psi -10 bou ***
--- *** nds -50 to 30, res i+1: phi -75 bounds - ***
--- *** 100 to -50, res i+1: psi 140 bounds 110  ***
--- *** to 170. An extra restriction of the leng ***
--- *** th of the O to O distance would be usefu ***
--- *** l, that it be less than 5 Angstrom. More ***
--- ***  precisely these two oxygens are the mai ***
--- *** n chain carbonyl oxygen atoms of residue ***
--- *** s i-1 and i+1.                           ***
--- ************************************************
---

CREATE VIEW catmat_left_handed_three AS
  SELECT
    feature_id AS catmat_left_handed_three_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'catmat_left_handed_three';

--- ************************************************
--- *** relation: catmat_left_handed_four ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A motif of 4 consecutive residues with d ***
--- *** ihedral angles as follows: res i: phi -9 ***
--- *** 0 bounds -120 to -60, res i psi -10 boun ***
--- *** ds -50 to 30, res i+1: phi -90 bounds -1 ***
--- *** 20 to -60, res i+1: psi -10 bounds -50 t ***
--- *** o 30, res i+2: phi -75 bounds -100 to -5 ***
--- *** 0, res i+2: psi 140 bounds 110 to 170.   ***
--- *** The extra restriction of the length of t ***
--- *** he O to O distance is similar, that it b ***
--- *** e less than 5 Angstrom. In this case the ***
--- *** se two Oxygen atoms are the main chain c ***
--- *** arbonyl oxygen atoms of residues i-1 and ***
--- ***  i+2.                                    ***
--- ************************************************
---

CREATE VIEW catmat_left_handed_four AS
  SELECT
    feature_id AS catmat_left_handed_four_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'catmat_left_handed_four';

--- ************************************************
--- *** relation: catmat_right_handed_three ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A motif of 3 consecutive residues with d ***
--- *** ihedral angles as follows: res i: phi -9 ***
--- *** 0 bounds -120 to -60, res i: psi -10 bou ***
--- *** nds -50 to 30, res i+1: phi -75 bounds - ***
--- *** 100 to -50, res i+1: psi 140 bounds 110  ***
--- *** to 170. An extra restriction of the leng ***
--- *** th of the O to O distance would be usefu ***
--- *** l, that it be less than 5 Angstrom. More ***
--- ***  precisely these two oxygens are the mai ***
--- *** n chain carbonyl oxygen atoms of residue ***
--- *** s i-1 and i+1.                           ***
--- ************************************************
---

CREATE VIEW catmat_right_handed_three AS
  SELECT
    feature_id AS catmat_right_handed_three_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'catmat_right_handed_three';

--- ************************************************
--- *** relation: catmat_right_handed_four ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A motif of 4 consecutive residues with d ***
--- *** ihedral angles as follows: res i: phi -9 ***
--- *** 0 bounds -120 to -60, res i: psi -10 bou ***
--- *** nds -50 to 30, res i+1: phi -90 bounds - ***
--- *** 120 to -60, res i+1: psi -10 bounds -50  ***
--- *** to 30, res i+2: phi -75 bounds -100 to - ***
--- *** 50, res i+2: psi 140 bounds 110 to 170.  ***
--- *** The extra restriction of the length of t ***
--- *** he O to O distance is similar, that it b ***
--- *** e less than 5 Angstrom. In this case the ***
--- *** se two Oxygen atoms are the main chain c ***
--- *** arbonyl oxygen atoms of residues i-1 and ***
--- ***  i+2.                                    ***
--- ************************************************
---

CREATE VIEW catmat_right_handed_four AS
  SELECT
    feature_id AS catmat_right_handed_four_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'catmat_right_handed_four';

--- ************************************************
--- *** relation: alpha_beta_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A motif of five consecutive residues and ***
--- ***  two H-bonds in which: H-bond between CO ***
--- ***  of residue(i) and NH of residue(i+4), H ***
--- *** -bond between CO of residue(i) and NH of ***
--- ***  residue(i+3),Phi angles of residues(i+1 ***
--- *** ), (i+2) and (i+3) are negative.         ***
--- ************************************************
---

CREATE VIEW alpha_beta_motif AS
  SELECT
    feature_id AS alpha_beta_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'alpha_beta_motif';

--- ************************************************
--- *** relation: lipoprotein_signal_peptide ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A peptide that acts as a signal for both ***
--- ***  membrane translocation and lipid attach ***
--- *** ment in prokaryotes.                     ***
--- ************************************************
---

CREATE VIEW lipoprotein_signal_peptide AS
  SELECT
    feature_id AS lipoprotein_signal_peptide_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'lipoprotein_signal_peptide';

--- ************************************************
--- *** relation: no_output ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An experimental region wherean analysis  ***
--- *** has been run and not produced any annota ***
--- *** tion.                                    ***
--- ************************************************
---

CREATE VIEW no_output AS
  SELECT
    feature_id AS no_output_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'no_output';

--- ************************************************
--- *** relation: cleaved_peptide_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The cleaved_peptide_regon is the a regio ***
--- *** n of peptide sequence that is cleaved du ***
--- *** ring maturation.                         ***
--- ************************************************
---

CREATE VIEW cleaved_peptide_region AS
  SELECT
    feature_id AS cleaved_peptide_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cleaved_initiator_methionine' OR cvterm.name = 'intein' OR cvterm.name = 'propeptide_cleavage_site' OR cvterm.name = 'propeptide' OR cvterm.name = 'cleaved_for_gpi_anchor_region' OR cvterm.name = 'lipoprotein_signal_peptide' OR cvterm.name = 'n_terminal_region' OR cvterm.name = 'c_terminal_region' OR cvterm.name = 'central_hydrophobic_region_of_signal_peptide' OR cvterm.name = 'cleaved_peptide_region';

--- ************************************************
--- *** relation: peptide_coil ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Irregular, unstructured regions of a pro ***
--- *** tein's backbone, as distinct from the re ***
--- *** gular region (namely alpha helix and bet ***
--- *** a strand - characterised by specific pat ***
--- *** terns of main-chain hydrogen bonds).     ***
--- ************************************************
---

CREATE VIEW peptide_coil AS
  SELECT
    feature_id AS peptide_coil_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'peptide_coil';

--- ************************************************
--- *** relation: hydrophobic_region_of_peptide ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Hydrophobic regions are regions with a l ***
--- *** ow affinity for water.                   ***
--- ************************************************
---

CREATE VIEW hydrophobic_region_of_peptide AS
  SELECT
    feature_id AS hydrophobic_region_of_peptide_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'hydrophobic_region_of_peptide';

--- ************************************************
--- *** relation: n_terminal_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The amino-terminal positively-charged re ***
--- *** gion of a signal peptide (approx 1-5 aa) ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW n_terminal_region AS
  SELECT
    feature_id AS n_terminal_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'n_terminal_region';

--- ************************************************
--- *** relation: c_terminal_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The more polar, carboxy-terminal region  ***
--- *** of the signal peptide (approx 3-7 aa).   ***
--- ************************************************
---

CREATE VIEW c_terminal_region AS
  SELECT
    feature_id AS c_terminal_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'c_terminal_region';

--- ************************************************
--- *** relation: central_hydrophobic_region_of_signal_peptide ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The central, hydrophobic region of the s ***
--- *** ignal peptide (approx 7-15 aa).          ***
--- ************************************************
---

CREATE VIEW central_hydrophobic_region_of_signal_peptide AS
  SELECT
    feature_id AS central_hydrophobic_region_of_signal_peptide_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'central_hydrophobic_region_of_signal_peptide';

--- ************************************************
--- *** relation: polypeptide_conserved_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A conserved motif is a short (up to 20 a ***
--- *** mino acids) region of biological interes ***
--- *** t that is conserved in different protein ***
--- *** s. They may or may not have functional o ***
--- *** r structural significance within the pro ***
--- *** teins in which they are found.           ***
--- ************************************************
---

CREATE VIEW polypeptide_conserved_motif AS
  SELECT
    feature_id AS polypeptide_conserved_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_conserved_motif';

--- ************************************************
--- *** relation: polypeptide_binding_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A polypeptide binding motif is a short ( ***
--- *** up to 20 amino acids) polypeptide region ***
--- ***  of biological interest that contains on ***
--- *** e or more amino acids experimentally sho ***
--- *** wn to bind to a ligand.                  ***
--- ************************************************
---

CREATE VIEW polypeptide_binding_motif AS
  SELECT
    feature_id AS polypeptide_binding_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_binding_motif';

--- ************************************************
--- *** relation: polypeptide_catalytic_motif ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A polypeptide catalytic motif is a short ***
--- ***  (up to 20 amino acids) polypeptide regi ***
--- *** on that contains one or more active site ***
--- ***  residues.                               ***
--- ************************************************
---

CREATE VIEW polypeptide_catalytic_motif AS
  SELECT
    feature_id AS polypeptide_catalytic_motif_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_catalytic_motif';

--- ************************************************
--- *** relation: polypeptide_dna_contact ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A binding site that, in the polypeptide  ***
--- *** molecule, interacts selectively and non- ***
--- *** covalently with DNA.                     ***
--- ************************************************
---

CREATE VIEW polypeptide_dna_contact AS
  SELECT
    feature_id AS polypeptide_dna_contact_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_DNA_contact';

--- ************************************************
--- *** relation: polypeptide_conserved_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A subsection of sequence with biological ***
--- ***  interest that is conserved in different ***
--- ***  proteins. They may or may not have func ***
--- *** tional or structural significance within ***
--- ***  the proteins in which they are found.   ***
--- ************************************************
---

CREATE VIEW polypeptide_conserved_region AS
  SELECT
    feature_id AS polypeptide_conserved_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'polypeptide_domain' OR cvterm.name = 'polypeptide_motif' OR cvterm.name = 'polypeptide_repeat' OR cvterm.name = 'biochemical_region_of_peptide' OR cvterm.name = 'polypeptide_conserved_motif' OR cvterm.name = 'post_translationally_modified_region' OR cvterm.name = 'conformational_switch' OR cvterm.name = 'molecular_contact_region' OR cvterm.name = 'polypeptide_binding_motif' OR cvterm.name = 'polypeptide_catalytic_motif' OR cvterm.name = 'histone_modification' OR cvterm.name = 'histone_methylation_site' OR cvterm.name = 'histone_acetylation_site' OR cvterm.name = 'histone_ubiqitination_site' OR cvterm.name = 'histone_acylation_region' OR cvterm.name = 'H4K20_monomethylation_site' OR cvterm.name = 'H2BK5_monomethylation_site' OR cvterm.name = 'H3K27_methylation_site' OR cvterm.name = 'H3K36_methylation_site' OR cvterm.name = 'H3K4_methylation_site' OR cvterm.name = 'H3K79_methylation_site' OR cvterm.name = 'H3K9_methylation_site' OR cvterm.name = 'H3K27_monomethylation_site' OR cvterm.name = 'H3K27_trimethylation_site' OR cvterm.name = 'H3K27_dimethylation_site' OR cvterm.name = 'H3K36_monomethylation_site' OR cvterm.name = 'H3K36_dimethylation_site' OR cvterm.name = 'H3K36_trimethylation_site' OR cvterm.name = 'H3K4_monomethylation_site' OR cvterm.name = 'H3K4_trimethylation' OR cvterm.name = 'H3K4_dimethylation_site' OR cvterm.name = 'H3K79_monomethylation_site' OR cvterm.name = 'H3K79_dimethylation_site' OR cvterm.name = 'H3K79_trimethylation_site' OR cvterm.name = 'H3K9_trimethylation_site' OR cvterm.name = 'H3K9_monomethylation_site' OR cvterm.name = 'H3K9_dimethylation_site' OR cvterm.name = 'H3K9_acetylation_site' OR cvterm.name = 'H3K14_acetylation_site' OR cvterm.name = 'H3K18_acetylation_site' OR cvterm.name = 'H3K23_acylation site' OR cvterm.name = 'H3K27_acylation_site' OR cvterm.name = 'H4K16_acylation_site' OR cvterm.name = 'H4K5_acylation_site' OR cvterm.name = 'H4K8_acylation site' OR cvterm.name = 'H2B_ubiquitination_site' OR cvterm.name = 'H4K_acylation_region' OR cvterm.name = 'polypeptide_metal_contact' OR cvterm.name = 'protein_protein_contact' OR cvterm.name = 'polypeptide_ligand_contact' OR cvterm.name = 'polypeptide_DNA_contact' OR cvterm.name = 'polypeptide_calcium_ion_contact_site' OR cvterm.name = 'polypeptide_cobalt_ion_contact_site' OR cvterm.name = 'polypeptide_copper_ion_contact_site' OR cvterm.name = 'polypeptide_iron_ion_contact_site' OR cvterm.name = 'polypeptide_magnesium_ion_contact_site' OR cvterm.name = 'polypeptide_manganese_ion_contact_site' OR cvterm.name = 'polypeptide_molybdenum_ion_contact_site' OR cvterm.name = 'polypeptide_nickel_ion_contact_site' OR cvterm.name = 'polypeptide_tungsten_ion_contact_site' OR cvterm.name = 'polypeptide_zinc_ion_contact_site' OR cvterm.name = 'polypeptide_conserved_region';

--- ************************************************
--- *** relation: substitution ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence alteration where the length o ***
--- *** f the change in the variant is the same  ***
--- *** as that of the reference.                ***
--- ************************************************
---

CREATE VIEW substitution AS
  SELECT
    feature_id AS substitution_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'sequence_length_variation' OR cvterm.name = 'MNP' OR cvterm.name = 'SNV' OR cvterm.name = 'complex_substitution' OR cvterm.name = 'simple_sequence_length_variation' OR cvterm.name = 'SNP' OR cvterm.name = 'point_mutation' OR cvterm.name = 'transition' OR cvterm.name = 'transversion' OR cvterm.name = 'pyrimidine_transition' OR cvterm.name = 'purine_transition' OR cvterm.name = 'C_to_T_transition' OR cvterm.name = 'T_to_C_transition' OR cvterm.name = 'C_to_T_transition_at_pCpG_site' OR cvterm.name = 'A_to_G_transition' OR cvterm.name = 'G_to_A_transition' OR cvterm.name = 'pyrimidine_to_purine_transversion' OR cvterm.name = 'purine_to_pyrimidine_transversion' OR cvterm.name = 'C_to_A_transversion' OR cvterm.name = 'C_to_G_transversion' OR cvterm.name = 'T_to_A_transversion' OR cvterm.name = 'T_to_G_transversion' OR cvterm.name = 'A_to_C_transversion' OR cvterm.name = 'A_to_T_transversion' OR cvterm.name = 'G_to_C_transversion' OR cvterm.name = 'G_to_T_transversion' OR cvterm.name = 'substitution';

--- ************************************************
--- *** relation: complex_substitution ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** When no simple or well defined DNA mutat ***
--- *** ion event describes the observed DNA cha ***
--- *** nge, the keyword "complex" should be use ***
--- *** d. Usually there are multiple equally pl ***
--- *** ausible explanations for the change.     ***
--- ************************************************
---

CREATE VIEW complex_substitution AS
  SELECT
    feature_id AS complex_substitution_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'complex_substitution';

--- ************************************************
--- *** relation: point_mutation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A single nucleotide change which has occ ***
--- *** urred at the same position of a correspo ***
--- *** nding nucleotide in a reference sequence ***
--- *** .                                        ***
--- ************************************************
---

CREATE VIEW point_mutation AS
  SELECT
    feature_id AS point_mutation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'point_mutation';

--- ************************************************
--- *** relation: transition ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Change of a pyrimidine nucleotide, C or  ***
--- *** T, into an other pyrimidine nucleotide,  ***
--- *** or change of a purine nucleotide, A or G ***
--- *** , into an other purine nucleotide.       ***
--- ************************************************
---

CREATE VIEW transition AS
  SELECT
    feature_id AS transition_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pyrimidine_transition' OR cvterm.name = 'purine_transition' OR cvterm.name = 'C_to_T_transition' OR cvterm.name = 'T_to_C_transition' OR cvterm.name = 'C_to_T_transition_at_pCpG_site' OR cvterm.name = 'A_to_G_transition' OR cvterm.name = 'G_to_A_transition' OR cvterm.name = 'transition';

--- ************************************************
--- *** relation: pyrimidine_transition ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A substitution of a pyrimidine, C or T,  ***
--- *** for another pyrimidine.                  ***
--- ************************************************
---

CREATE VIEW pyrimidine_transition AS
  SELECT
    feature_id AS pyrimidine_transition_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'C_to_T_transition' OR cvterm.name = 'T_to_C_transition' OR cvterm.name = 'C_to_T_transition_at_pCpG_site' OR cvterm.name = 'pyrimidine_transition';

--- ************************************************
--- *** relation: c_to_t_transition ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transition of a cytidine to a thymine. ***
--- ************************************************
---

CREATE VIEW c_to_t_transition AS
  SELECT
    feature_id AS c_to_t_transition_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'C_to_T_transition_at_pCpG_site' OR cvterm.name = 'C_to_T_transition';

--- ************************************************
--- *** relation: c_to_t_transition_at_pcpg_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The transition of cytidine to thymine oc ***
--- *** curring at a pCpG site as a consequence  ***
--- *** of the spontaneous deamination of 5'-met ***
--- *** hylcytidine.                             ***
--- ************************************************
---

CREATE VIEW c_to_t_transition_at_pcpg_site AS
  SELECT
    feature_id AS c_to_t_transition_at_pcpg_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'C_to_T_transition_at_pCpG_site';

--- ************************************************
--- *** relation: t_to_c_transition ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW t_to_c_transition AS
  SELECT
    feature_id AS t_to_c_transition_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'T_to_C_transition';

--- ************************************************
--- *** relation: purine_transition ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A substitution of a purine, A or G, for  ***
--- *** another purine.                          ***
--- ************************************************
---

CREATE VIEW purine_transition AS
  SELECT
    feature_id AS purine_transition_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'A_to_G_transition' OR cvterm.name = 'G_to_A_transition' OR cvterm.name = 'purine_transition';

--- ************************************************
--- *** relation: a_to_g_transition ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transition of an adenine to a guanine. ***
--- ************************************************
---

CREATE VIEW a_to_g_transition AS
  SELECT
    feature_id AS a_to_g_transition_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'A_to_G_transition';

--- ************************************************
--- *** relation: g_to_a_transition ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transition of a guanine to an adenine. ***
--- ************************************************
---

CREATE VIEW g_to_a_transition AS
  SELECT
    feature_id AS g_to_a_transition_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'G_to_A_transition';

--- ************************************************
--- *** relation: transversion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Change of a pyrimidine nucleotide, C or  ***
--- *** T, into a purine nucleotide, A or G, or  ***
--- *** vice versa.                              ***
--- ************************************************
---

CREATE VIEW transversion AS
  SELECT
    feature_id AS transversion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pyrimidine_to_purine_transversion' OR cvterm.name = 'purine_to_pyrimidine_transversion' OR cvterm.name = 'C_to_A_transversion' OR cvterm.name = 'C_to_G_transversion' OR cvterm.name = 'T_to_A_transversion' OR cvterm.name = 'T_to_G_transversion' OR cvterm.name = 'A_to_C_transversion' OR cvterm.name = 'A_to_T_transversion' OR cvterm.name = 'G_to_C_transversion' OR cvterm.name = 'G_to_T_transversion' OR cvterm.name = 'transversion';

--- ************************************************
--- *** relation: pyrimidine_to_purine_transversion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Change of a pyrimidine nucleotide, C or  ***
--- *** T, into a purine nucleotide, A or G.     ***
--- ************************************************
---

CREATE VIEW pyrimidine_to_purine_transversion AS
  SELECT
    feature_id AS pyrimidine_to_purine_transversion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'C_to_A_transversion' OR cvterm.name = 'C_to_G_transversion' OR cvterm.name = 'T_to_A_transversion' OR cvterm.name = 'T_to_G_transversion' OR cvterm.name = 'pyrimidine_to_purine_transversion';

--- ************************************************
--- *** relation: c_to_a_transversion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transversion from cytidine to adenine. ***
--- ************************************************
---

CREATE VIEW c_to_a_transversion AS
  SELECT
    feature_id AS c_to_a_transversion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'C_to_A_transversion';

--- ************************************************
--- *** relation: c_to_g_transversion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW c_to_g_transversion AS
  SELECT
    feature_id AS c_to_g_transversion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'C_to_G_transversion';

--- ************************************************
--- *** relation: t_to_a_transversion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transversion from T to A.              ***
--- ************************************************
---

CREATE VIEW t_to_a_transversion AS
  SELECT
    feature_id AS t_to_a_transversion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'T_to_A_transversion';

--- ************************************************
--- *** relation: t_to_g_transversion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transversion from T to G.              ***
--- ************************************************
---

CREATE VIEW t_to_g_transversion AS
  SELECT
    feature_id AS t_to_g_transversion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'T_to_G_transversion';

--- ************************************************
--- *** relation: purine_to_pyrimidine_transversion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Change of a purine nucleotide, A or G ,  ***
--- *** into a pyrimidine nucleotide C or T.     ***
--- ************************************************
---

CREATE VIEW purine_to_pyrimidine_transversion AS
  SELECT
    feature_id AS purine_to_pyrimidine_transversion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'A_to_C_transversion' OR cvterm.name = 'A_to_T_transversion' OR cvterm.name = 'G_to_C_transversion' OR cvterm.name = 'G_to_T_transversion' OR cvterm.name = 'purine_to_pyrimidine_transversion';

--- ************************************************
--- *** relation: a_to_c_transversion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transversion from adenine to cytidine. ***
--- ************************************************
---

CREATE VIEW a_to_c_transversion AS
  SELECT
    feature_id AS a_to_c_transversion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'A_to_C_transversion';

--- ************************************************
--- *** relation: a_to_t_transversion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transversion from adenine to thymine.  ***
--- ************************************************
---

CREATE VIEW a_to_t_transversion AS
  SELECT
    feature_id AS a_to_t_transversion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'A_to_T_transversion';

--- ************************************************
--- *** relation: g_to_c_transversion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transversion from guanine to cytidine. ***
--- ************************************************
---

CREATE VIEW g_to_c_transversion AS
  SELECT
    feature_id AS g_to_c_transversion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'G_to_C_transversion';

--- ************************************************
--- *** relation: g_to_t_transversion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transversion from guanine to thymine.  ***
--- ************************************************
---

CREATE VIEW g_to_t_transversion AS
  SELECT
    feature_id AS g_to_t_transversion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'G_to_T_transversion';

--- ************************************************
--- *** relation: intrachromosomal_mutation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosomal structure variation within ***
--- ***  a single chromosome.                    ***
--- ************************************************
---

CREATE VIEW intrachromosomal_mutation AS
  SELECT
    feature_id AS intrachromosomal_mutation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'chromosomal_deletion' OR cvterm.name = 'chromosomal_inversion' OR cvterm.name = 'intrachromosomal_duplication' OR cvterm.name = 'ring_chromosome' OR cvterm.name = 'chromosome_fission' OR cvterm.name = 'deficient_intrachromosomal_transposition' OR cvterm.name = 'inversion_derived_bipartite_deficiency' OR cvterm.name = 'inversion_derived_deficiency_plus_duplication' OR cvterm.name = 'inversion_derived_deficiency_plus_aneuploid' OR cvterm.name = 'deficient_translocation' OR cvterm.name = 'deficient_inversion' OR cvterm.name = 'inverted_ring_chromosome' OR cvterm.name = 'pericentric_inversion' OR cvterm.name = 'paracentric_inversion' OR cvterm.name = 'inversion_cum_translocation' OR cvterm.name = 'bipartite_inversion' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'deficient_inversion' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'inversion_derived_deficiency_plus_duplication' OR cvterm.name = 'inversion_derived_bipartite_duplication' OR cvterm.name = 'inversion_derived_duplication_plus_aneuploid' OR cvterm.name = 'intrachromosomal_transposition' OR cvterm.name = 'bipartite_duplication' OR cvterm.name = 'deficient_intrachromosomal_transposition' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'uninverted_intrachromosomal_transposition' OR cvterm.name = 'unoriented_intrachromosomal_transposition' OR cvterm.name = 'inverted_ring_chromosome' OR cvterm.name = 'free_ring_duplication' OR cvterm.name = 'intrachromosomal_mutation';

--- ************************************************
--- *** relation: chromosomal_deletion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An incomplete chromosome.                ***
--- ************************************************
---

CREATE VIEW chromosomal_deletion AS
  SELECT
    feature_id AS chromosomal_deletion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'deficient_intrachromosomal_transposition' OR cvterm.name = 'inversion_derived_bipartite_deficiency' OR cvterm.name = 'inversion_derived_deficiency_plus_duplication' OR cvterm.name = 'inversion_derived_deficiency_plus_aneuploid' OR cvterm.name = 'deficient_translocation' OR cvterm.name = 'deficient_inversion' OR cvterm.name = 'chromosomal_deletion';

--- ************************************************
--- *** relation: chromosomal_inversion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An interchromosomal mutation where a reg ***
--- *** ion of the chromosome is inverted with r ***
--- *** espect to wild type.                     ***
--- ************************************************
---

CREATE VIEW chromosomal_inversion AS
  SELECT
    feature_id AS chromosomal_inversion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inverted_ring_chromosome' OR cvterm.name = 'pericentric_inversion' OR cvterm.name = 'paracentric_inversion' OR cvterm.name = 'inversion_cum_translocation' OR cvterm.name = 'bipartite_inversion' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'deficient_inversion' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'chromosomal_inversion';

--- ************************************************
--- *** relation: interchromosomal_mutation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosomal structure variation whereb ***
--- *** y more than one chromosome is involved.  ***
--- ************************************************
---

CREATE VIEW interchromosomal_mutation AS
  SELECT
    feature_id AS interchromosomal_mutation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'chromosomal_translocation' OR cvterm.name = 'bipartite_duplication' OR cvterm.name = 'interchromosomal_transposition' OR cvterm.name = 'translocation_element' OR cvterm.name = 'Robertsonian_fusion' OR cvterm.name = 'reciprocal_chromosomal_translocation' OR cvterm.name = 'deficient_translocation' OR cvterm.name = 'inversion_cum_translocation' OR cvterm.name = 'cyclic_translocation' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'deficient_interchromosomal_transposition' OR cvterm.name = 'inverted_interchromosomal_transposition' OR cvterm.name = 'uninverted_interchromosomal_transposition' OR cvterm.name = 'unoriented_interchromosomal_transposition' OR cvterm.name = 'interchromosomal_mutation';

--- ************************************************
--- *** relation: indel ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A sequence alteration which included an  ***
--- *** insertion and a deletion, affecting 2 or ***
--- ***  more bases.                             ***
--- ************************************************
---

CREATE VIEW indel AS
  SELECT
    feature_id AS indel_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'indel';

--- ************************************************
--- *** relation: duplication ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** One or more nucleotides are added betwee ***
--- *** n two adjacent nucleotides in the sequen ***
--- *** ce; the inserted sequence derives from,  ***
--- *** or is identical in sequence to, nucleoti ***
--- *** des adjacent to insertion point.         ***
--- ************************************************
---

CREATE VIEW duplication AS
  SELECT
    feature_id AS duplication_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tandem_duplication' OR cvterm.name = 'direct_tandem_duplication' OR cvterm.name = 'inverted_tandem_duplication' OR cvterm.name = 'duplication';

--- ************************************************
--- *** relation: inversion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A continuous nucleotide sequence is inve ***
--- *** rted in the same position.               ***
--- ************************************************
---

CREATE VIEW inversion AS
  SELECT
    feature_id AS inversion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inversion';

--- ************************************************
--- *** relation: chromosomal_duplication ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An extra chromosome.                     ***
--- ************************************************
---

CREATE VIEW chromosomal_duplication AS
  SELECT
    feature_id AS chromosomal_duplication_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'interchromosomal_duplication' OR cvterm.name = 'intrachromosomal_duplication' OR cvterm.name = 'free_duplication' OR cvterm.name = 'insertional_duplication' OR cvterm.name = 'inversion_derived_deficiency_plus_duplication' OR cvterm.name = 'inversion_derived_bipartite_duplication' OR cvterm.name = 'inversion_derived_duplication_plus_aneuploid' OR cvterm.name = 'intrachromosomal_transposition' OR cvterm.name = 'bipartite_duplication' OR cvterm.name = 'deficient_intrachromosomal_transposition' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'uninverted_intrachromosomal_transposition' OR cvterm.name = 'unoriented_intrachromosomal_transposition' OR cvterm.name = 'free_ring_duplication' OR cvterm.name = 'uninverted_insertional_duplication' OR cvterm.name = 'inverted_insertional_duplication' OR cvterm.name = 'unoriented_insertional_duplication' OR cvterm.name = 'chromosomal_duplication';

--- ************************************************
--- *** relation: intrachromosomal_duplication ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A duplication that occurred within a chr ***
--- *** omosome.                                 ***
--- ************************************************
---

CREATE VIEW intrachromosomal_duplication AS
  SELECT
    feature_id AS intrachromosomal_duplication_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inversion_derived_deficiency_plus_duplication' OR cvterm.name = 'inversion_derived_bipartite_duplication' OR cvterm.name = 'inversion_derived_duplication_plus_aneuploid' OR cvterm.name = 'intrachromosomal_transposition' OR cvterm.name = 'bipartite_duplication' OR cvterm.name = 'deficient_intrachromosomal_transposition' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'uninverted_intrachromosomal_transposition' OR cvterm.name = 'unoriented_intrachromosomal_transposition' OR cvterm.name = 'intrachromosomal_duplication';

--- ************************************************
--- *** relation: direct_tandem_duplication ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tandem duplication where the individua ***
--- *** l regions are in the same orientation.   ***
--- ************************************************
---

CREATE VIEW direct_tandem_duplication AS
  SELECT
    feature_id AS direct_tandem_duplication_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'direct_tandem_duplication';

--- ************************************************
--- *** relation: inverted_tandem_duplication ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A tandem duplication where the individua ***
--- *** l regions are not in the same orientatio ***
--- *** n.                                       ***
--- ************************************************
---

CREATE VIEW inverted_tandem_duplication AS
  SELECT
    feature_id AS inverted_tandem_duplication_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inverted_tandem_duplication';

--- ************************************************
--- *** relation: intrachromosomal_transposition ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosome structure variation whereby ***
--- ***  a transposition occurred within a chrom ***
--- *** osome.                                   ***
--- ************************************************
---

CREATE VIEW intrachromosomal_transposition AS
  SELECT
    feature_id AS intrachromosomal_transposition_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'deficient_intrachromosomal_transposition' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'uninverted_intrachromosomal_transposition' OR cvterm.name = 'unoriented_intrachromosomal_transposition' OR cvterm.name = 'intrachromosomal_transposition';

--- ************************************************
--- *** relation: compound_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosome structure variant where a m ***
--- *** onocentric element is caused by the fusi ***
--- *** on of two chromosome arms.               ***
--- ************************************************
---

CREATE VIEW compound_chromosome AS
  SELECT
    feature_id AS compound_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'compound_chromosome_arm' OR cvterm.name = 'homo_compound_chromosome' OR cvterm.name = 'hetero_compound_chromosome' OR cvterm.name = 'compound_chromosome';

--- ************************************************
--- *** relation: robertsonian_fusion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A non reciprocal translocation whereby t ***
--- *** he participating chromosomes break at th ***
--- *** eir centromeres and the long arms fuse t ***
--- *** o form a single chromosome with a single ***
--- ***  centromere.                             ***
--- ************************************************
---

CREATE VIEW robertsonian_fusion AS
  SELECT
    feature_id AS robertsonian_fusion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'Robertsonian_fusion';

--- ************************************************
--- *** relation: chromosomal_translocation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An interchromosomal mutation. Rearrangem ***
--- *** ents that alter the pairing of telomeres ***
--- ***  are classified as translocations.       ***
--- ************************************************
---

CREATE VIEW chromosomal_translocation AS
  SELECT
    feature_id AS chromosomal_translocation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'translocation_element' OR cvterm.name = 'Robertsonian_fusion' OR cvterm.name = 'reciprocal_chromosomal_translocation' OR cvterm.name = 'deficient_translocation' OR cvterm.name = 'inversion_cum_translocation' OR cvterm.name = 'cyclic_translocation' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'chromosomal_translocation';

--- ************************************************
--- *** relation: ring_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A ring chromosome is a chromosome whose  ***
--- *** arms have fused together to form a ring, ***
--- ***  often with the loss of the ends of the  ***
--- *** chromosome.                              ***
--- ************************************************
---

CREATE VIEW ring_chromosome AS
  SELECT
    feature_id AS ring_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inverted_ring_chromosome' OR cvterm.name = 'free_ring_duplication' OR cvterm.name = 'ring_chromosome';

--- ************************************************
--- *** relation: pericentric_inversion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosomal inversion that includes th ***
--- *** e centromere.                            ***
--- ************************************************
---

CREATE VIEW pericentric_inversion AS
  SELECT
    feature_id AS pericentric_inversion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pericentric_inversion';

--- ************************************************
--- *** relation: paracentric_inversion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosomal inversion that does not in ***
--- *** clude the centromere.                    ***
--- ************************************************
---

CREATE VIEW paracentric_inversion AS
  SELECT
    feature_id AS paracentric_inversion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'paracentric_inversion';

--- ************************************************
--- *** relation: reciprocal_chromosomal_translocation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosomal translocation with two bre ***
--- *** aks; two chromosome segments have simply ***
--- ***  been exchanged.                         ***
--- ************************************************
---

CREATE VIEW reciprocal_chromosomal_translocation AS
  SELECT
    feature_id AS reciprocal_chromosomal_translocation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'reciprocal_chromosomal_translocation';

--- ************************************************
--- *** relation: autosynaptic_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An autosynaptic chromosome is the aneupl ***
--- *** oid product of recombination between a p ***
--- *** ericentric inversion and a cytologically ***
--- ***  wild-type chromosome.                   ***
--- ************************************************
---

CREATE VIEW autosynaptic_chromosome AS
  SELECT
    feature_id AS autosynaptic_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'dexstrosynaptic_chromosome' OR cvterm.name = 'laevosynaptic_chromosome' OR cvterm.name = 'autosynaptic_chromosome';

--- ************************************************
--- *** relation: homo_compound_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A compound chromosome whereby two copies ***
--- ***  of the same chromosomal arm attached to ***
--- ***  a common centromere. The chromosome is  ***
--- *** diploid for the arm involved.            ***
--- ************************************************
---

CREATE VIEW homo_compound_chromosome AS
  SELECT
    feature_id AS homo_compound_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'homo_compound_chromosome';

--- ************************************************
--- *** relation: hetero_compound_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A compound chromosome whereby two arms f ***
--- *** rom different chromosomes are connected  ***
--- *** through the centromere of one of them.   ***
--- ************************************************
---

CREATE VIEW hetero_compound_chromosome AS
  SELECT
    feature_id AS hetero_compound_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'hetero_compound_chromosome';

--- ************************************************
--- *** relation: chromosome_fission ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosome that occurred by the divisi ***
--- *** on of a larger chromosome.               ***
--- ************************************************
---

CREATE VIEW chromosome_fission AS
  SELECT
    feature_id AS chromosome_fission_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'chromosome_fission';

--- ************************************************
--- *** relation: dexstrosynaptic_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An autosynaptic chromosome carrying the  ***
--- *** two right (D = dextro) telomeres.        ***
--- ************************************************
---

CREATE VIEW dexstrosynaptic_chromosome AS
  SELECT
    feature_id AS dexstrosynaptic_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'dexstrosynaptic_chromosome';

--- ************************************************
--- *** relation: laevosynaptic_chromosome ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** LS is an autosynaptic chromosome carryin ***
--- *** g the two left (L = levo) telomeres.     ***
--- ************************************************
---

CREATE VIEW laevosynaptic_chromosome AS
  SELECT
    feature_id AS laevosynaptic_chromosome_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'laevosynaptic_chromosome';

--- ************************************************
--- *** relation: free_duplication ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosome structure variation whereby ***
--- ***  the duplicated sequences are carried as ***
--- ***  a free centric element.                 ***
--- ************************************************
---

CREATE VIEW free_duplication AS
  SELECT
    feature_id AS free_duplication_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'free_ring_duplication' OR cvterm.name = 'free_duplication';

--- ************************************************
--- *** relation: free_ring_duplication ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A ring chromosome which is a copy of ano ***
--- *** ther chromosome.                         ***
--- ************************************************
---

CREATE VIEW free_ring_duplication AS
  SELECT
    feature_id AS free_ring_duplication_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'free_ring_duplication';

--- ************************************************
--- *** relation: complex_chromosomal_mutation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosome structure variant with 4 or ***
--- ***  more breakpoints.                       ***
--- ************************************************
---

CREATE VIEW complex_chromosomal_mutation AS
  SELECT
    feature_id AS complex_chromosomal_mutation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'complex_chromosomal_mutation';

--- ************************************************
--- *** relation: deficient_translocation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosomal deletion whereby a translo ***
--- *** cation occurs in which one of the four b ***
--- *** roken ends loses a segment before re-joi ***
--- *** ning.                                    ***
--- ************************************************
---

CREATE VIEW deficient_translocation AS
  SELECT
    feature_id AS deficient_translocation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'deficient_translocation';

--- ************************************************
--- *** relation: inversion_cum_translocation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosomal translocation whereby the  ***
--- *** first two breaks are in the same chromos ***
--- *** ome, and the region between them is rejo ***
--- *** ined in inverted order to the other side ***
--- ***  of the first break, such that both side ***
--- *** s of break one are present on the same c ***
--- *** hromosome. The remaining free ends are j ***
--- *** oined as a translocation with those resu ***
--- *** lting from the third break.              ***
--- ************************************************
---

CREATE VIEW inversion_cum_translocation AS
  SELECT
    feature_id AS inversion_cum_translocation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'inversion_cum_translocation';

--- ************************************************
--- *** relation: bipartite_duplication ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An interchromosomal mutation whereby the ***
--- ***  (large) region between the first two br ***
--- *** eaks listed is lost, and the two flankin ***
--- *** g segments (one of them centric) are joi ***
--- *** ned as a translocation to the free ends  ***
--- *** resulting from the third break.          ***
--- ************************************************
---

CREATE VIEW bipartite_duplication AS
  SELECT
    feature_id AS bipartite_duplication_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'bipartite_duplication';

--- ************************************************
--- *** relation: cyclic_translocation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosomal translocation whereby thre ***
--- *** e breaks occurred in three different chr ***
--- *** omosomes. The centric segment resulting  ***
--- *** from the first break listed is joined to ***
--- ***  the acentric segment resulting from the ***
--- ***  second, rather than the third.          ***
--- ************************************************
---

CREATE VIEW cyclic_translocation AS
  SELECT
    feature_id AS cyclic_translocation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cyclic_translocation';

--- ************************************************
--- *** relation: bipartite_inversion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosomal inversion caused by three  ***
--- *** breaks in the same chromosome; both cent ***
--- *** ral segments are inverted in place (i.e. ***
--- *** , they are not transposed).              ***
--- ************************************************
---

CREATE VIEW bipartite_inversion AS
  SELECT
    feature_id AS bipartite_inversion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'bipartite_inversion';

--- ************************************************
--- *** relation: uninvert_insert_dup ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An insertional duplication where a copy  ***
--- *** of the segment between the first two bre ***
--- *** aks listed is inserted at the third brea ***
--- *** k; the insertion is in cytologically the ***
--- ***  same orientation as its flanking segmen ***
--- *** ts.                                      ***
--- ************************************************
---

CREATE VIEW uninvert_insert_dup AS
  SELECT
    feature_id AS uninvert_insert_dup_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'uninverted_insertional_duplication';

--- ************************************************
--- *** relation: inverted_insertional_duplication ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An insertional duplication where a copy  ***
--- *** of the segment between the first two bre ***
--- *** aks listed is inserted at the third brea ***
--- *** k; the insertion is in cytologically inv ***
--- *** erted orientation with respect to its fl ***
--- *** anking segments.                         ***
--- ************************************************
---

CREATE VIEW inverted_insertional_duplication AS
  SELECT
    feature_id AS inverted_insertional_duplication_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inverted_insertional_duplication';

--- ************************************************
--- *** relation: insertional_duplication ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosome duplication involving the i ***
--- *** nsertion of a duplicated region (as oppo ***
--- *** sed to a free duplication).              ***
--- ************************************************
---

CREATE VIEW insertional_duplication AS
  SELECT
    feature_id AS insertional_duplication_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'uninverted_insertional_duplication' OR cvterm.name = 'inverted_insertional_duplication' OR cvterm.name = 'unoriented_insertional_duplication' OR cvterm.name = 'insertional_duplication';

--- ************************************************
--- *** relation: interchromosomal_transposition ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosome structure variation whereby ***
--- ***  a transposition occurred between chromo ***
--- *** somes.                                   ***
--- ************************************************
---

CREATE VIEW interchromosomal_transposition AS
  SELECT
    feature_id AS interchromosomal_transposition_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'deficient_interchromosomal_transposition' OR cvterm.name = 'inverted_interchromosomal_transposition' OR cvterm.name = 'uninverted_interchromosomal_transposition' OR cvterm.name = 'unoriented_interchromosomal_transposition' OR cvterm.name = 'interchromosomal_transposition';

--- ************************************************
--- *** relation: invert_inter_transposition ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An interchromosomal transposition whereb ***
--- *** y a copy of the segment between the firs ***
--- *** t two breaks listed is inserted at the t ***
--- *** hird break; the insertion is in cytologi ***
--- *** cally inverted orientation with respect  ***
--- *** to its flanking segment.                 ***
--- ************************************************
---

CREATE VIEW invert_inter_transposition AS
  SELECT
    feature_id AS invert_inter_transposition_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inverted_interchromosomal_transposition';

--- ************************************************
--- *** relation: uninvert_inter_transposition ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An interchromosomal transition where the ***
--- ***  segment between the first two breaks li ***
--- *** sted is removed and inserted at the thir ***
--- *** d break; the insertion is in cytological ***
--- *** ly the same orientation as its flanking  ***
--- *** segments.                                ***
--- ************************************************
---

CREATE VIEW uninvert_inter_transposition AS
  SELECT
    feature_id AS uninvert_inter_transposition_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'uninverted_interchromosomal_transposition';

--- ************************************************
--- *** relation: invert_intra_transposition ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An intrachromosomal transposition whereb ***
--- *** y the segment between the first two brea ***
--- *** ks listed is removed and inserted at the ***
--- ***  third break; the insertion is in cytolo ***
--- *** gically inverted orientation with respec ***
--- *** t to its flanking segments.              ***
--- ************************************************
---

CREATE VIEW invert_intra_transposition AS
  SELECT
    feature_id AS invert_intra_transposition_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'inverted_intrachromosomal_transposition';

--- ************************************************
--- *** relation: uninvert_intra_transposition ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An intrachromosomal transposition whereb ***
--- *** y the segment between the first two brea ***
--- *** ks listed is removed and inserted at the ***
--- ***  third break; the insertion is in cytolo ***
--- *** gically the same orientation as its flan ***
--- *** king segments.                           ***
--- ************************************************
---

CREATE VIEW uninvert_intra_transposition AS
  SELECT
    feature_id AS uninvert_intra_transposition_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'uninverted_intrachromosomal_transposition';

--- ************************************************
--- *** relation: unorient_insert_dup ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An insertional duplication where a copy  ***
--- *** of the segment between the first two bre ***
--- *** aks listed is inserted at the third brea ***
--- *** k; the orientation of the insertion with ***
--- ***  respect to its flanking segments is not ***
--- ***  recorded.                               ***
--- ************************************************
---

CREATE VIEW unorient_insert_dup AS
  SELECT
    feature_id AS unorient_insert_dup_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'unoriented_insertional_duplication';

--- ************************************************
--- *** relation: unoriented_interchromosomal_transposition ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An interchromosomal transposition whereb ***
--- *** y a copy of the segment between the firs ***
--- *** t two breaks listed is inserted at the t ***
--- *** hird break; the orientation of the inser ***
--- *** tion with respect to its flanking segmen ***
--- *** ts is not recorded.                      ***
--- ************************************************
---

CREATE VIEW unoriented_interchromosomal_transposition AS
  SELECT
    feature_id AS unoriented_interchromosomal_transposition_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'unoriented_interchromosomal_transposition';

--- ************************************************
--- *** relation: unoriented_intrachromosomal_transposition ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An intrachromosomal transposition whereb ***
--- *** y the segment between the first two brea ***
--- *** ks listed is removed and inserted at the ***
--- ***  third break; the orientation of the ins ***
--- *** ertion with respect to its flanking segm ***
--- *** ents is not recorded.                    ***
--- ************************************************
---

CREATE VIEW unoriented_intrachromosomal_transposition AS
  SELECT
    feature_id AS unoriented_intrachromosomal_transposition_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'unoriented_intrachromosomal_transposition';

--- ************************************************
--- *** relation: uncharacterised_chromosomal_mutation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW uncharacterised_chromosomal_mutation AS
  SELECT
    feature_id AS uncharacterised_chromosomal_mutation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'partially_characterised_chromosomal_mutation' OR cvterm.name = 'uncharacterised_chromosomal_mutation';

--- ************************************************
--- *** relation: deficient_inversion ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A chromosomal deletion whereby three bre ***
--- *** aks occur in the same chromosome; one ce ***
--- *** ntral region is lost, and the other is i ***
--- *** nverted.                                 ***
--- ************************************************
---

CREATE VIEW deficient_inversion AS
  SELECT
    feature_id AS deficient_inversion_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'deficient_inversion';

--- ************************************************
--- *** relation: tandem_duplication ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A duplication consisting of 2 identical  ***
--- *** adjacent regions.                        ***
--- ************************************************
---

CREATE VIEW tandem_duplication AS
  SELECT
    feature_id AS tandem_duplication_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'direct_tandem_duplication' OR cvterm.name = 'inverted_tandem_duplication' OR cvterm.name = 'tandem_duplication';

--- ************************************************
--- *** relation: partially_characterised_chromosomal_mutation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW partially_characterised_chromosomal_mutation AS
  SELECT
    feature_id AS partially_characterised_chromosomal_mutation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'partially_characterised_chromosomal_mutation';

--- ************************************************
--- *** relation: chromosome_number_variation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A kind of chromosome variation where the ***
--- ***  chromosome complement is not an exact m ***
--- *** ultiple of the haploid number.           ***
--- ************************************************
---

CREATE VIEW chromosome_number_variation AS
  SELECT
    feature_id AS chromosome_number_variation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'aneuploid' OR cvterm.name = 'polyploid' OR cvterm.name = 'hyperploid' OR cvterm.name = 'hypoploid' OR cvterm.name = 'autopolyploid' OR cvterm.name = 'allopolyploid' OR cvterm.name = 'chromosome_number_variation';

--- ************************************************
--- *** relation: chromosome_structure_variation ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW chromosome_structure_variation AS
  SELECT
    feature_id AS chromosome_structure_variation_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'free_chromosome_arm' OR cvterm.name = 'chromosomal_transposition' OR cvterm.name = 'aneuploid_chromosome' OR cvterm.name = 'intrachromosomal_mutation' OR cvterm.name = 'interchromosomal_mutation' OR cvterm.name = 'chromosomal_duplication' OR cvterm.name = 'compound_chromosome' OR cvterm.name = 'autosynaptic_chromosome' OR cvterm.name = 'complex_chromosomal_mutation' OR cvterm.name = 'uncharacterised_chromosomal_mutation' OR cvterm.name = 'intrachromosomal_transposition' OR cvterm.name = 'interchromosomal_transposition' OR cvterm.name = 'deficient_intrachromosomal_transposition' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'uninverted_intrachromosomal_transposition' OR cvterm.name = 'unoriented_intrachromosomal_transposition' OR cvterm.name = 'deficient_interchromosomal_transposition' OR cvterm.name = 'inverted_interchromosomal_transposition' OR cvterm.name = 'uninverted_interchromosomal_transposition' OR cvterm.name = 'unoriented_interchromosomal_transposition' OR cvterm.name = 'inversion_derived_aneuploid_chromosome' OR cvterm.name = 'chromosomal_deletion' OR cvterm.name = 'chromosomal_inversion' OR cvterm.name = 'intrachromosomal_duplication' OR cvterm.name = 'ring_chromosome' OR cvterm.name = 'chromosome_fission' OR cvterm.name = 'deficient_intrachromosomal_transposition' OR cvterm.name = 'inversion_derived_bipartite_deficiency' OR cvterm.name = 'inversion_derived_deficiency_plus_duplication' OR cvterm.name = 'inversion_derived_deficiency_plus_aneuploid' OR cvterm.name = 'deficient_translocation' OR cvterm.name = 'deficient_inversion' OR cvterm.name = 'inverted_ring_chromosome' OR cvterm.name = 'pericentric_inversion' OR cvterm.name = 'paracentric_inversion' OR cvterm.name = 'inversion_cum_translocation' OR cvterm.name = 'bipartite_inversion' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'deficient_inversion' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'inversion_derived_deficiency_plus_duplication' OR cvterm.name = 'inversion_derived_bipartite_duplication' OR cvterm.name = 'inversion_derived_duplication_plus_aneuploid' OR cvterm.name = 'intrachromosomal_transposition' OR cvterm.name = 'bipartite_duplication' OR cvterm.name = 'deficient_intrachromosomal_transposition' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'uninverted_intrachromosomal_transposition' OR cvterm.name = 'unoriented_intrachromosomal_transposition' OR cvterm.name = 'inverted_ring_chromosome' OR cvterm.name = 'free_ring_duplication' OR cvterm.name = 'chromosomal_translocation' OR cvterm.name = 'bipartite_duplication' OR cvterm.name = 'interchromosomal_transposition' OR cvterm.name = 'translocation_element' OR cvterm.name = 'Robertsonian_fusion' OR cvterm.name = 'reciprocal_chromosomal_translocation' OR cvterm.name = 'deficient_translocation' OR cvterm.name = 'inversion_cum_translocation' OR cvterm.name = 'cyclic_translocation' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'deficient_interchromosomal_transposition' OR cvterm.name = 'inverted_interchromosomal_transposition' OR cvterm.name = 'uninverted_interchromosomal_transposition' OR cvterm.name = 'unoriented_interchromosomal_transposition' OR cvterm.name = 'interchromosomal_duplication' OR cvterm.name = 'intrachromosomal_duplication' OR cvterm.name = 'free_duplication' OR cvterm.name = 'insertional_duplication' OR cvterm.name = 'inversion_derived_deficiency_plus_duplication' OR cvterm.name = 'inversion_derived_bipartite_duplication' OR cvterm.name = 'inversion_derived_duplication_plus_aneuploid' OR cvterm.name = 'intrachromosomal_transposition' OR cvterm.name = 'bipartite_duplication' OR cvterm.name = 'deficient_intrachromosomal_transposition' OR cvterm.name = 'inverted_intrachromosomal_transposition' OR cvterm.name = 'uninverted_intrachromosomal_transposition' OR cvterm.name = 'unoriented_intrachromosomal_transposition' OR cvterm.name = 'free_ring_duplication' OR cvterm.name = 'uninverted_insertional_duplication' OR cvterm.name = 'inverted_insertional_duplication' OR cvterm.name = 'unoriented_insertional_duplication' OR cvterm.name = 'compound_chromosome_arm' OR cvterm.name = 'homo_compound_chromosome' OR cvterm.name = 'hetero_compound_chromosome' OR cvterm.name = 'dexstrosynaptic_chromosome' OR cvterm.name = 'laevosynaptic_chromosome' OR cvterm.name = 'partially_characterised_chromosomal_mutation' OR cvterm.name = 'chromosome_structure_variation';

--- ************************************************
--- *** relation: alternatively_spliced_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A transcript that is alternatively splic ***
--- *** ed.                                      ***
--- ************************************************
---

CREATE VIEW alternatively_spliced_transcript AS
  SELECT
    feature_id AS alternatively_spliced_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'alternatively_spliced_transcript';

--- ************************************************
--- *** relation: encodes_1_polypeptide ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is alternately spliced, but  ***
--- *** encodes only one polypeptide.            ***
--- ************************************************
---

CREATE VIEW encodes_1_polypeptide AS
  SELECT
    feature_id AS encodes_1_polypeptide_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'encodes_1_polypeptide';

--- ************************************************
--- *** relation: encodes_greater_than_1_polypeptide ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is alternately spliced, and  ***
--- *** encodes more than one polypeptide.       ***
--- ************************************************
---

CREATE VIEW encodes_greater_than_1_polypeptide AS
  SELECT
    feature_id AS encodes_greater_than_1_polypeptide_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'encodes_disjoint_polypeptides' OR cvterm.name = 'encodes_overlapping_peptides' OR cvterm.name = 'encodes_different_polypeptides_different_stop' OR cvterm.name = 'encodes_overlapping_peptides_different_start' OR cvterm.name = 'encodes_overlapping_polypeptides_different_start_and_stop' OR cvterm.name = 'encodes_greater_than_1_polypeptide';

--- ************************************************
--- *** relation: encodes_different_polypeptides_different_stop ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is alternately spliced, and  ***
--- *** encodes more than one polypeptide, that  ***
--- *** have overlapping peptide sequences, but  ***
--- *** use different stop codons.               ***
--- ************************************************
---

CREATE VIEW encodes_different_polypeptides_different_stop AS
  SELECT
    feature_id AS encodes_different_polypeptides_different_stop_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'encodes_different_polypeptides_different_stop';

--- ************************************************
--- *** relation: encodes_overlapping_peptides_different_start ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is alternately spliced, and  ***
--- *** encodes more than one polypeptide, that  ***
--- *** have overlapping peptide sequences, but  ***
--- *** use different start codons.              ***
--- ************************************************
---

CREATE VIEW encodes_overlapping_peptides_different_start AS
  SELECT
    feature_id AS encodes_overlapping_peptides_different_start_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'encodes_overlapping_peptides_different_start';

--- ************************************************
--- *** relation: encodes_disjoint_polypeptides ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is alternately spliced, and  ***
--- *** encodes more than one polypeptide, that  ***
--- *** do not have overlapping peptide sequence ***
--- *** s.                                       ***
--- ************************************************
---

CREATE VIEW encodes_disjoint_polypeptides AS
  SELECT
    feature_id AS encodes_disjoint_polypeptides_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'encodes_disjoint_polypeptides';

--- ************************************************
--- *** relation: encodes_overlapping_polypeptides_different_start_and_stop ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is alternately spliced, and  ***
--- *** encodes more than one polypeptide, that  ***
--- *** have overlapping peptide sequences, but  ***
--- *** use different start and stop codons.     ***
--- ************************************************
---

CREATE VIEW encodes_overlapping_polypeptides_different_start_and_stop AS
  SELECT
    feature_id AS encodes_overlapping_polypeptides_different_start_and_stop_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'encodes_overlapping_polypeptides_different_start_and_stop';

--- ************************************************
--- *** relation: encodes_overlapping_peptides ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene that is alternately spliced, and  ***
--- *** encodes more than one polypeptide, that  ***
--- *** have overlapping peptide sequences.      ***
--- ************************************************
---

CREATE VIEW encodes_overlapping_peptides AS
  SELECT
    feature_id AS encodes_overlapping_peptides_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'encodes_different_polypeptides_different_stop' OR cvterm.name = 'encodes_overlapping_peptides_different_start' OR cvterm.name = 'encodes_overlapping_polypeptides_different_start_and_stop' OR cvterm.name = 'encodes_overlapping_peptides';

--- ************************************************
--- *** relation: cryptogene ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A maxicircle gene so extensively edited  ***
--- *** that it cannot be matched to its edited  ***
--- *** mRNA sequence.                           ***
--- ************************************************
---

CREATE VIEW cryptogene AS
  SELECT
    feature_id AS cryptogene_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'cryptogene';

--- ************************************************
--- *** relation: dicistronic_primary_transcript ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A primary transcript that has the qualit ***
--- *** y dicistronic.                           ***
--- ************************************************
---

CREATE VIEW dicistronic_primary_transcript AS
  SELECT
    feature_id AS dicistronic_primary_transcript_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'dicistronic_primary_transcript';

--- ************************************************
--- *** relation: member_of_regulon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- ************************************************
---

CREATE VIEW member_of_regulon AS
  SELECT
    feature_id AS member_of_regulon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'member_of_regulon';

--- ************************************************
--- *** relation: cds_independently_known ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A CDS with the evidence status of being  ***
--- *** independently known.                     ***
--- ************************************************
---

CREATE VIEW cds_independently_known AS
  SELECT
    feature_id AS cds_independently_known_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'CDS_independently_known';

--- ************************************************
--- *** relation: orphan_cds ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A CDS whose predicted amino acid sequenc ***
--- *** e is unsupported by any experimental evi ***
--- *** dence or by any match with any other kno ***
--- *** wn sequence.                             ***
--- ************************************************
---

CREATE VIEW orphan_cds AS
  SELECT
    feature_id AS orphan_cds_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'orphan_CDS';

--- ************************************************
--- *** relation: cds_supported_by_domain_match_data ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A CDS that is supported by domain simila ***
--- *** rity.                                    ***
--- ************************************************
---

CREATE VIEW cds_supported_by_domain_match_data AS
  SELECT
    feature_id AS cds_supported_by_domain_match_data_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'CDS_supported_by_domain_match_data';

--- ************************************************
--- *** relation: cds_supported_by_sequence_similarity_data ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A CDS that is supported by sequence simi ***
--- *** larity data.                             ***
--- ************************************************
---

CREATE VIEW cds_supported_by_sequence_similarity_data AS
  SELECT
    feature_id AS cds_supported_by_sequence_similarity_data_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'CDS_supported_by_domain_match_data' OR cvterm.name = 'CDS_supported_by_EST_or_cDNA_data' OR cvterm.name = 'CDS_supported_by_sequence_similarity_data';

--- ************************************************
--- *** relation: cds_predicted ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A CDS that is predicted.                 ***
--- ************************************************
---

CREATE VIEW cds_predicted AS
  SELECT
    feature_id AS cds_predicted_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'orphan_CDS' OR cvterm.name = 'CDS_supported_by_sequence_similarity_data' OR cvterm.name = 'CDS_supported_by_domain_match_data' OR cvterm.name = 'CDS_supported_by_EST_or_cDNA_data' OR cvterm.name = 'CDS_predicted';

--- ************************************************
--- *** relation: cds_supported_by_est_or_cdna_data ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A CDS that is supported by similarity to ***
--- ***  EST or cDNA data.                       ***
--- ************************************************
---

CREATE VIEW cds_supported_by_est_or_cdna_data AS
  SELECT
    feature_id AS cds_supported_by_est_or_cdna_data_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'CDS_supported_by_EST_or_cDNA_data';

--- ************************************************
--- *** relation: internal_shine_dalgarno_sequence ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A Shine-Dalgarno sequence that stimulate ***
--- *** s recoding through interactions with the ***
--- ***  anti-Shine-Dalgarno in the RNA of small ***
--- ***  ribosomal subunits of translating ribos ***
--- *** omes. The signal is only operative in Ba ***
--- *** cteria.                                  ***
--- ************************************************
---

CREATE VIEW internal_shine_dalgarno_sequence AS
  SELECT
    feature_id AS internal_shine_dalgarno_sequence_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'internal_Shine_Dalgarno_sequence';

--- ************************************************
--- *** relation: recoded_mrna ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The sequence of a mature mRNA transcript ***
--- *** , modified before translation or during  ***
--- *** translation, usually by special cis-acti ***
--- *** ng signals.                              ***
--- ************************************************
---

CREATE VIEW recoded_mrna AS
  SELECT
    feature_id AS recoded_mrna_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mRNA_recoded_by_translational_bypass' OR cvterm.name = 'mRNA_recoded_by_codon_redefinition' OR cvterm.name = 'recoded_mRNA';

--- ************************************************
--- *** relation: minus_1_translationally_frameshifted ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a translational  ***
--- *** frameshift of -1.                        ***
--- ************************************************
---

CREATE VIEW minus_1_translationally_frameshifted AS
  SELECT
    feature_id AS minus_1_translationally_frameshifted_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'minus_1_translationally_frameshifted';

--- ************************************************
--- *** relation: plus_1_translationally_frameshifted ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An attribute describing a translational  ***
--- *** frameshift of +1.                        ***
--- ************************************************
---

CREATE VIEW plus_1_translationally_frameshifted AS
  SELECT
    feature_id AS plus_1_translationally_frameshifted_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'plus_1_translationally_frameshifted';

--- ************************************************
--- *** relation: mrna_recoded_by_translational_bypass ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A recoded_mRNA where translation was sus ***
--- *** pended at a particular codon and resumed ***
--- ***  at a particular non-overlapping downstr ***
--- *** eam codon.                               ***
--- ************************************************
---

CREATE VIEW mrna_recoded_by_translational_bypass AS
  SELECT
    feature_id AS mrna_recoded_by_translational_bypass_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mRNA_recoded_by_translational_bypass';

--- ************************************************
--- *** relation: mrna_recoded_by_codon_redefinition ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A recoded_mRNA that was modified by an a ***
--- *** lteration of codon meaning.              ***
--- ************************************************
---

CREATE VIEW mrna_recoded_by_codon_redefinition AS
  SELECT
    feature_id AS mrna_recoded_by_codon_redefinition_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'mRNA_recoded_by_codon_redefinition';

--- ************************************************
--- *** relation: recoding_stimulatory_region ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A site in an mRNA sequence that stimulat ***
--- *** es the recoding of a region in the same  ***
--- *** mRNA.                                    ***
--- ************************************************
---

CREATE VIEW recoding_stimulatory_region AS
  SELECT
    feature_id AS recoding_stimulatory_region_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'internal_Shine_Dalgarno_sequence' OR cvterm.name = 'SECIS_element' OR cvterm.name = 'three_prime_recoding_site' OR cvterm.name = 'five_prime_recoding_site' OR cvterm.name = 'stop_codon_signal' OR cvterm.name = 'three_prime_stem_loop_structure' OR cvterm.name = 'flanking_three_prime_quadruplet_recoding_signal' OR cvterm.name = 'three_prime_repeat_recoding_signal' OR cvterm.name = 'distant_three_prime_recoding_signal' OR cvterm.name = 'UAG_stop_codon_signal' OR cvterm.name = 'UAA_stop_codon_signal' OR cvterm.name = 'UGA_stop_codon_signal' OR cvterm.name = 'recoding_stimulatory_region';

--- ************************************************
--- *** relation: four_bp_start_codon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A non-canonical start codon with 4 base  ***
--- *** pairs.                                   ***
--- ************************************************
---

CREATE VIEW four_bp_start_codon AS
  SELECT
    feature_id AS four_bp_start_codon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'four_bp_start_codon';

--- ************************************************
--- *** relation: archaeal_intron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An intron characteristic of Archaeal tRN ***
--- *** A and rRNA genes, where intron transcrip ***
--- *** t generates a bulge-helix-bulge motif th ***
--- *** at is recognised by a splicing endoribon ***
--- *** uclease.                                 ***
--- ************************************************
---

CREATE VIEW archaeal_intron AS
  SELECT
    feature_id AS archaeal_intron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'archaeal_intron';

--- ************************************************
--- *** relation: trna_intron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** An intron found in tRNA that is spliced  ***
--- *** via endonucleolytic cleavage and ligatio ***
--- *** n rather than transesterification.       ***
--- ************************************************
---

CREATE VIEW trna_intron AS
  SELECT
    feature_id AS trna_intron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'tRNA_intron';

--- ************************************************
--- *** relation: ctg_start_codon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A non-canonical start codon of sequence  ***
--- *** CTG.                                     ***
--- ************************************************
---

CREATE VIEW ctg_start_codon AS
  SELECT
    feature_id AS ctg_start_codon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'CTG_start_codon';

--- ************************************************
--- *** relation: secis_element ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The incorporation of selenocysteine into ***
--- ***  a protein sequence is directed by an in ***
--- *** -frame UGA codon (usually a stop codon)  ***
--- *** within the coding region of the mRNA. Se ***
--- *** lenoprotein mRNAs contain a conserved se ***
--- *** condary structure in the 3' UTR that is  ***
--- *** required for the distinction of UGA stop ***
--- ***  from UGA selenocysteine. The selenocyst ***
--- *** eine insertion sequence (SECIS) is aroun ***
--- *** d 60 nt in length and adopts a hairpin s ***
--- *** tructure which is sufficiently well-defi ***
--- *** ned and conserved to act as a computatio ***
--- *** nal screen for selenoprotein genes.      ***
--- ************************************************
---

CREATE VIEW secis_element AS
  SELECT
    feature_id AS secis_element_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'SECIS_element';

--- ************************************************
--- *** relation: retron ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Sequence coding for a short, single-stra ***
--- *** nded, DNA sequence via a retrotransposed ***
--- ***  RNA intermediate; characteristic of som ***
--- *** e microbial genomes.                     ***
--- ************************************************
---

CREATE VIEW retron AS
  SELECT
    feature_id AS retron_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'retron';

--- ************************************************
--- *** relation: three_prime_recoding_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The recoding stimulatory signal located  ***
--- *** downstream of the recoding site.         ***
--- ************************************************
---

CREATE VIEW three_prime_recoding_site AS
  SELECT
    feature_id AS three_prime_recoding_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_stem_loop_structure' OR cvterm.name = 'flanking_three_prime_quadruplet_recoding_signal' OR cvterm.name = 'three_prime_repeat_recoding_signal' OR cvterm.name = 'distant_three_prime_recoding_signal' OR cvterm.name = 'three_prime_recoding_site';

--- ************************************************
--- *** relation: three_prime_stem_loop_structure ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A recoding stimulatory region, the stem- ***
--- *** loop secondary structural element is dow ***
--- *** nstream of the redefined region.         ***
--- ************************************************
---

CREATE VIEW three_prime_stem_loop_structure AS
  SELECT
    feature_id AS three_prime_stem_loop_structure_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_stem_loop_structure';

--- ************************************************
--- *** relation: five_prime_recoding_site ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The recoding stimulatory signal located  ***
--- *** upstream of the recoding site.           ***
--- ************************************************
---

CREATE VIEW five_prime_recoding_site AS
  SELECT
    feature_id AS five_prime_recoding_site_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'five_prime_recoding_site';

--- ************************************************
--- *** relation: flanking_three_prime_quadruplet_recoding_signal ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** Four base pair sequence immediately down ***
--- *** stream of the redefined region. The rede ***
--- *** fined region is a frameshift site. The q ***
--- *** uadruplet is 2 overlapping codons.       ***
--- ************************************************
---

CREATE VIEW flanking_three_prime_quadruplet_recoding_signal AS
  SELECT
    feature_id AS flanking_three_prime_quadruplet_recoding_signal_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'flanking_three_prime_quadruplet_recoding_signal';

--- ************************************************
--- *** relation: uag_stop_codon_signal ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A stop codon signal for a UAG stop codon ***
--- ***  redefinition.                           ***
--- ************************************************
---

CREATE VIEW uag_stop_codon_signal AS
  SELECT
    feature_id AS uag_stop_codon_signal_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'UAG_stop_codon_signal';

--- ************************************************
--- *** relation: uaa_stop_codon_signal ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A stop codon signal for a UAA stop codon ***
--- ***  redefinition.                           ***
--- ************************************************
---

CREATE VIEW uaa_stop_codon_signal AS
  SELECT
    feature_id AS uaa_stop_codon_signal_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'UAA_stop_codon_signal';

--- ************************************************
--- *** relation: regulon ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A group of genes, whether linked as a cl ***
--- *** uster or not, that respond to a common r ***
--- *** egulatory signal.                        ***
--- ************************************************
---

CREATE VIEW regulon AS
  SELECT
    feature_id AS regulon_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'regulon';

--- ************************************************
--- *** relation: uga_stop_codon_signal ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A stop codon signal for a UGA stop codon ***
--- ***  redefinition.                           ***
--- ************************************************
---

CREATE VIEW uga_stop_codon_signal AS
  SELECT
    feature_id AS uga_stop_codon_signal_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'UGA_stop_codon_signal';

--- ************************************************
--- *** relation: three_prime_repeat_recoding_signal ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A recoding stimulatory signal, downstrea ***
--- *** m sequence important for recoding that c ***
--- *** ontains repetitive elements.             ***
--- ************************************************
---

CREATE VIEW three_prime_repeat_recoding_signal AS
  SELECT
    feature_id AS three_prime_repeat_recoding_signal_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'three_prime_repeat_recoding_signal';

--- ************************************************
--- *** relation: distant_three_prime_recoding_signal ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A recoding signal that is found many hun ***
--- *** dreds of nucleotides 3' of a redefined s ***
--- *** top codon.                               ***
--- ************************************************
---

CREATE VIEW distant_three_prime_recoding_signal AS
  SELECT
    feature_id AS distant_three_prime_recoding_signal_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'distant_three_prime_recoding_signal';

--- ************************************************
--- *** relation: stop_codon_signal ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A recoding stimulatory signal that is a  ***
--- *** stop codon and has effect on efficiency  ***
--- *** of recoding.                             ***
--- ************************************************
---

CREATE VIEW stop_codon_signal AS
  SELECT
    feature_id AS stop_codon_signal_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'UAG_stop_codon_signal' OR cvterm.name = 'UAA_stop_codon_signal' OR cvterm.name = 'UGA_stop_codon_signal' OR cvterm.name = 'stop_codon_signal';

--- ************************************************
--- *** relation: databank_entry ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** The sequence referred to by an entry in  ***
--- *** a databank such as Genbank or SwissProt. ***
--- ************************************************
---

CREATE VIEW databank_entry AS
  SELECT
    feature_id AS databank_entry_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'databank_entry';

--- ************************************************
--- *** relation: gene_segment ***
--- *** relation type: VIEW                      ***
--- ***                                          ***
--- *** A gene component region which acts as a  ***
--- *** recombinational unit of a gene whose fun ***
--- *** ctional form is generated through somati ***
--- *** c recombination.                         ***
--- ************************************************
---

CREATE VIEW gene_segment AS
  SELECT
    feature_id AS gene_segment_id,
    feature.*
  FROM
    feature INNER JOIN cvterm ON (feature.type_id = cvterm.cvterm_id)
  WHERE cvterm.name = 'pseudogenic_gene_segment' OR cvterm.name = 'gene_segment';

CREATE TABLE sequence_cv_lookup_table (sequence_cv_lookup_table_id serial not null, primary key(sequence_cv_lookup_table_id), original_cvterm_name varchar(1024), relation_name varchar(128));
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transcription_variant','transcription_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('helitron','helitron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cleaved_initiator_methionine','cleaved_initiator_methionine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('epoxyqueuosine','epoxyqueuosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('u4atac_snrna','u4atac_snrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('kinetoplast','kinetoplast');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('elongated_out_of_frame_polypeptide_n_terminal','elongated_out_of_frame_polypeptide_n_terminal');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('shadow_enhancer','shadow_enhancer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('engineered','engineered');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rna_polymerase_ii_tata_box','rna_polymerase_ii_tata_box');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('seven_aminomethyl_seven_deazaguanosine','seven_aminomethyl_seven_deazaguanosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sequence_motif','sequence_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('low_complexity','low_complexity');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('est_match','est_match');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('v_nonamer','v_nonamer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('d_dj_j_c_cluster','d_dj_j_c_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rrna_21s','rrna_21s');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('bound_by_factor','bound_by_factor');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_carboxymethyluridine','five_carboxymethyluridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dinucleotide_repeat_microsatellite_feature','dinucleotide_repeat_microsatellite_feature');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('two_methylthio_n6_methyladenosine','two_methylthio_n6_methyladenosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('trans_spliced_mrna','trans_spliced_mrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('g_to_c_transversion','g_to_c_transversion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('heptamer_of_recombination_feature_of_vertebrate_immune_system_gene','heptamer_of_recombination_feature_of_vertebrate_im_sys_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('genotype','so_genotype');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cloned_region','cloned_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tmrna_coding_piece','tmrna_coding_piece');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rna_6s','rna_6s');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('x_element','x_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('minicircle','minicircle');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('grna_encoding','grna_encoding');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('endonuclease_spliced_intron','endonuclease_spliced_intron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('insertional_duplication','insertional_duplication');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('databank_entry','databank_entry');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('glycine','glycine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('variant_phenotype','variant_phenotype');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('v_cluster','v_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sl12_acceptor_site','sl12_acceptor_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_nickel_ion_contact_site','polypeptide_nickel_ion_contact_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('circular_single_stranded_rna_chromosome','circular_single_stranded_rna_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('wc_base_pair','wc_base_pair');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pcr_product','pcr_product');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('3_prime_utr_variant','three_prime_utr_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_three_amino_three_carboxypropyl_uridine','three_three_amino_three_carboxypropyl_uridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('site_specific_recombination_target_region','site_specific_recombination_target_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_with_polycistronic_transcript','gene_with_polycistronic_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rescue','rescue');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('nuclease_hypersensitive_site','nuclease_hypersensitive_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('upstream_gene_variant','upstream_gene_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mirna_loop','mirna_loop');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('double_stranded_cdna','double_stranded_cdna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_post_translational_processing_variant','polypeptide_post_translational_processing_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('2kb_upstream_variant','twokb_upstream_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('supported_by_domain_match','supported_by_domain_match');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('one_methylpseudouridine','one_methylpseudouridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('n_terminal_region','n_terminal_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('blunt_end_restriction_enzyme_cleavage_site','blunt_end_restriction_enzyme_cleavage_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('experimental_result_region','experimental_result_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('methionine_trna_primary_transcript','methionine_trna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('utr','utr');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('non_terminal_residue','non_terminal_residue');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('member_of_regulon','member_of_regulon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('threonine_trna_primary_transcript','thr_trna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cds_supported_by_sequence_similarity_data','cds_supported_by_sequence_similarity_data');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_structural_region','polypeptide_structural_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('trna_gene','trna_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_tungsten_ion_contact_site','polypeptide_tungsten_ion_contact_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('beta_bulge_loop_six','beta_bulge_loop_six');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('d_dj_c_cluster','d_dj_c_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sequence_location','sequence_location');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_nest_right_left_motif','polypeptide_nest_right_left_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('encodes_overlapping_polypeptides_different_start_and_stop','encodes_overlapping_polypeptides_different_start_and_stop');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('leucoplast_gene','leucoplast_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('y_rna','y_rna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('trans_spliced_transcript','trans_spliced_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inverted','inverted');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('splicing_regulatory_region','splicing_regulatory_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('branch_site','branch_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('beta_bulge_loop_five','beta_bulge_loop_five');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chromosome_breakpoint','chromosome_breakpoint');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sequence_uncertainty','sequence_uncertainty');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('n6_methyl_n6_threonylcarbamoyladenosine','n6_methyl_n6_threonylcarbamoyladenosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_with_mrna_with_frameshift','gene_with_mrna_with_frameshift');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('compositionally_biased_region_of_peptide','compositionally_biased_region_of_peptide');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('vj_j_c_cluster','vj_j_c_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pirna','pirna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('reverse_hoogsteen_base_pair','reverse_hoogsteen_base_pair');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tryptophanyl_trna','tryptophanyl_trna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polya_primed_cdna_clone','polya_primed_cdna_clone');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('leucoplast_chromosome','leucoplast_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('status','status');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('ltr_retrotransposon','ltr_retrotransposon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rnase_p_rna','rnase_p_rna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('conjugative_transposon','conjugative_transposon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('improved_high_quality_draft','improved_high_quality_draft');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('copy_number_gain','copy_number_gain');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('linkage_group','linkage_group');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_with_trans_spliced_transcript','gene_with_trans_spliced_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sl8_acceptor_site','sl8_acceptor_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('peptide_coil','peptide_coil');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pyrrolysine_trna_primary_transcript','pyrrolysine_trna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('v_vj_c_cluster','v_vj_c_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('phage_sequence','phage_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h3k79_methylation_site','h3k79_methylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('recoded','recoded');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transposon_fragment','transposon_fragment');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('vj_c_cluster','vj_c_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('editing_domain','editing_domain');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_methylaminomethyluridine','five_methylaminomethyluridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('centromere_dna_element_ii','centromere_dna_element_ii');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('alteration_attribute','alteration_attribute');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('non_ltr_retrotransposon_polymeric_tract','non_ltr_retrotransposon_polymeric_tract');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transversion','transversion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tryptophan','tryptophan');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('recursive_splice_site','recursive_splice_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_fusion','polypeptide_fusion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('insulator_binding_site','insulator_binding_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('increased_polyadenylation_variant','increased_polyadenylation_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('proline_trna_primary_transcript','proline_trna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('repeat_fragment','repeat_fragment');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('blocked_reading_frame','blocked_reading_frame');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rrna_cleavage_snorna_primary_transcript','rrna_cleavage_snorna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('n6_isopentenyladenosine','n6_isopentenyladenosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_l_arginine','modified_l_arginine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_conserved_motif','polypeptide_conserved_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('paracentric','paracentric');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('t3_rna_polymerase_promoter','t3_rna_polymerase_promoter');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inversion_derived_bipartite_duplication','inversion_derived_bipartite_duplication');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('trans_splice_acceptor_site','trans_splice_acceptor_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('a_box_type_2','a_box_type_2');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rre_rna','rre_rna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('two_prime_o_ribosyladenosine_phosphate','two_prime_o_riboA_phosphate');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pac_end','pac_end');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('extramembrane_polypeptide_region','extramembrane_polypeptide_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('copy_number_change','copy_number_change');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('intein','intein');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('endosomal_localization_signal','endosomal_localization_signal');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('twintron','twintron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('scrna_primary_transcript','scrna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_carboxymethylaminomethyl_two_prime_o_methyluridine','five_carboxymethylaminomethyl_two_prime_o_methyluridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('somatic_variant','somatic_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('duplication','duplication');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tmrna_encoding','tmrna_encoding');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_cobalt_ion_contact_site','polypeptide_cobalt_ion_contact_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('flanked','flanked');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inversion','inversion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('ctg_start_codon','ctg_start_codon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tyrosine_trna_primary_transcript','tyrosine_trna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('eukaryotic_terminator','eukaryotic_terminator');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('frt_flanked','frt_flanked');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('spliceosomal_intron_region','spliceosomal_intron_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('coding_region_of_exon','coding_region_of_exon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cloned_cdna_insert','cloned_cdna_insert');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('decreased_transcription_rate_variant','decreased_transcription_rate_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('v_vdj_c_cluster','v_vdj_c_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rnase_p_rna_gene','rnase_p_rna_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('translationally_regulated','translationally_regulated');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('histidyl_trna','histidyl_trna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sonicate_fragment','sonicate_fragment');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_with_recoded_mrna','gene_with_recoded_mrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('two_prime_o_methyluridine','two_prime_o_methyluridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cosmid','cosmid');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('silenced_by_rna_interference','silenced_by_rna_interference');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('non_conservative_missense_codon','non_conservative_missense_codon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('snorna','snorna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mature_transcript','mature_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pseudouridylation_guide_snorna','pseudouridylation_guide_snorna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('c_gene','c_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('processed_transcript','processed_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('floxed_gene','floxed_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('spot_42_rna','spot_42_rna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cdna_clone','cdna_clone');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cryptic_splice_site','cryptic_splice_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pseudogenic_gene_segment','pseudogenic_gene_segment');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_ltr','three_prime_ltr');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('group_ii_intron','group_ii_intron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rnase_mrp_rna_gene','rnase_mrp_rna_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('structural_alteration','structural_alteration');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pna_oligo','pna_oligo');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('insertion_sequence','insertion_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('junction','junction');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('paralogous','paralogous');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tna','tna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_isopentenylaminomethyl_two_thiouridine','five_isopentenylaminomethyl_two_thiouridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('nested_tandem_repeat','nested_tandem_repeat');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('minus_1_frameshift','minus_1_frameshift');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('non_canonical_three_prime_splice_site','non_canonical_three_prime_splice_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_with_non_canonical_start_codon','gene_with_non_canonical_start_codon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pseudogenic_rrna','pseudogenic_rrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('serine_threonine_turn','serine_threonine_turn');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('j_gene','j_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h3k27_trimethylation_site','h3k27_trimethylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('strna_primary_transcript','strna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('internal_eliminated_sequence','internal_eliminated_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('allelically_excluded_gene','allelically_excluded_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('qtl','qtl');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_est','three_prime_est');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('bred_motif','bred_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('reverse','reverse');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mirna_encoding','mirna_encoding');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('n2_n2_2_prime_o_trimethylguanosine','n2_n2_2_prime_o_trimethylguanosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('translational_product_function_variant','translational_product_function_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('encodes_alternate_transcription_start_sites','encodes_alternate_transcription_start_sites');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_array','gene_array');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tetranucleotide_repeat_microsatellite_feature','tetranuc_repeat_microsat');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_aminomethyl_two_thiouridine','five_aminomethyl_two_thiouridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('monocistronic_primary_transcript','monocistronic_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('snv','snv');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('direct','direct');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mobile_genetic_element','mobile_genetic_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_ligand_contact','polypeptide_ligand_contact');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('biomaterial_region','biomaterial_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transposable_element_flanking_region','transposable_element_flanking_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('symmetric_rna_internal_loop','symmetric_rna_internal_loop');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mrna_with_plus_1_frameshift','mrna_with_plus_1_frameshift');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transcriptionally_regulated','transcriptionally_regulated');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_prime_intron','five_prime_intron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('vertebrate_immune_system_gene_recombination_feature','vertebrate_immune_system_gene_recombination_feature');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_carboxyhydroxymethyl_uridine_methyl_ester','five_carboxyhydroxymethyl_uridine_methyl_ester');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chromosomal_transposition','chromosomal_transposition');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('proplastid_gene','proplastid_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('serine_trna_primary_transcript','serine_trna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('attp_site','attp_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('antisense','antisense');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('terminal_inverted_repeat_element','terminal_inverted_repeat_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('coiled_coil','coiled_coil');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('v_vdj_cluster','v_vdj_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('edited_transcript_by_a_to_i_substitution','edited_transcript_by_a_to_i_substitution');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('protein_coding_primary_transcript','protein_coding_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mite','mite');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cryptic_splice_site_variant','cryptic_splice_site_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('insertion','insertion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('secis_element','secis_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('maxicircle','maxicircle');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tss','tss');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pedigree_specific_variant','pedigree_specific_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cysteine','cysteine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('ribothymidine','ribothymidine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('non_adjacent_residues','non_adjacent_residues');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('histone_modification','histone_modification');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('internal_ribosome_entry_site','internal_ribosome_entry_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('outron','outron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_repeat','polypeptide_repeat');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('clone_insert_start','clone_insert_start');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('attr_site','attr_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dmv3_motif','dmv3_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('capped_mrna','capped_mrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sequence_rearrangement_feature','sequence_rearrangement_feature');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('apicoplast_chromosome','apicoplast_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('beta_turn_type_six_a_two','beta_turn_type_six_a_two');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('invalidated','invalidated');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('valine','valine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('translationally_regulated_gene','translationally_regulated_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('amino_acid_insertion','amino_acid_insertion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('promoter_targeting_sequence','promoter_targeting_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polinton','polinton');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('engineered_tag','engineered_tag');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('non_coding_exon_variant','non_coding_exon_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_methylcytidine','five_methylcytidine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sl5_acceptor_site','sl5_acceptor_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('positively_autoregulated','positively_autoregulated');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pseudouridine','pseudouridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('amplification_origin','amplification_origin');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('unoriented_insertional_duplication','unorient_insert_dup');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transcriptionally_constitutive','transcriptionally_constitutive');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('extrachromosomal_mobile_genetic_element','extrachromosomal_mobile_genetic_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('variant_origin','variant_origin');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('utr_region','utr_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mirna','mirna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tyrosine','tyrosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inr1_motif','inr1_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h2b_ubiquitination_site','h2b_ubiquitination_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('n6_acetyladenosine','n6_acetyladenosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cis_splice_site','cis_splice_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('floxed','floxed');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('beta_turn_right_handed_type_two','beta_turn_right_handed_type_two');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('utr_variant','utr_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('c_terminal_region','c_terminal_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transcription_regulatory_region','transcription_regulatory_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_l_leucine','modified_l_leucine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_prime_ltr_component','five_prime_ltr_component');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('histone_acylation_region','histone_acylation_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('vdj_c_cluster','vdj_c_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chromosome_part','chromosome_part');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transcriptional_cis_regulatory_region','transcriptional_cis_regulatory_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('phenylalanyl_trna','phenylalanyl_trna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('insertion_site','insertion_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gc_rich_promoter_region','gc_rich_promoter_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('overlapping_est_set','overlapping_est_set');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('asx_turn_right_handed_type_two','asx_turn_right_handed_type_two');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('anticodon_loop','anticodon_loop');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dmv5_motif','dmv5_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sl1_acceptor_site','sl1_acceptor_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cds_region','cds_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('regulatory_region_variant','regulatory_region_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h3k9_dimethylation_site','h3k9_dimethylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('stop_gained','stop_gained');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('telomerase_rna_gene','telomerase_rna_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('v_dj_j_c_cluster','v_dj_j_c_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('engineered_insert','engineered_insert');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('recombinationally_inverted_gene','recombinationally_inverted_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('microarray_oligo','microarray_oligo');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cassette_array_member','cassette_array_member');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('plus_1_frameshift_variant','plus_1_frameshift_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('u12_snrna','u12_snrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('supported_by_est_or_cdna','supported_by_est_or_cdna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('minus_10_signal','minus_10_signal');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('clone_insert_end','clone_insert_end');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inr_motif','inr_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_stem_loop_structure','three_prime_stem_loop_structure');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rflp_fragment','rflp_fragment');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('phage_rna_polymerase_promoter','phage_rna_polymerase_promoter');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pyrimidine_transition','pyrimidine_transition');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('intrinsically_unstructured_polypeptide_region','intrinsically_unstructured_polypeptide_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('n2_2_prime_o_dimethylguanosine','n2_2_prime_o_dimethylguanosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('exon_loss','exon_loss');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('archaeal_intron','archaeal_intron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('lna','lna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('exon_junction','exon_junction');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('t7_rna_polymerase_promoter','t7_rna_polymerase_promoter');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inverted_interchromosomal_transposition','invert_inter_transposition');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('episome','episome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('uninverted_insertional_duplication','uninvert_insert_dup');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('free','free');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sequence_difference','sequence_difference');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h4k5_acylation_site','h4k5_acylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('v_d_dj_c_cluster','v_d_dj_c_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sequence_conflict','sequence_conflict');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('nmd_transcript_variant','nmd_transcript_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tiling_path_clone','tiling_path_clone');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('group_iii_intron','group_iii_intron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_glycine','modified_glycine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sequence_alteration','sequence_alteration');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polyploid','polyploid');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mathematically_defined_repeat','mathematically_defined_repeat');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_silenced_by_dna_modification','gene_silenced_by_dna_modification');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('v_vj_j_cluster','v_vj_j_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('isoleucine_trna_primary_transcript','isoleucine_trna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rrna_small_subunit_primary_transcript','rrna_small_subunit_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('ltr_component','ltr_component');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('plus_2_framshift','plus_2_framshift');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('translational_product_structure_variant','translational_product_structure_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('glutamic_acid_trna_primary_transcript','glutamic_acid_trna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_rearranged_at_dna_level','gene_rearranged_at_dna_level');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('edited_transcript','edited_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('invalidated_by_partial_processing','invalidated_by_partial_processing');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('increased_transcript_stability_variant','increased_transcript_stability_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sequencing_primer','sequencing_primer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cleaved_for_gpi_anchor_region','cleaved_for_gpi_anchor_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_l_cysteine','modified_l_cysteine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_prime_utr','five_prime_utr');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('restriction_enzyme_recognition_site','restriction_enzyme_recognition_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('frt_site','frt_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('terminal_inverted_repeat','terminal_inverted_repeat');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('centromere_dna_element_i','centromere_dna_element_i');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transition','transition');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('deletion_junction','deletion_junction');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('beta_turn_right_handed_type_one','beta_turn_right_handed_type_one');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('two_prime_o_ribosylguanosine_phosphate','two_prime_o_ribosylguanosine_phosphate');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_carbamoylmethyl_two_prime_o_methyluridine','five_cm_2_prime_o_methU');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('internal_transcribed_spacer_region','internal_transcribed_spacer_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dicistronic','dicistronic');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('supported_by_sequence_similarity','supported_by_sequence_similarity');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('reverse_primer','reverse_primer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('u3_three_prime_ltr_region','u3_three_prime_ltr_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('glutamine_trna_primary_transcript','glutamine_trna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rnapol_ii_promoter','rnapol_ii_promoter');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('overlapping','overlapping');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('alpha_beta_motif','alpha_beta_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('engineered_transposable_element','engineered_transposable_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('forward_primer','forward_primer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('attctn_site','attctn_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_prime_d_recombination_signal_sequence','five_prime_d_recombination_signal_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('u6_snrna','u6_snrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('recombinationally_rearranged_gene','recombinationally_rearranged_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('n6_threonylcarbamoyladenosine','n6_threonylcarbamoyladenosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_carbamoylmethyluridine','five_carbamoylmethyluridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cds_fragment','cds_fragment');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('genome','genome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('increased_translational_product_level','increased_translational_product_level');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('translational_product_level_variant','translational_product_level_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('promoter','promoter');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('protein_coding_gene','protein_coding_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('u5_snrna','u5_snrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('wybutosine','wybutosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('methylwyosine','methylwyosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('large_subunit_rrna','large_subunit_rrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chromosomally_aberrant_genome','chromosomally_aberrant_genome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('n4_2_prime_o_dimethylcytidine','n4_2_prime_o_dimethylcytidine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('c_to_t_transition','c_to_t_transition');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('bidirectional_promoter','bidirectional_promoter');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('validated_cdna_clone','validated_cdna_clone');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('k_turn_rna_motif','k_turn_rna_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transcribed_fragment','transcribed_fragment');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_prime_ust','five_prime_ust');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_utr_intron','three_prime_utr_intron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('retrogene','retrogene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pyrimidine_to_purine_transversion','pyrimidine_to_purine_transversion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sine_element','sine_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_prime_rst','five_prime_rst');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('utr_intron','utr_intron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('interchromosomal_transposition','interchromosomal_transposition');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rna_sequence_secondary_structure','rna_sequence_secondary_structure');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('complex_change_in_transcript','complex_change_in_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('engineered_foreign_transposable_element','engineered_foreign_transposable_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('ds_rna_viral_sequence','ds_rna_viral_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('fosmid','fosmid');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('complex_substitution','complex_substitution');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('validated','validated');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('u2_snrna','u2_snrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('duplication_attribute','duplication_attribute');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('caat_signal','caat_signal');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('c_cluster','c_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('consensus_region','consensus_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('vertebrate_immune_system_gene_recombination_spacer','vertebrate_immune_system_gene_recombination_spacer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_restriction_enzyme_junction','three_prime_restriction_enzyme_junction');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_trap_construct','gene_trap_construct');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rna_aptamer','rna_aptamer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transcriptionally_induced','transcriptionally_induced');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('intrachromosomal','intrachromosomal');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('nuclear_localization_signal','nuclear_localization_signal');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rescue_region','rescue_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inversion_site_part','inversion_site_part');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('plus_2_frameshift variant','plus_2_frameshift_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('origin_of_replication','origin_of_replication');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('standard_draft','standard_draft');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h3k79_dimethylation_site','h3k79_dimethylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rna_internal_loop','rna_internal_loop');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('ultracontig','ultracontig');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('peptidyl','peptidyl');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_region','polypeptide_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('epigenetically_modified_region','epigenetically_modified_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transgenic_insertion','transgenic_insertion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mirna_antiguide','mirna_antiguide');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rearranged_at_dna_level','rearranged_at_dna_level');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('intergenic_variant','intergenic_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('v_spacer','v_spacer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('strand_attribute','strand_attribute');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('stop_lost','stop_lost');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('alternatively_spliced','alternatively_spliced');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_formyl_two_prime_o_methylcytidine','five_formyl_two_prime_o_methylcytidine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('plasmid_location','plasmid_location');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('four_bp_start_codon','four_bp_start_codon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('increased_transcription_rate_variant','increased_transcription_rate_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('recombinationally_rearranged','recombinationally_rearranged');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('complex_3d_structural_variant','complex_3d_structural_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chimeric_cdna_clone','chimeric_cdna_clone');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tasirna_primary_transcript','tasirna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_with_dicistronic_transcript','gene_with_dicistronic_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_ltr_component','three_prime_ltr_component');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('retron','retron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('autopolyploid','autopolyploid');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('phenylalanine','phenylalanine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('translation_regulatory_region','translation_regulatory_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transit_peptide','transit_peptide');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('amino_acid_deletion','amino_acid_deletion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rrna_28s','rrna_28s');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('one_two_prime_o_dimethylinosine','one_two_prime_o_dimethylinosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('threonine','threonine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('a_minor_rna_motif','a_minor_rna_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('j_cluster','j_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dce','dce');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('quantitative_variant','quantitative_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('lysosomal_localization_signal','lysosomal_localization_signal');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('d_dj_cluster','d_dj_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chromosome_arm','chromosome_arm');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('kinetoplast_gene','kinetoplast_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('line_element','line_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('solo_ltr','solo_ltr');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('external_transcribed_spacer_region','external_transcribed_spacer_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('non_transcribed_region','non_transcribed_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mirna_stem','mirna_stem');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dj_j_c_cluster','dj_j_c_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('hyperploid','hyperploid');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cryptic','cryptic');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h3k9_acetylation_site','h3k9_acetylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('alpha_helix','alpha_helix');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('fusion','fusion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('vdj_j_cluster','vdj_j_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('isowyosine','isowyosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('paracentric_inversion','paracentric_inversion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('homing_endonuclease_binding_site','homing_endonuclease_binding_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tna_oligo','tna_oligo');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mini_gene','mini_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('restriction_fragment','restriction_fragment');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('base_pair','base_pair');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inside_intron_antiparallel','inside_intron_antiparallel');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dna_binding_site','dna_binding_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_cytidine','modified_cytidine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('hydrophobic_region_of_peptide','hydrophobic_region_of_peptide');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polycistronic_primary_transcript','polycistronic_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_l_proline','modified_l_proline');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('overlapping_feature_set','overlapping_feature_set');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('asx_turn_left_handed_type_two','asx_turn_left_handed_type_two');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('interchromosomal_duplication','interchromosomal_duplication');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inframe_codon_loss','inframe_codon_loss');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('substitution','substitution');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('isoleucine','isoleucine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('functional_variant','functional_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_recoding_site','three_prime_recoding_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transcript_stability_variant','transcript_stability_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('5kb_upstream_variant','fivekb_upstream_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('terminator_of_type_2_rnapol_iii_promoter','terminator_of_type_2_rnapol_iii_promoter');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('glycine_trna_primary_transcript','glycine_trna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('intron_variant','intron_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('regional_centromere_outer_repeat_region','regional_centromere_outer_repeat_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('replication_regulatory_region','replication_regulatory_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mating_type_region','mating_type_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('v_heptamer','v_heptamer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dispersed_repeat','dispersed_repeat');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('primer','primer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_domain','polypeptide_domain');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('wild_type','wild_type');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('fusion_gene','fusion_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transcript_function_variant','transcript_function_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_member_region','gene_member_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('arginyl_trna','arginyl_trna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('compensatory_transcript_secondary_structure_variant','compensatory_transcript_secondary_structure_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('methylated_base_feature','methylated_base_feature');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('uninverted_intrachromosomal_transposition','uninvert_intra_transposition');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('scrna_gene','scrna_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rrna_18s','rrna_18s');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rnapol_iii_promoter_type_1','rnapol_iii_promoter_type_1');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('point_mutation','point_mutation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pseudoknot','pseudoknot');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('g_quartet','g_quartet');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('schellmann_loop','schellmann_loop');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_l_selenocysteine','modified_l_selenocysteine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pna','pna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_coding_exon','three_prime_coding_exon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('endogenous_retroviral_gene','endogenous_retroviral_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('vertebrate_immunoglobulin_t_cell_receptor_segment','vertebrate_immunoglobulin_t_cell_receptor_segment');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mrna_recoded_by_translational_bypass','mrna_recoded_by_translational_bypass');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('engineered_foreign_region','engineered_foreign_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('snorna_encoding','snorna_encoding');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_prime_est','five_prime_est');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('foldback_element','foldback_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('srp_rna_encoding','srp_rna_encoding');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('d_j_c_cluster','d_j_c_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dj_c_cluster','dj_c_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('histone_ubiqitination_site','histone_ubiqitination_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('complex_structural_alteration','complex_structural_alteration');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rrna_encoding','rrna_encoding');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mrna_recoded_by_codon_redefinition','mrna_recoded_by_codon_redefinition');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_methyluridine','five_methyluridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polya_sequence','polya_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('metabolic_island','metabolic_island');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('homologous','homologous');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('immature_peptide_region','immature_peptide_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h2bk5_monomethylation_site','h2bk5_monomethylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sequence_attribute','sequence_attribute');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sirna','sirna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dart_marker','dart_marker');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('nucleotide_motif','nucleotide_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('plus_1_translationally_frameshifted','plus_1_translationally_frameshifted');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('trna_intron','trna_intron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_prime_noncoding_exon','five_prime_noncoding_exon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dna_motif','dna_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('beta_strand','beta_strand');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('ds_oligo','ds_oligo');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('one_methyladenosine','one_methyladenosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('oxys_rna','oxys_rna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('asx_motif','asx_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_hydroxyuridine','five_hydroxyuridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('coding_exon','coding_exon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('plus_1_translational_frameshift','plus_1_translational_frameshift');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_formylcytidine','five_formylcytidine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h3k27_dimethylation_site','h3k27_dimethylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('spliced_leader_rna','spliced_leader_rna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mitochondrial_chromosome','mitochondrial_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_fragment','gene_fragment');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('n2_7_2prirme_o_trimethylguanosine','n2_7_2prirme_o_trimethylguanosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('frameshift','frameshift');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('propeptide_cleavage_site','propeptide_cleavage_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_methyldihydrouridine','five_methyldihydrouridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('amino_acid','amino_acid');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('translocation_breakpoint','translocation_breakpoint');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rrna_5_8s','rrna_5_8s');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('helix_turn_helix','helix_turn_helix');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('simple_sequence_length_variation','simple_sequence_length_variation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('methionine','methionine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_loss_of_function_variant','polypeptide_loss_of_function_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transposable_element_gene','transposable_element_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('whole_genome_sequence_status','whole_genome_sequence_status');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('genomic_island','genomic_island');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_segment','gene_segment');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('snrna_gene','snrna_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('engineered_region','engineered_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('common_variant','common_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cryptogene','cryptogene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_coding_exon_noncoding_region','three_prime_coding_exon_noncoding_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_silenced_by_rna_interference','gene_silenced_by_rna_interference');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('deficient_interchromosomal_transposition','d_interchr_transposition');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('natural_variant_site','natural_variant_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('assembly','assembly');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('major_tss','major_tss');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('trna','trna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('encodes_overlapping_peptides','encodes_overlapping_peptides');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('nc_conserved_region','nc_conserved_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('locus_control_region','locus_control_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('s_gna_oligo','s_gna_oligo');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dna_chromosome','dna_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('beta_turn_type_six_b','beta_turn_type_six_b');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('loss_of_heterozygosity','loss_of_heterozygosity');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('engineered_gene','engineered_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('wobble_base_pair','wobble_base_pair');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_amino_acid_feature','modified_amino_acid_feature');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('t_to_c_transition','t_to_c_transition');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('translocaton_attribute','translocaton_attribute');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('apicoplast_sequence','apicoplast_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('terminal_codon_variant','terminal_codon_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('irlinv_site','irlinv_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('synthetic_sequence','synthetic_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('encodes_1_polypeptide','encodes_1_polypeptide');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('group_iia_intron','group_iia_intron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('telomere','telomere');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('interior_intron','interior_intron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('edited_mrna','edited_mrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('catmat_right_handed_three','catmat_right_handed_three');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tandem_duplication','tandem_duplication');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tmrna_gene','tmrna_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pre_edited_region','pre_edited_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('n6_hydroxynorvalylcarbamoyladenosine','n6_hydroxynorvalylcarbamoyladenosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('nucleomorphic_chromosome','nucleomorphic_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('fragmentary','fragmentary');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('single','single');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('binding_site','binding_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('seven_methylguanine','seven_methylguanine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('target_site_duplication','target_site_duplication');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('vdj_gene','vdj_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('bound_by_nucleic_acid','bound_by_nucleic_acid');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('peptide_localization_signal','peptide_localization_signal');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('catmat_right_handed_four','catmat_right_handed_four');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h3k27_acylation_site','h3k27_acylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('compound_chromosome','compound_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('coding_end','coding_end');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gap','gap');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('ligand_binding_site','ligand_binding_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('upstream_aug_codon','upstream_aug_codon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pseudogenic_transcript','pseudogenic_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('satellite_dna','satellite_dna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('assortment_derived_deficiency_plus_duplication','assortment_derived_deficiency_plus_duplication');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transposable_element','transposable_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('endogenous_retroviral_sequence','endogenous_retroviral_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('microsatellite','microsatellite');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('encodes_different_polypeptides_different_stop','encodes_different_polypeptides_different_stop');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('primary_transcript','primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('consensus_mrna','consensus_mrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('membrane_peptide_loop','membrane_peptide_loop');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('foreign','so_foreign');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rho_independent_bacterial_terminator','rho_independent_bacterial_terminator');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('u_box','u_box');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_silenced_by_histone_deacetylation','gene_silenced_by_histone_deacetylation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('vdj_j_c_cluster','vdj_j_c_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cpg_island','cpg_island');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('haplotype','haplotype');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('two_prime_o_methylinosine','two_prime_o_methylinosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dna','dna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('circular_double_stranded_rna_chromosome','circular_double_stranded_rna_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mature_protein_region','mature_protein_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('b_box','b_box');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_zinc_ion_contact_site','polypeptide_zinc_ion_contact_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_subarray_member','gene_subarray_member');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_cassette','gene_cassette');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('oric','oric');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('deletion_breakpoint','deletion_breakpoint');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('insertion_attribute','insertion_attribute');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mrna_with_plus_2_frameshift','mrna_with_plus_2_frameshift');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chip_seq_region','chip_seq_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('asx_turn_right_handed_type_one','asx_turn_right_handed_type_one');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transcribed_cluster','transcribed_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tyrosyl_trna','tyrosyl_trna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('orthologous','orthologous');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('s_gna','s_gna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('canonical_three_prime_splice_site','canonical_three_prime_splice_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('noncoding_exon','noncoding_exon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('lethal_variant','lethal_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('minor_tss','minor_tss');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_two_prime_o_dimethylcytidine','five_two_prime_o_dimethylcytidine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h3k36_trimethylation_site','h3k36_trimethylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('macronuclear_chromosome','macronuclear_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('deficient_translocation','deficient_translocation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('read_pair','read_pair');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transcript_with_translational_frameshift','transcript_with_translational_frameshift');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('finished_genome','finished_genome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rnapol_iii_promoter_type_3','rnapol_iii_promoter_type_3');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dna_transposon','dna_transposon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('orf','orf');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('right_handed_peptide_helix','right_handed_peptide_helix');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_nest_left_right_motif','polypeptide_nest_left_right_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('topology_attribute','topology_attribute');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mirtron','mirtron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_motif','polypeptide_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sl9_acceptor_site','sl9_acceptor_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('proplastid_sequence','proplastid_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('negatively_autoregulated_gene','negatively_autoregulated_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('retinoic_acid_responsive_element','retinoic_acid_responsive_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('c_d_box_snorna_encoding','c_d_box_snorna_encoding');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sequence_assembly','sequence_assembly');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chromoplast_gene','chromoplast_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dcaps_primer','dcaps_primer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_prime_clip','five_prime_clip');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('golden_path','golden_path');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('splice_acceptor_variant','splice_acceptor_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('alanine','alanine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cleaved_peptide_region','cleaved_peptide_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('v_dj_j_cluster','v_dj_j_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pseudogenic_region','pseudogenic_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('terminator_codon_variant','terminator_codon_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('methylation_guide_snorna','methylation_guide_snorna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('v_vj_j_c_cluster','v_vj_j_c_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('non_canonical_start_codon','non_canonical_start_codon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_with_mrna_recoded_by_translational_bypass','gene_with_mrna_recoded_by_translational_bypass');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_turn_motif','polypeptide_turn_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('autocatalytically_spliced_intron','autocatalytically_spliced_intron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mobile','mobile');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tandem','tandem');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('intron','intron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('clip','clip');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dye_terminator_read','dye_terminator_read');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dmv4_motif','dmv4_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('au_rich_element','au_rich_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inversion_breakpoint','inversion_breakpoint');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dce_siii','dce_siii');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_prime_recoding_site','five_prime_recoding_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('non_protein_coding','non_protein_coding');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mobile_intron','mobile_intron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('vertebrate_immunoglobulin_t_cell_receptor_rearranged_segment','vertebrate_immunoglobulin_t_cell_receptor_rearranged_segment');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('st_turn_right_handed_type_one','st_turn_right_handed_type_one');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rrna','rrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inside_intron_parallel','inside_intron_parallel');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('spliceosomal_intron','spliceosomal_intron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('phagemid','phagemid');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('editing_block','editing_block');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('fragment_assembly','fragment_assembly');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tmrna_acceptor_piece','tmrna_acceptor_piece');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('beta_turn_type_six','beta_turn_type_six');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_rst','three_prime_rst');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cysteine_trna_primary_transcript','cysteine_trna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('post_translationally_regulated_gene','post_translationally_regulated_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transcriptionally_repressed','transcriptionally_repressed');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('crm','crm');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cointegrated_plasmid','cointegrated_plasmid');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_sequencing_information','polypeptide_sequencing_information');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_d_spacer','three_prime_d_spacer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tiling_path_fragment','tiling_path_fragment');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('natural','so_natural');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pi_helix','pi_helix');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('possible_base_call_error','possible_base_call_error');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_truncation','polypeptide_truncation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h3k14_acetylation_site','h3k14_acetylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('adaptive_island','adaptive_island');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('uridine_five_oxyacetic_acid','uridine_five_oxyacetic_acid');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sl7_acceptor_site','sl7_acceptor_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('plus_2_translational_frameshift','plus_2_translational_frameshift');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('stop_retained_variant','stop_retained_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('homologous_region','homologous_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('500b_downstream_variant','fivehundred_b_downstream_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('internal_utr','internal_utr');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('non_cytoplasmic_polypeptide_region','non_cytoplasmic_polypeptide_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('experimental_feature','experimental_feature');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('nuclear_chromosome','nuclear_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('exemplar','exemplar');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rnapol_ii_core_promoter','rnapol_ii_core_promoter');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h3k9_methylation_site','h3k9_methylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('alanine_trna_primary_transcript','alanine_trna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('assortment_derived_variation','assortment_derived_variation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('n2_n2_dimethylguanosine','n2_n2_dimethylguanosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rna_hook_turn','rna_hook_turn');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transcribed_spacer_region','transcribed_spacer_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('plasmid_gene','plasmid_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('u14_snorna','u14_snorna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('galactosyl_queuosine','galactosyl_queuosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cyanelle_gene','cyanelle_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('wild_type_rescue_gene','wild_type_rescue_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('u12_intron','u12_intron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('aptamer','aptamer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('recoded_mrna','recoded_mrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('nested_transposon','nested_transposon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tf_binding_site_variant','tf_binding_site_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('macronuclear_sequence','macronuclear_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('ust','ust');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('selenocysteine','selenocysteine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('elongated_out_of_frame_polypeptide_c_terminal','elongated_out_of_frame_polypeptide_c_terminal');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_with_dicistronic_mrna','gene_with_dicistronic_mrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('match_part','match_part');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('nucleomorphic_sequence','nucleomorphic_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('apicoplast_gene','apicoplast_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('regulon','regulon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('plasmid_vector','plasmid_vector');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_l_tryptophan','modified_l_tryptophan');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('free_chromosome_arm','free_chromosome_arm');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('srp_rna_primary_transcript','srp_rna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('asx_turn','asx_turn');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('anchor_binding_site','anchor_binding_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rrna_primary_transcript','rrna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('reading_frame','reading_frame');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h3k23_acylation site','h3k23_acylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('maternal_variant','maternal_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dhu_loop','dhu_loop');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('n4_acetylcytidine','n4_acetylcytidine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('experimental_feature_attribute','experimental_feature_attribute');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('silenced_gene','silenced_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cloned_genomic_insert','cloned_genomic_insert');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('intron_gain','intron_gain');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dna_sequence_secondary_structure','dna_sequence_secondary_structure');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cdna_match','cdna_match');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_prime_flanking_region','five_prime_flanking_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pyrrolysyl_trna','pyrrolysyl_trna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('two_methylthio_n6_cis_hydroxyisopentenyl_adenosine','two_methylthio_n6_cis_hydroxyisopentenyl_adenosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('repeat_component','repeat_component');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('one_methyl_three_three_amino_three_carboxypropyl_pseudouridine','one_methyl_3_3_amino_three_carboxypropyl_pseudouridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rpra_rna','rpra_rna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('nuclease_sensitive_site','nuclease_sensitive_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('conservative_amino_acid_substitution','conservative_amino_acid_substitution');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_prime_coding_exon_noncoding_region','five_prime_coding_exon_noncoding_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rnapol_iii_promoter','rnapol_iii_promoter');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tryptophan_trna_primary_transcript','try_trna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('noncontiguous_finished','noncontiguous_finished');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('region','region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tf_binding_site','tf_binding_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('attl_site','attl_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('natural_plasmid','natural_plasmid');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('upd','upd');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('conservative_missense_codon','conservative_missense_codon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('n6_n6_dimethyladenosine','n6_n6_dimethyladenosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('laevosynaptic_chromosome','laevosynaptic_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chromosomal_structural_element','chromosomal_structural_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_cassette_array','gene_cassette_array');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('vertebrate_immunoglobulin_t_cell_receptor_gene_cluster','vertebrate_immunoglobulin_t_cell_receptor_gene_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('canonical_five_prime_splice_site','canonical_five_prime_splice_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('bound_by_protein','bound_by_protein');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sts_map','sts_map');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dnazyme','dnazyme');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('silent_mutation','silent_mutation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('v_d_j_cluster','v_d_j_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('distal_promoter_element','distal_promoter_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('bipartite_duplication','bipartite_duplication');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('hydroxywybutosine','hydroxywybutosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dihydrouridine','dihydrouridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_prime_coding_exon_coding_region','five_prime_coding_exon_coding_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('beta_turn_left_handed_type_one','beta_turn_left_handed_type_one');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h3k4_trimethylation','h3k4_trimethylation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('recoded_codon','recoded_codon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('predicted','predicted');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('resolution_site','resolution_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('seven_cyano_seven_deazaguanosine','seven_cyano_seven_deazaguanosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('disease_associated_variant','disease_associated_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('conformational_switch','conformational_switch');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('regulated','regulated');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inverted_repeat','inverted_repeat');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('t_to_a_transversion','t_to_a_transversion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('attc_site','attc_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('two_methyladenosine','two_methyladenosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cross_genome_match','cross_genome_match');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tandem_repeat','tandem_repeat');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('copy_number_loss','copy_number_loss');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('antisense_primary_transcript','antisense_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sequence_collection','sequence_collection');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_with_polyadenylated_mrna','gene_with_polyadenylated_mrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rnapol_i_promoter','rnapol_i_promoter');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_methyluridine','three_methyluridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('start_codon','start_codon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('retrotransposon','retrotransposon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('elongated_in_frame_polypeptide_c_terminal','elongated_in_frame_polypeptide_c_terminal');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('v_gene','v_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chloroplast_dna','chloroplast_dna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('negative_sense_ssrna_viral_sequence','negative_sense_ssrna_viral_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('primer_binding_site','primer_binding_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('c_box','c_box');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('plasmid','plasmid');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('biological_region','biological_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('g_to_a_transition','g_to_a_transition');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('non_canonical_five_prime_splice_site','non_canonical_five_prime_splice_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('c_d_box_snorna_primary_transcript','c_d_box_snorna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('trna_region','trna_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('n6_cis_hydroxyisopentenyl_adenosine','n6_cis_hydroxyisopentenyl_adenosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chloroplast_sequence','chloroplast_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('variant_frequency','variant_frequency');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('exon_region','exon_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('r_five_prime_ltr_region','r_five_prime_ltr_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('v_j_c_cluster','v_j_c_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('r_three_prime_ltr_region','r_three_prime_ltr_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('snrna','snrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('one_methylinosine','one_methylinosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inframe_codon_gain','inframe_codon_gain');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('j_gene_recombination_feature','j_gene_recombination_feature');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_structural_motif','polypeptide_structural_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('conserved_region','conserved_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sl3_acceptor_site','sl3_acceptor_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('remark','remark');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('fixed_variant','fixed_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_dna_contact','polypeptide_dna_contact');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('codon','codon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rrna_23s','rrna_23s');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_gain_of_function_variant','polypeptide_gain_of_function_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mrna','mrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('glycyl_trna','glycyl_trna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cyanelle_sequence','cyanelle_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cds_independently_known','cds_independently_known');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('insulator','insulator');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('positive_sense_ssrna_viral_sequence','positive_sense_ssrna_viral_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sticky_end_restriction_enzyme_cleavage_site','sticky_end_restriction_enzyme_cleavage_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('expressed_sequence_match','expressed_sequence_match');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('possible_assembly_error','possible_assembly_error');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('u3_snorna','u3_snorna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_manganese_ion_contact_site','polypeptide_manganese_ion_contact_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h4k16_acylation_site','h4k16_acylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('g_to_t_transversion','g_to_t_transversion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('recombination_feature_of_rearranged_gene','recombination_feature_of_rearranged_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_coding_exon_coding_region','three_prime_coding_exon_coding_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tmrna_primary_transcript','tmrna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('single_stranded_cdna','single_stranded_cdna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('experimentally_determined','experimentally_determined');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pseudogenic_exon','pseudogenic_exon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('u2_intron','u2_intron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chromosome','chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('encodes_alternately_spliced_transcripts','encodes_alternately_spliced_transcripts');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('aberrant_processed_transcript','aberrant_processed_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('complex_change_of_translational_product_variant','complex_change_of_translational_product_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gna','gna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dsra_rna','dsra_rna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('intron_domain','intron_domain');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cds_predicted','cds_predicted');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_l_asparagine','modified_l_asparagine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inframe_variant','inframe_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_prime_d_nonamer','five_prime_d_nonamer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sl2_acceptor_site','sl2_acceptor_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_localization_variant','polypeptide_localization_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dce_si','dce_si');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('snrna_primary_transcript','snrna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('translocation','translocation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h3k27_methylation_site','h3k27_methylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_l_phenylalanine','modified_l_phenylalanine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('lincrna','lincrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_l_valine','modified_l_valine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('yac','yac');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('signal_peptide','signal_peptide');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('r_ltr_region','r_ltr_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('srp_rna_gene','srp_rna_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('elongated_polypeptide_n_terminal','elongated_polypeptide_n_terminal');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('recombination_hotspot','recombination_hotspot');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('v_dj_c_cluster','v_dj_c_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('viral_sequence','viral_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_prime_terminal_inverted_repeat','five_prime_terminal_inverted_repeat');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_methoxycarbonylmethyl_two_thiouridine','five_mcm_2_thiouridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('edited','edited');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('breu_motif','breu_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('coding_start','coding_start');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h3k9_monomethylation_site','h3k9_monomethylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_utr','three_prime_utr');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dpe1_motif','dpe1_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_l_tyrosine','modified_l_tyrosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('v_d_j_c_cluster','v_d_j_c_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('silenced_by_histone_methylation','silenced_by_histone_methylation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('deficient_inversion','deficient_inversion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('decreased_transcript_level_variant','decreased_transcript_level_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('two_thiouridine','two_thiouridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polyadenylation_variant','polyadenylation_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rna_polymerase_iii_tata_box','rna_polymerase_iii_tata_box');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('two_thio_two_prime_o_methyluridine','two_thio_two_prime_o_methyluridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h3k18_acetylation_site','h3k18_acetylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('leucoplast_sequence','leucoplast_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cds','cds');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polya_signal_sequence','polya_signal_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('micronuclear_sequence','micronuclear_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('glutamyl_trna','glutamyl_trna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h3k27_monomethylation_site','h3k27_monomethylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('minus_2_frameshift_variant','minus_2_frameshift_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('strna_gene','strna_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('paternally_imprinted_gene','paternally_imprinted_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rna_chromosome','rna_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('ndm3_motif','ndm3_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('u1_snrna','u1_snrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_hydroxymethylcytidine','five_hydroxymethylcytidine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('recombination_feature','recombination_feature');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('encodes_disjoint_polypeptides','encodes_disjoint_polypeptides');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('post_translationally_regulated','post_translationally_regulated');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('engineered_fusion_gene','engineered_fusion_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_d_recombination_signal_sequence','three_prime_d_recombination_signal_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('intermediate','intermediate');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_calcium_ion_contact_site','polypeptide_calcium_ion_contact_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('syntenic_region','syntenic_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('variant_collection','variant_collection');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cryptic_splice_donor','cryptic_splice_donor');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('assembly_error_correction','assembly_error_correction');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sugar_edge_base_pair','sugar_edge_base_pair');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('engineered_foreign_gene','engineered_foreign_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h3k4_monomethylation_site','h3k4_monomethylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('n4_acetyl_2_prime_o_methylcytidine','n4_acetyl_2_prime_o_methylcytidine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('predicted_by_ab_initio_computation','predicted_by_ab_initio_computation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_secondary_structure','polypeptide_secondary_structure');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('ncrna_gene','ncrna_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rna_junction_loop','rna_junction_loop');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('haplotype_block','haplotype_block');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('oriv','oriv');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('peptide_collection','peptide_collection');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('ambisense_ssrna_viral_sequence','ambisense_ssrna_viral_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('morpholino_oligo','morpholino_oligo');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('centromere','centromere');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('epigenetically_modified_gene','epigenetically_modified_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chromosomal_inversion','chromosomal_inversion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('minus_35_signal','minus_35_signal');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_two_prime_o_dimethyluridine','three_two_prime_o_dimethyluridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('four_thiouridine','four_thiouridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transcription_end_site','transcription_end_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pirna_gene','pirna_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pre_mirna','pre_mirna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cysteinyl_trna','cysteinyl_trna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('catmat_left_handed_three','catmat_left_handed_three');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cryptic_splice_acceptor','cryptic_splice_acceptor');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('schellmann_loop_seven','schellmann_loop_seven');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('v_vdj_j_c_cluster','v_vdj_j_c_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transposable_element_insertion_site','transposable_element_insertion_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('translocation_element','translocation_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mirna_primary_transcript_region','mirna_primary_transcript_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('orphan_cds','orphan_cds');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('monocistronic_mrna','monocistronic_mrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('natural_transposable_element','natural_transposable_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('golden_path_fragment','golden_path_fragment');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('lipoprotein_signal_peptide','lipoprotein_signal_peptide');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('arginine','arginine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('linear_double_stranded_rna_chromosome','linear_double_stranded_rna_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h4k8_acylation site','h4k8_acylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rrna_large_subunit_primary_transcript','rrna_large_subunit_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('irrinv_site','irrinv_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('plastid_sequence','plastid_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('base_call_error_correction','base_call_error_correction');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('integrated_plasmid','integrated_plasmid');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_l_methionine','modified_l_methionine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('linear_single_stranded_rna_chromosome','linear_single_stranded_rna_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chromoplast_sequence','chromoplast_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('proximal_promoter_element','proximal_promoter_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('contig_read','contig_read');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('promoter_trap_construct','promoter_trap_construct');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('stop_codon_redefined_as_selenocysteine','stop_codon_redefined_as_selenocysteine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('seven_methylguanosine','seven_methylguanosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gamma_turn','gamma_turn');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tmrna','tmrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('methionyl_trna','methionyl_trna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('synonymous_codon','synonymous_codon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cdna','cdna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sl4_acceptor_site','sl4_acceptor_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('nuclease_binding_site','nuclease_binding_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('uridine_five_oxyacetic_acid_methyl_ester','uridine_five_oxyacetic_acid_methyl_ester');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_race_clone','three_prime_race_clone');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('circular_double_stranded_dna_chromosome','circular_double_stranded_dna_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('consensus','consensus');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('positively_autoregulated_gene','positively_autoregulated_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tss_region','tss_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_l_histidine','modified_l_histidine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('unitary_pseudogene','unitary_pseudogene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_metal_contact','polypeptide_metal_contact');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('integron','integron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('d_loop','d_loop');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('decayed_exon','decayed_exon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('recombination_signal_sequence','recombination_signal_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_inosine','modified_inosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_three_prime_overlap','three_prime_three_prime_overlap');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('v_j_cluster','v_j_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_five_prime_overlap','three_prime_five_prime_overlap');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('recombination_regulatory_region','recombination_regulatory_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('beta_bulge_loop','beta_bulge_loop');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('restriction_enzyme_cleavage_junction','restriction_enzyme_cleavage_junction');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('blunt_end_restriction_enzyme_cleavage_junction','blunt_end_restriction_enzyme_cleavage_junction');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('intergenic_region','intergenic_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dmv2_motif','dmv2_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('intrachromosomal_mutation','intrachromosomal_mutation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('antisense_rna','antisense_rna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sequence_feature','sequence_feature');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('n6_glycinylcarbamoyladenosine','n6_glycinylcarbamoyladenosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gamma_turn_classic','gamma_turn_classic');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_cis_splice_site','three_prime_cis_splice_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rapd','rapd');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inverted_ring_chromosome','inverted_ring_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cca_tail','cca_tail');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('linear_double_stranded_dna_chromosome','linear_double_stranded_dna_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('u5_five_prime_ltr_region','u5_five_prime_ltr_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('bruno_response_element','bruno_response_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('t_to_g_transversion','t_to_g_transversion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('c_to_a_transversion','c_to_a_transversion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('macronucleus_destined_segment','macronucleus_destined_segment');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('distant_three_prime_recoding_signal','distant_three_prime_recoding_signal');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pre_edited_mrna','pre_edited_mrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('p_element','p_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pac','pac');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_fusion','gene_fusion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('base','base');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('codon_redefined','codon_redefined');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polycistronic_mrna','polycistronic_mrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('codon_variant','codon_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_methoxycarbonylmethyl_two_prime_o_methyluridine','five_methoxycarbonylmethyl_two_prime_o_methyluridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('match','match');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_with_stop_codon_read_through','gene_with_stop_codon_read_through');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('asparaginyl_trna','asparaginyl_trna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('threonyl_trna','threonyl_trna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('u3_five_prime_ltr_region','u3_five_prime_ltr_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_prime_ltr','five_prime_ltr');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('vj_gene','vj_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rho_dependent_bacterial_terminator','rho_dependent_bacterial_terminator');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('n2_methylguanosine','n2_methylguanosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_flanking_region','three_prime_flanking_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('genomically_contaminated_cdna_clone','genomically_contaminated_cdna_clone');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('internal_guide_sequence','internal_guide_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mirna_target_site','mirna_target_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('u5_three_prime_ltr_region','u5_three_prime_ltr_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('undermodified_hydroxywybutosine','undermodified_hydroxywybutosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('introgressed_chromosome_region','introgressed_chromosome_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('translationally_frameshifted','translationally_frameshifted');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('trans_spliced','trans_spliced');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('methylation_guide_snorna_primary_transcript','methylation_guide_snorna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('leucine','leucine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chromosomal_deletion','chromosomal_deletion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_isopentenylaminomethyl_uridine','five_isopentenylaminomethyl_uridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('stop_codon','stop_codon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('two_methylthio_n6_threonyl_carbamoyladenosine','two_methylthio_n6_threonyl_carbamoyladenosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('decreased_polyadenylation_variant','decreased_polyadenylation_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('biochemical_region_of_peptide','biochemical_region_of_peptide');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('interband','interband');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dna_constraint_sequence','dna_constraint_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('clone_insert','clone_insert');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('snp','snp');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chromoplast_chromosome','chromoplast_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rrna_25s','rrna_25s');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tata_box','tata_box');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('plastid_gene','plastid_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('asx_turn_left_handed_type_one','asx_turn_left_handed_type_one');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_uridine','modified_uridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dce_sii','dce_sii');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('intramembrane_polypeptide_region','intramembrane_polypeptide_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('lysyl_trna','lysyl_trna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rr_tract','rr_tract');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rrna_primary_transcript_region','rrna_primary_transcript_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h4k20_monomethylation_site','h4k20_monomethylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('ds_dna_viral_sequence','ds_dna_viral_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('alternatively_spliced_transcript','alternatively_spliced_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_copper_ion_contact_site','polypeptide_copper_ion_contact_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('scrna_encoding','scrna_encoding');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chromosomal_duplication','chromosomal_duplication');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('clone','clone');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_l_isoleucine','modified_l_isoleucine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_subarray','gene_subarray');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('hetero_compound_chromosome','hetero_compound_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dicistronic_transcript','dicistronic_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inactive_ligand_binding_site','inactive_ligand_binding_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('silenced_by_dna_methylation','silenced_by_dna_methylation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sl6_acceptor_site','sl6_acceptor_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('t_loop','t_loop');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('targeting_vector','targeting_vector');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('two_thiocytidine','two_thiocytidine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_l_serine','modified_l_serine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('srp_rna','srp_rna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_repeat_recoding_signal','three_prime_repeat_recoding_signal');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rate_of_transcription_variant','rate_of_transcription_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('two_prime_o_methylguanosine','two_prime_o_methylguanosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_binding_motif','polypeptide_binding_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('recombinationally_rearranged_vertebrate_immune_system_gene','recombinationally_rearranged_vertebrate_immune_system_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('a_box','a_box');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('splicing_variant','splicing_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('one_methylguanosine','one_methylguanosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_l_glutamine','modified_l_glutamine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sequence_variant','sequence_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sequence_length_variation','sequence_length_variation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('strna_encoding','strna_encoding');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('plus_1_frameshift','plus_1_frameshift');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('topologically_defined_region','topologically_defined_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('edited_cds','edited_cds');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_silenced_by_histone_modification','gene_silenced_by_histone_modification');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('e_box_motif','e_box_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('paternal_uniparental_disomy','paternal_uniparental_disomy');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('small_subunit_rrna','small_subunit_rrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dnasei_hypersensitive_site','dnasei_hypersensitive_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('v_d_dj_j_c_cluster','v_d_dj_j_c_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('compound_chromosome_arm','compound_chromosome_arm');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('score','score');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('feature_attribute','feature_attribute');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('protein_match','protein_match');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('downstream_gene_variant','downstream_gene_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sl10_accceptor_site','sl10_accceptor_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chromosome_variation','chromosome_variation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('serine_threonine_motif','serine_threonine_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('a_box_type_1','a_box_type_1');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('allelically_excluded','allelically_excluded');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('assortment_derived_aneuploid','assortment_derived_aneuploid');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rare_variant','rare_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_isopentenylaminomethyl_two_prime_o_methyluridine','five_isopentenylaminomethyl_two_prime_o_methyluridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('regional_centromere_central_core','regional_centromere_central_core');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gna_oligo','gna_oligo');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('nc_transcript_variant','nc_transcript_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('copy_number_variation','copy_number_variation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('silenced','silenced');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_methylcytidine','three_methylcytidine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dexstrosynaptic_chromosome','dexstrosynaptic_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inverted_insertional_duplication','inverted_insertional_duplication');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rescue_mini_gene','rescue_mini_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('catmat_left_handed_four','catmat_left_handed_four');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('alternate_sequence_site','alternate_sequence_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_iron_ion_contact_site','polypeptide_iron_ion_contact_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('c_to_t_transition_at_pcpg_site','c_to_t_transition_at_pcpg_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_molybdenum_ion_contact_site','polypeptide_molybdenum_ion_contact_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('phenylalanine_trna_primary_transcript','phe_trna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('decreased_translational_product_level','decreased_translational_product_level');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h_aca_box_snorna_primary_transcript','h_aca_box_snorna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('r_gna','r_gna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('coding_sequence_variant','coding_sequence_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_partial_loss_of_function','polypeptide_partial_loss_of_function');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_prime_restriction_enzyme_junction','five_prime_restriction_enzyme_junction');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('intrachromosomal_transposition','intrachromosomal_transposition');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('methylated_a','methylated_a');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rrna_16s','rrna_16s');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('disease_causing_variant','disease_causing_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('n4_methylcytidine','n4_methylcytidine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('riboswitch','riboswitch');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('duplicated_pseudogene','duplicated_pseudogene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('assortment_derived_duplication','assortment_derived_duplication');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chromosomal_regulatory_element','chromosomal_regulatory_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_prime_five_prime_overlap','five_prime_five_prime_overlap');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_function_variant','polypeptide_function_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('ribozymic','ribozymic');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inversion_derived_bipartite_deficiency','inversion_derived_bipartite_deficiency');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('invalidated_by_genomic_contamination','invalidated_by_genomic_contamination');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('variant_genome','variant_genome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('vj_j_cluster','vj_j_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chromosome_number_variation','chromosome_number_variation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_attribute','gene_attribute');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('uag_stop_codon_signal','uag_stop_codon_signal');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('nucleotide_match','nucleotide_match');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mature_mirna_variant','mature_mirna_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('st_turn_left_handed_type_two','st_turn_left_handed_type_two');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('epigenetically_modified','epigenetically_modified');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inversion_derived_deficiency_plus_duplication','inversion_derived_deficiency_plus_duplication');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_methylaminomethyl_two_selenouridine','five_methylaminomethyl_two_selenouridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('aspartic_acid_trna_primary_transcript','aspartic_acid_trna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('nuclear_mt_pseudogene','nuclear_mt_pseudogene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('exonic_splice_enhancer','exonic_splice_enhancer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('u4_snrna','u4_snrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('csrb_rsmb_rna','csrb_rsmb_rna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('group_1_intron_homing_endonuclease_target_region','group_1_intron_homing_endonuclease_target_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('crispr','crispr');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('snorna_gene','snorna_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('trans_splice_junction','trans_splice_junction');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('flanking_three_prime_quadruplet_recoding_signal','flanking_three_prime_quadruplet_recoding_signal');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('v_vdj_j_cluster','v_vdj_j_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cassette_pseudogene','cassette_pseudogene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('incomplete_terminal_codon_variant','incomplete_terminal_codon_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('silenced_by_histone_modification','silenced_by_histone_modification');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('proviral_gene','proviral_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_carboxyhydroxymethyl_uridine','five_carboxyhydroxymethyl_uridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mt_gene','mt_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('single_stranded_rna_chromosome','single_stranded_rna_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('recoding_stimulatory_region','recoding_stimulatory_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_taurinomethyluridine','five_taurinomethyluridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_l_threonine','modified_l_threonine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('v_d_dj_cluster','v_d_dj_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('synthetic_oligo','synthetic_oligo');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('purine_to_pyrimidine_transversion','purine_to_pyrimidine_transversion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('editing_variant','editing_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('antiparallel_beta_strand','antiparallel_beta_strand');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('central_hydrophobic_region_of_signal_peptide','central_hydrophobic_region_of_signal_peptide');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('integrated_mobile_genetic_element','integrated_mobile_genetic_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('parallel_beta_strand','parallel_beta_strand');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('v_dj_cluster','v_dj_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dre_motif','dre_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('non_ltr_retrotransposon','non_ltr_retrotransposon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('r_gna_oligo','r_gna_oligo');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('autoregulated','autoregulated');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_l_lysine','modified_l_lysine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('bac_end','bac_end');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pyrrolysine','pyrrolysine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('high_quality_draft','high_quality_draft');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('lysine','lysine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('elongated_polypeptide','elongated_polypeptide');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('unique_variant','unique_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('protein_protein_contact','protein_protein_contact');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inversion_attribute','inversion_attribute');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('nucleotide_binding_site','nucleotide_binding_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('splice_site','splice_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('non_synonymous_codon','non_synonymous_codon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('5kb_downstream_variant','fivekb_downstream_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chromosomal_translocation','chromosomal_translocation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('epitope','epitope');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('allele','allele');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('n4_n4_2_prime_o_trimethylcytidine','n4_n4_2_prime_o_trimethylcytidine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('u5_ltr_region','u5_ltr_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('paired_end_fragment','paired_end_fragment');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rescue_gene','rescue_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transgenic_transposable_element','transgenic_transposable_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_conserved_region','polypeptide_conserved_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sts','sts');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('a_to_c_transversion','a_to_c_transversion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('class_ii_rna','class_ii_rna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('nonamer_of_recombination_feature_of_vertebrate_immune_system_gene','nonamer_of_recombination_feature_of_vertebrate_im_sys_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('unedited_region','unedited_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('lambda_vector','lambda_vector');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene','gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('alanyl_trna','alanyl_trna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('amino_acid_substitution','amino_acid_substitution');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('virtual_sequence','virtual_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('group_iib_intron','group_iib_intron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('retrotransposed','retrotransposed');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mrna_with_minus_2_frameshift','mrna_with_minus_2_frameshift');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polymer_attribute','polymer_attribute');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('autosynaptic_chromosome','autosynaptic_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('peptide_helix','peptide_helix');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('partially_processed_cdna_clone','partially_processed_cdna_clone');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rst_match','rst_match');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('paternally_imprinted','paternally_imprinted');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('predicted_gene','predicted_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('x_element_combinatorial_repeat','x_element_combinatorial_repeat');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('robertsonian_fusion','robertsonian_fusion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('two_prime_o_methylpseudouridine','two_prime_o_methylpseudouridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pericentric_inversion','pericentric_inversion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('aspartyl_trna','aspartyl_trna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('strna','strna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_intron','three_prime_intron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('linear','linear');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('j_nonamer','j_nonamer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('a_to_t_transversion','a_to_t_transversion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('idna','idna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('n2_n2_7_trimethylguanosine','n2_n2_7_trimethylguanosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('complex_chromosomal_mutation','complex_chromosomal_mutation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inversion_derived_deficiency_plus_aneuploid','inversion_derived_deficiency_plus_aneuploid');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h3k4_methylation_site','h3k4_methylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('asymmetric_rna_internal_loop','asymmetric_rna_internal_loop');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('deletion','deletion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h3k79_monomethylation_site','h3k79_monomethylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cyclic_translocation','cyclic_translocation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('ars','ars');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('glutaminyl_trna','glutaminyl_trna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('allopolyploid','allopolyploid');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('replicon','replicon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('two_prime_o_methylcytidine','two_prime_o_methylcytidine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('regional_centromere','regional_centromere');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('st_turn_left_handed_type_one','st_turn_left_handed_type_one');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('paralogous_region','paralogous_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mature_transcript_region','mature_transcript_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mrna_with_frameshift','mrna_with_frameshift');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('reference_genome','reference_genome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('unoriented_interchromosomal_transposition','unoriented_interchromosomal_transposition');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('d_dj_j_cluster','d_dj_j_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('maxicircle_gene','maxicircle_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('st_turn_right_handed_type_two','st_turn_right_handed_type_two');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('snrna_encoding','snrna_encoding');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('annotation_directed_improved_draft','annotation_directed_improved_draft');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_prime_d_spacer','five_prime_d_spacer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('read','read');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('arginine_trna_primary_transcript','arg_trna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('oligo_u_tail','oligo_u_tail');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('recoding_pseudoknot','recoding_pseudoknot');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_methylaminomethyl_two_thiouridine','five_mam_2_thiouridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('monocistronic','monocistronic');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('3d_polypeptide_structure_variant','threed_polypeptide_structure_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transmembrane_polypeptide_region','transmembrane_polypeptide_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transcript_processing_variant','transcript_processing_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('vector_replicon','vector_replicon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('maternal_uniparental_disomy','maternal_uniparental_disomy');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pyrosequenced_read','pyrosequenced_read');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('splice_site_variant','splice_site_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_magnesium_ion_contact_site','polypeptide_magnesium_ion_contact_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polycistronic_transcript','polycistronic_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polya_site','polya_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chromosomal_variation_attribute','chromosomal_variation_attribute');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('free_duplication','free_duplication');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chromosome_structure_variation','chromosome_structure_variation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_rna_base_feature','modified_rna_base_feature');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mutated_variant_site','mutated_variant_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gaga_motif','gaga_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('centromeric_repeat','centromeric_repeat');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rrna_gene','rrna_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('interchromosomal_mutation','interchromosomal_mutation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('prophage','prophage');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('syntenic','syntenic');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('engineered_foreign_repetitive_element','engineered_foreign_repetitive_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('translated_nucleotide_match','translated_nucleotide_match');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('exon_variant','exon_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h_aca_box_snorna','h_aca_box_snorna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('vault_rna','vault_rna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('orphan','orphan');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('linear_single_stranded_dna_chromosome','linear_single_stranded_dna_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('telomeric_repeat','telomeric_repeat');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('encodes_greater_than_1_polypeptide','encodes_greater_than_1_polypeptide');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('atti_site','atti_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_with_start_codon_cug','gene_with_start_codon_cug');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('silenced_by_histone_deacetylation','silenced_by_histone_deacetylation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('reagent','reagent');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chromosome_fission','chromosome_fission');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('ct_gene','ct_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('capped_primary_transcript','capped_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('methylinosine','methylinosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('j_spacer','j_spacer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('glutamine','glutamine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_guanosine','modified_guanosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('n2_7_dimethylguanosine','n2_7_dimethylguanosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h3k79_trimethylation_site','h3k79_trimethylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_d_heptamer','three_prime_d_heptamer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('invalidated_cdna_clone','invalidated_cdna_clone');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('terminator','terminator');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('stem_loop','stem_loop');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_prime_utr_intron','five_prime_utr_intron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('unoriented_intrachromosomal_transposition','unoriented_intrachromosomal_transposition');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chromosome_band','chromosome_band');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mini_exon_donor_rna','mini_exon_donor_rna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('aneuploid','aneuploid');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_methyl_2_thiouridine','five_methyl_2_thiouridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_silenced_by_dna_methylation','gene_silenced_by_dna_methylation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('engineered_foreign_transposable_element_gene','engineered_foreign_transposable_element_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('processed_pseudogene','processed_pseudogene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('supercontig','supercontig');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('trna_encoding','trna_encoding');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('reciprocal_chromosomal_translocation','reciprocal_chromosomal_translocation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tasirna','tasirna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('hoogsteen_base_pair','hoogsteen_base_pair');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('regional_centromere_inner_repeat_region','regional_centromere_inner_repeat_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('yac_end','yac_end');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('purine_transition','purine_transition');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('c_d_box_snorna','c_d_box_snorna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('snorna_primary_transcript','snorna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('v_vj_cluster','v_vj_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('intronic_regulatory_region','intronic_regulatory_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('u3_ltr_region','u3_ltr_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('attenuator','attenuator');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_noncoding_exon','three_prime_noncoding_exon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('u14_snorna_primary_transcript','u14_snorna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('d_gene_recombination_feature','d_gene_recombination_feature');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mte','mte');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gcvb_rna','gcvb_rna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rst','rst');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('operator','operator');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('ring_chromosome','ring_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('ndm2_motif','ndm2_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h3k4_dimethylation_site','h3k4_dimethylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('selenocysteine_trna_primary_transcript','selenocysteine_trna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('edited_transcript_feature','edited_transcript_feature');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('stop_codon_redefined_as_pyrrolysine','stop_codon_redefined_as_pyrrolysine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('homo_compound_chromosome','homo_compound_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('foreign_gene','foreign_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('four_demethylwyosine','four_demethylwyosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('guide_rna','guide_rna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_methylpseudouridine','three_methylpseudouridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inversion_derived_aneuploid_chromosome','inversion_derived_aneuploid_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('decreased_transcript_stability_variant','decreased_transcript_stability_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('lincrna_gene','lincrna_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('specific_recombination_site','specific_recombination_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inosine','inosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('foreign_transposable_element','foreign_transposable_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('d_gene','d_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('bipartite_inversion','bipartite_inversion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('engineered_plasmid','engineered_plasmid');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_group_regulatory_region','gene_group_regulatory_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('vd_gene','vd_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('regulatory_region','regulatory_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sl11_acceptor_site','sl11_acceptor_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('guide_rna_region','guide_rna_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_base','modified_base');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('elongated_polypeptide_c_terminal','elongated_polypeptide_c_terminal');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_ten_helix','three_ten_helix');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('elongated_in_frame_polypeptide_n_terminal_elongation','elongated_in_frame_polypeptide_n_terminal_elongation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sarcin_like_rna_motif','sarcin_like_rna_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('minus_1_translationally_frameshifted','minus_1_translationally_frameshifted');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_l_alanine','modified_l_alanine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inversion_cum_translocation','inversion_cum_translocation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tag','tag');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('uninverted_interchromosomal_transposition','uninvert_inter_transposition');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cryptic_gene','cryptic_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pericentric','pericentric');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transgenic','transgenic');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('genomic_clone','genomic_clone');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chromosome_breakage_sequence','chromosome_breakage_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('d_j_cluster','d_j_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('beta_turn_type_six_a_one','beta_turn_type_six_a_one');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('ribosome_entry_site','ribosome_entry_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('left_handed_peptide_helix','left_handed_peptide_helix');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dna_aptamer','dna_aptamer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('i_motif','i_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('deficient_intrachromosomal_transposition','d_intrachr_transposition');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('single_stranded_dna_chromosome','single_stranded_dna_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('methylated_c','methylated_c');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('clone_end','clone_end');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('ligation_based_read','ligation_based_read');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('expressed_sequence_assembly','expressed_sequence_assembly');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_two_prime_o_dimethyluridine','five_two_prime_o_dimethyluridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('histidine_trna_primary_transcript','histidine_trna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('orthologous_region','orthologous_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('valine_trna_primary_transcript','valine_trna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('operon_member','operon_member');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('missense_codon','missense_codon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('bacterial_rnapol_promoter_sigma54','bacterial_rnapol_promoter_sigma54');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_group','gene_group');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('small_regulatory_ncrna','small_regulatory_ncrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('intrachromosomal_duplication','intrachromosomal_duplication');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('non_conservative_amino_acid_substitution','non_conservative_amino_acid_substitution');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('uaa_stop_codon_signal','uaa_stop_codon_signal');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h3k36_methylation_site','h3k36_methylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transcript_variant','transcript_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('minus_2_frameshift','minus_2_frameshift');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('organelle_sequence','organelle_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('initiator_codon_change','initiator_codon_change');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cryptic_prophage','cryptic_prophage');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('micf_rna','micf_rna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('direct_tandem_duplication','direct_tandem_duplication');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('conserved','conserved');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('telomerase_rna','telomerase_rna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('u6atac_snrna','u6atac_snrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('attb_site','attb_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_array_member','gene_array_member');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polyadenylated_mrna','polyadenylated_mrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('symbiosis_island','symbiosis_island');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polymorphic_variant','polymorphic_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('splice_junction','splice_junction');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('fingerprint_map','fingerprint_map');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('single_strand_restriction_enzyme_cleavage_site','single_strand_restriction_enzyme_cleavage_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('wyosine','wyosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('uga_stop_codon_signal','uga_stop_codon_signal');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('minus_24_signal','minus_24_signal');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cytoplasmic_polypeptide_region','cytoplasmic_polypeptide_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h4k_acylation_region','h4k_acylation_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('one_two_prime_o_dimethylguanosine','one_two_prime_o_dimethylguanosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rh_map','rh_map');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('silenced_by_dna_modification','silenced_by_dna_modification');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inactive_catalytic_site','inactive_catalytic_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('anticodon','anticodon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('seven_deazaguanosine','seven_deazaguanosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('asparagine','asparagine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('probe','probe');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('defective_conjugative_transposon','defective_conjugative_transposon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('archaeosine','archaeosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('molecular_contact_region','molecular_contact_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('nested_repeat','nested_repeat');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('membrane_structure','membrane_structure');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('contig_collection','contig_collection');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tetraloop','tetraloop');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('coding_conserved_region','coding_conserved_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('long_terminal_repeat','long_terminal_repeat');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('vertebrate_immune_system_gene_recombination_signal_feature','vertebrate_immune_system_gene_recombination_signal_feature');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('untranslated_region_polycistronic_mrna','untranslated_region_polycistronic_mrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('leucine_trna_primary_transcript','leucine_trna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('high_identity_region','high_identity_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('circular_single_stranded_dna_chromosome','circular_single_stranded_dna_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('nuclear_rim_localization_signal','nuclear_rim_localization_signal');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('isoleucyl_trna','isoleucyl_trna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('insertion_breakpoint','insertion_breakpoint');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('5_prime_utr_variant','five_prime_utr_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transgene','transgene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mrna_region','mrna_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transcript_attribute','transcript_attribute');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('serine_threonine_staple_motif','serine_threonine_staple_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('protein_coding','protein_coding');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('enhancer_bound_by_factor','enhancer_bound_by_factor');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('recoded_by_translational_bypass','recoded_by_translational_bypass');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('operon','operon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('monocistronic_transcript','monocistronic_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('reciprocal','reciprocal');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polyadenylated','polyadenylated');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('unigene_cluster','unigene_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('vertebrate_immunoglobulin_t_cell_receptor_rearranged_gene_cluster','vertebrate_ig_t_cell_receptor_rearranged_gene_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_cassette_member','gene_cassette_member');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('stop_codon_read_through','stop_codon_read_through');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_with_transcript_with_translational_frameshift','gene_with_transcript_with_translational_frameshift');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('variant_quality','variant_quality');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mnp','mnp');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('glutamic_acid','glutamic_acid');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('y_prime_element','y_prime_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('beta_turn','beta_turn');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pathogenic_island','pathogenic_island');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('ust_match','ust_match');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transcript_bound_by_protein','transcript_bound_by_protein');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('n6_methyladenosine','n6_methyladenosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cyanelle_chromosome','cyanelle_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('orit','orit');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('maternally_imprinted','maternally_imprinted');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('chloroplast_chromosome','chloroplast_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('minicircle_gene','minicircle_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_catalytic_motif','polypeptide_catalytic_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rnapol_iii_promoter_type_2','rnapol_iii_promoter_type_2');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('no_output','no_output');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('interior_coding_exon','interior_coding_exon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_taurinomethyl_two_thiouridine','five_taurinomethyl_two_thiouridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h3k9_trimethylation_site','h3k9_trimethylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transcript_secondary_structure_variant','transcript_secondary_structure_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide','polypeptide');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('splice_donor_5th_base_variant','splice_donor_5th_base_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polymerase_synthesis_read','polymerase_synthesis_read');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('enhancer_binding_site','enhancer_binding_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('nucleotide_to_protein_binding_site','nucleotide_to_protein_binding_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('beta_turn_left_handed_type_two','beta_turn_left_handed_type_two');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('invalidated_by_genomic_polya_primed_cdna','invalidated_by_genomic_polya_primed_cdna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_with_edited_transcript','gene_with_edited_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dmv1_motif','dmv1_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('minus_12_signal','minus_12_signal');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('post_translationally_modified_region','post_translationally_modified_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('proline','proline');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('flanking_region','flanking_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('two_methylthio_n6_isopentenyladenosine','two_methylthio_n6_isopentenyladenosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypyrimidine_tract','polypyrimidine_tract');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_methoxyuridine','five_methoxyuridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_to_gene_feature','gene_to_gene_feature');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('bac_cloned_genomic_insert','bac_cloned_genomic_insert');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('j_heptamer','j_heptamer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_ust','three_prime_ust');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('n6_2_prime_o_dimethyladenosine','n6_2_prime_o_dimethyladenosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('trans_splice_site','trans_splice_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('de_novo_variant','de_novo_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('engineered_rescue_region','engineered_rescue_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('nucleomorph_gene','nucleomorph_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mrna_attribute','mrna_attribute');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_prime_three_prime_overlap','five_prime_three_prime_overlap');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('group_i_intron','group_i_intron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('d_cluster','d_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('open_chromatin_region','open_chromatin_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('genomic_dna','genomic_dna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inside_intron','inside_intron');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('hammerhead_ribozyme','hammerhead_ribozyme');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_prime_d_heptamer','five_prime_d_heptamer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('intronic_splice_enhancer','intronic_splice_enhancer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_adenosine','modified_adenosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_carboxymethylaminomethyluridine','five_carboxymethylaminomethyluridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('repeat_region','repeat_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('repeat_unit','repeat_unit');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('double_stranded_dna_chromosome','double_stranded_dna_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('heritable_phenotypic_marker','heritable_phenotypic_marker');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('template_region','template_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('primary_transcript_region','primary_transcript_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mitochondrial_dna','mitochondrial_dna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transcript_region','transcript_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('histone_acetylation_site','histone_acetylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('ribozyme','ribozyme');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('matrix_attachment_site','matrix_attachment_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('imprinted','imprinted');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_sequence_variant','polypeptide_sequence_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('est','est');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rna_motif','rna_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_variation_site','polypeptide_variation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('class_i_rna','class_i_rna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('oligo','oligo');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('stop_codon_signal','stop_codon_signal');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('hypoploid','hypoploid');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('exemplar_mrna','exemplar_mrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('experimentally_defined_binding_region','experimentally_defined_binding_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('c_to_g_transversion','c_to_g_transversion');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('active_peptide','active_peptide');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mannosyl_queuosine','mannosyl_queuosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_with_stop_codon_redefined_as_pyrrolysine','gene_with_stop_codon_redefined_as_pyrrolysine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('queuosine','queuosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('lna_oligo','lna_oligo');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('independently_known','independently_known');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('proviral_region','proviral_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('capped','capped');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('minus_1_frameshift_variant','minus_1_frameshift_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('direction_attribute','direction_attribute');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('micronuclear_chromosome','micronuclear_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pseudogene_by_unequal_crossing_over','pseudogene_by_unequal_crossing_over');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('one_two_prime_o_dimethyladenosine','one_two_prime_o_dimethyladenosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dpe_motif','dpe_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('frame_restoring_variant','frame_restoring_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('seryl_trna','seryl_trna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('structural_variant','structural_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('regulatory_promoter_element','regulatory_promoter_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('integration_excision_site','integration_excision_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('noncoding_region_of_exon','noncoding_region_of_exon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rnase_mrp_rna','rnase_mrp_rna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('nuclear_export_signal','nuclear_export_signal');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_methoxycarbonylmethyluridine','five_methoxycarbonylmethyluridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('exon_of_single_exon_gene','exon_of_single_exon_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_with_dicistronic_primary_transcript','gene_with_dicistronic_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sequence_secondary_structure','sequence_secondary_structure');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('bacterial_rnapol_promoter_sigma_70','bacterial_rnapol_promoter_sigma_70');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tiling_path','tiling_path');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('nuclear_sequence','nuclear_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('contig','contig');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('quality_value','quality_value');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('kozak_sequence','kozak_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('population_specific_variant','population_specific_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('catalytic_residue','catalytic_residue');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inversion_site','inversion_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('aspartic_acid','aspartic_acid');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dif_site','dif_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mirna_gene','mirna_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('valyl_trna','valyl_trna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inverted_tandem_duplication','inverted_tandem_duplication');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cis_regulatory_frameshift_element','cis_regulatory_frameshift_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('minisatellite','minisatellite');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('assembly_component','assembly_component');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('low_complexity_region','low_complexity_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('morpholino_backbone','morpholino_backbone');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('designed_sequence','designed_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('n6_n6_2_prime_o_trimethyladenosine','n6_n6_2_prime_o_trimethyladenosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rna_polymerase_promoter','rna_polymerase_promoter');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('v_gene_recombination_feature','v_gene_recombination_feature');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_carboxymethylaminomethyl_two_thiouridine','five_carboxymethylaminomethyl_two_thiouridine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('free_ring_duplication','free_ring_duplication');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('point_centromere','point_centromere');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dicistronic_mrna','dicistronic_mrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('interchromosomal','interchromosomal');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('uncharacterised_chromosomal_mutation','uncharacterised_chromosomal_mutation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_prime_cis_splice_site','five_prime_cis_splice_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('octamer_motif','octamer_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('encodes_overlapping_peptides_different_start','encodes_overlapping_peptides_different_start');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('ss_rna_viral_sequence','ss_rna_viral_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('indel','indel');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dicistronic_primary_transcript','dicistronic_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('protein_binding_site','protein_binding_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polycistronic','polycistronic');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('asparagine_trna_primary_transcript','asparagine_trna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('splice_enhancer','splice_enhancer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('aneuploid_chromosome','aneuploid_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('peroxywybutosine','peroxywybutosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_l_aspartic_acid','modified_l_aspartic_acid');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('engineered_episome','engineered_episome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rnai_reagent','rnai_reagent');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rasirna','rasirna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('tmrna_region','tmrna_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('increased_transcript_level_variant','increased_transcript_level_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('bacterial_rnapol_promoter','bacterial_rnapol_promoter');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mitochondrial_sequence','mitochondrial_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('trinucleotide_repeat_microsatellite_feature','trinuc_repeat_microsat');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('post_translationally_regulated_by_protein_stability','post_translationally_regulated_by_protein_stability');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('nc_primary_transcript','nc_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('iron_responsive_element','iron_responsive_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('v_d_dj_j_cluster','v_d_dj_j_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('forward','forward');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('proviral_location','proviral_location');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('histone_binding_site','histone_binding_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('promoter_element','promoter_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pse_motif','pse_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('beta_turn_type_eight','beta_turn_type_eight');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('double','double');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cds_supported_by_est_or_cdna_data','cds_supported_by_est_or_cdna_data');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('double_stranded_rna_chromosome','double_stranded_rna_chromosome');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('modified_l_glutamic_acid','modified_l_glutamic_acid');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polypeptide_nest_motif','polypeptide_nest_motif');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('translational_frameshift','translational_frameshift');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_terminal_inverted_repeat','three_prime_terminal_inverted_repeat');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pseudogenic_trna','pseudogenic_trna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cap','cap');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_prime_coding_exon','five_prime_coding_exon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('enzymatic','enzymatic');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('interior_exon','interior_exon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('genetic_marker','genetic_marker');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('a_to_g_transition','a_to_g_transition');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('two_methylthio_n6_hydroxynorvalyl_carbamoyladenosine','two_methylthio_n6_hydroxynorvalyl_carbamoyladenosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('isre','isre');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('maternally_imprinted_gene','maternally_imprinted_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('circular','circular');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h_pseudoknot','h_pseudoknot');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('intermediate_element','intermediate_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transcript','transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('pseudogene','pseudogene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('direct_repeat','direct_repeat');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('bacterial_terminator','bacterial_terminator');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('diplotype','diplotype');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('metal_binding_site','metal_binding_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dj_gene','dj_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('two_prime_o_methyladenosine','two_prime_o_methyladenosine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('splice_region_variant','splice_region_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('aspe_primer','aspe_primer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('restriction_enzyme_binding_site','restriction_enzyme_binding_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('bac','bac');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('dj_j_cluster','dj_j_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h3k36_dimethylation_site','h3k36_dimethylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('trans_splice_donor_site','trans_splice_donor_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_variant','gene_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('conformational_change_variant','conformational_change_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h3k36_monomethylation_site','h3k36_monomethylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('nucleic_acid','nucleic_acid');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('invalidated_by_chimeric_cdna','invalidated_by_chimeric_cdna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('histidine','histidine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_component_region','gene_component_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('primer_match','primer_match');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('trna_primary_transcript','trna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('loxp_site','loxp_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('serine','serine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('propeptide','propeptide');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('five_prime_open_reading_frame','five_prime_open_reading_frame');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('schellmann_loop_six','schellmann_loop_six');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('shine_dalgarno_sequence','shine_dalgarno_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sp6_rna_polymerase_promoter','sp6_rna_polymerase_promoter');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('centromere_dna_element_iii','centromere_dna_element_iii');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('lysine_trna_primary_transcript','lysine_trna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('j_c_cluster','j_c_cluster');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('assortment_derived_deficiency','assortment_derived_deficiency');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mirna_primary_transcript','mirna_primary_transcript');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rrna_5s','rrna_5s');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('leucyl_trna','leucyl_trna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inverted_intrachromosomal_transposition','invert_intra_transposition');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('enzymatic_rna','enzymatic_rna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('germline_variant','germline_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('negatively_autoregulated','negatively_autoregulated');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('benign_variant','benign_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('anchor_region','anchor_region');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('exon','exon');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('beta_turn_type_six_a','beta_turn_type_six_a');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('random_sequence','random_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('partially_characterised_chromosomal_mutation','partially_characterised_chromosomal_mutation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rna','rna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('core_promoter_element','core_promoter_element');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('restriction_enzyme_single_strand_overhang','restriction_enzyme_single_strand_overhang');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('ss_oligo','ss_oligo');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('histone_methylation_site','histone_methylation_site');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('inversion_derived_duplication_plus_aneuploid','inversion_derived_duplication_plus_aneuploid');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('transcript_bound_by_nucleic_acid','transcript_bound_by_nucleic_acid');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('intein_containing','intein_containing');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('h_aca_box_snorna_encoding','h_aca_box_snorna_encoding');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('rrna_cleavage_rna','rrna_cleavage_rna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('enhancer_trap_construct','enhancer_trap_construct');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gamma_turn_inverse','gamma_turn_inverse');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_d_nonamer','three_prime_d_nonamer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('paternal_variant','paternal_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('level_of_transcript_variant','level_of_transcript_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('selenocysteinyl_trna','selenocysteinyl_trna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_silenced_by_histone_methylation','gene_silenced_by_histone_methylation');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('u11_snrna','u11_snrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('scrna','scrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('gene_with_stop_codon_redefined_as_selenocysteine','gene_with_stop_codon_redefined_as_selenocysteine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('silencer','silencer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('sage_tag','sage_tag');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('mrna_with_minus_1_frameshift','mrna_with_minus_1_frameshift');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('nuclear_gene','nuclear_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('cds_supported_by_domain_match_data','cds_supported_by_domain_match_data');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('internal_shine_dalgarno_sequence','internal_shine_dalgarno_sequence');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('prolyl_trna','prolyl_trna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('lysidine','lysidine');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('beta_bulge','beta_bulge');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('post_translationally_regulated_by_protein_modification','post_translationally_regulated_by_protein_modification');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('splice_donor_variant','splice_donor_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('ncrna','ncrna');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('grna_gene','grna_gene');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('enhancer','enhancer');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('polymorphic_sequence_variant','polymorphic_sequence_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('three_prime_clip','three_prime_clip');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('frameshift_variant','frameshift_variant');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('insertional','insertional');
INSERT INTO sequence_cv_lookup_table (original_cvterm_name,relation_name) VALUES ('non_processed_pseudogene','non_processed_pseudogene');

CREATE INDEX sequence_cv_lookup_table_idx ON sequence_cv_lookup_table (original_cvterm_name);


SET search_path=public,pg_catalog;
-- DEPENDENCY:
--  chado/modules/bridges/sofa-bridge.sql

-- The standard Chado pattern for protein coding genes
-- is a feature of type 'gene' with 'mRNA' features as parts
-- REQUIRES: 'mrna' view from so-bridge.sql
CREATE OR REPLACE VIEW protein_coding_gene AS
 SELECT
  DISTINCT gene.*
 FROM
  feature AS gene
  INNER JOIN feature_relationship AS fr ON (gene.feature_id=fr.object_id)
  INNER JOIN so.mrna ON (mrna.feature_id=fr.subject_id);


-- introns are implicit from surrounding exons
-- combines intron features with location and parent transcript
-- the same intron appearing in multiple transcripts will appear
-- multiple times
CREATE VIEW intron_combined_view AS
 SELECT
  x1.feature_id         AS exon1_id,
  x2.feature_id         AS exon2_id,
  CASE WHEN l1.strand=-1  THEN l2.fmax ELSE l1.fmax END AS fmin,
  CASE WHEN l1.strand=-1  THEN l1.fmin ELSE l2.fmin END AS fmax,
  l1.strand             AS strand,
  l1.srcfeature_id      AS srcfeature_id,
  r1.rank               AS intron_rank,
  r1.object_id          AS transcript_id
 FROM
 cvterm
  INNER JOIN 
   feature                AS x1    ON (x1.type_id=cvterm.cvterm_id)
    INNER JOIN
     feature_relationship AS r1    ON (x1.feature_id=r1.subject_id)
    INNER JOIN
     featureloc           AS l1    ON (x1.feature_id=l1.feature_id)
  INNER JOIN
   feature                AS x2    ON (x2.type_id=cvterm.cvterm_id)
    INNER JOIN
     feature_relationship AS r2    ON (x2.feature_id=r2.subject_id)
    INNER JOIN
     featureloc           AS l2    ON (x2.feature_id=l2.feature_id)
 WHERE
  cvterm.name='exon'            AND
  (r2.rank - r1.rank) = 1       AND
  r1.object_id=r2.object_id     AND
  l1.strand = l2.strand         AND
  l1.srcfeature_id = l2.srcfeature_id         AND
  l1.locgroup=0                 AND
  l2.locgroup=0;

-- intron locations. intron IDs are the (exon1,exon2) ID pair
-- this means that introns may be counted twice if the start of
-- the 5' exon or the end of the 3' exon vary
-- introns shared by transcripts will not appear twice
CREATE VIEW intronloc_view AS
 SELECT DISTINCT
  exon1_id,
  exon2_id,
  fmin,
  fmax,
  strand,
  srcfeature_id
 FROM intron_combined_view;
CREATE OR REPLACE FUNCTION store_feature 
(INT,INT,INT,INT,
 INT,INT,VARCHAR,VARCHAR,INT,BOOLEAN)
 RETURNS INT AS 
'DECLARE
  v_srcfeature_id       ALIAS FOR $1;
  v_fmin                ALIAS FOR $2;
  v_fmax                ALIAS FOR $3;
  v_strand              ALIAS FOR $4;
  v_dbxref_id           ALIAS FOR $5;
  v_organism_id         ALIAS FOR $6;
  v_name                ALIAS FOR $7;
  v_uniquename          ALIAS FOR $8;
  v_type_id             ALIAS FOR $9;
  v_is_analysis         ALIAS FOR $10;
  v_feature_id          INT;
  v_featureloc_id       INT;
 BEGIN
    IF v_dbxref_id IS NULL THEN
      SELECT INTO v_feature_id feature_id
      FROM feature
      WHERE uniquename=v_uniquename     AND
            organism_id=v_organism_id   AND
            type_id=v_type_id;
    ELSE
      SELECT INTO v_feature_id feature_id
      FROM feature
      WHERE dbxref_id=v_dbxref_id;
    END IF;
    IF NOT FOUND THEN
      INSERT INTO feature
       ( dbxref_id           ,
         organism_id         ,
         name                ,
         uniquename          ,
         type_id             ,
         is_analysis         )
        VALUES
        ( v_dbxref_id           ,
          v_organism_id         ,
          v_name                ,
          v_uniquename          ,
          v_type_id             ,
          v_is_analysis         );
      v_feature_id = currval(''feature_feature_id_seq'');
    ELSE
      UPDATE feature SET
        dbxref_id   =  v_dbxref_id           ,
        organism_id =  v_organism_id         ,
        name        =  v_name                ,
        uniquename  =  v_uniquename          ,
        type_id     =  v_type_id             ,
        is_analysis =  v_is_analysis
      WHERE
        feature_id=v_feature_id;
    END IF;
  PERFORM store_featureloc(v_feature_id,
                           v_srcfeature_id,
                           v_fmin,
                           v_fmax,
                           v_strand,
                           0,
                           0);
  RETURN v_feature_id;
 END;
' LANGUAGE 'plpgsql';


CREATE OR REPLACE FUNCTION store_featureloc
(INT,INT,INT,INT,INT,INT,INT)
 RETURNS INT AS 
'DECLARE
  v_feature_id          ALIAS FOR $1;
  v_srcfeature_id       ALIAS FOR $2;
  v_fmin                ALIAS FOR $3;
  v_fmax                ALIAS FOR $4;
  v_strand              ALIAS FOR $5;
  v_rank                ALIAS FOR $6;
  v_locgroup            ALIAS FOR $7;
  v_featureloc_id       INT;
 BEGIN
    IF v_feature_id IS NULL THEN RAISE EXCEPTION ''feature_id cannot be null'';
    END IF;
    SELECT INTO v_featureloc_id featureloc_id
      FROM featureloc
      WHERE feature_id=v_feature_id     AND
            rank=v_rank                 AND
            locgroup=v_locgroup;
    IF NOT FOUND THEN
      INSERT INTO featureloc
        ( feature_id,
          srcfeature_id,
          fmin,
          fmax,
          strand,
          rank,
          locgroup)
        VALUES
        (  v_feature_id,
           v_srcfeature_id,
           v_fmin,
           v_fmax,
           v_strand,
           v_rank,
           v_locgroup);
      v_featureloc_id = currval(''featureloc_featureloc_id_seq'');
    ELSE
      UPDATE featureloc SET
        feature_id    =  v_feature_id,
        srcfeature_id =  v_srcfeature_id,
        fmin          =  v_fmin,
        fmax          =  v_fmax,
        strand        =  v_strand,
        rank          =  v_rank,
        locgroup      =  v_locgroup
      WHERE
        featureloc_id=v_featureloc_id;
    END IF;
  RETURN v_featureloc_id;
 END;
' LANGUAGE 'plpgsql';

CREATE OR REPLACE FUNCTION store_feature_synonym
(INT,VARCHAR,INT,BOOLEAN,BOOLEAN,INT)
 RETURNS INT AS 
'DECLARE
  v_feature_id          ALIAS FOR $1;
  v_syn                 ALIAS FOR $2;
  v_type_id             ALIAS FOR $3;
  v_is_current          ALIAS FOR $4;
  v_is_internal         ALIAS FOR $5;
  v_pub_id              ALIAS FOR $6;
  v_synonym_id          INT;
  v_feature_synonym_id  INT;
 BEGIN
    IF v_feature_id IS NULL THEN RAISE EXCEPTION ''feature_id cannot be null'';
    END IF;
    SELECT INTO v_synonym_id synonym_id
      FROM synonym
      WHERE name=v_syn                  AND
            type_id=v_type_id;
    IF NOT FOUND THEN
      INSERT INTO synonym
        ( name,
          synonym_sgml,
          type_id)
        VALUES
        ( v_syn,
          v_syn,
          v_type_id);
      v_synonym_id = currval(''synonym_synonym_id_seq'');
    END IF;
    SELECT INTO v_feature_synonym_id feature_synonym_id
        FROM feature_synonym
        WHERE feature_id=v_feature_id   AND
              synonym_id=v_synonym_id   AND
              pub_id=v_pub_id;
    IF NOT FOUND THEN
      INSERT INTO feature_synonym
        ( feature_id,
          synonym_id,
          pub_id,
          is_current,
          is_internal)
        VALUES
        ( v_feature_id,
          v_synonym_id,
          v_pub_id,
          v_is_current,
          v_is_internal);
      v_feature_synonym_id = currval(''feature_synonym_feature_synonym_id_seq'');
    ELSE
      UPDATE feature_synonym
        SET is_current=v_is_current, is_internal=v_is_internal
        WHERE feature_synonym_id=v_feature_synonym_id;
    END IF;
  RETURN v_feature_synonym_id;
 END;
' LANGUAGE 'plpgsql';



-- dependency_on: [sequtil,sequence-cv-helper]

CREATE OR REPLACE FUNCTION subsequence(INT,INT,INT,INT)
 RETURNS TEXT AS
 'SELECT 
  CASE WHEN $4<0 
   THEN reverse_complement(substring(srcf.residues,$2+1,($3-$2)))
   ELSE substring(residues,$2+1,($3-$2))
  END AS residues
  FROM feature AS srcf
  WHERE
   srcf.feature_id=$1'
LANGUAGE 'sql';

CREATE OR REPLACE FUNCTION subsequence_by_featureloc(INT)
 RETURNS TEXT AS
 'SELECT 
  CASE WHEN strand<0 
   THEN reverse_complement(substring(srcf.residues,fmin+1,(fmax-fmin)))
   ELSE substring(srcf.residues,fmin+1,(fmax-fmin))
  END AS residues
  FROM feature AS srcf
   INNER JOIN featureloc ON (srcf.feature_id=featureloc.srcfeature_id)
  WHERE
   featureloc_id=$1'
LANGUAGE 'sql';

CREATE OR REPLACE FUNCTION subsequence_by_feature(INT,INT,INT)
 RETURNS TEXT AS
 'SELECT 
  CASE WHEN strand<0 
   THEN reverse_complement(substring(srcf.residues,fmin+1,(fmax-fmin)))
   ELSE substring(srcf.residues,fmin+1,(fmax-fmin))
  END AS residues
  FROM feature AS srcf
   INNER JOIN featureloc ON (srcf.feature_id=featureloc.srcfeature_id)
  WHERE
   featureloc.feature_id=$1 AND
   featureloc.rank=$2 AND
   featureloc.locgroup=$3'
LANGUAGE 'sql';

CREATE OR REPLACE FUNCTION subsequence_by_feature(INT)
 RETURNS TEXT AS 'SELECT subsequence_by_feature($1,0,0)'
LANGUAGE 'sql';

-- based on subfeature sets:

-- constrained by feature_relationship.type_id
--   (allows user to construct queries that only get subsequences of
--    part_of subfeatures)

CREATE OR REPLACE FUNCTION subsequence_by_subfeatures(INT,INT,INT,INT)
 RETURNS TEXT AS '
DECLARE v_feature_id ALIAS FOR $1;
DECLARE v_rtype_id   ALIAS FOR $2;
DECLARE v_rank       ALIAS FOR $3;
DECLARE v_locgroup   ALIAS FOR $4;
DECLARE subseq       TEXT;
DECLARE seqrow       RECORD;
BEGIN 
  subseq = '''';
 FOR seqrow IN
   SELECT
    CASE WHEN strand<0 
     THEN reverse_complement(substring(srcf.residues,fmin+1,(fmax-fmin)))
     ELSE substring(srcf.residues,fmin+1,(fmax-fmin))
    END AS residues
    FROM feature AS srcf
     INNER JOIN featureloc ON (srcf.feature_id=featureloc.srcfeature_id)
     INNER JOIN feature_relationship AS fr
       ON (fr.subject_id=featureloc.feature_id)
    WHERE
     fr.object_id=v_feature_id AND
     fr.type_id=v_rtype_id AND
     featureloc.rank=v_rank AND
     featureloc.locgroup=v_locgroup
    ORDER BY fr.rank
  LOOP
   subseq = subseq  || seqrow.residues;
  END LOOP;
 RETURN subseq;
END
'
LANGUAGE 'plpgsql';

CREATE OR REPLACE FUNCTION subsequence_by_subfeatures(INT,INT)
 RETURNS TEXT AS
 'SELECT subsequence_by_subfeatures($1,$2,0,0)'
LANGUAGE 'sql';

CREATE OR REPLACE FUNCTION subsequence_by_subfeatures(INT)
 RETURNS TEXT AS
'
SELECT subsequence_by_subfeatures($1,get_feature_relationship_type_id(''part_of''),0,0)
'
LANGUAGE 'sql';


-- constrained by subfeature.type_id (eg exons of a transcript)
CREATE OR REPLACE FUNCTION subsequence_by_typed_subfeatures(INT,INT,INT,INT)
 RETURNS TEXT AS '
DECLARE v_feature_id ALIAS FOR $1;
DECLARE v_ftype_id   ALIAS FOR $2;
DECLARE v_rank       ALIAS FOR $3;
DECLARE v_locgroup   ALIAS FOR $4;
DECLARE subseq       TEXT;
DECLARE seqrow       RECORD;
BEGIN 
  subseq = '''';
 FOR seqrow IN
   SELECT
    CASE WHEN strand<0 
     THEN reverse_complement(substring(srcf.residues,fmin+1,(fmax-fmin)))
     ELSE substring(srcf.residues,fmin+1,(fmax-fmin))
    END AS residues
  FROM feature AS srcf
   INNER JOIN featureloc ON (srcf.feature_id=featureloc.srcfeature_id)
   INNER JOIN feature AS subf ON (subf.feature_id=featureloc.feature_id)
   INNER JOIN feature_relationship AS fr ON (fr.subject_id=subf.feature_id)
  WHERE
     fr.object_id=v_feature_id AND
     subf.type_id=v_ftype_id AND
     featureloc.rank=v_rank AND
     featureloc.locgroup=v_locgroup
  ORDER BY fr.rank
   LOOP
   subseq = subseq  || seqrow.residues;
  END LOOP;
 RETURN subseq;
END
'
LANGUAGE 'plpgsql';

CREATE OR REPLACE FUNCTION subsequence_by_typed_subfeatures(INT,INT)
 RETURNS TEXT AS
 'SELECT subsequence_by_typed_subfeatures($1,$2,0,0)'
LANGUAGE 'sql';

 


CREATE OR REPLACE FUNCTION feature_subalignments(integer) RETURNS SETOF featureloc AS '
DECLARE
  return_data featureloc%ROWTYPE;
  f_id ALIAS FOR $1;
  feature_data feature%rowtype;
  featureloc_data featureloc%rowtype;

  s text;

  fmin integer;
  slen integer;
BEGIN
  --RAISE NOTICE ''feature_id is %'', featureloc_data.feature_id;
  SELECT INTO feature_data * FROM feature WHERE feature_id = f_id;

  FOR featureloc_data IN SELECT * FROM featureloc WHERE feature_id = f_id LOOP

    --RAISE NOTICE ''fmin is %'', featureloc_data.fmin;

    return_data.feature_id      = f_id;
    return_data.srcfeature_id   = featureloc_data.srcfeature_id;
    return_data.is_fmin_partial = featureloc_data.is_fmin_partial;
    return_data.is_fmax_partial = featureloc_data.is_fmax_partial;
    return_data.strand          = featureloc_data.strand;
    return_data.phase           = featureloc_data.phase;
    return_data.residue_info    = featureloc_data.residue_info;
    return_data.locgroup        = featureloc_data.locgroup;
    return_data.rank            = featureloc_data.rank;

    s = feature_data.residues;
    fmin = featureloc_data.fmin;
    slen = char_length(s);

    WHILE char_length(s) LOOP
      --RAISE NOTICE ''residues is %'', s;

      --trim off leading match
      s = trim(leading ''|ATCGNatcgn'' from s);
      --if leading match detected
      IF slen > char_length(s) THEN
        return_data.fmin = fmin;
        return_data.fmax = featureloc_data.fmin + (slen - char_length(s));

        --if the string started with a match, return it,
        --otherwise, trim the gaps first (ie do not return this iteration)
        RETURN NEXT return_data;
      END IF;

      --trim off leading gap
      s = trim(leading ''-'' from s);

      fmin = featureloc_data.fmin + (slen - char_length(s));
    END LOOP;
  END LOOP;

  RETURN;

END;
' LANGUAGE 'plpgsql';
CREATE SCHEMA frange;
SET search_path = frange,public,pg_catalog;

CREATE TABLE featuregroup (
    featuregroup_id serial not null,
    primary key (featuregroup_id),

    subject_id int not null,
    foreign key (subject_id) references feature (feature_id) on delete cascade INITIALLY DEFERRED,

    object_id int not null,
    foreign key (object_id) references feature (feature_id) on delete cascade INITIALLY DEFERRED,

    group_id int not null,
    foreign key (group_id) references feature (feature_id) on delete cascade INITIALLY DEFERRED,

    srcfeature_id int null,
    foreign key (srcfeature_id) references feature (feature_id) on delete cascade INITIALLY DEFERRED,

    fmin int null,
    fmax int null,
    strand int null,
    is_root int not null default 0,

    constraint featuregroup_c1 unique (subject_id,object_id,group_id,srcfeature_id,fmin,fmax,strand)
);
CREATE INDEX featuregroup_idx1 ON featuregroup (subject_id);
CREATE INDEX featuregroup_idx2 ON featuregroup (object_id);
CREATE INDEX featuregroup_idx3 ON featuregroup (group_id);
CREATE INDEX featuregroup_idx4 ON featuregroup (srcfeature_id);
CREATE INDEX featuregroup_idx5 ON featuregroup (strand);
CREATE INDEX featuregroup_idx6 ON featuregroup (is_root);

CREATE OR REPLACE FUNCTION groupoverlaps(int4, int4, varchar) RETURNS setof featuregroup AS '
  SELECT g2.*
  FROM  featuregroup g1,
        featuregroup g2
  WHERE g1.is_root = 1
    AND ( g1.srcfeature_id = g2.srcfeature_id OR g2.srcfeature_id IS NULL )
    AND g1.group_id = g2.group_id
    AND g1.srcfeature_id = (SELECT feature_id FROM feature WHERE uniquename = $3)
    AND boxquery($1, $2) @ boxrange(g1.fmin,g2.fmax)
' LANGUAGE 'sql';

CREATE OR REPLACE FUNCTION groupcontains(int4, int4, varchar) RETURNS setof featuregroup AS '
  SELECT *
  FROM groupoverlaps($1,$2,$3)
  WHERE fmin <= $1 AND fmax >= $2
' LANGUAGE 'sql';

CREATE OR REPLACE FUNCTION groupinside(int4, int4, varchar) RETURNS setof featuregroup AS '
  SELECT *
  FROM groupoverlaps($1,$2,$3)
  WHERE fmin >= $1 AND fmax <= $2
' LANGUAGE 'sql';

CREATE OR REPLACE FUNCTION groupidentical(int4, int4, varchar) RETURNS setof featuregroup AS '
  SELECT *
  FROM groupoverlaps($1,$2,$3)
  WHERE fmin = $1 AND fmax = $2
' LANGUAGE 'sql';

CREATE OR REPLACE FUNCTION groupoverlaps(int4, int4) RETURNS setof featuregroup AS '
  SELECT *
  FROM featuregroup
  WHERE is_root = 1
    AND boxquery($1, $2) @ boxrange(fmin,fmax)
' LANGUAGE 'sql';

CREATE OR REPLACE FUNCTION groupoverlaps(_int4, _int4, _varchar) RETURNS setof featuregroup AS '
DECLARE
    mins alias for $1;
    maxs alias for $2;
    srcs alias for $3;
    f featuregroup%ROWTYPE;
    i int;
    s int;
BEGIN
    i := 1;
    FOR i in array_lower( mins, 1 ) .. array_upper( mins, 1 ) LOOP
        SELECT INTO s feature_id FROM feature WHERE uniquename = srcs[i];
        FOR f IN
            SELECT *
            FROM  featuregroup WHERE group_id IN (
                SELECT group_id FROM featuregroup
                WHERE (srcfeature_id = s OR srcfeature_id IS NULL)
                  AND group_id IN (
                      SELECT group_id FROM groupoverlaps( mins[i], maxs[i] )
                      WHERE  srcfeature_id = s
                  )
            )
        LOOP
            RETURN NEXT f;
        END LOOP;
    END LOOP;
    RETURN;
END;
' LANGUAGE 'plpgsql';

CREATE OR REPLACE FUNCTION groupcontains(_int4, _int4, _varchar) RETURNS setof featuregroup AS '
DECLARE
    mins alias for $1;
    maxs alias for $2;
    srcs alias for $3;
    f featuregroup%ROWTYPE;
    i int;
    s int;
BEGIN
    i := 1;
    FOR i in array_lower( mins, 1 ) .. array_upper( mins, 1 ) LOOP
        SELECT INTO s feature_id FROM feature WHERE uniquename = srcs[i];
        FOR f IN
            SELECT *
            FROM  featuregroup WHERE group_id IN (
                SELECT group_id FROM featuregroup
                WHERE (srcfeature_id = s OR srcfeature_id IS NULL)
                  AND fmin <= mins[i]
                  AND fmax >= maxs[i]
                  AND group_id IN (
                      SELECT group_id FROM groupoverlaps( mins[i], maxs[i] )
                      WHERE  srcfeature_id = s
                  )
            )
        LOOP
            RETURN NEXT f;
        END LOOP;
    END LOOP;
    RETURN;
END;
' LANGUAGE 'plpgsql';

CREATE OR REPLACE FUNCTION groupinside(_int4, _int4, _varchar) RETURNS setof featuregroup AS '
DECLARE
    mins alias for $1;
    maxs alias for $2;
    srcs alias for $3;
    f featuregroup%ROWTYPE;
    i int;
    s int;
BEGIN
    i := 1;
    FOR i in array_lower( mins, 1 ) .. array_upper( mins, 1 ) LOOP
        SELECT INTO s feature_id FROM feature WHERE uniquename = srcs[i];
        FOR f IN
            SELECT *
            FROM  featuregroup WHERE group_id IN (
                SELECT group_id FROM featuregroup
                WHERE (srcfeature_id = s OR srcfeature_id IS NULL)
                  AND fmin >= mins[i]
                  AND fmax <= maxs[i]
                  AND group_id IN (
                      SELECT group_id FROM groupoverlaps( mins[i], maxs[i] )
                      WHERE  srcfeature_id = s
                  )
            )
        LOOP
            RETURN NEXT f;
        END LOOP;
    END LOOP;
    RETURN;
END;
' LANGUAGE 'plpgsql';

CREATE OR REPLACE FUNCTION groupidentical(_int4, _int4, _varchar) RETURNS setof featuregroup AS '
DECLARE
    mins alias for $1;
    maxs alias for $2;
    srcs alias for $3;
    f featuregroup%ROWTYPE;
    i int;
    s int;
BEGIN
    i := 1;
    FOR i in array_lower( mins, 1 ) .. array_upper( mins, 1 ) LOOP
        SELECT INTO s feature_id FROM feature WHERE uniquename = srcs[i];
        FOR f IN
            SELECT *
            FROM  featuregroup WHERE group_id IN (
                SELECT group_id FROM featuregroup
                WHERE (srcfeature_id = s OR srcfeature_id IS NULL)
                  AND fmin = mins[i]
                  AND fmax = maxs[i]
                  AND group_id IN (
                      SELECT group_id FROM groupoverlaps( mins[i], maxs[i] )
                      WHERE  srcfeature_id = s
                  )
            )
        LOOP
            RETURN NEXT f;
        END LOOP;
    END LOOP;
    RETURN;
END;
' LANGUAGE 'plpgsql';

--functional index that depends on the above functions
CREATE INDEX bingroup_boxrange ON featuregroup USING RTREE (boxrange(fmin, fmax)) WHERE is_root = 1;

CREATE OR REPLACE FUNCTION _fill_featuregroup(INTEGER, INTEGER) RETURNS INTEGER AS '
DECLARE
    groupid alias for $1;
    parentid alias for $2;
    g featuregroup%ROWTYPE;
BEGIN
    FOR g IN
        SELECT DISTINCT 0, fr.subject_id, fr.object_id, groupid, fl.srcfeature_id, fl.fmin, fl.fmax, fl.strand, 0
        FROM  feature_relationship AS fr,
              featureloc AS fl
        WHERE fr.object_id = parentid
          AND fr.subject_id = fl.feature_id
    LOOP
        INSERT INTO featuregroup
            (subject_id, object_id, group_id, srcfeature_id, fmin, fmax, strand, is_root)
        VALUES
            (g.subject_id, g.object_id, g.group_id, g.srcfeature_id, g.fmin, g.fmax, g.strand, 0);
        PERFORM _fill_featuregroup(groupid,g.subject_id);
    END LOOP;
    RETURN 1;
END;
' LANGUAGE 'plpgsql';

CREATE OR REPLACE FUNCTION fill_featuregroup() RETURNS INTEGER AS '
DECLARE
    p featuregroup%ROWTYPE;
    l featureloc%ROWTYPE;
    isa int;
    c int;
BEGIN
    TRUNCATE featuregroup;
    SELECT INTO isa cvterm_id FROM cvterm WHERE (name = ''isa'' OR name = ''is_a'');

    -- Recursion is the biggest performance killer for this function.
    -- We can dodge the first round of recursion using the "fr1 / GROUP BY" approach.
    -- Luckily, most feature graphs are only 2 levels deep, so most recursion is
    -- avoidable.

    RAISE NOTICE ''Loading root and singleton features.'';
    FOR p IN
        SELECT DISTINCT 0, f.feature_id, f.feature_id, f.feature_id, srcfeature_id, fmin, fmax, strand, 1
        FROM feature AS f
        LEFT JOIN feature_relationship ON (f.feature_id = object_id)
        LEFT JOIN featureloc           ON (f.feature_id = featureloc.feature_id)
        WHERE f.feature_id NOT IN ( SELECT subject_id FROM feature_relationship )
          AND srcfeature_id IS NOT NULL
    LOOP
        INSERT INTO featuregroup
            (subject_id, object_id, group_id, srcfeature_id, fmin, fmax, strand, is_root)
        VALUES
            (p.object_id, p.object_id, p.object_id, p.srcfeature_id, p.fmin, p.fmax, p.strand, 1);
    END LOOP;

    RAISE NOTICE ''Loading child features.  If your database contains grandchild'';
    RAISE NOTICE ''features, they will be loaded recursively and may take a long time.'';

    FOR p IN
        SELECT DISTINCT 0, fr0.subject_id, fr0.object_id, fr0.object_id, fl.srcfeature_id, fl.fmin, fl.fmax, fl.strand, count(fr1.subject_id)
        FROM  feature_relationship AS fr0
        LEFT JOIN feature_relationship AS fr1 ON ( fr0.subject_id = fr1.object_id),
        featureloc AS fl
        WHERE fr0.subject_id = fl.feature_id
          AND fr0.object_id IN (
                  SELECT f.feature_id
                  FROM feature AS f
                  LEFT JOIN feature_relationship ON (f.feature_id = object_id)
                  LEFT JOIN featureloc           ON (f.feature_id = featureloc.feature_id)
                  WHERE f.feature_id NOT IN ( SELECT subject_id FROM feature_relationship )
                    AND f.feature_id     IN ( SELECT object_id  FROM feature_relationship )
                    AND srcfeature_id IS NOT NULL
              )
        GROUP BY fr0.subject_id, fr0.object_id, fl.srcfeature_id, fl.fmin, fl.fmax, fl.strand
    LOOP
        INSERT INTO featuregroup
            (subject_id, object_id, group_id, srcfeature_id, fmin, fmax, strand, is_root)
        VALUES
            (p.subject_id, p.object_id, p.object_id, p.srcfeature_id, p.fmin, p.fmax, p.strand, 0);
        IF ( p.is_root > 0 ) THEN
            PERFORM _fill_featuregroup(p.subject_id,p.subject_id);
        END IF;
    END LOOP;

    RETURN 1;
END;   
' LANGUAGE 'plpgsql';

SET search_path = public,pg_catalog;
--- create ontology that has instantiated located_sequence_feature part of SO
--- way as it is written, the function can not be execute more than once in one connection
--- when you get error like ERROR:  relation with OID NNNNN does not exist
--- as this is not meant to execute >1 times in one session so it should never happen
--- except at testing and test failed
--- disconnect and try again, in other words, it can NOT be executed >1 time in one connection
--- if using EXECUTE, we can avoid this problem but code is hard to write and read (lots of ', escape char)

--NOTE: private, don't call directly as relying on having temp table tmpcvtr

--DROP TYPE soi_type CASCADE;
CREATE TYPE soi_type AS (
    type_id INT,
    subject_id INT,
    object_id INT
);

CREATE OR REPLACE FUNCTION _fill_cvtermpath4soinode(INTEGER, INTEGER, INTEGER, INTEGER, INTEGER) RETURNS INTEGER AS
'
DECLARE
    origin alias for $1;
    child_id alias for $2;
    cvid alias for $3;
    typeid alias for $4;
    depth alias for $5;
    cterm soi_type%ROWTYPE;
    exist_c int;

BEGIN

    --RAISE NOTICE ''depth=% o=%, root=%, cv=%, t=%'', depth,origin,child_id,cvid,typeid;
    SELECT INTO exist_c count(*) FROM cvtermpath WHERE cv_id = cvid AND object_id = origin AND subject_id = child_id AND pathdistance = depth;
    --- longest path
    IF (exist_c > 0) THEN
        UPDATE cvtermpath SET pathdistance = depth WHERE cv_id = cvid AND object_id = origin AND subject_id = child_id;
    ELSE
        INSERT INTO cvtermpath (object_id, subject_id, cv_id, type_id, pathdistance) VALUES(origin, child_id, cvid, typeid, depth);
    END IF;

    FOR cterm IN SELECT tmp_type AS type_id, subject_id FROM tmpcvtr WHERE object_id = child_id LOOP
        PERFORM _fill_cvtermpath4soinode(origin, cterm.subject_id, cvid, cterm.type_id, depth+1);
    END LOOP;
    RETURN 1;
END;
'
LANGUAGE 'plpgsql';

CREATE OR REPLACE FUNCTION _fill_cvtermpath4soi(INTEGER, INTEGER) RETURNS INTEGER AS
'
DECLARE
    rootid alias for $1;
    cvid alias for $2;
    ttype int;
    cterm soi_type%ROWTYPE;

BEGIN
    
    SELECT INTO ttype cvterm_id FROM cvterm WHERE name = ''isa'';
    --RAISE NOTICE ''got ttype %'',ttype;
    PERFORM _fill_cvtermpath4soinode(rootid, rootid, cvid, ttype, 0);
    FOR cterm IN SELECT tmp_type AS type_id, subject_id FROM tmpcvtr WHERE object_id = rootid LOOP
        PERFORM _fill_cvtermpath4soi(cterm.subject_id, cvid);
    END LOOP;
    RETURN 1;
END;   
'
LANGUAGE 'plpgsql';

--- use tmpcvtr to temp store soi (virtural ontology)
--- using tmp tables is faster than using recursive function to create feature type relationship
--- since it gets feature type rel set by set instead of one by one
--- and getting feature type rel is very expensive
--- call _fillcvtermpath4soi to create path for the virtual ontology

CREATE OR REPLACE FUNCTION create_soi() RETURNS INTEGER AS
'
DECLARE
    parent soi_type%ROWTYPE;
    isa_id cvterm.cvterm_id%TYPE;
    soi_term TEXT := ''soi'';
    soi_def TEXT := ''ontology of SO feature instantiated in database'';
    soi_cvid INTEGER;
    soiterm_id INTEGER;
    pcount INTEGER;
    count INTEGER := 0;
    cquery TEXT;
BEGIN

    SELECT INTO isa_id cvterm_id FROM cvterm WHERE name = ''isa'';

    SELECT INTO soi_cvid cv_id FROM cv WHERE name = soi_term;
    IF (soi_cvid > 0) THEN
        DELETE FROM cvtermpath WHERE cv_id = soi_cvid;
        DELETE FROM cvterm WHERE cv_id = soi_cvid;
    ELSE
        INSERT INTO cv (name, definition) VALUES(soi_term, soi_def);
    END IF;
    SELECT INTO soi_cvid cv_id FROM cv WHERE name = soi_term;
    INSERT INTO cvterm (name, cv_id) VALUES(soi_term, soi_cvid);
    SELECT INTO soiterm_id cvterm_id FROM cvterm WHERE name = soi_term;

    CREATE TEMP TABLE tmpcvtr (tmp_type INT, type_id INT, subject_id INT, object_id INT);
    CREATE UNIQUE INDEX u_tmpcvtr ON tmpcvtr(subject_id, object_id);

    INSERT INTO tmpcvtr (tmp_type, type_id, subject_id, object_id)
        SELECT DISTINCT isa_id, soiterm_id, f.type_id, soiterm_id FROM feature f, cvterm t
        WHERE f.type_id = t.cvterm_id AND f.type_id > 0;
    EXECUTE ''select * from tmpcvtr where type_id = '' || soiterm_id || '';'';
    get diagnostics pcount = row_count;
    raise notice ''all types in feature %'',pcount;
--- do it hard way, delete any child feature type from above (NOT IN clause did not work)
    FOR parent IN SELECT DISTINCT 0, t.cvterm_id, 0 FROM feature c, feature_relationship fr, cvterm t
            WHERE t.cvterm_id = c.type_id AND c.feature_id = fr.subject_id LOOP
        DELETE FROM tmpcvtr WHERE type_id = soiterm_id and object_id = soiterm_id
            AND subject_id = parent.subject_id;
    END LOOP;
    EXECUTE ''select * from tmpcvtr where type_id = '' || soiterm_id || '';'';
    get diagnostics pcount = row_count;
    raise notice ''all types in feature after delete child %'',pcount;

    --- create feature type relationship (store in tmpcvtr)
    CREATE TEMP TABLE tmproot (cv_id INTEGER not null, cvterm_id INTEGER not null, status INTEGER DEFAULT 0);
    cquery := ''SELECT * FROM tmproot tmp WHERE tmp.status = 0;'';
    ---temp use tmpcvtr to hold instantiated SO relationship for speed
    ---use soterm_id as type_id, will delete from tmpcvtr
    ---us tmproot for this as well
    INSERT INTO tmproot (cv_id, cvterm_id, status) SELECT DISTINCT soi_cvid, c.subject_id, 0 FROM tmpcvtr c
        WHERE c.object_id = soiterm_id;
    EXECUTE cquery;
    GET DIAGNOSTICS pcount = ROW_COUNT;
    WHILE (pcount > 0) LOOP
        RAISE NOTICE ''num child temp (to be inserted) in tmpcvtr: %'',pcount;
        INSERT INTO tmpcvtr (tmp_type, type_id, subject_id, object_id)
            SELECT DISTINCT fr.type_id, soiterm_id, c.type_id, p.cvterm_id FROM feature c, feature_relationship fr,
            tmproot p, feature pf, cvterm t WHERE c.feature_id = fr.subject_id AND fr.object_id = pf.feature_id
            AND p.cvterm_id = pf.type_id AND t.cvterm_id = c.type_id AND p.status = 0;
        UPDATE tmproot SET status = 1 WHERE status = 0;
        INSERT INTO tmproot (cv_id, cvterm_id, status)
            SELECT DISTINCT soi_cvid, c.type_id, 0 FROM feature c, feature_relationship fr,
            tmproot tmp, feature p, cvterm t WHERE c.feature_id = fr.subject_id AND fr.object_id = p.feature_id
            AND tmp.cvterm_id = p.type_id AND t.cvterm_id = c.type_id AND tmp.status = 1;
        UPDATE tmproot SET status = 2 WHERE status = 1;
        EXECUTE cquery;
        GET DIAGNOSTICS pcount = ROW_COUNT; 
    END LOOP;
    DELETE FROM tmproot;

    ---get transitive closure for soi
    PERFORM _fill_cvtermpath4soi(soiterm_id, soi_cvid);

    DROP TABLE tmpcvtr;
    DROP TABLE tmproot;

    RETURN 1;
END;
'
LANGUAGE 'plpgsql';

---bad precedence: change customed type name
---drop here to remove old function
--DROP TYPE feature_by_cvt_type CASCADE;
--DROP TYPE fxgsfids_type CASCADE;

--DROP TYPE feature_by_fx_type CASCADE;
CREATE TYPE feature_by_fx_type AS (
    feature_id INTEGER,
    depth INT
);

CREATE OR REPLACE FUNCTION get_sub_feature_ids(text) RETURNS SETOF feature_by_fx_type AS
'
DECLARE
    sql alias for $1;
    myrc feature_by_fx_type%ROWTYPE;
    myrc2 feature_by_fx_type%ROWTYPE;

BEGIN
    FOR myrc IN EXECUTE sql LOOP
        FOR myrc2 IN SELECT * FROM get_sub_feature_ids(myrc.feature_id) LOOP
            RETURN NEXT myrc2;
        END LOOP;
    END LOOP;
    RETURN;
END;
'
LANGUAGE 'plpgsql';

CREATE OR REPLACE FUNCTION get_up_feature_ids(text) RETURNS SETOF feature_by_fx_type AS
'
DECLARE
    sql alias for $1;
    myrc feature_by_fx_type%ROWTYPE;
    myrc2 feature_by_fx_type%ROWTYPE;

BEGIN
    FOR myrc IN EXECUTE sql LOOP
        FOR myrc2 IN SELECT * FROM get_up_feature_ids(myrc.feature_id) LOOP
            RETURN NEXT myrc2;
        END LOOP;
    END LOOP;
    RETURN;
END;
'
LANGUAGE 'plpgsql';

CREATE OR REPLACE FUNCTION get_feature_ids(text) RETURNS SETOF feature_by_fx_type AS
'
DECLARE
    sql alias for $1;
    myrc feature_by_fx_type%ROWTYPE;
    myrc2 feature_by_fx_type%ROWTYPE;
    myrc3 feature_by_fx_type%ROWTYPE;

BEGIN

    FOR myrc IN EXECUTE sql LOOP
        RETURN NEXT myrc;
        FOR myrc2 IN SELECT * FROM get_up_feature_ids(myrc.feature_id) LOOP
            RETURN NEXT myrc2;
        END LOOP;
        FOR myrc3 IN SELECT * FROM get_sub_feature_ids(myrc.feature_id) LOOP
            RETURN NEXT myrc3;
        END LOOP;
    END LOOP;
    RETURN;
END;
'
LANGUAGE 'plpgsql';


CREATE OR REPLACE FUNCTION get_sub_feature_ids(integer) RETURNS SETOF feature_by_fx_type AS
'
DECLARE
    root alias for $1;
    myrc feature_by_fx_type%ROWTYPE;
    myrc2 feature_by_fx_type%ROWTYPE;

BEGIN
    FOR myrc IN SELECT DISTINCT subject_id AS feature_id FROM feature_relationship WHERE object_id = root LOOP
        RETURN NEXT myrc;
        FOR myrc2 IN SELECT * FROM get_sub_feature_ids(myrc.feature_id) LOOP
            RETURN NEXT myrc2;
        END LOOP;
    END LOOP;
    RETURN;
END;
'
LANGUAGE 'plpgsql';

CREATE OR REPLACE FUNCTION get_up_feature_ids(integer) RETURNS SETOF feature_by_fx_type AS
'
DECLARE
    leaf alias for $1;
    myrc feature_by_fx_type%ROWTYPE;
    myrc2 feature_by_fx_type%ROWTYPE;
BEGIN
    FOR myrc IN SELECT DISTINCT object_id AS feature_id FROM feature_relationship WHERE subject_id = leaf LOOP
        RETURN NEXT myrc;
        FOR myrc2 IN SELECT * FROM get_up_feature_ids(myrc.feature_id) LOOP
            RETURN NEXT myrc2;
        END LOOP;
    END LOOP;
    RETURN;
END;
'
LANGUAGE 'plpgsql';

CREATE OR REPLACE FUNCTION get_sub_feature_ids(integer, integer) RETURNS SETOF feature_by_fx_type AS
'
DECLARE
    root alias for $1;
    depth alias for $2;
    myrc feature_by_fx_type%ROWTYPE;
    myrc2 feature_by_fx_type%ROWTYPE;

BEGIN
    FOR myrc IN SELECT DISTINCT subject_id AS feature_id, depth FROM feature_relationship WHERE object_id = root LOOP
        RETURN NEXT myrc;
        FOR myrc2 IN SELECT * FROM get_sub_feature_ids(myrc.feature_id,depth+1) LOOP
            RETURN NEXT myrc2;
        END LOOP;
    END LOOP;
    RETURN;
END;
'
LANGUAGE 'plpgsql';

--- depth is reversed and meanless when union with results from get_sub_feature_ids
CREATE OR REPLACE FUNCTION get_up_feature_ids(integer, integer) RETURNS SETOF feature_by_fx_type AS
'
DECLARE
    leaf alias for $1;
    depth alias for $2;
    myrc feature_by_fx_type%ROWTYPE;
    myrc2 feature_by_fx_type%ROWTYPE;
BEGIN
    FOR myrc IN SELECT DISTINCT object_id AS feature_id, depth FROM feature_relationship WHERE subject_id = leaf LOOP
        RETURN NEXT myrc;
        FOR myrc2 IN SELECT * FROM get_up_feature_ids(myrc.feature_id,depth+1) LOOP
            RETURN NEXT myrc2;
        END LOOP;
    END LOOP;
    RETURN;
END;
'
LANGUAGE 'plpgsql';

--- children feature ids only (not include itself--parent) for SO type and range (src)
CREATE OR REPLACE FUNCTION get_sub_feature_ids_by_type_src(cvterm.name%TYPE,feature.uniquename%TYPE,char(1)) RETURNS SETOF feature_by_fx_type AS
'
DECLARE
    gtype alias for $1;
    src alias for $2;
    is_an alias for $3;
    query text;
    myrc feature_by_fx_type%ROWTYPE;
    myrc2 feature_by_fx_type%ROWTYPE;

BEGIN

    query := ''SELECT DISTINCT f.feature_id FROM feature f INNER join cvterm t ON (f.type_id = t.cvterm_id)
        INNER join featureloc fl
        ON (f.feature_id = fl.feature_id) INNER join feature src ON (src.feature_id = fl.srcfeature_id)
        WHERE t.name = '' || quote_literal(gtype) || '' AND src.uniquename = '' || quote_literal(src)
        || '' AND f.is_analysis = '' || quote_literal(is_an) || '';'';
 
    IF (STRPOS(gtype, ''%'') > 0) THEN
        query := ''SELECT DISTINCT f.feature_id FROM feature f INNER join cvterm t ON (f.type_id = t.cvterm_id)
             INNER join featureloc fl
            ON (f.feature_id = fl.feature_id) INNER join feature src ON (src.feature_id = fl.srcfeature_id)
            WHERE t.name like '' || quote_literal(gtype) || '' AND src.uniquename = '' || quote_literal(src)
            || '' AND f.is_analysis = '' || quote_literal(is_an) || '';'';
    END IF;
    FOR myrc IN SELECT * FROM get_sub_feature_ids(query) LOOP
        RETURN NEXT myrc;
    END LOOP;
    RETURN;
END;
'
LANGUAGE 'plpgsql';

--- by SO type, usefull for tRNA, ncRNA, etc
CREATE OR REPLACE FUNCTION get_feature_ids_by_type(cvterm.name%TYPE, char(1)) RETURNS SETOF feature_by_fx_type AS
'
DECLARE
    gtype alias for $1;
    is_an alias for $2;
    query TEXT;
    myrc feature_by_fx_type%ROWTYPE;
    myrc2 feature_by_fx_type%ROWTYPE;

BEGIN

    query := ''SELECT DISTINCT f.feature_id 
        FROM feature f, cvterm t WHERE t.cvterm_id = f.type_id AND t.name = '' || quote_literal(gtype) ||
        '' AND f.is_analysis = '' || quote_literal(is_an) || '';'';
    IF (STRPOS(gtype, ''%'') > 0) THEN
        query := ''SELECT DISTINCT f.feature_id 
            FROM feature f, cvterm t WHERE t.cvterm_id = f.type_id AND t.name like ''
            || quote_literal(gtype) || '' AND f.is_analysis = '' || quote_literal(is_an) || '';'';
    END IF;

    FOR myrc IN SELECT * FROM get_feature_ids(query) LOOP
        RETURN NEXT myrc;
    END LOOP;
    RETURN;
END;
'
LANGUAGE 'plpgsql';

CREATE OR REPLACE FUNCTION get_feature_ids_by_type_src(cvterm.name%TYPE, feature.uniquename%TYPE, char(1)) RETURNS SETOF feature_by_fx_type AS
'
DECLARE
    gtype alias for $1;
    src alias for $2;
    is_an alias for $3;
    query TEXT;
    myrc feature_by_fx_type%ROWTYPE;
    myrc2 feature_by_fx_type%ROWTYPE;

BEGIN

    query := ''SELECT DISTINCT f.feature_id 
        FROM feature f INNER join cvterm t ON (f.type_id = t.cvterm_id) INNER join featureloc fl
        ON (f.feature_id = fl.feature_id) INNER join feature src ON (src.feature_id = fl.srcfeature_id)
        WHERE t.name = '' || quote_literal(gtype) || '' AND src.uniquename = '' || quote_literal(src)
        || '' AND f.is_analysis = '' || quote_literal(is_an) || '';'';
 
    IF (STRPOS(gtype, ''%'') > 0) THEN
        query := ''SELECT DISTINCT f.feature_id 
            FROM feature f INNER join cvterm t ON (f.type_id = t.cvterm_id) INNER join featureloc fl
            ON (f.feature_id = fl.feature_id) INNER join feature src ON (src.feature_id = fl.srcfeature_id)
            WHERE t.name like '' || quote_literal(gtype) || '' AND src.uniquename = '' || quote_literal(src)
            || '' AND f.is_analysis = '' || quote_literal(is_an) || '';'';
    END IF;

    FOR myrc IN SELECT * FROM get_feature_ids(query) LOOP
        RETURN NEXT myrc;
    END LOOP;
    RETURN;
END;
'
LANGUAGE 'plpgsql';

CREATE OR REPLACE FUNCTION get_feature_ids_by_type_name(cvterm.name%TYPE, feature.uniquename%TYPE, char(1)) RETURNS SETOF feature_by_fx_type AS
'
DECLARE
    gtype alias for $1;
    name alias for $2;
    is_an alias for $3;
    query TEXT;
    myrc feature_by_fx_type%ROWTYPE;
    myrc2 feature_by_fx_type%ROWTYPE;

BEGIN

    query := ''SELECT DISTINCT f.feature_id 
        FROM feature f INNER join cvterm t ON (f.type_id = t.cvterm_id)
        WHERE t.name = '' || quote_literal(gtype) || '' AND (f.uniquename = '' || quote_literal(name)
        || '' OR f.name = '' || quote_literal(name) || '') AND f.is_analysis = '' || quote_literal(is_an) || '';'';
 
    IF (STRPOS(name, ''%'') > 0) THEN
        query := ''SELECT DISTINCT f.feature_id 
            FROM feature f INNER join cvterm t ON (f.type_id = t.cvterm_id)
            WHERE t.name = '' || quote_literal(gtype) || '' AND (f.uniquename like '' || quote_literal(name)
            || '' OR f.name like '' || quote_literal(name) || '') AND f.is_analysis = '' || quote_literal(is_an) || '';'';
    END IF;

    FOR myrc IN SELECT * FROM get_feature_ids(query) LOOP
        RETURN NEXT myrc;
    END LOOP;
    RETURN;
END;
'
LANGUAGE 'plpgsql';

--- get all feature ids (including children) for feature that has an ontology term (say GO function)
CREATE OR REPLACE FUNCTION get_feature_ids_by_ont(cv.name%TYPE,cvterm.name%TYPE) RETURNS SETOF feature_by_fx_type AS
'
DECLARE
    aspect alias for $1;
    term alias for $2;
    query TEXT;
    myrc feature_by_fx_type%ROWTYPE;
    myrc2 feature_by_fx_type%ROWTYPE;

BEGIN

    query := ''SELECT DISTINCT fcvt.feature_id 
        FROM feature_cvterm fcvt, cv, cvterm t WHERE cv.cv_id = t.cv_id AND
        t.cvterm_id = fcvt.cvterm_id AND cv.name = '' || quote_literal(aspect) ||
        '' AND t.name = '' || quote_literal(term) || '';'';
    IF (STRPOS(term, ''%'') > 0) THEN
        query := ''SELECT DISTINCT fcvt.feature_id 
            FROM feature_cvterm fcvt, cv, cvterm t WHERE cv.cv_id = t.cv_id AND
            t.cvterm_id = fcvt.cvterm_id AND cv.name = '' || quote_literal(aspect) ||
            '' AND t.name like '' || quote_literal(term) || '';'';
    END IF;

    FOR myrc IN SELECT * FROM get_feature_ids(query) LOOP
        RETURN NEXT myrc;
    END LOOP;
    RETURN;
END;
'
LANGUAGE 'plpgsql';

CREATE OR REPLACE FUNCTION get_feature_ids_by_ont_root(cv.name%TYPE,cvterm.name%TYPE) RETURNS SETOF feature_by_fx_type AS
'
DECLARE
    aspect alias for $1;
    term alias for $2;
    query TEXT;
    subquery TEXT;
    myrc feature_by_fx_type%ROWTYPE;
    myrc2 feature_by_fx_type%ROWTYPE;

BEGIN

    subquery := ''SELECT t.cvterm_id FROM cv, cvterm t WHERE cv.cv_id = t.cv_id 
        AND cv.name = '' || quote_literal(aspect) || '' AND t.name = '' || quote_literal(term) || '';'';
    IF (STRPOS(term, ''%'') > 0) THEN
        subquery := ''SELECT t.cvterm_id FROM cv, cvterm t WHERE cv.cv_id = t.cv_id 
            AND cv.name = '' || quote_literal(aspect) || '' AND t.name like '' || quote_literal(term) || '';'';
    END IF;
    query := ''SELECT DISTINCT fcvt.feature_id 
        FROM feature_cvterm fcvt INNER JOIN (SELECT cvterm_id FROM get_it_sub_cvterm_ids('' || quote_literal(subquery) || '')) AS ont ON (fcvt.cvterm_id = ont.cvterm_id);'';

    FOR myrc IN SELECT * FROM get_feature_ids(query) LOOP
        RETURN NEXT myrc;
    END LOOP;
    RETURN;
END;
'
LANGUAGE 'plpgsql';

--- get all feature ids (including children) for feature with the property (type, val)
CREATE OR REPLACE FUNCTION get_feature_ids_by_property(cvterm.name%TYPE,varchar) RETURNS SETOF feature_by_fx_type AS
'
DECLARE
    p_type alias for $1;
    p_val alias for $2;
    query TEXT;
    myrc feature_by_fx_type%ROWTYPE;
    myrc2 feature_by_fx_type%ROWTYPE;

BEGIN

    query := ''SELECT DISTINCT fprop.feature_id 
        FROM featureprop fprop, cvterm t WHERE t.cvterm_id = fprop.type_id AND t.name = '' ||
        quote_literal(p_type) || '' AND fprop.value = '' || quote_literal(p_val) || '';'';
    IF (STRPOS(p_val, ''%'') > 0) THEN
        query := ''SELECT DISTINCT fprop.feature_id 
            FROM featureprop fprop, cvterm t WHERE t.cvterm_id = fprop.type_id AND t.name = '' ||
            quote_literal(p_type) || '' AND fprop.value like '' || quote_literal(p_val) || '';'';
    END IF;

    FOR myrc IN SELECT * FROM get_feature_ids(query) LOOP
        RETURN NEXT myrc;
    END LOOP;
    RETURN;
END;
'
LANGUAGE 'plpgsql';

--- get all feature ids (including children) for feature with the property val
CREATE OR REPLACE FUNCTION get_feature_ids_by_propval(varchar) RETURNS SETOF feature_by_fx_type AS
'
DECLARE
    p_val alias for $1;
    query TEXT;
    myrc feature_by_fx_type%ROWTYPE;
    myrc2 feature_by_fx_type%ROWTYPE;

BEGIN

    query := ''SELECT DISTINCT fprop.feature_id 
        FROM featureprop fprop WHERE fprop.value = '' || quote_literal(p_val) || '';'';
    IF (STRPOS(p_val, ''%'') > 0) THEN
        query := ''SELECT DISTINCT fprop.feature_id 
            FROM featureprop fprop WHERE fprop.value like '' || quote_literal(p_val) || '';'';
    END IF;

    FOR myrc IN SELECT * FROM get_feature_ids(query) LOOP
        RETURN NEXT myrc;
    END LOOP;
    RETURN;
END;
'
LANGUAGE 'plpgsql';


---4 args: ptype, ctype, count, operator (valid SQL number comparison operator), and is_analysis 
---get feature ids for any node with type = ptype whose child node type = ctype
---and child node feature count comparing (using operator) to ccount
CREATE OR REPLACE FUNCTION get_feature_ids_by_child_count(cvterm.name%TYPE, cvterm.name%TYPE, INTEGER, varchar, char(1)) RETURNS SETOF feature_by_fx_type AS
'
DECLARE
    ptype alias for $1;
    ctype alias for $2;
    ccount alias for $3;
    operator alias for $4;
    is_an alias for $5;
    query TEXT;
    myrc feature_by_fx_type%ROWTYPE;
    myrc2 feature_by_fx_type %ROWTYPE;

BEGIN

    query := ''SELECT DISTINCT f.feature_id
        FROM feature f INNER join (select count(*) as c, p.feature_id FROM feature p
        INNER join cvterm pt ON (p.type_id = pt.cvterm_id) INNER join feature_relationship fr
        ON (p.feature_id = fr.object_id) INNER join feature c ON (c.feature_id = fr.subject_id)
        INNER join cvterm ct ON (c.type_id = ct.cvterm_id)
        WHERE pt.name = '' || quote_literal(ptype) || '' AND ct.name = '' || quote_literal(ctype)
        || '' AND p.is_analysis = '' || quote_literal(is_an) || '' group by p.feature_id) as cq
        ON (cq.feature_id = f.feature_id) WHERE cq.c '' || operator || ccount || '';'';
    ---RAISE NOTICE ''%'', query; 

    FOR myrc IN SELECT * FROM get_feature_ids(query) LOOP
        RETURN NEXT myrc;
    END LOOP;
    RETURN;
END;
'
LANGUAGE 'plpgsql';
-- ==========================================
-- Chado companalysis module
--
-- =================================================================
-- Dependencies:
--
-- :import feature from sequence
-- :import cvterm from cv
-- =================================================================

-- ================================================
-- TABLE: analysis
-- ================================================

create table analysis (
    analysis_id serial not null,
    primary key (analysis_id),
    name varchar(255),
    description text,
    program varchar(255) not null,
    programversion varchar(255) not null,
    algorithm varchar(255),
    sourcename varchar(255),
    sourceversion varchar(255),
    sourceuri text,
    timeexecuted timestamp not null default current_timestamp,
    constraint analysis_c1 unique (program,programversion,sourcename)
);
COMMENT ON TABLE analysis IS 'An analysis is a particular type of a
    computational analysis; it may be a blast of one sequence against
    another, or an all by all blast, or a different kind of analysis
    altogether. It is a single unit of computation.';
COMMENT ON COLUMN analysis.name IS 'A way of grouping analyses. This
    should be a handy short identifier that can help people find an
    analysis they want. For instance "tRNAscan", "cDNA", "FlyPep",
    "SwissProt", and it should not be assumed to be unique. For instance, there may be lots of separate analyses done against a cDNA database.';
COMMENT ON COLUMN analysis.program IS 'Program name, e.g. blastx, blastp, sim4, genscan.';
COMMENT ON COLUMN analysis.programversion IS 'Version description, e.g. TBLASTX 2.0MP-WashU [09-Nov-2000].';
COMMENT ON COLUMN analysis.algorithm IS 'Algorithm name, e.g. blast.';
COMMENT ON COLUMN analysis.sourcename IS 'Source name, e.g. cDNA, SwissProt.';
COMMENT ON COLUMN analysis.sourceuri IS 'This is an optional, permanent URL or URI for the source of the  analysis. The idea is that someone could recreate the analysis directly by going to this URI and fetching the source data (e.g. the blast database, or the training model).';

-- ================================================
-- TABLE: analysisprop
-- ================================================

create table analysisprop (
    analysisprop_id serial not null,
    primary key (analysisprop_id),
    analysis_id int not null,
    foreign key (analysis_id) references analysis (analysis_id) on delete cascade INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    value text,
    rank int not null default 0,
    constraint analysisprop_c1 unique (analysis_id,type_id,rank)
);
create index analysisprop_idx1 on analysisprop (analysis_id);
create index analysisprop_idx2 on analysisprop (type_id);

-- ================================================
-- TABLE: analysisfeature
-- ================================================

create table analysisfeature (
    analysisfeature_id serial not null,
    primary key (analysisfeature_id),
    feature_id int not null,
    foreign key (feature_id) references feature (feature_id) on delete cascade INITIALLY DEFERRED,
    analysis_id int not null,
    foreign key (analysis_id) references analysis (analysis_id) on delete cascade INITIALLY DEFERRED,
    rawscore double precision,
    normscore double precision,
    significance double precision,
    identity double precision,
    constraint analysisfeature_c1 unique (feature_id,analysis_id)
);
create index analysisfeature_idx1 on analysisfeature (feature_id);
create index analysisfeature_idx2 on analysisfeature (analysis_id);

COMMENT ON TABLE analysisfeature IS 'Computational analyses generate features (e.g. Genscan generates transcripts and exons; sim4 alignments generate similarity/match features). analysisfeatures are stored using the feature table from the sequence module. The analysisfeature table is used to decorate these features, with analysis specific attributes. A feature is an analysisfeature if and only if there is a corresponding entry in the analysisfeature table. analysisfeatures will have two or more featureloc entries,
 with rank indicating query/subject';
COMMENT ON COLUMN analysisfeature.identity IS 'Percent identity between the locations compared.  Note that these 4 metrics do not cover the full range of scores possible; it would be undesirable to list every score possible, as this should be kept extensible. instead, for non-standard scores, use the analysisprop table.';
COMMENT ON COLUMN analysisfeature.significance IS 'This is some kind of expectation or probability metric, representing the probability that the analysis would appear randomly given the model. As such, any program or person querying this table can assume the following semantics:
   * 0 <= significance <= n, where n is a positive number, theoretically unbounded but unlikely to be more than 10
  * low numbers are better than high numbers.';
COMMENT ON COLUMN analysisfeature.normscore IS 'This is the rawscore but
    semi-normalized. Complete normalization to allow comparison of
    features generated by different programs would be nice but too
    difficult. Instead the normalization should strive to enforce the
    following semantics: * normscores are floating point numbers >= 0,
    * high normscores are better than low one. For most programs, it would be sufficient to make the normscore the same as this rawscore, providing these semantics are satisfied.';
COMMENT ON COLUMN analysisfeature.rawscore IS 'This is the native score generated by the program; for example, the bitscore generated by blast, sim4 or genscan scores. One should not assume that high is necessarily better than low.';


CREATE TABLE analysisfeatureprop (
    analysisfeatureprop_id SERIAL PRIMARY KEY,
    analysisfeature_id INTEGER NOT NULL REFERENCES analysisfeature(analysisfeature_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
    type_id INTEGER NOT NULL REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
    value TEXT,
    rank INTEGER NOT NULL,
    CONSTRAINT analysisfeature_id_type_id_rank UNIQUE(analysisfeature_id, type_id, rank)
);
create index analysisfeatureprop_idx1 on analysisfeatureprop (analysisfeature_id);
create index analysisfeatureprop_idx2 on analysisfeatureprop (type_id);

CREATE OR REPLACE FUNCTION store_analysis (VARCHAR,VARCHAR,VARCHAR) 
  RETURNS INT AS 
'DECLARE
   v_program            ALIAS FOR $1;
   v_programversion     ALIAS FOR $2;
   v_sourcename         ALIAS FOR $3;
   pkval                INTEGER;
 BEGIN
    SELECT INTO pkval analysis_id
      FROM analysis
      WHERE program=v_program AND
            programversion=v_programversion AND
            sourcename=v_sourcename;
    IF NOT FOUND THEN
      INSERT INTO analysis 
       (program,programversion,sourcename)
         VALUES
       (v_program,v_programversion,v_sourcename);
      RETURN currval(''analysis_analysis_id_seq'');
    END IF;
    RETURN pkval;
 END;
' LANGUAGE 'plpgsql';

--CREATE OR REPLACE FUNCTION store_analysisfeature
--()
--RETURNS INT AS
--'DECLARE
--  v_srcfeature_id       ALIAS FOR $1;
  
-- ==========================================
-- Chado phenotype module
--
-- 05-31-2011
-- added 'name' column to phenotype. non-unique human readable field.
--
-- =================================================================
-- Dependencies:
--
-- :import cvterm from cv
-- :import feature from sequence
-- =================================================================

-- ================================================
-- TABLE: phenotype
-- ================================================

CREATE TABLE phenotype (
    phenotype_id SERIAL NOT NULL,
    primary key (phenotype_id),
    uniquename TEXT NOT NULL,
    name TEXT default null,
    observable_id INT,
    FOREIGN KEY (observable_id) REFERENCES cvterm (cvterm_id) ON DELETE CASCADE,
    attr_id INT,
    FOREIGN KEY (attr_id) REFERENCES cvterm (cvterm_id) ON DELETE SET NULL,
    value TEXT,
    cvalue_id INT,
    FOREIGN KEY (cvalue_id) REFERENCES cvterm (cvterm_id) ON DELETE SET NULL,
    assay_id INT,
    FOREIGN KEY (assay_id) REFERENCES cvterm (cvterm_id) ON DELETE SET NULL,
    CONSTRAINT phenotype_c1 UNIQUE (uniquename)
);
CREATE INDEX phenotype_idx1 ON phenotype (cvalue_id);
CREATE INDEX phenotype_idx2 ON phenotype (observable_id);
CREATE INDEX phenotype_idx3 ON phenotype (attr_id);

COMMENT ON TABLE phenotype IS 'A phenotypic statement, or a single
atomic phenotypic observation, is a controlled sentence describing
observable effects of non-wild type function. E.g. Obs=eye, attribute=color, cvalue=red.';
COMMENT ON COLUMN phenotype.observable_id IS 'The entity: e.g. anatomy_part, biological_process.';
COMMENT ON COLUMN phenotype.attr_id IS 'Phenotypic attribute (quality, property, attribute, character) - drawn from PATO.';
COMMENT ON COLUMN phenotype.value IS 'Value of attribute - unconstrained free text. Used only if cvalue_id is not appropriate.';
COMMENT ON COLUMN phenotype.cvalue_id IS 'Phenotype attribute value (state).';
COMMENT ON COLUMN phenotype.assay_id IS 'Evidence type.';

-- ================================================
-- TABLE: phenotype_cvterm
-- ================================================

CREATE TABLE phenotype_cvterm (
    phenotype_cvterm_id SERIAL NOT NULL,
    primary key (phenotype_cvterm_id),
    phenotype_id INT NOT NULL,
    FOREIGN KEY (phenotype_id) REFERENCES phenotype (phenotype_id) ON DELETE CASCADE,
    cvterm_id INT NOT NULL,
    FOREIGN KEY (cvterm_id) REFERENCES cvterm (cvterm_id) ON DELETE CASCADE,
    rank int not null default 0,
    CONSTRAINT phenotype_cvterm_c1 UNIQUE (phenotype_id, cvterm_id, rank)
);
CREATE INDEX phenotype_cvterm_idx1 ON phenotype_cvterm (phenotype_id);
CREATE INDEX phenotype_cvterm_idx2 ON phenotype_cvterm (cvterm_id);

COMMENT ON TABLE phenotype_cvterm IS NULL;

-- ================================================
-- TABLE: feature_phenotype
-- ================================================

CREATE TABLE feature_phenotype (
    feature_phenotype_id SERIAL NOT NULL,
    primary key (feature_phenotype_id),
    feature_id INT NOT NULL,
    FOREIGN KEY (feature_id) REFERENCES feature (feature_id) ON DELETE CASCADE,
    phenotype_id INT NOT NULL,
    FOREIGN KEY (phenotype_id) REFERENCES phenotype (phenotype_id) ON DELETE CASCADE,
    CONSTRAINT feature_phenotype_c1 UNIQUE (feature_id,phenotype_id)       
);
CREATE INDEX feature_phenotype_idx1 ON feature_phenotype (feature_id);
CREATE INDEX feature_phenotype_idx2 ON feature_phenotype (phenotype_id);

COMMENT ON TABLE feature_phenotype IS NULL;
-- ==========================================
-- Chado genetics module
--
-- changes 2011-05-31
--   added type_id to genotype (can be null for backward compatibility)
--   added genotypeprop table
-- 2006-04-11
--   split out phenotype tables into phenotype module
--
-- redesigned 2003-10-28
--
-- changes 2003-11-10:
--   incorporating suggestions to make everything a gcontext; use 
--   gcontext_relationship to make some gcontexts derivable from others. we 
--   would incorporate environment this way - just add the environment 
--   descriptors as properties of the child gcontext
--
-- changes 2004-06 (Documented by DE: 10-MAR-2005):
--   Many, including rename of gcontext to genotype,  split 
--   phenstatement into phenstatement & phenotype, created environment
--
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ============
-- DEPENDENCIES
-- ============
-- :import feature from sequence
-- :import phenotype from phenotype
-- :import cvterm from cv
-- :import pub from pub
-- :import dbxref from general
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-- ================================================
-- TABLE: genotype
-- ================================================
create table genotype (
    genotype_id serial not null,
    primary key (genotype_id),
    name text,
    uniquename text not null,
    description varchar(255),
    type_id INT NOT NULL,
    FOREIGN KEY (type_id) REFERENCES cvterm (cvterm_id) ON DELETE CASCADE,
    constraint genotype_c1 unique (uniquename)
);
create index genotype_idx1 on genotype(uniquename);
create index genotype_idx2 on genotype(name);

COMMENT ON TABLE genotype IS 'Genetic context. A genotype is defined by a collection of features, mutations, balancers, deficiencies, haplotype blocks, or engineered constructs.';

COMMENT ON COLUMN genotype.uniquename IS 'The unique name for a genotype; 
typically derived from the features making up the genotype.';

COMMENT ON COLUMN genotype.name IS 'Optional alternative name for a genotype, 
for display purposes.';

-- ===============================================
-- TABLE: feature_genotype
-- ================================================
create table feature_genotype (
    feature_genotype_id serial not null,
    primary key (feature_genotype_id),
    feature_id int not null,
    foreign key (feature_id) references feature (feature_id) on delete cascade,
    genotype_id int not null,
    foreign key (genotype_id) references genotype (genotype_id) on delete cascade,
    chromosome_id int,
    foreign key (chromosome_id) references feature (feature_id) on delete set null,
    rank int not null,
    cgroup    int not null,
    cvterm_id int not null,
    foreign key (cvterm_id) references cvterm (cvterm_id) on delete cascade,
    constraint feature_genotype_c1 unique (feature_id, genotype_id, cvterm_id, chromosome_id, rank, cgroup)
);
create index feature_genotype_idx1 on feature_genotype (feature_id);
create index feature_genotype_idx2 on feature_genotype (genotype_id);

COMMENT ON TABLE feature_genotype IS NULL;
COMMENT ON COLUMN feature_genotype.rank IS 'rank can be used for
n-ploid organisms or to preserve order.';
COMMENT ON COLUMN feature_genotype.cgroup IS 'Spatially distinguishable
group. group can be used for distinguishing the chromosomal groups,
for example (RNAi products and so on can be treated as different
groups, as they do not fall on a particular chromosome).';
COMMENT ON COLUMN feature_genotype.chromosome_id IS 'A feature of SO type "chromosome".';

-- ================================================
-- TABLE: environment
-- ================================================
create table environment (
    environment_id serial not NULL,
    primary key  (environment_id),
    uniquename text not null,
    description text,
    constraint environment_c1 unique (uniquename)
);
create index environment_idx1 on environment(uniquename);

COMMENT ON TABLE environment IS 'The environmental component of a phenotype description.';


-- ================================================
-- TABLE: environment_cvterm
-- ================================================
create table environment_cvterm (
    environment_cvterm_id serial not null,
    primary key  (environment_cvterm_id),
    environment_id int not null,
    foreign key (environment_id) references environment (environment_id) on delete cascade,
    cvterm_id int not null,
    foreign key (cvterm_id) references cvterm (cvterm_id) on delete cascade,
    constraint environment_cvterm_c1 unique (environment_id, cvterm_id)
);
create index environment_cvterm_idx1 on environment_cvterm (environment_id);
create index environment_cvterm_idx2 on environment_cvterm (cvterm_id);

COMMENT ON TABLE environment_cvterm IS NULL;

-- ================================================
-- TABLE: phenstatement
-- ================================================
CREATE TABLE phenstatement (
    phenstatement_id SERIAL NOT NULL,
    primary key (phenstatement_id),
    genotype_id INT NOT NULL,
    FOREIGN KEY (genotype_id) REFERENCES genotype (genotype_id) ON DELETE CASCADE,
    environment_id INT NOT NULL,
    FOREIGN KEY (environment_id) REFERENCES environment (environment_id) ON DELETE CASCADE,
    phenotype_id INT NOT NULL,
    FOREIGN KEY (phenotype_id) REFERENCES phenotype (phenotype_id) ON DELETE CASCADE,
    type_id INT NOT NULL,
    FOREIGN KEY (type_id) REFERENCES cvterm (cvterm_id) ON DELETE CASCADE,
    pub_id INT NOT NULL,
    FOREIGN KEY (pub_id) REFERENCES pub (pub_id) ON DELETE CASCADE,
    CONSTRAINT phenstatement_c1 UNIQUE (genotype_id,phenotype_id,environment_id,type_id,pub_id)
);
CREATE INDEX phenstatement_idx1 ON phenstatement (genotype_id);
CREATE INDEX phenstatement_idx2 ON phenstatement (phenotype_id);

COMMENT ON TABLE phenstatement IS 'Phenotypes are things like "larval lethal".  Phenstatements are things like "dpp-1 is recessive larval lethal". So essentially phenstatement is a linking table expressing the relationship between genotype, environment, and phenotype.';

-- ================================================
-- TABLE: phendesc
-- ================================================
CREATE TABLE phendesc (
    phendesc_id SERIAL NOT NULL,
    primary key (phendesc_id),
    genotype_id INT NOT NULL,
    FOREIGN KEY (genotype_id) REFERENCES genotype (genotype_id) ON DELETE CASCADE,
    environment_id INT NOT NULL,
    FOREIGN KEY (environment_id) REFERENCES environment ( environment_id) ON DELETE CASCADE,
    description TEXT NOT NULL,
    type_id INT NOT NULL,
        FOREIGN KEY (type_id) REFERENCES cvterm (cvterm_id) ON DELETE CASCADE,
    pub_id INT NOT NULL,
    FOREIGN KEY (pub_id) REFERENCES pub (pub_id) ON DELETE CASCADE,
    CONSTRAINT phendesc_c1 UNIQUE (genotype_id,environment_id,type_id,pub_id)
);
CREATE INDEX phendesc_idx1 ON phendesc (genotype_id);
CREATE INDEX phendesc_idx2 ON phendesc (environment_id);
CREATE INDEX phendesc_idx3 ON phendesc (pub_id);

COMMENT ON TABLE phendesc IS 'A summary of a _set_ of phenotypic statements for any one gcontext made in any one publication.';

-- ================================================
-- TABLE: phenotype_comparison
-- ================================================
CREATE TABLE phenotype_comparison (
    phenotype_comparison_id SERIAL NOT NULL,
    primary key (phenotype_comparison_id),
    genotype1_id INT NOT NULL,
        FOREIGN KEY (genotype1_id) REFERENCES genotype (genotype_id) ON DELETE CASCADE,
    environment1_id INT NOT NULL,
        FOREIGN KEY (environment1_id) REFERENCES environment (environment_id) ON DELETE CASCADE,
    genotype2_id INT NOT NULL,
        FOREIGN KEY (genotype2_id) REFERENCES genotype (genotype_id) ON DELETE CASCADE,
    environment2_id INT NOT NULL,
        FOREIGN KEY (environment2_id) REFERENCES environment (environment_id) ON DELETE CASCADE,
    phenotype1_id INT NOT NULL,
        FOREIGN KEY (phenotype1_id) REFERENCES phenotype (phenotype_id) ON DELETE CASCADE,
    phenotype2_id INT,
        FOREIGN KEY (phenotype2_id) REFERENCES phenotype (phenotype_id) ON DELETE CASCADE,
    pub_id INT NOT NULL,
    FOREIGN KEY (pub_id) REFERENCES pub (pub_id) ON DELETE CASCADE,
    organism_id INT NOT NULL,
    FOREIGN KEY (organism_id) REFERENCES organism (organism_id) ON DELETE CASCADE,
    CONSTRAINT phenotype_comparison_c1 UNIQUE (genotype1_id,environment1_id,genotype2_id,environment2_id,phenotype1_id,pub_id)
);
CREATE INDEX phenotype_comparison_idx1 on phenotype_comparison (genotype1_id);
CREATE INDEX phenotype_comparison_idx2 on phenotype_comparison (genotype2_id);
CREATE INDEX phenotype_comparison_idx4 on phenotype_comparison (pub_id);

COMMENT ON TABLE phenotype_comparison IS 'Comparison of phenotypes e.g., genotype1/environment1/phenotype1 "non-suppressible" with respect to genotype2/environment2/phenotype2.';

-- ================================================
-- TABLE: phenotype_comparison_cvterm
-- ================================================
CREATE TABLE phenotype_comparison_cvterm (
    phenotype_comparison_cvterm_id serial not null,
    primary key (phenotype_comparison_cvterm_id),
    phenotype_comparison_id int not null,
    FOREIGN KEY (phenotype_comparison_id) references phenotype_comparison (phenotype_comparison_id) on delete cascade,
    cvterm_id int not null,
    FOREIGN KEY (cvterm_id) references cvterm (cvterm_id) on delete cascade,
    pub_id INT not null,
    FOREIGN KEY (pub_id) references pub (pub_id) on delete cascade,
    rank int not null default 0,
    CONSTRAINT phenotype_comparison_cvterm_c1 unique (phenotype_comparison_id, cvterm_id)
);
CREATE INDEX phenotype_comparison_cvterm_idx1 on phenotype_comparison_cvterm (phenotype_comparison_id);
CREATE INDEX  phenotype_comparison_cvterm_idx2 on phenotype_comparison_cvterm (cvterm_id);

-- ================================================
-- TABLE: genotypeprop
-- ================================================
create table genotypeprop (
    genotypeprop_id serial not null,
    primary key (genotypeprop_id),
    genotype_id int not null,
    foreign key (genotype_id) references genotype (genotype_id) on delete cascade INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    value text null,
    rank int not null default 0,
    constraint genotypeprop_c1 unique (genotype_id,type_id,rank)
);
create index genotypeprop_idx1 on genotypeprop (genotype_id);
create index genotypeprop_idx2 on genotypeprop (type_id);
-- ==========================================
-- Chado map module
--
-- =================================================================
-- Dependencies:
--
-- :import feature from sequence
-- :import cvterm from cv
-- :import pub from pub
-- =================================================================

-- ================================================
-- TABLE: featuremap
-- ================================================

create table featuremap (
    featuremap_id serial not null,
    primary key (featuremap_id),
    name varchar(255),
    description text,
    unittype_id int null,
    foreign key (unittype_id) references cvterm (cvterm_id) on delete set null INITIALLY DEFERRED,
    constraint featuremap_c1 unique (name)
);

-- ================================================
-- TABLE: featurerange
-- ================================================

create table featurerange (
    featurerange_id serial not null,
    primary key (featurerange_id),
    featuremap_id int not null,
    foreign key (featuremap_id) references featuremap (featuremap_id) on delete cascade INITIALLY DEFERRED,
    feature_id int not null,
    foreign key (feature_id) references feature (feature_id) on delete cascade INITIALLY DEFERRED,
    leftstartf_id int not null,
    foreign key (leftstartf_id) references feature (feature_id) on delete cascade INITIALLY DEFERRED,
    leftendf_id int,
    foreign key (leftendf_id) references feature (feature_id) on delete set null INITIALLY DEFERRED,
    rightstartf_id int,
    foreign key (rightstartf_id) references feature (feature_id) on delete set null INITIALLY DEFERRED,
    rightendf_id int not null,
    foreign key (rightendf_id) references feature (feature_id) on delete cascade INITIALLY DEFERRED,
    rangestr varchar(255)
);
create index featurerange_idx1 on featurerange (featuremap_id);
create index featurerange_idx2 on featurerange (feature_id);
create index featurerange_idx3 on featurerange (leftstartf_id);
create index featurerange_idx4 on featurerange (leftendf_id);
create index featurerange_idx5 on featurerange (rightstartf_id);
create index featurerange_idx6 on featurerange (rightendf_id);

COMMENT ON TABLE featurerange IS 'In cases where the start and end of a mapped feature is a range, leftendf and rightstartf are populated. leftstartf_id, leftendf_id, rightstartf_id, rightendf_id are the ids of features with respect to which the feature is being mapped. These may be cytological bands.';
COMMENT ON COLUMN featurerange.featuremap_id IS 'featuremap_id is the id of the feature being mapped.';


-- ================================================
-- TABLE: featurepos
-- ================================================

create table featurepos (
    featurepos_id serial not null,
    primary key (featurepos_id),
    featuremap_id serial not null,
    foreign key (featuremap_id) references featuremap (featuremap_id) on delete cascade INITIALLY DEFERRED,
    feature_id int not null,
    foreign key (feature_id) references feature (feature_id) on delete cascade INITIALLY DEFERRED,
    map_feature_id int not null,
    foreign key (map_feature_id) references feature (feature_id) on delete cascade INITIALLY DEFERRED,
    mappos float not null
);
create index featurepos_idx1 on featurepos (featuremap_id);
create index featurepos_idx2 on featurepos (feature_id);
create index featurepos_idx3 on featurepos (map_feature_id);

COMMENT ON COLUMN featurepos.map_feature_id IS 'map_feature_id
links to the feature (map) upon which the feature is being localized.';


-- ================================================
-- TABLE: featuremap_pub
-- ================================================

create table featuremap_pub (
    featuremap_pub_id serial not null,
    primary key (featuremap_pub_id),
    featuremap_id int not null,
    foreign key (featuremap_id) references featuremap (featuremap_id) on delete cascade INITIALLY DEFERRED,
    pub_id int not null,
    foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED
);
create index featuremap_pub_idx1 on featuremap_pub (featuremap_id);
create index featuremap_pub_idx2 on featuremap_pub (pub_id);
-- ==========================================
-- Chado phylogenetics module
--
-- Richard Bruskiewich
-- Chris Mungall
--
-- Initial design: 2004-05-27
--
-- ============
-- DEPENDENCIES
-- ============
-- :import feature from sequence
-- :import cvterm from cv
-- :import pub from pub
-- :import organism from organism
-- :import dbxref from general
-- :import analysis from companalysis
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-- ================================================
-- TABLE: phylotree
-- ================================================

create table phylotree (
	phylotree_id serial not null,
	primary key (phylotree_id),
   dbxref_id int not null,
   foreign key (dbxref_id) references dbxref (dbxref_id) on delete cascade,
	name varchar(255) null,
	type_id int,
	foreign key (type_id) references cvterm (cvterm_id) on delete cascade,
	analysis_id int null,
   foreign key (analysis_id) references analysis (analysis_id) on delete cascade,
	comment text null,
	unique(phylotree_id)
);
create index phylotree_idx1 on phylotree (phylotree_id);

COMMENT ON TABLE phylotree IS 'Global anchor for phylogenetic tree.';
COMMENT ON COLUMN phylotree.type_id IS 'Type: protein, nucleotide, taxonomy, for example. The type should be any SO type, or "taxonomy".';


-- ================================================
-- TABLE: phylotree_pub
-- ================================================

create table phylotree_pub (
       phylotree_pub_id serial not null,
       primary key (phylotree_pub_id),
       phylotree_id int not null,
       foreign key (phylotree_id) references phylotree (phylotree_id) on delete cascade,
       pub_id int not null,
       foreign key (pub_id) references pub (pub_id) on delete cascade,
       unique(phylotree_id, pub_id)
);
create index phylotree_pub_idx1 on phylotree_pub (phylotree_id);
create index phylotree_pub_idx2 on phylotree_pub (pub_id);

COMMENT ON TABLE phylotree_pub IS 'Tracks citations global to the tree e.g. multiple sequence alignment supporting tree construction.';

-- ================================================
-- TABLE: phylonode
-- ================================================

create table phylonode (
       phylonode_id serial not null,
       primary key (phylonode_id),
       phylotree_id int not null,
       foreign key (phylotree_id) references phylotree (phylotree_id) on delete cascade,
       parent_phylonode_id int null,
       foreign key (parent_phylonode_id) references phylonode (phylonode_id) on delete cascade,
       left_idx int not null,
       right_idx int not null,
       type_id int,
       foreign key(type_id) references cvterm (cvterm_id) on delete cascade,
       feature_id int,
       foreign key (feature_id) references feature (feature_id) on delete cascade,
       label varchar(255) null,
       distance float  null,
--       Bootstrap float null.
       unique(phylotree_id, left_idx),
       unique(phylotree_id, right_idx)
);
COMMENT ON TABLE phylonode IS 'This is the most pervasive
       element in the phylogeny module, cataloging the "phylonodes" of
       tree graphs. Edges are implied by the parent_phylonode_id
       reflexive closure. For all nodes in a nested set implementation the left and right index will be *between* the parents left and right indexes.';
COMMENT ON COLUMN phylonode.feature_id IS 'Phylonodes can have optional features attached to them e.g. a protein or nucleotide sequence usually attached to a leaf of the phylotree for non-leaf nodes, the feature may be a feature that is an instance of SO:match; this feature is the alignment of all leaf features beneath it.';
COMMENT ON COLUMN phylonode.type_id IS 'Type: e.g. root, interior, leaf.';
COMMENT ON COLUMN phylonode.parent_phylonode_id IS 'Root phylonode can have null parent_phylonode_id value.';


-- ================================================
-- TABLE: phylonode_dbxref
-- ================================================

create table phylonode_dbxref (
       phylonode_dbxref_id serial not null,
       primary key (phylonode_dbxref_id),

       phylonode_id int not null,
       foreign key (phylonode_id) references phylonode (phylonode_id) on delete cascade,
       dbxref_id int not null,
       foreign key (dbxref_id) references dbxref (dbxref_id) on delete cascade,

       unique(phylonode_id,dbxref_id)
);
create index phylonode_dbxref_idx1 on phylonode_dbxref (phylonode_id);
create index phylonode_dbxref_idx2 on phylonode_dbxref (dbxref_id);

COMMENT ON TABLE phylonode_dbxref IS 'For example, for orthology, paralogy group identifiers; could also be used for NCBI taxonomy; for sequences, refer to phylonode_feature, feature associated dbxrefs.';


-- ================================================
-- TABLE: phylonode_pub
-- ================================================

create table phylonode_pub (
       phylonode_pub_id serial not null,
       primary key (phylonode_pub_id),

       phylonode_id int not null,
       foreign key (phylonode_id) references phylonode (phylonode_id) on delete cascade,
       pub_id int not null,
       foreign key (pub_id) references pub (pub_id) on delete cascade,

       unique(phylonode_id, pub_id)
);
create index phylonode_pub_idx1 on phylonode_pub (phylonode_id);
create index phylonode_pub_idx2 on phylonode_pub (pub_id);

-- ================================================
-- TABLE: phylonode_organism
-- ================================================

create table phylonode_organism (
       phylonode_organism_id serial not null,
       primary key (phylonode_organism_id),

       phylonode_id int not null,
       foreign key (phylonode_id) references phylonode (phylonode_id) on delete cascade,
       organism_id int not null,
       foreign key (organism_id) references organism (organism_id) on delete cascade,

       unique(phylonode_id)
);
create index phylonode_organism_idx1 on phylonode_organism (phylonode_id);
create index phylonode_organism_idx2 on phylonode_organism (organism_id);

COMMENT ON TABLE phylonode_organism IS 'This linking table should only be used for nodes in taxonomy trees; it provides a mapping between the node and an organism. One node can have zero or one organisms, one organism can have zero or more nodes (although typically it should only have one in the standard NCBI taxonomy tree).';
COMMENT ON COLUMN phylonode_organism.phylonode_id IS 'One phylonode cannot refer to >1 organism.';


-- ================================================
-- TABLE: phylonodeprop
-- ================================================

create table phylonodeprop (
       phylonodeprop_id serial not null,
       primary key (phylonodeprop_id),

       phylonode_id int not null,
       foreign key (phylonode_id) references phylonode (phylonode_id) on delete cascade,
       type_id int not null,
       foreign key (type_id) references cvterm (cvterm_id) on delete cascade,

       value text not null default '',
-- It is not clear how useful the rank concept is here, leave it in for now.
       rank int not null default 0,

       unique(phylonode_id, type_id, value, rank)
);
create index phylonodeprop_idx1 on phylonodeprop (phylonode_id);
create index phylonodeprop_idx2 on phylonodeprop (type_id);

COMMENT ON COLUMN phylonodeprop.type_id IS 'type_id could designate phylonode hierarchy relationships, for example: species taxonomy (kingdom, order, family, genus, species), "ortholog/paralog", "fold/superfold", etc.';

-- ================================================
-- TABLE: phylonode_relationship
-- ================================================

create table phylonode_relationship (
       phylonode_relationship_id serial not null,
       primary key (phylonode_relationship_id),
       subject_id int not null,
       foreign key (subject_id) references phylonode (phylonode_id) on delete cascade,
       object_id int not null,
       foreign key (object_id) references phylonode (phylonode_id) on delete cascade,
       type_id int not null,
       foreign key (type_id) references cvterm (cvterm_id) on delete cascade,
       rank int,
       phylotree_id int not null,
       foreign key (phylotree_id) references phylotree (phylotree_id) on delete cascade,
       unique(subject_id, object_id, type_id)
);
create index phylonode_relationship_idx1 on phylonode_relationship (subject_id);
create index phylonode_relationship_idx2 on phylonode_relationship (object_id);
create index phylonode_relationship_idx3 on phylonode_relationship (type_id);

COMMENT ON TABLE phylonode_relationship IS 'This is for 
relationships that are not strictly hierarchical; for example,
horizontal gene transfer. Most phylogenetic trees are strictly
hierarchical, nevertheless it is here for completeness.';

CREATE OR REPLACE FUNCTION phylonode_depth(INT)
 RETURNS FLOAT AS
 'DECLARE  id    ALIAS FOR $1;
  DECLARE  depth FLOAT := 0;
  DECLARE  curr_node phylonode%ROWTYPE;
  BEGIN
   SELECT INTO curr_node *
    FROM phylonode 
    WHERE phylonode_id=id;
   depth = depth + curr_node.distance;
   IF curr_node.parent_phylonode_id IS NULL
    THEN RETURN depth;
    ELSE RETURN depth + phylonode_depth(curr_node.parent_phylonode_id);
   END IF;
 END
'
LANGUAGE 'plpgsql';

CREATE OR REPLACE FUNCTION phylonode_height(INT)
 RETURNS FLOAT AS
'
  SELECT coalesce(max(phylonode_height(phylonode_id) + distance), 0.0)
    FROM phylonode
    WHERE parent_phylonode_id = $1
'
LANGUAGE 'sql';

-- ==========================================
-- Chado contact module
--
-- =================================================================
-- Dependencies:
--
-- :import cvterm from cv
-- =================================================================

-- ================================================
-- TABLE: contact
-- ================================================

create table contact (
    contact_id serial not null,
    primary key (contact_id),
    type_id int null,
    foreign key (type_id) references cvterm (cvterm_id),
    name varchar(255) not null,
    description varchar(255) null,
    constraint contact_c1 unique (name)
);

COMMENT ON TABLE contact IS 'Model persons, institutes, groups, organizations, etc.';
COMMENT ON COLUMN contact.type_id IS 'What type of contact is this?  E.g. "person", "lab".';

-- ================================================
-- TABLE: contact_relationship
-- ================================================

create table contact_relationship (
    contact_relationship_id serial not null,
    primary key (contact_relationship_id),
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    subject_id int not null,
    foreign key (subject_id) references contact (contact_id) on delete cascade INITIALLY DEFERRED,
    object_id int not null,
    foreign key (object_id) references contact (contact_id) on delete cascade INITIALLY DEFERRED,
    constraint contact_relationship_c1 unique (subject_id,object_id,type_id)
);
create index contact_relationship_idx1 on contact_relationship (type_id);
create index contact_relationship_idx2 on contact_relationship (subject_id);
create index contact_relationship_idx3 on contact_relationship (object_id);

COMMENT ON TABLE contact_relationship IS 'Model relationships between contacts';
COMMENT ON COLUMN contact_relationship.subject_id IS 'The subject of the subj-predicate-obj sentence. In a DAG, this corresponds to the child node.';
COMMENT ON COLUMN contact_relationship.object_id IS 'The object of the subj-predicate-obj sentence. In a DAG, this corresponds to the parent node.';
COMMENT ON COLUMN contact_relationship.type_id IS 'Relationship type between subject and object. This is a cvterm, typically from the OBO relationship ontology, although other relationship types are allowed.';
-- ==========================================
-- Chado expression module
--
-- =================================================================
-- Dependencies:
--
-- :import feature from sequence
-- :import cvterm from cv
-- :import pub from pub
-- =================================================================


-- ================================================
-- TABLE: expression
-- ================================================

create table expression (
       expression_id serial not null,
       primary key (expression_id),
       uniquename text not null,
       md5checksum character(32),
       description text,
       constraint expression_c1 unique(uniquename)       
);

COMMENT ON TABLE expression IS 'The expression table is essentially a bridge table.';

-- ================================================
-- TABLE: expression_cvterm
-- ================================================

create table expression_cvterm (
       expression_cvterm_id serial not null,
       primary key (expression_cvterm_id),
       expression_id int not null,
       foreign key (expression_id) references expression (expression_id) on delete cascade INITIALLY DEFERRED,
       cvterm_id int not null,
       foreign key (cvterm_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
       rank int not null default 0,
       cvterm_type_id int not null,
       foreign key (cvterm_type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
       constraint expression_cvterm_c1 unique(expression_id,cvterm_id,cvterm_type_id)
);
create index expression_cvterm_idx1 on expression_cvterm (expression_id);
create index expression_cvterm_idx2 on expression_cvterm (cvterm_id);
create index expression_cvterm_idx3 on expression_cvterm (cvterm_type_id);

--================================================
-- TABLE: expression_cvtermprop
-- ================================================

create table expression_cvtermprop (
    expression_cvtermprop_id serial not null,
    primary key (expression_cvtermprop_id),
    expression_cvterm_id int not null,
    foreign key (expression_cvterm_id) references expression_cvterm (expression_cvterm_id) on delete cascade INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    value text null,
    rank int not null default 0,
    constraint expression_cvtermprop_c1 unique (expression_cvterm_id,type_id,rank)
);
create index expression_cvtermprop_idx1 on expression_cvtermprop (expression_cvterm_id);
create index expression_cvtermprop_idx2 on expression_cvtermprop (type_id);

COMMENT ON TABLE expression_cvtermprop IS 'Extensible properties for
expression to cvterm associations. Examples: qualifiers.';

COMMENT ON COLUMN expression_cvtermprop.type_id IS 'The name of the
property/slot is a cvterm. The meaning of the property is defined in
that cvterm. For example, cvterms may come from the FlyBase miscellaneous cv.';

COMMENT ON COLUMN expression_cvtermprop.value IS 'The value of the
property, represented as text. Numeric values are converted to their
text representation. This is less efficient than using native database
types, but is easier to query.';

COMMENT ON COLUMN expression_cvtermprop.rank IS 'Property-Value
ordering. Any expression_cvterm can have multiple values for any particular
property type - these are ordered in a list using rank, counting from
zero. For properties that are single-valued rather than multi-valued,
the default 0 value should be used.';

-- ================================================
-- TABLE: expressionprop
-- ================================================

create table expressionprop (
    expressionprop_id serial not null,
    primary key (expressionprop_id),
    expression_id int not null,
    foreign key (expression_id) references expression (expression_id) on delete cascade INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    value text null,
    rank int not null default 0,
    constraint expressionprop_c1 unique (expression_id,type_id,rank)
);
create index expressionprop_idx1 on expressionprop (expression_id);
create index expressionprop_idx2 on expressionprop (type_id);


-- ================================================
-- TABLE: expression_pub
-- ================================================

create table expression_pub (
       expression_pub_id serial not null,
       primary key (expression_pub_id),
       expression_id int not null,
       foreign key (expression_id) references expression (expression_id) on delete cascade INITIALLY DEFERRED,
       pub_id int not null,
       foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
       constraint expression_pub_c1 unique(expression_id,pub_id)       
);
create index expression_pub_idx1 on expression_pub (expression_id);
create index expression_pub_idx2 on expression_pub (pub_id);


-- ================================================
-- TABLE: feature_expression
-- ================================================

create table feature_expression (
       feature_expression_id serial not null,
       primary key (feature_expression_id),
       expression_id int not null,
       foreign key (expression_id) references expression (expression_id) on delete cascade INITIALLY DEFERRED,
       feature_id int not null,
       foreign key (feature_id) references feature (feature_id) on delete cascade INITIALLY DEFERRED,
       pub_id int not null,
       foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
       constraint feature_expression_c1 unique(expression_id,feature_id,pub_id)       
);
create index feature_expression_idx1 on feature_expression (expression_id);
create index feature_expression_idx2 on feature_expression (feature_id);
create index feature_expression_idx3 on feature_expression (pub_id);


-- ================================================
-- TABLE: feature_expressionprop
-- ================================================

create table feature_expressionprop (
       feature_expressionprop_id serial not null,
       primary key (feature_expressionprop_id),
       feature_expression_id int not null,
       foreign key (feature_expression_id) references feature_expression (feature_expression_id) on delete cascade INITIALLY DEFERRED,
       type_id int not null,
       foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
       value text null,
       rank int not null default 0,
       constraint feature_expressionprop_c1 unique (feature_expression_id,type_id,rank)
);
create index feature_expressionprop_idx1 on feature_expressionprop (feature_expression_id);
create index feature_expressionprop_idx2 on feature_expressionprop (type_id);

COMMENT ON TABLE feature_expressionprop IS 'Extensible properties for
feature_expression (comments, for example). Modeled on feature_cvtermprop.';


-- ================================================
-- TABLE: eimage
-- ================================================

create table eimage (
		eimage_id serial not null,
      primary key (eimage_id),
      eimage_data text,
      eimage_type varchar(255) not null,
      image_uri varchar(255)
);

COMMENT ON COLUMN eimage.eimage_data IS 'We expect images in eimage_data (e.g. JPEGs) to be uuencoded.';
COMMENT ON COLUMN eimage.eimage_type IS 'Describes the type of data in eimage_data.';


-- ================================================
-- TABLE: expression_image
-- ================================================

create table expression_image (
       expression_image_id serial not null,
       primary key (expression_image_id),
       expression_id int not null,
       foreign key (expression_id) references expression (expression_id) on delete cascade INITIALLY DEFERRED,
       eimage_id int not null,
       foreign key (eimage_id) references eimage (eimage_id) on delete cascade INITIALLY DEFERRED,
       constraint expression_image_c1 unique(expression_id,eimage_id)
);
create index expression_image_idx1 on expression_image (expression_id);
create index expression_image_idx2 on expression_image (eimage_id);
-- =================================================================
-- Dependencies:
--
-- :import cvterm from cv
-- :import pub from pub
-- :import contact from contact
-- =================================================================


-- ================================================
-- TABLE: project
-- ================================================

create table project (
    project_id serial not null,  
    primary key (project_id),
    name varchar(255) not null,
    description varchar(255) not null,
    constraint project_c1 unique (name)
);

COMMENT ON TABLE project IS NULL;

-- ================================================
-- TABLE: projectprop
-- ================================================

CREATE TABLE projectprop (
	projectprop_id serial NOT NULL,
	PRIMARY KEY (projectprop_id),
	project_id integer NOT NULL,
	FOREIGN KEY (project_id) REFERENCES project (project_id) ON DELETE CASCADE,
	type_id integer NOT NULL,
	FOREIGN KEY (type_id) REFERENCES cvterm (cvterm_id) ON DELETE CASCADE,
	value text,
	rank integer not null default 0,
	CONSTRAINT projectprop_c1 UNIQUE (project_id, type_id, rank)
);

-- ================================================
-- TABLE: project_relationship
-- ================================================

CREATE TABLE project_relationship (
	project_relationship_id serial NOT NULL,
	PRIMARY KEY (project_relationship_id),
	subject_project_id integer NOT NULL,
	FOREIGN KEY (subject_project_id) REFERENCES project (project_id) ON DELETE CASCADE,
	object_project_id integer NOT NULL,
	FOREIGN KEY (object_project_id) REFERENCES project (project_id) ON DELETE CASCADE,
	type_id integer NOT NULL,
	FOREIGN KEY (type_id) REFERENCES cvterm (cvterm_id) ON DELETE RESTRICT,
	CONSTRAINT project_relationship_c1 UNIQUE (subject_project_id, object_project_id, type_id)
);
COMMENT ON TABLE project_relationship IS 'A project can be composed of several smaller scale projects';
COMMENT ON COLUMN project_relationship.type_id IS 'The type of relationship being stated, such as "is part of".';


create table project_pub (
       project_pub_id serial not null,
       primary key (project_pub_id),
       project_id int not null,
       foreign key (project_id) references project (project_id) on delete cascade INITIALLY DEFERRED,
       pub_id int not null,
       foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
       constraint project_pub_c1 unique (project_id,pub_id)
);
create index project_pub_idx1 on project_pub (project_id);
create index project_pub_idx2 on project_pub (pub_id);

COMMENT ON TABLE project_pub IS 'Linking project(s) to publication(s)';


create table project_contact (
       project_contact_id serial not null,
       primary key (project_contact_id),
       project_id int not null,
       foreign key (project_id) references project (project_id) on delete cascade INITIALLY DEFERRED,
       contact_id int not null,
       foreign key (contact_id) references contact (contact_id) on delete cascade INITIALLY DEFERRED,
       constraint project_contact_c1 unique (project_id,contact_id)
);
create index project_contact_idx1 on project_contact (project_id);
create index project_contact_idx2 on project_contact (contact_id);

COMMENT ON TABLE project_contact IS 'Linking project(s) to contact(s)';
-- ==========================================
-- Chado mage module
--
-- =================================================================
-- Dependencies:
--
-- :import feature from sequence
-- :import cvterm from cv
-- :import pub from pub
-- :import organism from organism
-- :import contact from contact
-- :import dbxref from general
-- :import tableinfo from general
-- :import project from project
-- :import analysis from companalysis
-- =================================================================

-- ================================================
-- TABLE: mageml
-- ================================================

create table mageml (
    mageml_id serial not null,
    primary key (mageml_id),
    mage_package text not null,
    mage_ml text not null
);

COMMENT ON TABLE mageml IS 'This table is for storing extra bits of MAGEml in a denormalized form. More normalization would require many more tables.';

-- ================================================
-- TABLE: magedocumentation
-- ================================================

create table magedocumentation (
    magedocumentation_id serial not null,
    primary key (magedocumentation_id),
    mageml_id int not null,
    foreign key (mageml_id) references mageml (mageml_id) on delete cascade INITIALLY DEFERRED,
    tableinfo_id int not null,
    foreign key (tableinfo_id) references tableinfo (tableinfo_id) on delete cascade INITIALLY DEFERRED,
    row_id int not null,
    mageidentifier text not null
);
create index magedocumentation_idx1 on magedocumentation (mageml_id);
create index magedocumentation_idx2 on magedocumentation (tableinfo_id);
create index magedocumentation_idx3 on magedocumentation (row_id);

COMMENT ON TABLE magedocumentation IS NULL;

-- ================================================
-- TABLE: protocol
-- ================================================

create table protocol (
    protocol_id serial not null,
    primary key (protocol_id),
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    pub_id int null,
    foreign key (pub_id) references pub (pub_id) on delete set null INITIALLY DEFERRED,
    dbxref_id int null,
    foreign key (dbxref_id) references dbxref (dbxref_id) on delete set null INITIALLY DEFERRED,
    name text not null,
    uri text null,
    protocoldescription text null,
    hardwaredescription text null,
    softwaredescription text null,
    constraint protocol_c1 unique (name)
);
create index protocol_idx1 on protocol (type_id);
create index protocol_idx2 on protocol (pub_id);
create index protocol_idx3 on protocol (dbxref_id);

COMMENT ON TABLE protocol IS 'Procedural notes on how data was prepared and processed.';

-- ================================================
-- TABLE: protocolparam
-- ================================================

create table protocolparam (
    protocolparam_id serial not null,
    primary key (protocolparam_id),
    protocol_id int not null,
    foreign key (protocol_id) references protocol (protocol_id) on delete cascade INITIALLY DEFERRED,
    name text not null,
    datatype_id int null,
    foreign key (datatype_id) references cvterm (cvterm_id) on delete set null INITIALLY DEFERRED,
    unittype_id int null,
    foreign key (unittype_id) references cvterm (cvterm_id) on delete set null INITIALLY DEFERRED,
    value text null,
    rank int not null default 0
);
create index protocolparam_idx1 on protocolparam (protocol_id);
create index protocolparam_idx2 on protocolparam (datatype_id);
create index protocolparam_idx3 on protocolparam (unittype_id);

COMMENT ON TABLE protocolparam IS 'Parameters related to a
protocol. For example, if the protocol is a soak, this might include attributes of bath temperature and duration.';

-- ================================================
-- TABLE: channel
-- ================================================

create table channel (
    channel_id serial not null,
    primary key (channel_id),
    name text not null,
    definition text not null,
    constraint channel_c1 unique (name)
);

COMMENT ON TABLE channel IS 'Different array platforms can record signals from one or more channels (cDNA arrays typically use two CCD, but Affymetrix uses only one).';

-- ================================================
-- TABLE: arraydesign
-- ================================================

create table arraydesign (
    arraydesign_id serial not null,
    primary key (arraydesign_id),
    manufacturer_id int not null,
    foreign key (manufacturer_id) references contact (contact_id) on delete cascade INITIALLY DEFERRED,
    platformtype_id int not null,
    foreign key (platformtype_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    substratetype_id int null,
    foreign key (substratetype_id) references cvterm (cvterm_id) on delete set null INITIALLY DEFERRED,
    protocol_id int null,
    foreign key (protocol_id) references protocol (protocol_id) on delete set null INITIALLY DEFERRED,
    dbxref_id int null,
    foreign key (dbxref_id) references dbxref (dbxref_id) on delete set null INITIALLY DEFERRED,
    name text not null,
    version text null,
    description text null,
    array_dimensions text null,
    element_dimensions text null,
    num_of_elements int null,
    num_array_columns int null,
    num_array_rows int null,
    num_grid_columns int null,
    num_grid_rows int null,
    num_sub_columns int null,
    num_sub_rows int null,
    constraint arraydesign_c1 unique (name)
);
create index arraydesign_idx1 on arraydesign (manufacturer_id);
create index arraydesign_idx2 on arraydesign (platformtype_id);
create index arraydesign_idx3 on arraydesign (substratetype_id);
create index arraydesign_idx4 on arraydesign (protocol_id);
create index arraydesign_idx5 on arraydesign (dbxref_id);

COMMENT ON TABLE arraydesign IS 'General properties about an array.
An array is a template used to generate physical slides, etc.  It
contains layout information, as well as global array properties, such
as material (glass, nylon) and spot dimensions (in rows/columns).';

-- ================================================
-- TABLE: arraydesignprop
-- ================================================

create table arraydesignprop (
    arraydesignprop_id serial not null,
    primary key (arraydesignprop_id),
    arraydesign_id int not null,
    foreign key (arraydesign_id) references arraydesign (arraydesign_id) on delete cascade INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    value text null,
    rank int not null default 0,
    constraint arraydesignprop_c1 unique (arraydesign_id,type_id,rank)
);
create index arraydesignprop_idx1 on arraydesignprop (arraydesign_id);
create index arraydesignprop_idx2 on arraydesignprop (type_id);

COMMENT ON TABLE arraydesignprop IS 'Extra array design properties that are not accounted for in arraydesign.';

-- ================================================
-- TABLE: assay
-- ================================================

create table assay (
    assay_id serial not null,
    primary key (assay_id),
    arraydesign_id int not null,
    foreign key (arraydesign_id) references arraydesign (arraydesign_id) on delete cascade INITIALLY DEFERRED,
    protocol_id int null,
    foreign key (protocol_id) references protocol (protocol_id) on delete set null INITIALLY DEFERRED,
    assaydate timestamp null default current_timestamp,
    arrayidentifier text null,
    arraybatchidentifier text null,
    operator_id int not null,
    foreign key (operator_id) references contact (contact_id) on delete cascade INITIALLY DEFERRED,
    dbxref_id int null,
    foreign key (dbxref_id) references dbxref (dbxref_id) on delete set null INITIALLY DEFERRED,
    name text null,
    description text null,
    constraint assay_c1 unique (name)
);
create index assay_idx1 on assay (arraydesign_id);
create index assay_idx2 on assay (protocol_id);
create index assay_idx3 on assay (operator_id);
create index assay_idx4 on assay (dbxref_id);

COMMENT ON TABLE assay IS 'An assay consists of a physical instance of
an array, combined with the conditions used to create the array
(protocols, technician information). The assay can be thought of as a hybridization.';

-- ================================================
-- TABLE: assayprop
-- ================================================

create table assayprop (
    assayprop_id serial not null,
    primary key (assayprop_id),
    assay_id int not null,
    foreign key (assay_id) references assay (assay_id) on delete cascade INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    value text null,
    rank int not null default 0,
    constraint assayprop_c1 unique (assay_id,type_id,rank)
);
create index assayprop_idx1 on assayprop (assay_id);
create index assayprop_idx2 on assayprop (type_id);

COMMENT ON TABLE assayprop IS 'Extra assay properties that are not accounted for in assay.';

-- ================================================
-- TABLE: assay_project
-- ================================================

create table assay_project (
    assay_project_id serial not null,
    primary key (assay_project_id),
    assay_id int not null,
    foreign key (assay_id) references assay (assay_id) INITIALLY DEFERRED,
    project_id int not null,
    foreign key (project_id) references project (project_id) INITIALLY DEFERRED,
    constraint assay_project_c1 unique (assay_id,project_id)
);
create index assay_project_idx1 on assay_project (assay_id);
create index assay_project_idx2 on assay_project (project_id);

COMMENT ON TABLE assay_project IS 'Link assays to projects.';

-- ================================================
-- TABLE: biomaterial
-- ================================================

create table biomaterial (
    biomaterial_id serial not null,
    primary key (biomaterial_id),
    taxon_id int null,
    foreign key (taxon_id) references organism (organism_id) on delete set null INITIALLY DEFERRED,
    biosourceprovider_id int null,
    foreign key (biosourceprovider_id) references contact (contact_id) on delete set null INITIALLY DEFERRED,
    dbxref_id int null,
    foreign key (dbxref_id) references dbxref (dbxref_id) on delete set null INITIALLY DEFERRED,
    name text null,
    description text null,
    constraint biomaterial_c1 unique (name)
);
create index biomaterial_idx1 on biomaterial (taxon_id);
create index biomaterial_idx2 on biomaterial (biosourceprovider_id);
create index biomaterial_idx3 on biomaterial (dbxref_id);

COMMENT ON TABLE biomaterial IS 'A biomaterial represents the MAGE concept of BioSource, BioSample, and LabeledExtract. It is essentially some biological material (tissue, cells, serum) that may have been processed. Processed biomaterials should be traceable back to raw biomaterials via the biomaterialrelationship table.';

-- ================================================
-- TABLE: biomaterial_relationship
-- ================================================

create table biomaterial_relationship (
    biomaterial_relationship_id serial not null,
    primary key (biomaterial_relationship_id),
    subject_id int not null,
    foreign key (subject_id) references biomaterial (biomaterial_id) INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) INITIALLY DEFERRED,
    object_id int not null,
    foreign key (object_id) references biomaterial (biomaterial_id) INITIALLY DEFERRED,
    constraint biomaterial_relationship_c1 unique (subject_id,object_id,type_id)
);
create index biomaterial_relationship_idx1 on biomaterial_relationship (subject_id);
create index biomaterial_relationship_idx2 on biomaterial_relationship (object_id);
create index biomaterial_relationship_idx3 on biomaterial_relationship (type_id);

COMMENT ON TABLE biomaterial_relationship IS 'Relate biomaterials to one another. This is a way to track a series of treatments or material splits/merges, for instance.';

-- ================================================
-- TABLE: biomaterialprop
-- ================================================

create table biomaterialprop (
    biomaterialprop_id serial not null,
    primary key (biomaterialprop_id),
    biomaterial_id int not null,
    foreign key (biomaterial_id) references biomaterial (biomaterial_id) on delete cascade INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    value text null,
    rank int not null default 0,
    constraint biomaterialprop_c1 unique (biomaterial_id,type_id,rank)
);
create index biomaterialprop_idx1 on biomaterialprop (biomaterial_id);
create index biomaterialprop_idx2 on biomaterialprop (type_id);

COMMENT ON TABLE biomaterialprop IS 'Extra biomaterial properties that are not accounted for in biomaterial.';

-- ================================================
-- TABLE: biomaterial_dbxref
-- ================================================

create table biomaterial_dbxref (
    biomaterial_dbxref_id serial not null,
    primary key (biomaterial_dbxref_id),
    biomaterial_id int not null,
    foreign key (biomaterial_id) references biomaterial (biomaterial_id) on delete cascade INITIALLY DEFERRED,
    dbxref_id int not null,
    foreign key (dbxref_id) references dbxref (dbxref_id) on delete cascade INITIALLY DEFERRED,
    constraint biomaterial_dbxref_c1 unique (biomaterial_id,dbxref_id)
);
create index biomaterial_dbxref_idx1 on biomaterial_dbxref (biomaterial_id);
create index biomaterial_dbxref_idx2 on biomaterial_dbxref (dbxref_id);

-- ================================================
-- TABLE: treatment
-- ================================================

create table treatment (
    treatment_id serial not null,
    primary key (treatment_id),
    rank int not null default 0,
    biomaterial_id int not null,
    foreign key (biomaterial_id) references biomaterial (biomaterial_id) on delete cascade INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    protocol_id int null,
    foreign key (protocol_id) references protocol (protocol_id) on delete set null INITIALLY DEFERRED,
    name text null
);
create index treatment_idx1 on treatment (biomaterial_id);
create index treatment_idx2 on treatment (type_id);
create index treatment_idx3 on treatment (protocol_id);

COMMENT ON TABLE treatment IS 'A biomaterial may undergo multiple
treatments. Examples of treatments: apoxia, fluorophore and biotin labeling.';

-- ================================================
-- TABLE: biomaterial_treatment
-- ================================================

create table biomaterial_treatment (
    biomaterial_treatment_id serial not null,
    primary key (biomaterial_treatment_id),
    biomaterial_id int not null,
    foreign key (biomaterial_id) references biomaterial (biomaterial_id) on delete cascade INITIALLY DEFERRED,
    treatment_id int not null,
    foreign key (treatment_id) references treatment (treatment_id) on delete cascade INITIALLY DEFERRED,
    unittype_id int null,
    foreign key (unittype_id) references cvterm (cvterm_id) on delete set null INITIALLY DEFERRED,
    value float(15) null,
    rank int not null default 0,
    constraint biomaterial_treatment_c1 unique (biomaterial_id,treatment_id)
);
create index biomaterial_treatment_idx1 on biomaterial_treatment (biomaterial_id);
create index biomaterial_treatment_idx2 on biomaterial_treatment (treatment_id);
create index biomaterial_treatment_idx3 on biomaterial_treatment (unittype_id);

COMMENT ON TABLE biomaterial_treatment IS 'Link biomaterials to treatments. Treatments have an order of operations (rank), and associated measurements (unittype_id, value).';

-- ================================================
-- TABLE: assay_biomaterial
-- ================================================

create table assay_biomaterial (
    assay_biomaterial_id serial not null,
    primary key (assay_biomaterial_id),
    assay_id int not null,
    foreign key (assay_id) references assay (assay_id) on delete cascade INITIALLY DEFERRED,
    biomaterial_id int not null,
    foreign key (biomaterial_id) references biomaterial (biomaterial_id) on delete cascade INITIALLY DEFERRED,
    channel_id int null,
    foreign key (channel_id) references channel (channel_id) on delete set null INITIALLY DEFERRED,
    rank int not null default 0,
    constraint assay_biomaterial_c1 unique (assay_id,biomaterial_id,channel_id,rank)
);
create index assay_biomaterial_idx1 on assay_biomaterial (assay_id);
create index assay_biomaterial_idx2 on assay_biomaterial (biomaterial_id);
create index assay_biomaterial_idx3 on assay_biomaterial (channel_id);

COMMENT ON TABLE assay_biomaterial IS 'A biomaterial can be hybridized many times (technical replicates), or combined with other biomaterials in a single hybridization (for two-channel arrays).';

-- ================================================
-- TABLE: acquisition
-- ================================================

create table acquisition (
    acquisition_id serial not null,
    primary key (acquisition_id),
    assay_id int not null,
    foreign key (assay_id) references  assay (assay_id) on delete cascade INITIALLY DEFERRED,
    protocol_id int null,
    foreign key (protocol_id) references protocol (protocol_id) on delete set null INITIALLY DEFERRED,
    channel_id int null,
    foreign key (channel_id) references channel (channel_id) on delete set null INITIALLY DEFERRED,
    acquisitiondate timestamp null default current_timestamp,
    name text null,
    uri text null,
    constraint acquisition_c1 unique (name)
);
create index acquisition_idx1 on acquisition (assay_id);
create index acquisition_idx2 on acquisition (protocol_id);
create index acquisition_idx3 on acquisition (channel_id);

COMMENT ON TABLE acquisition IS 'This represents the scanning of hybridized material. The output of this process is typically a digital image of an array.';

-- ================================================
-- TABLE: acquisitionprop
-- ================================================

create table acquisitionprop (
    acquisitionprop_id serial not null,
    primary key (acquisitionprop_id),
    acquisition_id int not null,
    foreign key (acquisition_id) references acquisition (acquisition_id) on delete cascade INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    value text null,
    rank int not null default 0,
    constraint acquisitionprop_c1 unique (acquisition_id,type_id,rank)
);
create index acquisitionprop_idx1 on acquisitionprop (acquisition_id);
create index acquisitionprop_idx2 on acquisitionprop (type_id);

COMMENT ON TABLE acquisitionprop IS 'Parameters associated with image acquisition.';

-- ================================================
-- TABLE: acquisition_relationship
-- ================================================

create table acquisition_relationship (
    acquisition_relationship_id serial not null,
    primary key (acquisition_relationship_id),
    subject_id int not null,
    foreign key (subject_id) references acquisition (acquisition_id) on delete cascade INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    object_id int not null,
    foreign key (object_id) references acquisition (acquisition_id) on delete cascade INITIALLY DEFERRED,
    value text null,
    rank int not null default 0,
    constraint acquisition_relationship_c1 unique (subject_id,object_id,type_id,rank)
);
create index acquisition_relationship_idx1 on acquisition_relationship (subject_id);
create index acquisition_relationship_idx2 on acquisition_relationship (type_id);
create index acquisition_relationship_idx3 on acquisition_relationship (object_id);

COMMENT ON TABLE acquisition_relationship IS 'Multiple monochrome images may be merged to form a multi-color image. Red-green images of 2-channel hybridizations are an example of this.';

-- ================================================
-- TABLE: quantification
-- ================================================

create table quantification (
    quantification_id serial not null,
    primary key (quantification_id),
    acquisition_id int not null,
    foreign key (acquisition_id) references acquisition (acquisition_id) on delete cascade INITIALLY DEFERRED,
    operator_id int null,
    foreign key (operator_id) references contact (contact_id) on delete set null INITIALLY DEFERRED,
    protocol_id int null,
    foreign key (protocol_id) references protocol (protocol_id) on delete set null INITIALLY DEFERRED,
    analysis_id int not null,
    foreign key (analysis_id) references analysis (analysis_id) on delete cascade INITIALLY DEFERRED,
    quantificationdate timestamp null default current_timestamp,
    name text null,
    uri text null,
    constraint quantification_c1 unique (name,analysis_id)
);
create index quantification_idx1 on quantification (acquisition_id);
create index quantification_idx2 on quantification (operator_id);
create index quantification_idx3 on quantification (protocol_id);
create index quantification_idx4 on quantification (analysis_id);

COMMENT ON TABLE quantification IS 'Quantification is the transformation of an image acquisition to numeric data. This typically involves statistical procedures.';

-- ================================================
-- TABLE: quantificationprop
-- ================================================

create table quantificationprop (
    quantificationprop_id serial not null,
    primary key (quantificationprop_id),
    quantification_id int not null,
    foreign key (quantification_id) references quantification (quantification_id) on delete cascade INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    value text null,
    rank int not null default 0,
    constraint quantificationprop_c1 unique (quantification_id,type_id,rank)
);
create index quantificationprop_idx1 on quantificationprop (quantification_id);
create index quantificationprop_idx2 on quantificationprop (type_id);

COMMENT ON TABLE quantificationprop IS 'Extra quantification properties that are not accounted for in quantification.';

-- ================================================
-- TABLE: quantification_relationship
-- ================================================

create table quantification_relationship (
    quantification_relationship_id serial not null,
    primary key (quantification_relationship_id),
    subject_id int not null,
    foreign key (subject_id) references quantification (quantification_id) on delete cascade INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    object_id int not null,
    foreign key (object_id) references quantification (quantification_id) on delete cascade INITIALLY DEFERRED,
    constraint quantification_relationship_c1 unique (subject_id,object_id,type_id)
);
create index quantification_relationship_idx1 on quantification_relationship (subject_id);
create index quantification_relationship_idx2 on quantification_relationship (type_id);
create index quantification_relationship_idx3 on quantification_relationship (object_id);

COMMENT ON TABLE quantification_relationship IS 'There may be multiple rounds of quantification, this allows us to keep an audit trail of what values went where.';

-- ================================================
-- TABLE: control
-- ================================================

create table control (
    control_id serial not null,
    primary key (control_id),
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    assay_id int not null,
    foreign key (assay_id) references assay (assay_id) on delete cascade INITIALLY DEFERRED,
    tableinfo_id int not null,
    foreign key (tableinfo_id) references tableinfo (tableinfo_id) on delete cascade INITIALLY DEFERRED,
    row_id int not null,
    name text null,
    value text null,
    rank int not null default 0
);
create index control_idx1 on control (type_id);
create index control_idx2 on control (assay_id);
create index control_idx3 on control (tableinfo_id);
create index control_idx4 on control (row_id);

COMMENT ON TABLE control IS NULL;

-- ================================================
-- TABLE: element
-- ================================================

create table element (
    element_id serial not null,
    primary key (element_id),
    feature_id int null,
    foreign key (feature_id) references feature (feature_id) on delete set null INITIALLY DEFERRED,
    arraydesign_id int not null,
    foreign key (arraydesign_id) references arraydesign (arraydesign_id) on delete cascade INITIALLY DEFERRED,
    type_id int null,
    foreign key (type_id) references cvterm (cvterm_id) on delete set null INITIALLY DEFERRED,
    dbxref_id int null,
    foreign key (dbxref_id) references dbxref (dbxref_id) on delete set null INITIALLY DEFERRED,
    constraint element_c1 unique (feature_id,arraydesign_id)
);
create index element_idx1 on element (feature_id);
create index element_idx2 on element (arraydesign_id);
create index element_idx3 on element (type_id);
create index element_idx4 on element (dbxref_id);

COMMENT ON TABLE element IS 'Represents a feature of the array. This is typically a region of the array coated or bound to DNA.';

-- ================================================
-- TABLE: element_result
-- ================================================

create table elementresult (
    elementresult_id serial not null,
    primary key (elementresult_id),
    element_id int not null,
    foreign key (element_id) references element (element_id) on delete cascade INITIALLY DEFERRED,
    quantification_id int not null,
    foreign key (quantification_id) references quantification (quantification_id) on delete cascade INITIALLY DEFERRED,
    signal float not null,
    constraint elementresult_c1 unique (element_id,quantification_id)
);
create index elementresult_idx1 on elementresult (element_id);
create index elementresult_idx2 on elementresult (quantification_id);
create index elementresult_idx3 on elementresult (signal);

COMMENT ON TABLE elementresult IS 'An element on an array produces a measurement when hybridized to a biomaterial (traceable through quantification_id). This is the base data from which tables that actually contain data inherit.';

-- ================================================
-- TABLE: element_relationship
-- ================================================

create table element_relationship (
    element_relationship_id serial not null,
    primary key (element_relationship_id),
    subject_id int not null,
    foreign key (subject_id) references element (element_id) INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) INITIALLY DEFERRED,
    object_id int not null,
    foreign key (object_id) references element (element_id) INITIALLY DEFERRED,
    value text null,
    rank int not null default 0,
    constraint element_relationship_c1 unique (subject_id,object_id,type_id,rank)
);
create index element_relationship_idx1 on element_relationship (subject_id);
create index element_relationship_idx2 on element_relationship (type_id);
create index element_relationship_idx3 on element_relationship (object_id);
create index element_relationship_idx4 on element_relationship (value);

COMMENT ON TABLE element_relationship IS 'Sometimes we want to combine measurements from multiple elements to get a composite value. Affymetrix combines many probes to form a probeset measurement, for instance.';

-- ================================================
-- TABLE: elementresult_relationship
-- ================================================

create table elementresult_relationship (
    elementresult_relationship_id serial not null,
    primary key (elementresult_relationship_id),
    subject_id int not null,
    foreign key (subject_id) references elementresult (elementresult_id) INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) INITIALLY DEFERRED,
    object_id int not null,
    foreign key (object_id) references elementresult (elementresult_id) INITIALLY DEFERRED,
    value text null,
    rank int not null default 0,
    constraint elementresult_relationship_c1 unique (subject_id,object_id,type_id,rank)
);
create index elementresult_relationship_idx1 on elementresult_relationship (subject_id);
create index elementresult_relationship_idx2 on elementresult_relationship (type_id);
create index elementresult_relationship_idx3 on elementresult_relationship (object_id);
create index elementresult_relationship_idx4 on elementresult_relationship (value);

COMMENT ON TABLE elementresult_relationship IS 'Sometimes we want to combine measurements from multiple elements to get a composite value. Affymetrix combines many probes to form a probeset measurement, for instance.';

-- ================================================
-- TABLE: study
-- ================================================

create table study (
    study_id serial not null,
    primary key (study_id),
    contact_id int not null,
    foreign key (contact_id) references contact (contact_id) on delete cascade INITIALLY DEFERRED,
    pub_id int null,
    foreign key (pub_id) references pub (pub_id) on delete set null INITIALLY DEFERRED,
    dbxref_id int null,
    foreign key (dbxref_id) references dbxref (dbxref_id) on delete set null INITIALLY DEFERRED,
    name text not null,
    description text null,
    constraint study_c1 unique (name)
);
create index study_idx1 on study (contact_id);
create index study_idx2 on study (pub_id);
create index study_idx3 on study (dbxref_id);

COMMENT ON TABLE study IS NULL;

-- ================================================
-- TABLE: study_assay
-- ================================================

create table study_assay (
    study_assay_id serial not null,
    primary key (study_assay_id),
    study_id int not null,
    foreign key (study_id) references study (study_id) on delete cascade INITIALLY DEFERRED,
    assay_id int not null,
    foreign key (assay_id) references assay (assay_id) on delete cascade INITIALLY DEFERRED,
    constraint study_assay_c1 unique (study_id,assay_id)
);
create index study_assay_idx1 on study_assay (study_id);
create index study_assay_idx2 on study_assay (assay_id);

COMMENT ON TABLE study_assay IS NULL;

-- ================================================
-- TABLE: studydesign
-- ================================================

create table studydesign (
    studydesign_id serial not null,
    primary key (studydesign_id),
    study_id int not null,
    foreign key (study_id) references study (study_id) on delete cascade INITIALLY DEFERRED,
    description text null
);
create index studydesign_idx1 on studydesign (study_id);

COMMENT ON TABLE studydesign IS NULL;

-- ================================================
-- TABLE: studydesignprop
-- ================================================

create table studydesignprop (
    studydesignprop_id serial not null,
    primary key (studydesignprop_id),
    studydesign_id int not null,
    foreign key (studydesign_id) references studydesign (studydesign_id) on delete cascade INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    value text null,
    rank int not null default 0,
    constraint studydesignprop_c1 unique (studydesign_id,type_id,rank)
);
create index studydesignprop_idx1 on studydesignprop (studydesign_id);
create index studydesignprop_idx2 on studydesignprop (type_id);

COMMENT ON TABLE studydesignprop IS NULL;

-- ================================================
-- TABLE: studyfactor
-- ================================================

create table studyfactor (
    studyfactor_id serial not null,
    primary key (studyfactor_id),
    studydesign_id int not null,
    foreign key (studydesign_id) references studydesign (studydesign_id) on delete cascade INITIALLY DEFERRED,
    type_id int null,
    foreign key (type_id) references cvterm (cvterm_id) on delete set null INITIALLY DEFERRED,
    name text not null,
    description text null
);
create index studyfactor_idx1 on studyfactor (studydesign_id);
create index studyfactor_idx2 on studyfactor (type_id);

COMMENT ON TABLE studyfactor IS NULL;

-- ================================================
-- TABLE: studyfactorvalue
-- ================================================

create table studyfactorvalue (
    studyfactorvalue_id serial not null,
    primary key (studyfactorvalue_id),
    studyfactor_id int not null,
    foreign key (studyfactor_id) references studyfactor (studyfactor_id) on delete cascade INITIALLY DEFERRED,
    assay_id int not null,
    foreign key (assay_id) references assay (assay_id) on delete cascade INITIALLY DEFERRED,
    factorvalue text null,
    name text null,
    rank int not null default 0
);
create index studyfactorvalue_idx1 on studyfactorvalue (studyfactor_id);
create index studyfactorvalue_idx2 on studyfactorvalue (assay_id);

COMMENT ON TABLE studyfactorvalue IS NULL;

--
-- studyprop and studyprop_feature added for Kara Dolinski's group
-- 
-- Here is her description of it:
--Both of the tables are used for our YFGdb project 
--(http://yfgdb.princeton.edu/), which uses chado. 
--
--Here is how we use those tables, using the following example:
--
--http://yfgdb.princeton.edu/cgi-bin/display.cgi?db=pmid&amp;id=15575969
--
--The above data set is represented as a row in the STUDY table.  We have
--lots of attributes that we want to store about each STUDY (status, etc)
--and in the official schema, the only prop table we could use was the
--STUDYDESIGN_PROP table.  This forced us to go through the STUDYDESIGN 
--table when we often have no real data to store in that table (small 
--percent of our collection use MAGE-ML unfortunately, and even fewer 
--provide all the data in the MAGE model, of which STUDYDESIGN is a vestige). 
--So, we created a STUDYPROP table.  I'd think this table would be 
--generally useful to people storing various types of data sets via the 
--STUDY table.
--
--The other new table is STUDYPROP_FEATURE.  This basically allows us to
--group features together per study.  For example, we can store microarray
--clustering results by saying that the STUDYPROP type is 'cluster'  (via 
--type_id -> CVTERM of course), the value is 'cluster id 123', and then
--that cluster would be associated with all the features that are in that
--cluster via STUDYPROP_FEATURE.  Adding type_id to STUDYPROP_FEATURE is
-- fine by us!
--
--studyprop
create table studyprop (
    studyprop_id serial not null,
        primary key (studyprop_id),
    study_id int not null,
        foreign key (study_id) references study (study_id) on delete cascade,
    type_id int not null,
        foreign key (type_id) references cvterm (cvterm_id) on delete cascade,  
    value text null,
    rank int not null default 0,
    unique (study_id,type_id,rank)
);

create index studyprop_idx1 on studyprop (study_id);
create index studyprop_idx2 on studyprop (type_id);


--studyprop_feature
CREATE TABLE studyprop_feature (
    studyprop_feature_id serial NOT NULL,
    primary key (studyprop_feature_id),
    studyprop_id integer NOT NULL,
    foreign key (studyprop_id) references studyprop(studyprop_id) on delete cascade,
    feature_id integer NOT NULL,
    foreign key (feature_id) references feature (feature_id) on delete cascade,
    type_id integer,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade,
    unique (studyprop_id, feature_id)
    );
 

create index studyprop_feature_idx1 on studyprop_feature (studyprop_id);
create index studyprop_feature_idx2 on studyprop_feature (feature_id);

-- ==========================================
-- Chado stock module
--
-- DEPENDENCIES
-- ============
-- :import cvterm from cv
-- :import pub from pub
-- :import dbxref from general
-- :import organism from organism
-- :import genotype from genetic
-- :import contact from contact

-- ================================================
-- TABLE: stock
-- ================================================

create table stock (
       stock_id serial not null,
       primary key (stock_id),
       dbxref_id int,
       foreign key (dbxref_id) references dbxref (dbxref_id) on delete set null INITIALLY DEFERRED,
       organism_id int,
       foreign key (organism_id) references organism (organism_id) on delete cascade INITIALLY DEFERRED,
       name varchar(255),
       uniquename text not null,
       description text,
       type_id int not null,
       foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
       is_obsolete boolean not null default 'false',
       constraint stock_c1 unique (organism_id,uniquename,type_id)
);
create index stock_name_ind1 on stock (name);
create index stock_idx1 on stock (dbxref_id);
create index stock_idx2 on stock (organism_id);
create index stock_idx3 on stock (type_id);
create index stock_idx4 on stock (uniquename);

COMMENT ON TABLE stock IS 'Any stock can be globally identified by the
combination of organism, uniquename and stock type. A stock is the physical entities, either living or preserved, held by collections. Stocks belong to a collection; they have IDs, type, organism, description and may have a genotype.';
COMMENT ON COLUMN stock.dbxref_id IS 'The dbxref_id is an optional primary stable identifier for this stock. Secondary indentifiers and external dbxrefs go in table: stock_dbxref.';
COMMENT ON COLUMN stock.organism_id IS 'The organism_id is the organism to which the stock belongs. This column should only be left blank if the organism cannot be determined.';
COMMENT ON COLUMN stock.type_id IS 'The type_id foreign key links to a controlled vocabulary of stock types. The would include living stock, genomic DNA, preserved specimen. Secondary cvterms for stocks would go in stock_cvterm.';
COMMENT ON COLUMN stock.description IS 'The description is the genetic description provided in the stock list.';
COMMENT ON COLUMN stock.name IS 'The name is a human-readable local name for a stock.';


-- ================================================
-- TABLE: stock_pub
-- ================================================

create table stock_pub (
       stock_pub_id serial not null,
       primary key (stock_pub_id),
       stock_id int not null,
       foreign key (stock_id) references stock (stock_id)  on delete cascade INITIALLY DEFERRED,
       pub_id int not null,
       foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
       constraint stock_pub_c1 unique (stock_id,pub_id)
);
create index stock_pub_idx1 on stock_pub (stock_id);
create index stock_pub_idx2 on stock_pub (pub_id);

COMMENT ON TABLE stock_pub IS 'Provenance. Linking table between stocks and, for example, a stocklist computer file.';


-- ================================================
-- TABLE: stockprop
-- ================================================

create table stockprop (
       stockprop_id serial not null,
       primary key (stockprop_id),
       stock_id int not null,
       foreign key (stock_id) references stock (stock_id) on delete cascade INITIALLY DEFERRED,
       type_id int not null,
       foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
       value text null,
       rank int not null default 0,
       constraint stockprop_c1 unique (stock_id,type_id,rank)
);
create index stockprop_idx1 on stockprop (stock_id);
create index stockprop_idx2 on stockprop (type_id);

COMMENT ON TABLE stockprop IS 'A stock can have any number of
slot-value property tags attached to it. This is an alternative to
hardcoding a list of columns in the relational schema, and is
completely extensible. There is a unique constraint, stockprop_c1, for
the combination of stock_id, rank, and type_id. Multivalued property-value pairs must be differentiated by rank.';


-- ================================================
-- TABLE: stockprop_pub
-- ================================================

create table stockprop_pub (
     stockprop_pub_id serial not null,
     primary key (stockprop_pub_id),
     stockprop_id int not null,
     foreign key (stockprop_id) references stockprop (stockprop_id) on delete cascade INITIALLY DEFERRED,
     pub_id int not null,
     foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
     constraint stockprop_pub_c1 unique (stockprop_id,pub_id)
);
create index stockprop_pub_idx1 on stockprop_pub (stockprop_id);
create index stockprop_pub_idx2 on stockprop_pub (pub_id); 

COMMENT ON TABLE stockprop_pub IS 'Provenance. Any stockprop assignment can optionally be supported by a publication.';


-- ================================================
-- TABLE: stock_relationship
-- ================================================

create table stock_relationship (
       stock_relationship_id serial not null,
       primary key (stock_relationship_id),
       subject_id int not null,
       foreign key (subject_id) references stock (stock_id) on delete cascade INITIALLY DEFERRED,
       object_id int not null,
       foreign key (object_id) references stock (stock_id) on delete cascade INITIALLY DEFERRED,
       type_id int not null,
       foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
       value text null,
       rank int not null default 0,
       constraint stock_relationship_c1 unique (subject_id,object_id,type_id,rank)
);
create index stock_relationship_idx1 on stock_relationship (subject_id);
create index stock_relationship_idx2 on stock_relationship (object_id);
create index stock_relationship_idx3 on stock_relationship (type_id);

COMMENT ON COLUMN stock_relationship.subject_id IS 'stock_relationship.subject_id is the subject of the subj-predicate-obj sentence. This is typically the substock.';
COMMENT ON COLUMN stock_relationship.object_id IS 'stock_relationship.object_id is the object of the subj-predicate-obj sentence. This is typically the container stock.';
COMMENT ON COLUMN stock_relationship.type_id IS 'stock_relationship.type_id is relationship type between subject and object. This is a cvterm, typically from the OBO relationship ontology, although other relationship types are allowed.';
COMMENT ON COLUMN stock_relationship.rank IS 'stock_relationship.rank is the ordering of subject stocks with respect to the object stock may be important where rank is used to order these; starts from zero.';
COMMENT ON COLUMN stock_relationship.value IS 'stock_relationship.value is for additional notes or comments.';



-- ================================================
-- TABLE: stock_relationship_cvterm
-- ================================================

CREATE TABLE stock_relationship_cvterm (
	stock_relationship_cvterm_id SERIAL NOT NULL,
	PRIMARY KEY (stock_relationship_cvterm_id),
	stock_relationship_id integer NOT NULL,
	FOREIGN KEY (stock_relationship_id) references stock_relationship (stock_relationship_id) ON DELETE CASCADE INITIALLY DEFERRED,
	cvterm_id integer NOT NULL,
	FOREIGN KEY (cvterm_id) REFERENCES cvterm (cvterm_id) ON DELETE RESTRICT,
	pub_id integer,
	FOREIGN KEY (pub_id) REFERENCES pub (pub_id) ON DELETE RESTRICT
);
COMMENT ON TABLE stock_relationship_cvterm is 'For germplasm maintenance and pedigree data, stock_relationship. type_id will record cvterms such as "is a female parent of", "a parent for mutation", "is a group_id of", "is a source_id of", etc The cvterms for higher categories such as "generative", "derivative" or "maintenance" can be stored in table stock_relationship_cvterm';


-- ================================================
-- TABLE: stock_relationship_pub
-- ================================================

create table stock_relationship_pub (
      stock_relationship_pub_id serial not null,
      primary key (stock_relationship_pub_id),
      stock_relationship_id integer not null,
      foreign key (stock_relationship_id) references stock_relationship (stock_relationship_id) on delete cascade INITIALLY DEFERRED,
      pub_id int not null,
      foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
      constraint stock_relationship_pub_c1 unique (stock_relationship_id,pub_id)
);
create index stock_relationship_pub_idx1 on stock_relationship_pub (stock_relationship_id);
create index stock_relationship_pub_idx2 on stock_relationship_pub (pub_id);

COMMENT ON TABLE stock_relationship_pub IS 'Provenance. Attach optional evidence to a stock_relationship in the form of a publication.';


-- ================================================
-- TABLE: stock_dbxref
-- ================================================

create table stock_dbxref (
     stock_dbxref_id serial not null,
     primary key (stock_dbxref_id),
     stock_id int not null,
     foreign key (stock_id) references stock (stock_id) on delete cascade INITIALLY DEFERRED,
     dbxref_id int not null,
     foreign key (dbxref_id) references dbxref (dbxref_id) on delete cascade INITIALLY DEFERRED,
     is_current boolean not null default 'true',
     constraint stock_dbxref_c1 unique (stock_id,dbxref_id)
);
create index stock_dbxref_idx1 on stock_dbxref (stock_id);
create index stock_dbxref_idx2 on stock_dbxref (dbxref_id);

COMMENT ON TABLE stock_dbxref IS 'stock_dbxref links a stock to dbxrefs. This is for secondary identifiers; primary identifiers should use stock.dbxref_id.';
COMMENT ON COLUMN stock_dbxref.is_current IS 'The is_current boolean indicates whether the linked dbxref is the current -official- dbxref for the linked stock.';


-- ================================================
-- TABLE: stock_cvterm
-- ================================================

create table stock_cvterm (
     stock_cvterm_id serial not null,
     primary key (stock_cvterm_id),
     stock_id int not null,
     foreign key (stock_id) references stock (stock_id) on delete cascade INITIALLY DEFERRED,
     cvterm_id int not null,
     foreign key (cvterm_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
     pub_id int not null,
     foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
     is_not boolean not null default false,
     rank integer not null default 0,
     constraint stock_cvterm_c1 unique (stock_id,cvterm_id,pub_id,rank)
 );
create index stock_cvterm_idx1 on stock_cvterm (stock_id);
create index stock_cvterm_idx2 on stock_cvterm (cvterm_id);
create index stock_cvterm_idx3 on stock_cvterm (pub_id);

COMMENT ON TABLE stock_cvterm IS 'stock_cvterm links a stock to cvterms. This is for secondary cvterms; primary cvterms should use stock.type_id.';


-- ================================================
-- TABLE: stock_cvtermprop
-- ================================================

create table stock_cvtermprop (
    stock_cvtermprop_id serial not null,
    primary key (stock_cvtermprop_id),
    stock_cvterm_id int not null,
    foreign key (stock_cvterm_id) references stock_cvterm (stock_cvterm_id) on delete cascade,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    value text null,
    rank int not null default 0,
    constraint stock_cvtermprop_c1 unique (stock_cvterm_id,type_id,rank)
);
create index stock_cvtermprop_idx1 on stock_cvtermprop (stock_cvterm_id);
create index stock_cvtermprop_idx2 on stock_cvtermprop (type_id);

COMMENT ON TABLE stock_cvtermprop IS 'Extensible properties for
stock to cvterm associations. Examples: GO evidence codes;
qualifiers; metadata such as the date on which the entry was curated
and the source of the association. See the stockprop table for
meanings of type_id, value and rank.';

COMMENT ON COLUMN stock_cvtermprop.type_id IS 'The name of the
property/slot is a cvterm. The meaning of the property is defined in
that cvterm. cvterms may come from the OBO evidence code cv.';

COMMENT ON COLUMN stock_cvtermprop.value IS 'The value of the
property, represented as text. Numeric values are converted to their
text representation. This is less efficient than using native database
types, but is easier to query.';

COMMENT ON COLUMN stock_cvtermprop.rank IS 'Property-Value
ordering. Any stock_cvterm can have multiple values for any particular
property type - these are ordered in a list using rank, counting from
zero. For properties that are single-valued rather than multi-valued,
the default 0 value should be used.';


-- ================================================
-- TABLE: stock_genotype
-- ================================================

create table stock_genotype (
       stock_genotype_id serial not null,
       primary key (stock_genotype_id),
       stock_id int not null,
       foreign key (stock_id) references stock (stock_id) on delete cascade,
       genotype_id int not null,
       foreign key (genotype_id) references genotype (genotype_id) on delete cascade,
       constraint stock_genotype_c1 unique (stock_id, genotype_id)
);
create index stock_genotype_idx1 on stock_genotype (stock_id);
create index stock_genotype_idx2 on stock_genotype (genotype_id);

COMMENT ON TABLE stock_genotype IS 'Simple table linking a stock to
a genotype. Features with genotypes can be linked to stocks thru feature_genotype -> genotype -> stock_genotype -> stock.';


-- ================================================
-- TABLE: stockcollection
-- ================================================

create table stockcollection (
	stockcollection_id serial not null, 
        primary key (stockcollection_id),
	type_id int not null,
        foreign key (type_id) references cvterm (cvterm_id) on delete cascade,
        contact_id int null,
        foreign key (contact_id) references contact (contact_id) on delete set null INITIALLY DEFERRED,
	name varchar(255),
	uniquename text not null,
	constraint stockcollection_c1 unique (uniquename,type_id)
);
create index stockcollection_name_ind1 on stockcollection (name);
create index stockcollection_idx1 on stockcollection (contact_id);
create index stockcollection_idx2 on stockcollection (type_id);
create index stockcollection_idx3 on stockcollection (uniquename);

COMMENT ON TABLE stockcollection IS 'The lab or stock center distributing the stocks in their collection.';
COMMENT ON COLUMN stockcollection.uniquename IS 'uniqename is the value of the collection cv.';
COMMENT ON COLUMN stockcollection.type_id IS 'type_id is the collection type cv.';
COMMENT ON COLUMN stockcollection.name IS 'name is the collection.';
COMMENT ON COLUMN stockcollection.contact_id IS 'contact_id links to the contact information for the collection.';


-- ================================================
-- TABLE: stockcollectionprop
-- ================================================

create table stockcollectionprop (
    stockcollectionprop_id serial not null,
    primary key (stockcollectionprop_id),
    stockcollection_id int not null,
    foreign key (stockcollection_id) references stockcollection (stockcollection_id) on delete cascade INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id),
    value text null,
    rank int not null default 0,
    constraint stockcollectionprop_c1 unique (stockcollection_id,type_id,rank)
);
create index stockcollectionprop_idx1 on stockcollectionprop (stockcollection_id);
create index stockcollectionprop_idx2 on stockcollectionprop (type_id);

COMMENT ON TABLE stockcollectionprop IS 'The table stockcollectionprop
contains the value of the stock collection such as website/email URLs;
the value of the stock collection order URLs.';
COMMENT ON COLUMN stockcollectionprop.type_id IS 'The cv for the type_id is "stockcollection property type".';


-- ================================================
-- TABLE: stockcollection_stock
-- ================================================

create table stockcollection_stock (
    stockcollection_stock_id serial not null,
    primary key (stockcollection_stock_id),
    stockcollection_id int not null,
    foreign key (stockcollection_id) references stockcollection (stockcollection_id) on delete cascade INITIALLY DEFERRED,
    stock_id int not null,
    foreign key (stock_id) references stock (stock_id) on delete cascade INITIALLY DEFERRED,
    constraint stockcollection_stock_c1 unique (stockcollection_id,stock_id)
);
create index stockcollection_stock_idx1 on stockcollection_stock (stockcollection_id);
create index stockcollection_stock_idx2 on stockcollection_stock (stock_id);

COMMENT ON TABLE stockcollection_stock IS 'stockcollection_stock links
a stock collection to the stocks which are contained in the collection.';



-- ================================================
-- TABLE: stock_dbxrefprop
-- ================================================

create table stock_dbxrefprop (
       stock_dbxrefprop_id serial not null,
       primary key (stock_dbxrefprop_id),
       stock_dbxref_id int not null,
       foreign key (stock_dbxref_id) references stock_dbxref (stock_dbxref_id) on delete cascade INITIALLY DEFERRED,
       type_id int not null,
       foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
       value text null,
       rank int not null default 0,
       constraint stock_dbxrefprop_c1 unique (stock_dbxref_id,type_id,rank)
);
create index stock_dbxrefprop_idx1 on stock_dbxrefprop (stock_dbxref_id);
create index stock_dbxrefprop_idx2 on stock_dbxrefprop (type_id);

COMMENT ON TABLE stock_dbxrefprop IS 'A stock_dbxref can have any number of
slot-value property tags attached to it. This is useful for storing properties related to dbxref annotations of stocks, such as evidence codes, and references, and metadata, such as create/modify dates. This is an alternative to
hardcoding a list of columns in the relational schema, and is
completely extensible. There is a unique constraint, stock_dbxrefprop_c1, for
the combination of stock_dbxref_id, rank, and type_id. Multivalued property-value pairs must be differentiated by rank.';

-- =================================================================
-- Dependencies:
--
-- :import feature from sequence
-- :import synonym from sequence
-- :import cvterm from cv
-- :import pub from pub
-- :import organism from organism
-- =================================================================

-- ================================================
-- TABLE: library
-- ================================================

create table library (
    library_id serial not null,
    primary key (library_id),
    organism_id int not null,
    foreign key (organism_id) references organism (organism_id),
    name varchar(255),
    uniquename text not null,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id),
    is_obsolete int not null default 0,
    timeaccessioned timestamp not null default current_timestamp,
    timelastmodified timestamp not null default current_timestamp,
    constraint library_c1 unique (organism_id,uniquename,type_id)
);
create index library_name_ind1 on library(name);
create index library_idx1 on library (organism_id);
create index library_idx2 on library (type_id);
create index library_idx3 on library (uniquename);

COMMENT ON COLUMN library.type_id IS 'The type_id foreign key links
to a controlled vocabulary of library types. Examples of this would be: "cDNA_library" or "genomic_library"';


-- ================================================
-- TABLE: library_synonym
-- ================================================

create table library_synonym (
    library_synonym_id serial not null,
    primary key (library_synonym_id),
    synonym_id int not null,
    foreign key (synonym_id) references synonym (synonym_id) on delete cascade INITIALLY DEFERRED,
    library_id int not null,
    foreign key (library_id) references library (library_id) on delete cascade INITIALLY DEFERRED,
    pub_id int not null,
    foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
    is_current boolean not null default 'true',
    is_internal boolean not null default 'false',
    constraint library_synonym_c1 unique (synonym_id,library_id,pub_id)
);
create index library_synonym_idx1 on library_synonym (synonym_id);
create index library_synonym_idx2 on library_synonym (library_id);
create index library_synonym_idx3 on library_synonym (pub_id);

COMMENT ON COLUMN library_synonym.is_current IS 'The is_current bit indicates whether the linked synonym is the current -official- symbol for the linked library.';
COMMENT ON COLUMN library_synonym.pub_id IS 'The pub_id link is for
relating the usage of a given synonym to the publication in which it was used.';
COMMENT ON COLUMN library_synonym.is_internal IS 'Typically a synonym
exists so that somebody querying the database with an obsolete name
can find the object they are looking for under its current name.  If
the synonym has been used publicly and deliberately (e.g. in a paper), it my also be listed in reports as a synonym.   If the synonym was not used deliberately (e.g., there was a typo which went public), then the is_internal bit may be set to "true" so that it is known that the synonym is "internal" and should be queryable but should not be listed in reports as a valid synonym.';


-- ================================================
-- TABLE: library_pub
-- ================================================

create table library_pub (
    library_pub_id serial not null,
    primary key (library_pub_id),
    library_id int not null,
    foreign key (library_id) references library (library_id) on delete cascade INITIALLY DEFERRED,
    pub_id int not null,
    foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
    constraint library_pub_c1 unique (library_id,pub_id)
);
create index library_pub_idx1 on library_pub (library_id);
create index library_pub_idx2 on library_pub (pub_id);


-- ================================================
-- TABLE: libraryprop
-- ================================================

create table libraryprop (
    libraryprop_id serial not null,
    primary key (libraryprop_id),
    library_id int not null,
    foreign key (library_id) references library (library_id) on delete cascade INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id),
    value text null,
    rank int not null default 0,
    constraint libraryprop_c1 unique (library_id,type_id,rank)
);
create index libraryprop_idx1 on libraryprop (library_id);
create index libraryprop_idx2 on libraryprop (type_id);


-- ================================================
-- TABLE: libraryprop_pub
-- ================================================

create table libraryprop_pub (
    libraryprop_pub_id serial not null,
    primary key (libraryprop_pub_id),
    libraryprop_id int not null,
    foreign key (libraryprop_id) references libraryprop (libraryprop_id) on delete cascade INITIALLY DEFERRED,
    pub_id int not null,
    foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
    constraint libraryprop_pub_c1 unique (libraryprop_id,pub_id)
);
create index libraryprop_pub_idx1 on libraryprop_pub (libraryprop_id);
create index libraryprop_pub_idx2 on libraryprop_pub (pub_id);


-- ================================================
-- TABLE: library_cvterm
-- ================================================

create table library_cvterm (
    library_cvterm_id serial not null,
    primary key (library_cvterm_id),
    library_id int not null,
    foreign key (library_id) references library (library_id) on delete cascade INITIALLY DEFERRED,
    cvterm_id int not null,
    foreign key (cvterm_id) references cvterm (cvterm_id),
    pub_id int not null,
    foreign key (pub_id) references pub (pub_id),
    constraint library_cvterm_c1 unique (library_id,cvterm_id,pub_id)
);
create index library_cvterm_idx1 on library_cvterm (library_id);
create index library_cvterm_idx2 on library_cvterm (cvterm_id);
create index library_cvterm_idx3 on library_cvterm (pub_id);

COMMENT ON TABLE library_cvterm IS 'The table library_cvterm links a library to controlled vocabularies which describe the library.  For instance, there might be a link to the anatomy cv for "head" or "testes" for a head or testes library.';


-- ================================================
-- TABLE: library_feature
-- ================================================

create table library_feature (
    library_feature_id serial not null,
    primary key (library_feature_id),
    library_id int not null,
    foreign key (library_id) references library (library_id) on delete cascade INITIALLY DEFERRED,
    feature_id int not null,
    foreign key (feature_id) references feature (feature_id) on delete cascade INITIALLY DEFERRED,
    constraint library_feature_c1 unique (library_id,feature_id)
);
create index library_feature_idx1 on library_feature (library_id);
create index library_feature_idx2 on library_feature (feature_id);

COMMENT ON TABLE library_feature IS 'library_feature links a library to the clones which are contained in the library.  Examples of such linked features might be "cDNA_clone" or  "genomic_clone".';


-- ================================================
-- TABLE: library_dbxref
-- ================================================

create table library_dbxref (
    library_dbxref_id serial not null,
    primary key (library_dbxref_id),
    library_id int not null,
    foreign key (library_id) references library (library_id) on delete cascade INITIALLY DEFERRED,
    dbxref_id int not null,
    foreign key (dbxref_id) references dbxref (dbxref_id) on delete cascade INITIALLY DEFERRED,
    is_current boolean not null default 'true',
    constraint library_dbxref_c1 unique (library_id,dbxref_id)
);
create index library_dbxref_idx1 on library_dbxref (library_id);
create index library_dbxref_idx2 on library_dbxref (dbxref_id);





-- ==========================================
-- Chado cell line module
--
-- ============
-- DEPENDENCIES
-- ============
-- :import feature from sequence
-- :import synonym from sequence
-- :import library from library
-- :import cvterm from cv
-- :import dbxref from general
-- :import pub from pub
-- :import organism from organism
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-- ================================================
-- TABLE: cell_line
-- ================================================

create table cell_line (
        cell_line_id serial not null,
        primary key (cell_line_id),
        name varchar(255) null,
        uniquename varchar(255) not null,
	organism_id int not null,
	foreign key (organism_id) references organism (organism_id) on delete cascade INITIALLY DEFERRED,
	timeaccessioned timestamp not null default current_timestamp,
	timelastmodified timestamp not null default current_timestamp,
        constraint cell_line_c1 unique (uniquename, organism_id)
);
grant all on cell_line to PUBLIC;


-- ================================================
-- TABLE: cell_line_relationship
-- ================================================

create table cell_line_relationship (
	cell_line_relationship_id serial not null,
	primary key (cell_line_relationship_id),	
        subject_id int not null,
	foreign key (subject_id) references cell_line (cell_line_id) on delete cascade INITIALLY DEFERRED,
        object_id int not null,
	foreign key (object_id) references cell_line (cell_line_id) on delete cascade INITIALLY DEFERRED,
	type_id int not null,
	foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
	constraint cell_line_relationship_c1 unique (subject_id, object_id, type_id)
);
grant all on cell_line_relationship to PUBLIC;


-- ================================================
-- TABLE: cell_line_synonym
-- ================================================

create table cell_line_synonym (
	cell_line_synonym_id serial not null,
	primary key (cell_line_synonym_id),
	cell_line_id int not null,
	foreign key (cell_line_id) references cell_line (cell_line_id) on delete cascade INITIALLY DEFERRED,
	synonym_id int not null,
	foreign key (synonym_id) references synonym (synonym_id) on delete cascade INITIALLY DEFERRED,
	pub_id int not null,
	foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
	is_current boolean not null default 'false',
	is_internal boolean not null default 'false',
	constraint cell_line_synonym_c1 unique (synonym_id,cell_line_id,pub_id)	
);
grant all on cell_line_synonym to PUBLIC;


-- ================================================
-- TABLE: cell_line_cvterm
-- ================================================

create table cell_line_cvterm (
	cell_line_cvterm_id serial not null,
	primary key (cell_line_cvterm_id),
	cell_line_id int not null,
	foreign key (cell_line_id) references cell_line (cell_line_id) on delete cascade INITIALLY DEFERRED,
	cvterm_id int not null,
	foreign key (cvterm_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
	pub_id int not null,
	foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
	rank int not null default 0,
	constraint cell_line_cvterm_c1 unique (cell_line_id,cvterm_id,pub_id,rank)
);
grant all on cell_line_cvterm to PUBLIC;


-- ================================================
-- TABLE: cell_line_dbxref
-- ================================================

create table cell_line_dbxref (
	cell_line_dbxref_id serial not null,
	primary key (cell_line_dbxref_id),
	cell_line_id int not null,
	foreign key (cell_line_id) references cell_line (cell_line_id) on delete cascade INITIALLY DEFERRED,
	dbxref_id int not null,
	foreign key (dbxref_id) references dbxref (dbxref_id) on delete cascade INITIALLY DEFERRED,
	is_current boolean not null default 'true',
	constraint cell_line_dbxref_c1 unique (cell_line_id,dbxref_id)
);
grant all on cell_line_dbxref to PUBLIC;


-- ================================================
-- TABLE: cell_lineprop
-- ================================================

create table cell_lineprop (
	cell_lineprop_id serial not null,
	primary key (cell_lineprop_id),
	cell_line_id int not null,
	foreign key (cell_line_id) references cell_line (cell_line_id) on delete cascade INITIALLY DEFERRED,
	type_id int not null,
	foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
	value text null,
	rank int not null default 0,
	constraint cell_lineprop_c1 unique (cell_line_id,type_id,rank)
);
grant all on cell_lineprop to PUBLIC;


-- ================================================
-- TABLE: cell_lineprop_pub
-- ================================================

create table cell_lineprop_pub (
	cell_lineprop_pub_id serial not null,
	primary key (cell_lineprop_pub_id),
	cell_lineprop_id int not null,
	foreign key (cell_lineprop_id) references cell_lineprop (cell_lineprop_id) on delete cascade INITIALLY DEFERRED,
	pub_id int not null,
	foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
	constraint cell_lineprop_pub_c1 unique (cell_lineprop_id,pub_id)
);
grant all on cell_lineprop_pub to PUBLIC;


-- ================================================
-- TABLE: cell_line_feature
-- ================================================

create table cell_line_feature (
	cell_line_feature_id serial not null,
	primary key (cell_line_feature_id),
	cell_line_id int not null,
	foreign key (cell_line_id) references cell_line (cell_line_id) on delete cascade INITIALLY DEFERRED,
	feature_id int not null,
	foreign key (feature_id) references feature (feature_id) on delete cascade INITIALLY DEFERRED,
	pub_id int not null,
	foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
	constraint cell_line_feature_c1 unique (cell_line_id, feature_id, pub_id)
);
grant all on cell_line_feature to PUBLIC;


-- ================================================
-- TABLE: cell_line_cvtermprop
-- ================================================

create table cell_line_cvtermprop (
	cell_line_cvtermprop_id serial not null,
	primary key (cell_line_cvtermprop_id),
	cell_line_cvterm_id int not null,
	foreign key (cell_line_cvterm_id) references cell_line_cvterm (cell_line_cvterm_id) on delete cascade INITIALLY DEFERRED,
	type_id int not null,
	foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
	value text null,
	rank int not null default 0,
	constraint cell_line_cvtermprop_c1 unique (cell_line_cvterm_id, type_id, rank)
);
grant all on cell_line_cvtermprop to PUBLIC;


-- ================================================
-- TABLE: cell_line_pub
-- ================================================

create table cell_line_pub (
	cell_line_pub_id serial not null,
	primary key (cell_line_pub_id),
	cell_line_id int not null,
	foreign key (cell_line_id) references cell_line (cell_line_id) on delete cascade INITIALLY DEFERRED,
	pub_id int not null,
	foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
	constraint cell_line_pub_c1 unique (cell_line_id, pub_id)
);
grant all on cell_line_pub to PUBLIC;


-- ================================================
-- TABLE: cell_line_library
-- ================================================

create table cell_line_library (
	cell_line_library_id serial not null,
	primary key (cell_line_library_id),
	cell_line_id int not null,
	foreign key (cell_line_id) references cell_line (cell_line_id) on delete cascade INITIALLY DEFERRED,
	library_id int not null,
	foreign key (library_id) references library (library_id) on delete cascade INITIALLY DEFERRED,
	pub_id int not null,
	foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
	constraint cell_line_library_c1 unique (cell_line_id, library_id, pub_id)
);
grant all on cell_line_library to PUBLIC;

-- VIEW gffatts: a view to get feature attributes in a format that
-- will make it easy to convert them to GFF attributes

CREATE OR REPLACE VIEW gffatts (
    feature_id,
    type,
    attribute
) AS
SELECT feature_id, 'Ontology_term' AS type,  s.name AS attribute
FROM cvterm s, feature_cvterm fs
WHERE fs.cvterm_id = s.cvterm_id
UNION ALL
SELECT feature_id, 'Dbxref' AS type, d.name || ':' || s.accession AS attribute
FROM dbxref s, feature_dbxref fs, db d
WHERE fs.dbxref_id = s.dbxref_id and s.db_id = d.db_id
UNION ALL
SELECT feature_id, 'Alias' AS type, s.name AS attribute
FROM synonym s, feature_synonym fs
WHERE fs.synonym_id = s.synonym_id
UNION ALL
SELECT fp.feature_id,cv.name,fp.value
FROM featureprop fp, cvterm cv
WHERE fp.type_id = cv.cvterm_id
UNION ALL
SELECT feature_id, 'pub' AS type, s.series_name || ':' || s.title AS attribute
FROM pub s, feature_pub fs
WHERE fs.pub_id = s.pub_id;

--creates a view that can be used to assemble a GFF3 compliant attribute string
CREATE OR REPLACE VIEW gff3atts (
    feature_id,
    type,
    attribute
) AS
SELECT feature_id, 
      'Ontology_term' AS type, 
      CASE WHEN db.name like '%Gene Ontology%'    THEN 'GO:'|| dbx.accession
           WHEN db.name like 'Sequence Ontology%' THEN 'SO:'|| dbx.accession
           ELSE                            CAST(db.name||':'|| dbx.accession AS varchar)
      END 
FROM cvterm s, dbxref dbx, feature_cvterm fs, db
WHERE fs.cvterm_id = s.cvterm_id and s.dbxref_id=dbx.dbxref_id and
      db.db_id = dbx.db_id 
UNION ALL
SELECT feature_id, 'Dbxref' AS type, d.name || ':' || s.accession AS
attribute
FROM dbxref s, feature_dbxref fs, db d
WHERE fs.dbxref_id = s.dbxref_id and s.db_id = d.db_id and
      d.name != 'GFF_source'
UNION ALL
SELECT f.feature_id, 'Alias' AS type, s.name AS attribute
FROM synonym s, feature_synonym fs, feature f
WHERE fs.synonym_id = s.synonym_id and f.feature_id = fs.feature_id and
      f.name != s.name and f.uniquename != s.name
UNION ALL
SELECT fp.feature_id,cv.name,fp.value
FROM featureprop fp, cvterm cv
WHERE fp.type_id = cv.cvterm_id
UNION ALL
SELECT feature_id, 'pub' AS type, s.series_name || ':' || s.title AS
attribute
FROM pub s, feature_pub fs
WHERE fs.pub_id = s.pub_id
UNION ALL
SELECT fr.subject_id as feature_id, 'Parent' as type,  parent.uniquename
as attribute
FROM feature_relationship fr, feature parent
WHERE  fr.object_id=parent.feature_id AND fr.type_id = (SELECT cvterm_id
FROM cvterm WHERE name='part_of' and cv_id in (select cv_id
  FROM cv WHERE name='relationship'))
UNION ALL
SELECT fr.subject_id as feature_id, 'Derives_from' as type,
parent.uniquename as attribute
FROM feature_relationship fr, feature parent
WHERE  fr.object_id=parent.feature_id AND fr.type_id = (SELECT cvterm_id
FROM cvterm WHERE name='derives_from' and cv_id in (select cv_id
  FROM cv WHERE name='relationship'))
UNION ALL
SELECT fl.feature_id, 'Target' as type, target.name || ' ' || fl.fmin+1
|| ' ' || fl.fmax || ' ' || fl.strand as attribute
FROM featureloc fl, feature target
WHERE fl.srcfeature_id=target.feature_id
        AND fl.rank != 0
UNION ALL
SELECT feature_id, 'ID' as type, uniquename as attribute
FROM feature
WHERE type_id NOT IN (SELECT cvterm_id FROM cvterm WHERE name='CDS')
UNION ALL
SELECT feature_id, 'chado_feature_id' as type, CAST(feature_id AS
varchar) as attribute
FROM feature
UNION ALL
SELECT feature_id, 'Name' as type, name as attribute
FROM feature;


--replaced with Rob B's improved view
CREATE OR REPLACE VIEW gff3view (
feature_id, ref, source, type, fstart, fend,
score, strand, phase, seqlen, name, organism_id
) AS
SELECT
f.feature_id, sf.name, 
 COALESCE(gffdbx.accession,'.'::varchar(255)), cv.name,
fl.fmin+1, fl.fmax, 
 COALESCE(CAST(af.significance AS text), '.'),
 CASE WHEN fl.strand=-1 THEN '-'
      WHEN fl.strand=1  THEN '+'
      ELSE '.'
 END,
 COALESCE(CAST(fl.phase AS text), '.'), f.seqlen, f.name, f.organism_id
FROM feature f
LEFT JOIN featureloc fl ON (f.feature_id = fl.feature_id)
LEFT JOIN feature sf ON (fl.srcfeature_id = sf.feature_id)
LEFT JOIN ( SELECT fd.feature_id, d.accession
FROM feature_dbxref fd
JOIN dbxref d using(dbxref_id)
JOIN db using(db_id)
WHERE db.name = 'GFF_source'
) as gffdbx
ON (f.feature_id=gffdbx.feature_id)
LEFT JOIN cvterm cv ON (f.type_id = cv.cvterm_id)
LEFT JOIN analysisfeature af ON (f.feature_id = af.feature_id);

-- FUNCTION gfffeatureatts (integer) is a function to get 
-- data in the same format as the gffatts view so that 
-- it can be easily converted to GFF attributes.

CREATE FUNCTION  gfffeatureatts (integer)
RETURNS SETOF gffatts
AS
'
SELECT feature_id, ''Ontology_term'' AS type,  s.name AS attribute
FROM cvterm s, feature_cvterm fs
WHERE fs.feature_id= $1 AND fs.cvterm_id = s.cvterm_id
UNION
SELECT feature_id, ''Dbxref'' AS type, d.name || '':'' || s.accession AS attribute
FROM dbxref s, feature_dbxref fs, db d
WHERE fs.feature_id= $1 AND fs.dbxref_id = s.dbxref_id AND s.db_id = d.db_id
UNION
SELECT feature_id, ''Alias'' AS type, s.name AS attribute
FROM synonym s, feature_synonym fs
WHERE fs.feature_id= $1 AND fs.synonym_id = s.synonym_id
UNION
SELECT fp.feature_id,cv.name,fp.value
FROM featureprop fp, cvterm cv
WHERE fp.feature_id= $1 AND fp.type_id = cv.cvterm_id 
UNION
SELECT feature_id, ''pub'' AS type, s.series_name || '':'' || s.title AS attribute
FROM pub s, feature_pub fs
WHERE fs.feature_id= $1 AND fs.pub_id = s.pub_id
'
LANGUAGE SQL;


--
-- functions for creating coordinate based functions
--
-- create a point
CREATE OR REPLACE FUNCTION featureslice(int, int) RETURNS setof featureloc AS
  'SELECT * from featureloc where boxquery($1, $2) @ boxrange(fmin,fmax)'
LANGUAGE 'sql';

--uses the gff3atts to create a GFF3 compliant attribute string
CREATE OR REPLACE FUNCTION gffattstring (integer) RETURNS varchar AS
'DECLARE
  return_string      varchar;
  f_id               ALIAS FOR $1;
  atts_view          gffatts%ROWTYPE;
  feature_row        feature%ROWTYPE;
  name               varchar;
  uniquename         varchar;
  parent             varchar;
  escape_loc         int; 
BEGIN
  --Get name from feature.name
  --Get ID from feature.uniquename
                                                                                
  SELECT INTO feature_row * FROM feature WHERE feature_id = f_id;
  name  = feature_row.name;
  return_string = ''ID='' || feature_row.uniquename;
  IF name IS NOT NULL AND name != ''''
  THEN
    return_string = return_string ||'';'' || ''Name='' || name;
  END IF;
                                                                                
  --Get Parent from feature_relationship
  SELECT INTO feature_row * FROM feature f, feature_relationship fr
    WHERE fr.subject_id = f_id AND fr.object_id = f.feature_id;
  IF FOUND
  THEN
    return_string = return_string||'';''||''Parent=''||feature_row.uniquename;
  END IF;
                                                                                
  FOR atts_view IN SELECT * FROM gff3atts WHERE feature_id = f_id  LOOP
    escape_loc = position('';'' in atts_view.attribute);
    IF escape_loc > 0 THEN
      atts_view.attribute = replace(atts_view.attribute, '';'', ''%3B'');
    END IF;
    return_string = return_string || '';''
                     || atts_view.type || ''=''
                     || atts_view.attribute;
  END LOOP;
                                                                                
  RETURN return_string;
END;
'
LANGUAGE plpgsql;

--creates a view that is suitable for creating a GFF3 string
--CREATE OR REPLACE VIEW gff3view (
--REMOVED and RECREATED in sequence-gff-views.sql to avoid 
--using the function above
--------------------------------
---- all_feature_names ---------
--------------------------------
-- This is a view to replace the denormaliziation of the synonym
-- table.  It contains names and uniquenames from feature and
-- synonym.names from the synonym table, so that GBrowse has one
-- place to search for names.
--
-- To materialize this view, run gmod_materialized_view_tool.pl -c and
-- answer the questions with these responses:
--
--   all_feature_names
--
--   public.all_feature_names
--
--   y   (yes, replace the existing view)
--
--   (some update frequency, I chose daily)
--
--   feature_id integer,name varchar(255),organism_id integer
--
--   (the select part of the view below, all on one line)
--
--   feature_id,name
--
--   create index all_feature_names_lower_name on all_feature_names (lower(name))
--
--   y
--
-- OR, you could execute this command (the materialized view tool has been
-- updated to allow this all to be supplied on the command line):
--
-- (yes, it's all one really long line, to make copy and pasting easier)
-- gmod_materialized_view_tool.pl --create_view --view_name all_feature_names --table_name public.all_feature_names --refresh_time daily --column_def "feature_id integer,name varchar(255),organism_id integer" --sql_query "SELECT feature_id,CAST(substring(uniquename from 0 for 255) as varchar(255)) as name,organism_id FROM feature UNION SELECT feature_id, name, organism_id FROM feature where name is not null UNION SELECT fs.feature_id,s.name,f.organism_id FROM feature_synonym fs, synonym s, feature f WHERE fs.synonym_id = s.synonym_id AND fs.feature_id = f.feature_id UNION SELECT fp.feature_id, CAST(substring(fp.value from 0 for 255) as varchar(255)) as name,f.organism_id FROM featureprop fp, feature f WHERE f.feature_id = fp.feature_id UNION SELECT fd.feature_id, d.accession, f.organism_id FROM feature_dbxref fd, dbxref d,feature f WHERE fd.dbxref_id = d.dbxref_id AND fd.feature_id = f.feature_id" --index_fields "feature_id,name" --special_index "create index all_feature_names_lower_name on all_feature_names (lower(name))" --yes
--
--
-- OR, even more complicated, you could use this command to create a materialized view
-- for use with full text searching on PostgreSQL 8.4 or better:
--
-- gmod_materialized_view_tool.pl --create_view --view_name all_feature_names --table_name public.all_feature_names --refresh_time daily --column_def "feature_id integer,name varchar(255),organism_id integer,searchable_name tsvector" --sql_query "SELECT feature_id, CAST(substring(uniquename FROM 0 FOR 255) AS varchar(255)) AS name, organism_id, to_tsvector('english', CAST(substring(uniquename FROM 0 FOR 255) AS varchar(255))) AS searchable_name FROM feature UNION SELECT feature_id, name, organism_id, to_tsvector('english', name) AS searchable_name FROM feature WHERE name IS NOT NULL UNION SELECT fs.feature_id, s.name, f.organism_id, to_tsvector('english', s.name) AS searchable_name FROM feature_synonym fs, synonym s, feature f WHERE fs.synonym_id = s.synonym_id AND fs.feature_id = f.feature_id UNION SELECT fp.feature_id, CAST(substring(fp.value FROM 0 FOR 255) AS varchar(255)) AS name, f.organism_id, to_tsvector('english',CAST(substring(fp.value FROM 0 FOR 255) AS varchar(255))) AS searchable_name FROM featureprop fp, feature f WHERE f.feature_id = fp.feature_id UNION SELECT fd.feature_id, d.accession, f.organism_id,to_tsvector('english',d.accession) AS searchable_name FROM feature_dbxref fd, dbxref d,feature f WHERE fd.dbxref_id = d.dbxref_id AND fd.feature_id = f.feature_id" --index_fields "feature_id,name" --special_index "CREATE INDEX searchable_all_feature_names_idx ON all_feature_names USING gin(searchable_name)" --yes 
--
CREATE OR REPLACE VIEW all_feature_names (
  feature_id,
  name,
  organism_id
) AS
SELECT feature_id,CAST(substring(uniquename from 0 for 255) as varchar(255)) as name,organism_id FROM feature  
UNION
SELECT feature_id, name, organism_id FROM feature where name is not null 
UNION
SELECT fs.feature_id,s.name,f.organism_id FROM feature_synonym fs, synonym s, feature f
  WHERE fs.synonym_id = s.synonym_id AND fs.feature_id = f.feature_id
UNION
SELECT fp.feature_id, CAST(substring(fp.value from 0 for 255) as varchar(255)) as name,f.organism_id FROM featureprop fp, feature f 
  WHERE f.feature_id = fp.feature_id
UNION
SELECT fd.feature_id, d.accession, f.organism_id FROM feature_dbxref fd, dbxref d,feature f
  WHERE fd.dbxref_id = d.dbxref_id AND fd.feature_id = f.feature_id;

--------------------------------
---- dfeatureloc ---------------
--------------------------------
-- dfeatureloc is meant as an alternate representation of
-- the data in featureloc (see the descrption of featureloc
-- in sequence.sql).  In dfeatureloc, fmin and fmax are 
-- replaced with nbeg and nend.  Whereas fmin and fmax
-- are absolute coordinates relative to the parent feature, nbeg 
-- and nend are the beginning and ending coordinates
-- relative to the feature itself.  For example, nbeg would
-- mark the 5' end of a gene and nend would mark the 3' end.

CREATE OR REPLACE VIEW dfeatureloc (
 featureloc_id,
 feature_id,
 srcfeature_id,
 nbeg,
 is_nbeg_partial,
 nend,
 is_nend_partial,
 strand,
 phase,
 residue_info,
 locgroup,
 rank
) AS
SELECT featureloc_id, feature_id, srcfeature_id, fmin, is_fmin_partial,
       fmax, is_fmax_partial, strand, phase, residue_info, locgroup, rank
FROM featureloc
WHERE (strand < 0 or phase < 0)
UNION
SELECT featureloc_id, feature_id, srcfeature_id, fmax, is_fmax_partial,
       fmin, is_fmin_partial, strand, phase, residue_info, locgroup, rank
FROM featureloc
WHERE (strand is NULL or strand >= 0 or phase >= 0) ;

--------------------------------
---- f_type --------------------
--------------------------------
CREATE OR REPLACE VIEW f_type
AS
  SELECT  f.feature_id,
          f.name,
          f.dbxref_id,
          c.name AS type,
          f.residues,
          f.seqlen,
          f.md5checksum,
          f.type_id,
          f.timeaccessioned,
          f.timelastmodified
    FROM  feature f, cvterm c
   WHERE  f.type_id = c.cvterm_id;

--------------------------------
---- fnr_type ------------------
--------------------------------
CREATE OR REPLACE VIEW fnr_type
AS
  SELECT  f.feature_id,
          f.name,
          f.dbxref_id,
          c.name AS type,
          f.residues,
          f.seqlen,
          f.md5checksum,
          f.type_id,
          f.timeaccessioned,
          f.timelastmodified
    FROM  feature f left outer join analysisfeature af
          on (f.feature_id = af.feature_id), cvterm c
   WHERE  f.type_id = c.cvterm_id
          and af.feature_id is null;

--------------------------------
---- f_loc ---------------------
--------------------------------
-- Note from Scott:  I changed this view to depend on dfeatureloc,
-- since I don't know what it is used for.  The change should
-- be transparent.  I also changed dbxrefstr to dbxref_id since
-- dbxrefstr is no longer in feature

CREATE OR REPLACE VIEW f_loc
AS
  SELECT  f.feature_id,
          f.name,
          f.dbxref_id,
          fl.nbeg,
          fl.nend,
          fl.strand
    FROM  dfeatureloc fl, f_type f
   WHERE  f.feature_id = fl.feature_id;

--------------------------------
---- fp_key -------------------
--------------------------------
CREATE OR REPLACE VIEW fp_key
AS
  SELECT  fp.feature_id,
          c.name AS pkey,
          fp.value
    FROM  featureprop fp, cvterm c
   WHERE  fp.featureprop_id = c.cvterm_id;

-- [symmetric,reflexive]
-- intervals have at least one interbase point in common
-- (i.e. overlap OR abut)
-- EXAMPLE QUERY:
--   (features of same type that overlap)
--   SELECT r.*
--   FROM feature AS x 
--   INNER JOIN feature_meets AS r ON (x.feature_id=r.subject_id)
--   INNER JOIN feature AS y ON (y.feature_id=r.object_id)
--   WHERE x.type_id=y.type_id
CREATE OR REPLACE VIEW feature_meets (
  subject_id,
  object_id
) AS
SELECT
 x.feature_id,
 y.feature_id
FROM
 featureloc AS x,
 featureloc AS y
WHERE
 x.srcfeature_id=y.srcfeature_id
 AND
 ( x.fmax >= y.fmin AND x.fmin <= y.fmax );

COMMENT ON VIEW feature_meets IS 'intervals have at least one
interbase point in common (ie overlap OR abut). symmetric,reflexive';

-- [symmetric,reflexive]
-- as above, strands match
CREATE OR REPLACE VIEW feature_meets_on_same_strand (
  subject_id,
  object_id
) AS
SELECT
 x.feature_id,
 y.feature_id
FROM
 featureloc AS x,
 featureloc AS y
WHERE
 x.srcfeature_id=y.srcfeature_id
 AND
 x.strand = y.strand
 AND
 ( x.fmax >= y.fmin AND x.fmin <= y.fmax );

COMMENT ON VIEW feature_meets_on_same_strand IS 'as feature_meets, but
featurelocs must be on the same strand. symmetric,reflexive';


-- [symmetric]
-- intervals have no interbase points in common and do not abut
CREATE OR REPLACE VIEW feature_disjoint (
  subject_id,
  object_id
) AS
SELECT
 x.feature_id,
 y.feature_id
FROM
 featureloc AS x,
 featureloc AS y
WHERE
 x.srcfeature_id=y.srcfeature_id
 AND
 ( x.fmax < y.fmin AND x.fmin > y.fmax );

COMMENT ON VIEW feature_disjoint IS 'featurelocs do not meet. symmetric';

-- 4-ary relation
CREATE OR REPLACE VIEW feature_union AS
SELECT
  x.feature_id  AS subject_id,
  y.feature_id  AS object_id,
  x.srcfeature_id,
  x.strand      AS subject_strand,
  y.strand      AS object_strand,
  CASE WHEN x.fmin<y.fmin THEN x.fmin ELSE y.fmin END AS fmin,
  CASE WHEN x.fmax>y.fmax THEN x.fmax ELSE y.fmax END AS fmax
FROM
 featureloc AS x,
 featureloc AS y
WHERE
 x.srcfeature_id=y.srcfeature_id
 AND
 ( x.fmax >= y.fmin AND x.fmin <= y.fmax );

COMMENT ON VIEW feature_union IS 'set-union on interval defined by featureloc. featurelocs must meet';


-- 4-ary relation
CREATE OR REPLACE VIEW feature_intersection AS
SELECT
  x.feature_id  AS subject_id,
  y.feature_id  AS object_id,
  x.srcfeature_id,
  x.strand      AS subject_strand,
  y.strand      AS object_strand,
  CASE WHEN x.fmin<y.fmin THEN y.fmin ELSE x.fmin END AS fmin,
  CASE WHEN x.fmax>y.fmax THEN y.fmax ELSE x.fmax END AS fmax
FROM
 featureloc AS x,
 featureloc AS y
WHERE
 x.srcfeature_id=y.srcfeature_id
 AND
 ( x.fmax >= y.fmin AND x.fmin <= y.fmax );

COMMENT ON VIEW feature_intersection IS 'set-intersection on interval defined by featureloc. featurelocs must meet';

-- 4-ary relation
-- subtract object interval from subject interval
--  (may leave zero, one or two intervals)
CREATE OR REPLACE VIEW feature_difference (
  subject_id,
  object_id,
  srcfeature_id,
  fmin,
  fmax,
  strand
) AS
-- left interval
SELECT
  x.feature_id,
  y.feature_id,
  x.strand,
  x.srcfeature_id,
  x.fmin,
  y.fmin
FROM
 featureloc AS x,
 featureloc AS y
WHERE
 x.srcfeature_id=y.srcfeature_id
 AND
 (x.fmin < y.fmin AND x.fmax >= y.fmax )
UNION
-- right interval
SELECT
  x.feature_id,
  y.feature_id,
  x.strand,
  x.srcfeature_id,
  y.fmax,
  x.fmax
FROM
 featureloc AS x,
 featureloc AS y
WHERE
 x.srcfeature_id=y.srcfeature_id
 AND
 (x.fmax > y.fmax AND x.fmin <= y.fmin );

COMMENT ON VIEW feature_difference IS 'set-distance on interval defined by featureloc. featurelocs must meet';

-- 4-ary relation
CREATE OR REPLACE VIEW feature_distance AS
SELECT
  x.feature_id  AS subject_id,
  y.feature_id  AS object_id,
  x.srcfeature_id,
  x.strand      AS subject_strand,
  y.strand      AS object_strand,
  CASE WHEN x.fmax <= y.fmin THEN (x.fmax-y.fmin) ELSE (y.fmax-x.fmin) END AS distance
FROM
 featureloc AS x,
 featureloc AS y
WHERE
 x.srcfeature_id=y.srcfeature_id
 AND
 ( x.fmax <= y.fmin OR x.fmin >= y.fmax );

COMMENT ON VIEW feature_difference IS 'size of gap between two features. must be abutting or disjoint';

-- [transitive,reflexive]
-- (should this be made non-reflexive?)
-- subject intervals contains (or is same as) object interval
CREATE OR REPLACE VIEW feature_contains (
  subject_id,
  object_id
) AS
SELECT
 x.feature_id,
 y.feature_id
FROM
 featureloc AS x,
 featureloc AS y
WHERE
 x.srcfeature_id=y.srcfeature_id
 AND
 ( y.fmin >= x.fmin AND y.fmin <= x.fmax );

COMMENT ON VIEW feature_contains IS 'subject intervals contains (or is
same as) object interval. transitive,reflexive';

-- featureset relations:
--  a featureset relation is true between any two features x and y
--  if the relation is true for any x' and y' where x' and y' are
--  subfeatures of x and y

-- see feature_meets
-- example: two transcripts meet if any of their exons or CDSs overlap
-- or abut
CREATE OR REPLACE VIEW featureset_meets (
  subject_id,
  object_id
) AS
SELECT
 x.object_id,
 y.object_id
FROM
 feature_meets AS r
 INNER JOIN feature_relationship AS x ON (r.subject_id = x.subject_id)
 INNER JOIN feature_relationship AS y ON (r.object_id = y.subject_id);

-- =================================================================
-- Dependencies:
--
-- :import feature from sequence
-- :import cvterm from cv
-- :import pub from pub
-- :import phenotype from phenotype
-- :import organism from organism
-- :import genotype from genetic
-- :import contact from contact
-- :import project from project
-- :import stock from stock
-- :import synonym
-- =================================================================


-- this probably needs some work, depending on how cross-database we
-- want to be.  In Postgres, at least, there are much better ways to 
-- represent geo information.

CREATE TABLE nd_geolocation (
    nd_geolocation_id serial PRIMARY KEY NOT NULL,
    description character varying(255),
    latitude real,
    longitude real,
    geodetic_datum character varying(32),
    altitude real
);

COMMENT ON TABLE nd_geolocation IS 'The geo-referencable location of the stock. NOTE: This entity is subject to change as a more general and possibly more OpenGIS-compliant geolocation module may be introduced into Chado.';

COMMENT ON COLUMN nd_geolocation.description IS 'A textual representation of the location, if this is the original georeference. Optional if the original georeference is available in lat/long coordinates.';


COMMENT ON COLUMN nd_geolocation.latitude IS 'The decimal latitude coordinate of the georeference, using positive and negative sign to indicate N and S, respectively.';

COMMENT ON COLUMN nd_geolocation.longitude IS 'The decimal longitude coordinate of the georeference, using positive and negative sign to indicate E and W, respectively.';

COMMENT ON COLUMN nd_geolocation.geodetic_datum IS 'The geodetic system on which the geo-reference coordinates are based. For geo-references measured between 1984 and 2010, this will typically be WGS84.';

COMMENT ON COLUMN nd_geolocation.altitude IS 'The altitude (elevation) of the location in meters. If the altitude is only known as a range, this is the average, and altitude_dev will hold half of the width of the range.';



CREATE TABLE nd_experiment (
    nd_experiment_id serial PRIMARY KEY NOT NULL,
    nd_geolocation_id integer NOT NULL references nd_geolocation (nd_geolocation_id) on delete cascade INITIALLY DEFERRED,
    type_id integer NOT NULL references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED 
);

--
--used to be nd_diversityexperiment_project
--then was nd_assay_project
CREATE TABLE nd_experiment_project (
    nd_experiment_project_id serial PRIMARY KEY NOT NULL,
    project_id integer not null references project (project_id) on delete cascade INITIALLY DEFERRED,
    nd_experiment_id integer NOT NULL references nd_experiment (nd_experiment_id) on delete cascade INITIALLY DEFERRED
);



CREATE TABLE nd_experimentprop (
    nd_experimentprop_id serial PRIMARY KEY NOT NULL,
    nd_experiment_id integer NOT NULL references nd_experiment (nd_experiment_id) on delete cascade INITIALLY DEFERRED,
    type_id integer NOT NULL references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED ,
    value text null,
    rank integer NOT NULL default 0,
    constraint nd_experimentprop_c1 unique (nd_experiment_id,type_id,rank)
);

CREATE TABLE nd_experiment_pub (
       nd_experiment_pub_id serial PRIMARY KEY not null,
       nd_experiment_id int not null,
       foreign key (nd_experiment_id) references nd_experiment (nd_experiment_id) on delete cascade INITIALLY DEFERRED,
       pub_id int not null,
       foreign key (pub_id) references pub (pub_id) on delete cascade INITIALLY DEFERRED,
       constraint nd_experiment_pub_c1 unique (nd_experiment_id,pub_id)
);
create index nd_experiment_pub_idx1 on nd_experiment_pub (nd_experiment_id);
create index nd_experiment_pub_idx2 on nd_experiment_pub (pub_id);

COMMENT ON TABLE nd_experiment_pub IS 'Linking nd_experiment(s) to publication(s)';




CREATE TABLE nd_geolocationprop (
    nd_geolocationprop_id serial PRIMARY KEY NOT NULL,
    nd_geolocation_id integer NOT NULL references nd_geolocation (nd_geolocation_id) on delete cascade INITIALLY DEFERRED,
    type_id integer NOT NULL references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    value text null,
    rank integer NOT NULL DEFAULT 0,
    constraint nd_geolocationprop_c1 unique (nd_geolocation_id,type_id,rank)
);

COMMENT ON TABLE nd_geolocationprop IS 'Property/value associations for geolocations. This table can store the properties such as location and environment';

COMMENT ON COLUMN nd_geolocationprop.type_id IS 'The name of the property as a reference to a controlled vocabulary term.';

COMMENT ON COLUMN nd_geolocationprop.value IS 'The value of the property.';

COMMENT ON COLUMN nd_geolocationprop.rank IS 'The rank of the property value, if the property has an array of values.';


CREATE TABLE nd_protocol (
    nd_protocol_id serial PRIMARY KEY  NOT NULL,
    name character varying(255) NOT NULL unique,
    type_id integer NOT NULL references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED
);

COMMENT ON TABLE nd_protocol IS 'A protocol can be anything that is done as part of the experiment.';

COMMENT ON COLUMN nd_protocol.name IS 'The protocol name.';

CREATE TABLE nd_reagent (
    nd_reagent_id serial PRIMARY KEY NOT NULL,
    name character varying(80) NOT NULL,
    type_id integer NOT NULL references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    feature_id integer
);

COMMENT ON TABLE nd_reagent IS 'A reagent such as a primer, an enzyme, an adapter oligo, a linker oligo. Reagents are used in genotyping experiments, or in any other kind of experiment.';

COMMENT ON COLUMN nd_reagent.name IS 'The name of the reagent. The name should be unique for a given type.';

COMMENT ON COLUMN nd_reagent.type_id IS 'The type of the reagent, for example linker oligomer, or forward primer.';

COMMENT ON COLUMN nd_reagent.feature_id IS 'If the reagent is a primer, the feature that it corresponds to. More generally, the corresponding feature for any reagent that has a sequence that maps to another sequence.';



CREATE TABLE nd_protocol_reagent (
    nd_protocol_reagent_id serial PRIMARY KEY NOT NULL,
    nd_protocol_id integer NOT NULL references nd_protocol (nd_protocol_id) on delete cascade INITIALLY DEFERRED,
    reagent_id integer NOT NULL references nd_reagent (nd_reagent_id) on delete cascade INITIALLY DEFERRED,
    type_id integer NOT NULL references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED
);


CREATE TABLE nd_protocolprop (
    nd_protocolprop_id serial PRIMARY KEY NOT NULL,
    nd_protocol_id integer NOT NULL references nd_protocol (nd_protocol_id) on delete cascade INITIALLY DEFERRED,
    type_id integer NOT NULL references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    value text null,
    rank integer DEFAULT 0 NOT NULL,
    constraint nd_protocolprop_c1 unique (nd_protocol_id,type_id,rank)
);

COMMENT ON TABLE nd_protocolprop IS 'Property/value associations for protocol.';

COMMENT ON COLUMN nd_protocolprop.nd_protocol_id IS 'The protocol to which the property applies.';

COMMENT ON COLUMN nd_protocolprop.type_id IS 'The name of the property as a reference to a controlled vocabulary term.';

COMMENT ON COLUMN nd_protocolprop.value IS 'The value of the property.';

COMMENT ON COLUMN nd_protocolprop.rank IS 'The rank of the property value, if the property has an array of values.';



CREATE TABLE nd_experiment_stock (
    nd_experiment_stock_id serial PRIMARY KEY NOT NULL,
    nd_experiment_id integer NOT NULL references nd_experiment (nd_experiment_id) on delete cascade INITIALLY DEFERRED,
    stock_id integer NOT NULL references stock (stock_id)  on delete cascade INITIALLY DEFERRED,
    type_id integer NOT NULL references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED
);

COMMENT ON TABLE nd_experiment_stock IS 'Part of a stock or a clone of a stock that is used in an experiment';


COMMENT ON COLUMN nd_experiment_stock.stock_id IS 'stock used in the extraction or the corresponding stock for the clone';


CREATE TABLE nd_experiment_protocol (
    nd_experiment_protocol_id serial PRIMARY KEY NOT NULL,
    nd_experiment_id integer NOT NULL references nd_experiment (nd_experiment_id) on delete cascade INITIALLY DEFERRED,
    nd_protocol_id integer NOT NULL references nd_protocol (nd_protocol_id) on delete cascade INITIALLY DEFERRED
);

COMMENT ON TABLE nd_experiment_protocol IS 'Linking table: experiments to the protocols they involve.';


CREATE TABLE nd_experiment_phenotype (
    nd_experiment_phenotype_id serial PRIMARY KEY NOT NULL,
    nd_experiment_id integer NOT NULL REFERENCES nd_experiment (nd_experiment_id) on delete cascade INITIALLY DEFERRED,
    phenotype_id integer NOT NULL references phenotype (phenotype_id) on delete cascade INITIALLY DEFERRED,
   constraint nd_experiment_phenotype_c1 unique (nd_experiment_id,phenotype_id)
); 

COMMENT ON TABLE nd_experiment_phenotype IS 'Linking table: experiments to the phenotypes they produce. There is a one-to-one relationship between an experiment and a phenotype since each phenotype record should point to one experiment. Add a new experiment_id for each phenotype record.';

CREATE TABLE nd_experiment_genotype (
    nd_experiment_genotype_id serial PRIMARY KEY NOT NULL,
    nd_experiment_id integer NOT NULL references nd_experiment (nd_experiment_id) on delete cascade INITIALLY DEFERRED,
    genotype_id integer NOT NULL references genotype (genotype_id) on delete cascade INITIALLY DEFERRED ,
    constraint nd_experiment_genotype_c1 unique (nd_experiment_id,genotype_id)
);

COMMENT ON TABLE nd_experiment_genotype IS 'Linking table: experiments to the genotypes they produce. There is a one-to-one relationship between an experiment and a genotype since each genotype record should point to one experiment. Add a new experiment_id for each genotype record.';


CREATE TABLE nd_reagent_relationship (
    nd_reagent_relationship_id serial PRIMARY KEY NOT NULL,
    subject_reagent_id integer NOT NULL references nd_reagent (nd_reagent_id) on delete cascade INITIALLY DEFERRED,
    object_reagent_id integer NOT NULL  references nd_reagent (nd_reagent_id) on delete cascade INITIALLY DEFERRED,
    type_id integer NOT NULL  references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED
);

COMMENT ON TABLE nd_reagent_relationship IS 'Relationships between reagents. Some reagents form a group. i.e., they are used all together or not at all. Examples are adapter/linker/enzyme experiment reagents.';

COMMENT ON COLUMN nd_reagent_relationship.subject_reagent_id IS 'The subject reagent in the relationship. In parent/child terminology, the subject is the child. For example, in "linkerA 3prime-overhang-linker enzymeA" linkerA is the subject, 3prime-overhand-linker is the type, and enzymeA is the object.';

COMMENT ON COLUMN nd_reagent_relationship.object_reagent_id IS 'The object reagent in the relationship. In parent/child terminology, the object is the parent. For example, in "linkerA 3prime-overhang-linker enzymeA" linkerA is the subject, 3prime-overhand-linker is the type, and enzymeA is the object.';

COMMENT ON COLUMN nd_reagent_relationship.type_id IS 'The type (or predicate) of the relationship. For example, in "linkerA 3prime-overhang-linker enzymeA" linkerA is the subject, 3prime-overhand-linker is the type, and enzymeA is the object.';


CREATE TABLE nd_reagentprop (
    nd_reagentprop_id serial PRIMARY KEY NOT NULL,
    nd_reagent_id integer NOT NULL references nd_reagent (nd_reagent_id) on delete cascade INITIALLY DEFERRED,
    type_id integer NOT NULL references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    value text null,
    rank integer DEFAULT 0 NOT NULL,
    constraint nd_reagentprop_c1 unique (nd_reagent_id,type_id,rank)
);

CREATE TABLE nd_experiment_stockprop (
    nd_experiment_stockprop_id serial PRIMARY KEY NOT NULL,
    nd_experiment_stock_id integer NOT NULL references nd_experiment_stock (nd_experiment_stock_id) on delete cascade INITIALLY DEFERRED,
    type_id integer NOT NULL references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    value text null,
    rank integer DEFAULT 0 NOT NULL,
    constraint nd_experiment_stockprop_c1 unique (nd_experiment_stock_id,type_id,rank)
);

COMMENT ON TABLE nd_experiment_stockprop IS 'Property/value associations for experiment_stocks. This table can store the properties such as treatment';

COMMENT ON COLUMN nd_experiment_stockprop.nd_experiment_stock_id IS 'The experiment_stock to which the property applies.';

COMMENT ON COLUMN nd_experiment_stockprop.type_id IS 'The name of the property as a reference to a controlled vocabulary term.';

COMMENT ON COLUMN nd_experiment_stockprop.value IS 'The value of the property.';

COMMENT ON COLUMN nd_experiment_stockprop.rank IS 'The rank of the property value, if the property has an array of values.';


CREATE TABLE nd_experiment_stock_dbxref (
    nd_experiment_stock_dbxref_id serial PRIMARY KEY NOT NULL,
    nd_experiment_stock_id integer NOT NULL references nd_experiment_stock (nd_experiment_stock_id) on delete cascade INITIALLY DEFERRED,
    dbxref_id integer NOT NULL references dbxref (dbxref_id) on delete cascade INITIALLY DEFERRED
);

COMMENT ON TABLE nd_experiment_stock_dbxref IS 'Cross-reference experiment_stock to accessions, images, etc';



CREATE TABLE nd_experiment_dbxref (
    nd_experiment_dbxref_id serial PRIMARY KEY NOT NULL,
    nd_experiment_id integer NOT NULL references nd_experiment (nd_experiment_id) on delete cascade INITIALLY DEFERRED,
    dbxref_id integer NOT NULL references dbxref (dbxref_id) on delete cascade INITIALLY DEFERRED
);

COMMENT ON TABLE nd_experiment_dbxref IS 'Cross-reference experiment to accessions, images, etc';


CREATE TABLE nd_experiment_contact (
    nd_experiment_contact_id serial PRIMARY KEY NOT NULL,
    nd_experiment_id integer NOT NULL references nd_experiment (nd_experiment_id) on delete cascade INITIALLY DEFERRED,
    contact_id integer NOT NULL references contact (contact_id) on delete cascade INITIALLY DEFERRED
);
