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

