SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';

CREATE SCHEMA IF NOT EXISTS `image_annotation` DEFAULT CHARACTER SET latin1 ;
CREATE SCHEMA IF NOT EXISTS `po_beta` DEFAULT CHARACTER SET latin1 ;
USE `image_annotation` ;

-- -----------------------------------------------------
-- Table `po_beta`.`species`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`species` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`species` (
  `id` INT(11) NOT NULL AUTO_INCREMENT ,
  `ncbi_taxa_id` INT(11) NULL DEFAULT NULL ,
  `common_name` VARCHAR(255) NULL DEFAULT NULL ,
  `lineage_string` TEXT NULL DEFAULT NULL ,
  `genus` VARCHAR(55) NULL DEFAULT NULL ,
  `species` VARCHAR(255) NULL DEFAULT NULL ,
  `parent_id` INT(11) NULL DEFAULT NULL ,
  `left_value` INT(11) NULL DEFAULT NULL ,
  `right_value` INT(11) NULL DEFAULT NULL ,
  `taxonomic_rank` VARCHAR(255) NULL DEFAULT NULL ,
  PRIMARY KEY (`id`) ,
  UNIQUE INDEX `sp0` (`id` ASC) ,
  UNIQUE INDEX `ncbi_taxa_id` (`ncbi_taxa_id` ASC) ,
  INDEX `sp1` (`ncbi_taxa_id` ASC) ,
  INDEX `sp2` (`common_name` ASC) ,
  INDEX `sp3` (`genus` ASC) ,
  INDEX `sp4` (`species` ASC) ,
  INDEX `sp5` (`genus` ASC, `species` ASC) ,
  INDEX `sp6` (`id` ASC, `ncbi_taxa_id` ASC) ,
  INDEX `sp7` (`id` ASC, `ncbi_taxa_id` ASC, `genus` ASC, `species` ASC) ,
  INDEX `sp8` (`parent_id` ASC) ,
  INDEX `sp9` (`left_value` ASC) ,
  INDEX `sp10` (`right_value` ASC) ,
  INDEX `sp11` (`left_value` ASC, `right_value` ASC) ,
  INDEX `sp12` (`id` ASC, `left_value` ASC) )
ENGINE = MyISAM
AUTO_INCREMENT = 23
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `image_annotation`.`Species_map`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `image_annotation`.`Species_map` ;

CREATE  TABLE IF NOT EXISTS `image_annotation`.`Species_map` (
  `ubio_id` INT(11) NOT NULL ,
  `po_species_id` INT(11) NOT NULL ,
  PRIMARY KEY (`ubio_id`) ,
  INDEX `fk_Species_map_1` (`po_species_id` ASC) ,
  CONSTRAINT `fk_Species_map_1`
    FOREIGN KEY (`po_species_id` )
    REFERENCES `po_beta`.`species` (`id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `image_annotation`.`Annotated_term_type`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `image_annotation`.`Annotated_term_type` ;

CREATE  TABLE IF NOT EXISTS `image_annotation`.`Annotated_term_type` (
  `annotated_term_type_id` INT(11) NOT NULL ,
  `annotated_term_type` VARCHAR(45) NULL DEFAULT NULL ,
  PRIMARY KEY (`annotated_term_type_id`) )
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`term`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`term` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`term` (
  `id` INT(11) NOT NULL AUTO_INCREMENT ,
  `name` VARCHAR(255) NOT NULL ,
  `term_type` VARCHAR(55) NOT NULL ,
  `acc` VARCHAR(255) NOT NULL ,
  `is_obsolete` INT(11) NOT NULL DEFAULT '0' ,
  `is_root` INT(11) NOT NULL DEFAULT '0' ,
  PRIMARY KEY (`id`) ,
  UNIQUE INDEX `acc` (`acc` ASC) ,
  UNIQUE INDEX `t0` (`id` ASC) ,
  INDEX `t1` (`name` ASC) ,
  INDEX `t2` (`term_type` ASC) ,
  INDEX `t3` (`acc` ASC) )
ENGINE = MyISAM
AUTO_INCREMENT = 1642
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `image_annotation`.`Annotated_term`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `image_annotation`.`Annotated_term` ;

CREATE  TABLE IF NOT EXISTS `image_annotation`.`Annotated_term` (
  `annotated_term_id` INT(11) NOT NULL ,
  `annotated_term` VARCHAR(45) NULL DEFAULT NULL ,
  `annotated_term_type_id` INT(11) NULL DEFAULT NULL ,
  `po_term_id` INT(11) NULL DEFAULT NULL ,
  PRIMARY KEY (`annotated_term_id`) ,
  INDEX `fk_Annotated Term_1` (`annotated_term_type_id` ASC) ,
  INDEX `fk_Annotated_term_2` (`po_term_id` ASC) ,
  CONSTRAINT `fk_Annotated Term_1`
    FOREIGN KEY (`annotated_term_type_id` )
    REFERENCES `image_annotation`.`Annotated_term_type` (`annotated_term_type_id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_Annotated_term_2`
    FOREIGN KEY (`po_term_id` )
    REFERENCES `po_beta`.`term` (`id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `image_annotation`.`Annotated_image`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `image_annotation`.`Annotated_image` ;

CREATE  TABLE IF NOT EXISTS `image_annotation`.`Annotated_image` (
  `annotated_image_id` INT(11) NOT NULL ,
  `image_path` VARCHAR(255) NULL DEFAULT NULL ,
  `curator` VARCHAR(45) NULL DEFAULT NULL ,
  `comments` VARCHAR(45) NULL DEFAULT NULL ,
  `annotated_keywordlist_id` INT(11) NULL DEFAULT NULL ,
  `annotated_term_id` INT(11) NULL DEFAULT NULL ,
  `ubio_id` INT(11) NULL DEFAULT NULL ,
  `ubio_name` VARCHAR(45) NULL DEFAULT NULL ,
  `species_name` VARCHAR(45) NULL DEFAULT NULL ,
  PRIMARY KEY (`annotated_image_id`) ,
  INDEX `fk_Annotated_image_1` (`ubio_id` ASC) ,
  INDEX `fk_Annotated_image_3` (`annotated_term_id` ASC) ,
  CONSTRAINT `fk_Annotated_image_1`
    FOREIGN KEY (`ubio_id` )
    REFERENCES `image_annotation`.`Species_map` (`ubio_id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_Annotated_image_3`
    FOREIGN KEY (`annotated_term_id` )
    REFERENCES `image_annotation`.`Annotated_term` (`annotated_term_id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `image_annotation`.`Annotated_keyword`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `image_annotation`.`Annotated_keyword` ;

CREATE  TABLE IF NOT EXISTS `image_annotation`.`Annotated_keyword` (
  `annotated_keyword_id` INT(11) NOT NULL ,
  `annotated_keyword` VARCHAR(45) NULL DEFAULT NULL ,
  PRIMARY KEY (`annotated_keyword_id`) )
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `image_annotation`.`Annotated_keywordlist`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `image_annotation`.`Annotated_keywordlist` ;

CREATE  TABLE IF NOT EXISTS `image_annotation`.`Annotated_keywordlist` (
  `annotated_image_id` INT(11) NOT NULL ,
  `annotated_keyword_id` INT(11) NOT NULL ,
  PRIMARY KEY (`annotated_image_id`, `annotated_keyword_id`) ,
  INDEX `fk_Annotated_keywordlist_1` (`annotated_image_id` ASC) ,
  INDEX `fk_Annotated_keywordlist_2` (`annotated_keyword_id` ASC) ,
  CONSTRAINT `fk_Annotated_keywordlist_1`
    FOREIGN KEY (`annotated_image_id` )
    REFERENCES `image_annotation`.`Annotated_image` (`annotated_image_id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_Annotated_keywordlist_2`
    FOREIGN KEY (`annotated_keyword_id` )
    REFERENCES `image_annotation`.`Annotated_keyword` (`annotated_keyword_id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `image_annotation`.`Segment`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `image_annotation`.`Segment` ;

CREATE  TABLE IF NOT EXISTS `image_annotation`.`Segment` (
  `segment_id` INT(11) NOT NULL ,
  `color` VARCHAR(45) NULL DEFAULT NULL ,
  `annotated_image_id` INT(11) NULL DEFAULT NULL ,
  `byte_mask` BLOB NULL DEFAULT NULL ,
  `coordinates` LINESTRING NULL DEFAULT NULL ,
  `annotated_term_id` INT(11) NULL DEFAULT NULL ,
  PRIMARY KEY (`segment_id`) ,
  INDEX `fk_Segment_2` (`annotated_term_id` ASC) ,
  INDEX `fk_Segment_1` (`annotated_image_id` ASC) ,
  CONSTRAINT `fk_Segment_1`
    FOREIGN KEY (`annotated_image_id` )
    REFERENCES `image_annotation`.`Annotated_image` (`annotated_image_id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_Segment_2`
    FOREIGN KEY (`annotated_term_id` )
    REFERENCES `image_annotation`.`Annotated_term` (`annotated_term_id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;

USE `po_beta` ;

-- -----------------------------------------------------
-- Table `po_beta`.`assoc_rel`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`assoc_rel` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`assoc_rel` (
  `id` INT(11) NOT NULL AUTO_INCREMENT ,
  `from_id` INT(11) NOT NULL ,
  `to_id` INT(11) NOT NULL ,
  `relationship_type_id` INT(11) NOT NULL ,
  PRIMARY KEY (`id`) ,
  INDEX `from_id` (`from_id` ASC) ,
  INDEX `to_id` (`to_id` ASC) ,
  INDEX `relationship_type_id` (`relationship_type_id` ASC) )
ENGINE = MyISAM
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`association`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`association` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`association` (
  `id` INT(11) NOT NULL AUTO_INCREMENT ,
  `term_id` INT(11) NOT NULL ,
  `gene_product_id` INT(11) NOT NULL ,
  `is_not` INT(11) NULL DEFAULT NULL ,
  `role_group` INT(11) NULL DEFAULT NULL ,
  `assocdate` INT(11) NULL DEFAULT NULL ,
  `source_db_id` INT(11) NULL DEFAULT NULL ,
  PRIMARY KEY (`id`) ,
  UNIQUE INDEX `a0` (`id` ASC) ,
  INDEX `source_db_id` (`source_db_id` ASC) ,
  INDEX `a1` (`term_id` ASC) ,
  INDEX `a2` (`gene_product_id` ASC) ,
  INDEX `a3` (`term_id` ASC, `gene_product_id` ASC) ,
  INDEX `a4` (`id` ASC, `term_id` ASC, `gene_product_id` ASC) ,
  INDEX `a5` (`id` ASC, `gene_product_id` ASC) )
ENGINE = MyISAM
AUTO_INCREMENT = 2175695
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`association_property`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`association_property` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`association_property` (
  `id` INT(11) NOT NULL AUTO_INCREMENT ,
  `association_id` INT(11) NOT NULL ,
  `relationship_type_id` INT(11) NOT NULL ,
  `term_id` INT(11) NOT NULL ,
  PRIMARY KEY (`id`) ,
  INDEX `association_id` (`association_id` ASC) ,
  INDEX `relationship_type_id` (`relationship_type_id` ASC) ,
  INDEX `term_id` (`term_id` ASC) )
ENGINE = MyISAM
AUTO_INCREMENT = 200096
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`association_qualifier`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`association_qualifier` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`association_qualifier` (
  `id` INT(11) NOT NULL AUTO_INCREMENT ,
  `association_id` INT(11) NOT NULL ,
  `term_id` INT(11) NOT NULL ,
  `value` VARCHAR(255) NULL DEFAULT NULL ,
  PRIMARY KEY (`id`) ,
  INDEX `term_id` (`term_id` ASC) ,
  INDEX `aq1` (`association_id` ASC, `term_id` ASC) )
ENGINE = MyISAM
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`association_species_qualifier`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`association_species_qualifier` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`association_species_qualifier` (
  `id` INT(11) NOT NULL AUTO_INCREMENT ,
  `association_id` INT(11) NOT NULL ,
  `species_id` INT(11) NULL DEFAULT NULL ,
  PRIMARY KEY (`id`) ,
  INDEX `association_id` (`association_id` ASC) ,
  INDEX `species_id` (`species_id` ASC) )
ENGINE = MyISAM
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`db`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`db` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`db` (
  `id` INT(11) NOT NULL AUTO_INCREMENT ,
  `name` VARCHAR(55) NULL DEFAULT NULL ,
  `fullname` VARCHAR(255) NULL DEFAULT NULL ,
  `datatype` VARCHAR(255) NULL DEFAULT NULL ,
  `generic_url` VARCHAR(255) NULL DEFAULT NULL ,
  `url_syntax` VARCHAR(255) NULL DEFAULT NULL ,
  `url_example` VARCHAR(255) NULL DEFAULT NULL ,
  `uri_prefix` VARCHAR(255) NULL DEFAULT NULL ,
  PRIMARY KEY (`id`) ,
  UNIQUE INDEX `db0` (`id` ASC) ,
  UNIQUE INDEX `name` (`name` ASC) ,
  INDEX `db1` (`name` ASC) ,
  INDEX `db2` (`fullname` ASC) ,
  INDEX `db3` (`datatype` ASC) )
ENGINE = MyISAM
AUTO_INCREMENT = 12
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`dbxref`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`dbxref` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`dbxref` (
  `id` INT(11) NOT NULL AUTO_INCREMENT ,
  `xref_dbname` VARCHAR(55) NOT NULL ,
  `xref_key` VARCHAR(255) NOT NULL ,
  `xref_keytype` VARCHAR(32) NULL DEFAULT NULL ,
  `xref_desc` VARCHAR(255) NULL DEFAULT NULL ,
  `exist_in_go` INT(11) NULL DEFAULT '0' ,
  `go_id` VARCHAR(255) NULL DEFAULT NULL ,
  PRIMARY KEY (`id`) ,
  UNIQUE INDEX `xref_key` (`xref_key` ASC, `xref_dbname` ASC) ,
  UNIQUE INDEX `dx0` (`id` ASC) ,
  INDEX `dx1` (`xref_dbname` ASC) ,
  INDEX `dx2` (`xref_key` ASC) ,
  INDEX `dx3` (`id` ASC, `xref_dbname` ASC) ,
  INDEX `dx4` (`id` ASC, `xref_key` ASC, `xref_dbname` ASC) ,
  INDEX `dx5` (`id` ASC, `xref_key` ASC) )
ENGINE = MyISAM
AUTO_INCREMENT = 143140
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`evidence`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`evidence` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`evidence` (
  `id` INT(11) NOT NULL AUTO_INCREMENT ,
  `code` VARCHAR(8) NOT NULL ,
  `association_id` INT(11) NOT NULL ,
  `dbxref_id` INT(11) NOT NULL ,
  `seq_acc` VARCHAR(255) NULL DEFAULT NULL ,
  PRIMARY KEY (`id`) ,
  UNIQUE INDEX `association_id` (`association_id` ASC, `dbxref_id` ASC, `code` ASC) ,
  UNIQUE INDEX `ev0` (`id` ASC) ,
  INDEX `ev1` (`association_id` ASC) ,
  INDEX `ev2` (`code` ASC) ,
  INDEX `ev3` (`dbxref_id` ASC) ,
  INDEX `ev4` (`association_id` ASC, `code` ASC) ,
  INDEX `ev5` (`id` ASC, `association_id` ASC) )
ENGINE = MyISAM
AUTO_INCREMENT = 2175857
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`evidence_dbxref`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`evidence_dbxref` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`evidence_dbxref` (
  `evidence_id` INT(11) NOT NULL ,
  `dbxref_id` INT(11) NOT NULL ,
  INDEX `evx1` (`evidence_id` ASC) ,
  INDEX `evx2` (`dbxref_id` ASC) ,
  INDEX `evx3` (`evidence_id` ASC, `dbxref_id` ASC) )
ENGINE = MyISAM
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`gene_product`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`gene_product` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`gene_product` (
  `id` INT(11) NOT NULL AUTO_INCREMENT ,
  `symbol` VARCHAR(128) NOT NULL ,
  `dbxref_id` INT(11) NOT NULL ,
  `species_id` INT(11) NULL DEFAULT NULL ,
  `type_id` INT(11) NULL DEFAULT NULL ,
  `full_name` TEXT NULL DEFAULT NULL ,
  PRIMARY KEY (`id`) ,
  UNIQUE INDEX `dbxref_id` (`dbxref_id` ASC) ,
  UNIQUE INDEX `g0` (`id` ASC) ,
  INDEX `type_id` (`type_id` ASC) ,
  INDEX `g1` (`symbol` ASC) ,
  INDEX `g2` (`dbxref_id` ASC) ,
  INDEX `g3` (`species_id` ASC) ,
  INDEX `g4` (`id` ASC, `species_id` ASC) ,
  INDEX `g5` (`dbxref_id` ASC, `species_id` ASC) ,
  INDEX `g6` (`id` ASC, `dbxref_id` ASC) ,
  INDEX `g7` (`id` ASC, `species_id` ASC) )
ENGINE = MyISAM
AUTO_INCREMENT = 110951
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`gene_product_count`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`gene_product_count` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`gene_product_count` (
  `term_id` INT(11) NOT NULL ,
  `code` VARCHAR(8) NULL DEFAULT NULL ,
  `speciesdbname` VARCHAR(55) NULL DEFAULT NULL ,
  `species_id` INT(11) NULL DEFAULT NULL ,
  `product_count` INT(11) NOT NULL ,
  INDEX `species_id` (`species_id` ASC) ,
  INDEX `gpc1` (`term_id` ASC) ,
  INDEX `gpc2` (`code` ASC) ,
  INDEX `gpc3` (`speciesdbname` ASC) ,
  INDEX `gpc4` (`term_id` ASC, `code` ASC, `speciesdbname` ASC) )
ENGINE = MyISAM
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`gene_product_property`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`gene_product_property` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`gene_product_property` (
  `gene_product_id` INT(11) NOT NULL ,
  `property_key` VARCHAR(64) NOT NULL ,
  `property_val` VARCHAR(255) NULL DEFAULT NULL ,
  UNIQUE INDEX `gppu4` (`gene_product_id` ASC, `property_key` ASC, `property_val` ASC) ,
  INDEX `gpp1` (`gene_product_id` ASC) ,
  INDEX `gpp2` (`property_key` ASC) ,
  INDEX `gpp3` (`property_val` ASC) )
ENGINE = MyISAM
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`gene_product_seq`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`gene_product_seq` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`gene_product_seq` (
  `gene_product_id` INT(11) NOT NULL ,
  `seq_id` INT(11) NOT NULL ,
  `is_primary_seq` INT(11) NULL DEFAULT NULL ,
  INDEX `gpseq1` (`gene_product_id` ASC) ,
  INDEX `gpseq2` (`seq_id` ASC) ,
  INDEX `gpseq3` (`seq_id` ASC, `gene_product_id` ASC) )
ENGINE = MyISAM
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`gene_product_synonym`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`gene_product_synonym` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`gene_product_synonym` (
  `gene_product_id` INT(11) NOT NULL ,
  `product_synonym` VARCHAR(255) NOT NULL ,
  UNIQUE INDEX `gene_product_id` (`gene_product_id` ASC, `product_synonym` ASC) ,
  INDEX `gs1` (`gene_product_id` ASC) ,
  INDEX `gs2` (`product_synonym` ASC) )
ENGINE = MyISAM
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`graph_path`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`graph_path` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`graph_path` (
  `id` INT(11) NOT NULL AUTO_INCREMENT ,
  `term1_id` INT(11) NOT NULL ,
  `term2_id` INT(11) NOT NULL ,
  `distance` INT(11) NOT NULL ,
  PRIMARY KEY (`id`) ,
  UNIQUE INDEX `graph_path0` (`id` ASC) ,
  INDEX `graph_path1` (`term1_id` ASC) ,
  INDEX `graph_path2` (`term2_id` ASC) ,
  INDEX `graph_path3` (`term1_id` ASC, `term2_id` ASC) ,
  INDEX `graph_path4` (`term1_id` ASC, `distance` ASC) )
ENGINE = MyISAM
AUTO_INCREMENT = 65626
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`graph_path2term`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`graph_path2term` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`graph_path2term` (
  `graph_path_id` INT(11) NOT NULL ,
  `term_id` INT(11) NOT NULL ,
  `rank` INT(11) NOT NULL ,
  INDEX `graph_path_id` (`graph_path_id` ASC) ,
  INDEX `term_id` (`term_id` ASC) )
ENGINE = MyISAM
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`instance_data`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`instance_data` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`instance_data` (
  `release_name` VARCHAR(255) NULL DEFAULT NULL ,
  `release_type` VARCHAR(255) NULL DEFAULT NULL ,
  `release_notes` TEXT NULL DEFAULT NULL ,
  UNIQUE INDEX `release_name` (`release_name` ASC) )
ENGINE = MyISAM
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`seq`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`seq` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`seq` (
  `id` INT(11) NOT NULL AUTO_INCREMENT ,
  `display_id` VARCHAR(64) NULL DEFAULT NULL ,
  `description` VARCHAR(255) NULL DEFAULT NULL ,
  `seq` MEDIUMTEXT NULL DEFAULT NULL ,
  `seq_len` INT(11) NULL DEFAULT NULL ,
  `md5checksum` VARCHAR(32) NULL DEFAULT NULL ,
  `moltype` VARCHAR(25) NULL DEFAULT NULL ,
  `timestamp` INT(11) NULL DEFAULT NULL ,
  PRIMARY KEY (`id`) ,
  UNIQUE INDEX `seq0` (`id` ASC) ,
  UNIQUE INDEX `display_id` (`display_id` ASC, `md5checksum` ASC) ,
  INDEX `seq1` (`display_id` ASC) ,
  INDEX `seq2` (`md5checksum` ASC) )
ENGINE = MyISAM
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`seq_dbxref`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`seq_dbxref` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`seq_dbxref` (
  `seq_id` INT(11) NOT NULL ,
  `dbxref_id` INT(11) NOT NULL ,
  UNIQUE INDEX `seq_id` (`seq_id` ASC, `dbxref_id` ASC) ,
  INDEX `seqx0` (`seq_id` ASC) ,
  INDEX `seqx1` (`dbxref_id` ASC) ,
  INDEX `seqx2` (`seq_id` ASC, `dbxref_id` ASC) )
ENGINE = MyISAM
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`seq_property`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`seq_property` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`seq_property` (
  `id` INT(11) NOT NULL AUTO_INCREMENT ,
  `seq_id` INT(11) NOT NULL ,
  `property_key` VARCHAR(64) NOT NULL ,
  `property_val` VARCHAR(255) NOT NULL ,
  PRIMARY KEY (`id`) ,
  UNIQUE INDEX `seq_id` (`seq_id` ASC, `property_key` ASC, `property_val` ASC) ,
  INDEX `seqp0` (`seq_id` ASC) ,
  INDEX `seqp1` (`property_key` ASC) ,
  INDEX `seqp2` (`property_val` ASC) )
ENGINE = MyISAM
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`source_audit`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`source_audit` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`source_audit` (
  `source_id` VARCHAR(255) NULL DEFAULT NULL ,
  `source_fullpath` VARCHAR(255) NULL DEFAULT NULL ,
  `source_path` VARCHAR(255) NULL DEFAULT NULL ,
  `source_type` VARCHAR(255) NULL DEFAULT NULL ,
  `source_md5` CHAR(32) NULL DEFAULT NULL ,
  `source_parsetime` INT(11) NULL DEFAULT NULL ,
  `source_mtime` INT(11) NULL DEFAULT NULL ,
  INDEX `fa1` (`source_path` ASC) )
ENGINE = MyISAM
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`term2term`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`term2term` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`term2term` (
  `id` INT(11) NOT NULL AUTO_INCREMENT ,
  `relationship_type_id` INT(11) NOT NULL ,
  `term1_id` INT(11) NOT NULL ,
  `term2_id` INT(11) NOT NULL ,
  `complete` INT(11) NOT NULL ,
  PRIMARY KEY (`id`) ,
  UNIQUE INDEX `term1_id` (`term1_id` ASC, `term2_id` ASC, `relationship_type_id` ASC, `complete` ASC) ,
  INDEX `tt1` (`term1_id` ASC) ,
  INDEX `tt2` (`term2_id` ASC) ,
  INDEX `tt3` (`term1_id` ASC, `term2_id` ASC) ,
  INDEX `tt4` (`relationship_type_id` ASC) )
ENGINE = MyISAM
AUTO_INCREMENT = 2756
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`term2term_metadata`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`term2term_metadata` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`term2term_metadata` (
  `id` INT(11) NOT NULL AUTO_INCREMENT ,
  `relationship_type_id` INT(11) NOT NULL ,
  `term1_id` INT(11) NOT NULL ,
  `term2_id` INT(11) NOT NULL ,
  PRIMARY KEY (`id`) ,
  UNIQUE INDEX `term1_id` (`term1_id` ASC, `term2_id` ASC) ,
  INDEX `relationship_type_id` (`relationship_type_id` ASC) ,
  INDEX `term2_id` (`term2_id` ASC) )
ENGINE = MyISAM
AUTO_INCREMENT = 61
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`term_audit`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`term_audit` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`term_audit` (
  `term_id` INT(11) NOT NULL ,
  `term_loadtime` INT(11) NULL DEFAULT NULL ,
  UNIQUE INDEX `term_id` (`term_id` ASC) ,
  INDEX `ta1` (`term_id` ASC) )
ENGINE = MyISAM
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`term_dbxref`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`term_dbxref` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`term_dbxref` (
  `term_id` INT(11) NOT NULL ,
  `dbxref_id` INT(11) NOT NULL ,
  `is_for_definition` INT(11) NOT NULL DEFAULT '0' ,
  UNIQUE INDEX `term_id` (`term_id` ASC, `dbxref_id` ASC, `is_for_definition` ASC) ,
  INDEX `tx0` (`term_id` ASC) ,
  INDEX `tx1` (`dbxref_id` ASC) ,
  INDEX `tx2` (`term_id` ASC, `dbxref_id` ASC) )
ENGINE = MyISAM
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`term_definition`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`term_definition` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`term_definition` (
  `term_id` INT(11) NOT NULL ,
  `term_definition` TEXT NOT NULL ,
  `dbxref_id` INT(11) NULL DEFAULT NULL ,
  `term_comment` MEDIUMTEXT NULL DEFAULT NULL ,
  `reference` VARCHAR(255) NULL DEFAULT NULL ,
  UNIQUE INDEX `term_id` (`term_id` ASC) ,
  INDEX `dbxref_id` (`dbxref_id` ASC) ,
  INDEX `td1` (`term_id` ASC) )
ENGINE = MyISAM
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`term_property`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`term_property` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`term_property` (
  `term_id` INT(11) NOT NULL ,
  `property_key` VARCHAR(64) NOT NULL ,
  `property_val` VARCHAR(255) NULL DEFAULT NULL ,
  INDEX `term_id` (`term_id` ASC) )
ENGINE = MyISAM
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`term_subset`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`term_subset` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`term_subset` (
  `term_id` INT(11) NOT NULL ,
  `subset_id` INT(11) NOT NULL ,
  INDEX `tss1` (`term_id` ASC) ,
  INDEX `tss2` (`subset_id` ASC) ,
  INDEX `tss3` (`term_id` ASC, `subset_id` ASC) )
ENGINE = MyISAM
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `po_beta`.`term_synonym`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `po_beta`.`term_synonym` ;

CREATE  TABLE IF NOT EXISTS `po_beta`.`term_synonym` (
  `term_id` INT(11) NOT NULL ,
  `term_synonym` VARCHAR(255) NULL DEFAULT NULL ,
  `acc_synonym` VARCHAR(255) NULL DEFAULT NULL ,
  `synonym_type_id` INT(11) NOT NULL ,
  UNIQUE INDEX `term_id` (`term_id` ASC, `term_synonym` ASC) ,
  INDEX `synonym_type_id` (`synonym_type_id` ASC) ,
  INDEX `ts1` (`term_id` ASC) ,
  INDEX `ts2` (`term_synonym` ASC) ,
  INDEX `ts3` (`term_id` ASC, `term_synonym` ASC) )
ENGINE = MyISAM
DEFAULT CHARACTER SET = latin1;



SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

