# Description of Schema

## Tables

phenotype
phenotype_cvterm
feature_phenotype
phenotypeprop

### phenotype

Top

Comments:
$Id: phenotype.sql,v 1.6 2007-04-27 16:09:46 emmert Exp $
==========================================
Chado phenotype module
05-31-2011
added 'name' column to phenotype. non-unique human readable field.
=================================================================
Dependencies:
:import cvterm from cv
:import feature from sequence
=================================================================
================================================
TABLE: phenotype
================================================
A phenotypic statement, or a single atomic phenotypic observation, is a controlled sentence describing observable effects of non-wild type function. E.g. Obs=eye, attribute=color, cvalue=red.

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
phenotype_id | integer | 20 |  | PRIMARY KEY, NOT NULL |
uniquename | text | 64000 |  | UNIQUE, NOT NULL |
name | text | 64000 | null |  |
observable_id | integer | 20 |  | The entity: e.g. anatomy_part, biological_process. | cvterm.cvterm_id
attr_id | integer | 20 |  | Phenotypic attribute (quality, property, attribute, character) - drawn from PATO. | cvterm.cvterm_id
value | text | 64000 |  | Value of attribute - unconstrained free text. Used only if cvalue_id is not appropriate. |
cvalue_id | integer | 20 |  | Phenotype attribute value (state). | cvterm.cvterm_id
assay_id | integer | 20 |  | Evidence type. | cvterm.cvterm_id

### Indices

Name | Fields
--- | ---
phenotype_idx1 | cvalue_id
phenotype_idx2 | observable_id
phenotype_idx3 | attr_id

### Constraints

Type | Fields
--- | ---
NOT NULL | phenotype_id
NOT NULL | uniquename
FOREIGN KEY | observable_id
FOREIGN KEY | attr_id
FOREIGN KEY | cvalue_id
FOREIGN KEY | assay_id
UNIQUE | uniquename

### phenotype_cvterm

Top

Comments:
================================================
TABLE: phenotype_cvterm
================================================
phenotype to cvterm associations.

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
phenotype_cvterm_id | integer | 20 |  | PRIMARY KEY, NOT NULL |
phenotype_id | integer | 20 |  | UNIQUE, NOT NULL | phenotype.phenotype_id
cvterm_id | integer | 20 |  | UNIQUE, NOT NULL | cvterm.cvterm_id
rank | integer | 10 | 0 | UNIQUE, NOT NULL |

### Indices

Name | Fields
--- | ---
phenotype_cvterm_idx1 | phenotype_id
phenotype_cvterm_idx2 | cvterm_id

### Constraints

Type | Fields
--- | ---
NOT NULL | phenotype_cvterm_id
NOT NULL | phenotype_id
FOREIGN KEY | phenotype_id
NOT NULL | cvterm_id
FOREIGN KEY | cvterm_id
NOT NULL | rank
UNIQUE | phenotype_id, cvterm_id, rank

### feature_phenotype

Top

Comments:
================================================
TABLE: feature_phenotype
================================================
Linking table between features and phenotypes.

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
feature_phenotype_id | integer | 20 |  | PRIMARY KEY, NOT NULL |
feature_id | integer | 20 |  | UNIQUE, NOT NULL | feature.feature_id
phenotype_id | integer | 20 |  | UNIQUE, NOT NULL | phenotype.phenotype_id

### Indices

Name | Fields
--- | ---
feature_phenotype_idx1 | feature_id
feature_phenotype_idx2 | phenotype_id

### Constraints

Type | Fields
--- | ---
NOT NULL | feature_phenotype_id
NOT NULL | feature_id
FOREIGN KEY | feature_id
NOT NULL | phenotype_id
FOREIGN KEY | phenotype_id
UNIQUE | feature_id, phenotype_id

### phenotypeprop

Top

Comments:
================================================
TABLE: phenotypeprop
================================================
A phenotype can have any number of slot-value property tags attached to it. This is an alternative to hardcoding a list of columns in the relational schema, and is completely extensible. There is a unique constraint, phenotypeprop_c1, for the combination of phenotype_id, rank, and type_id. Multivalued property-value pairs must be differentiated by rank.

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
phenotypeprop_id | integer | 20 |  | PRIMARY KEY, NOT NULL |
phenotype_id | integer | 20 |  | UNIQUE, NOT NULL | phenotype.phenotype_id
type_id | integer | 20 |  | UNIQUE, NOT NULL | cvterm.cvterm_id
value | text | 64000 | NULL |  |
rank | integer | 10 | 0 | UNIQUE, NOT NULL |

### Indices

Name | Fields
--- | ---
phenotypeprop_idx1 | phenotype_id
phenotypeprop_idx2 | type_id

### Constraints

Type | Fields
--- | ---
NOT NULL | phenotypeprop_id
NOT NULL | phenotype_id
FOREIGN KEY | phenotype_id
NOT NULL | type_id
FOREIGN KEY | type_id
NOT NULL | rank
UNIQUE | phenotype_id, type_id, rank

Created by SQL::Translator 0.11020