# Description of Schema

## Tables
nd_geolocation
nd_experiment
nd_experiment_project
nd_experimentprop
nd_experiment_pub
nd_geolocationprop
nd_protocol
nd_reagent
nd_protocol_reagent
nd_protocolprop
nd_experiment_stock
nd_experiment_protocol
nd_experiment_phenotype
nd_experiment_genotype
nd_reagent_relationship
nd_reagentprop
nd_experiment_stockprop
nd_experiment_stock_dbxref
nd_experiment_dbxref
nd_experiment_contact

### nd_geolocation | Top

Comments:
=================================================================
Dependencies:
:import feature from sequence
:import cvterm from cv
:import pub from pub
:import phenotype from phenotype
:import organism from organism
:import genotype from genetic
:import contact from contact
:import project from project
:import stock from stock
:import synonym
=================================================================
this probably needs some work, depending on how cross-database we
want to be. In Postgres, at least, there are much better ways to
represent geo information.
The geo-referencable location of the stock. NOTE: This entity is subject to change as a more general and possibly more OpenGIS-compliant geolocation module may be introduced into Chado.

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
nd_geolocation_id | integer | 11 |  | PRIMARY KEY, NOT NULL |
description | varchar | 255 |  | A textual representation of the location, if this is the original georeference. Optional if the original georeference is available in lat/long coordinates. |
latitude | real | 10 |  | The decimal latitude coordinate of the georeference, using positive and negative sign to indicate N and S, respectively. |
longitude | real | 10 |  | The decimal longitude coordinate of the georeference, using positive and negative sign to indicate E and W, respectively. |
geodetic_datum | varchar | 32 |  | The geodetic system on which the geo-reference coordinates are based. For geo-references measured between 1984 and 2010, this will typically be WGS84. |
altitude | real | 10 |  | The altitude (elevation) of the location in meters. If the altitude is only known as a range, this is the average, and altitude_dev will hold half of the width of the range. |

### Constraints

Type | Fields
--- | ---
NOT NULL | nd_geolocation_id

### nd_experiment | Top

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
nd_experiment_id | integer | 11 |  | PRIMARY KEY, NOT NULL |
nd_geolocation_id | integer | 10 |  | NOT NULL | nd_geolocation.nd_geolocation_id
type_id | integer | 10 |  | NOT NULL | cvterm.cvterm_id

### Constraints

Type | Fields
--- | ---
NOT NULL | nd_experiment_id
NOT NULL | nd_geolocation_id
FOREIGN KEY | nd_geolocation_id
NOT NULL | type_id
FOREIGN KEY | type_id
FOREIGN KEY | nd_geolocation_id
FOREIGN KEY | type_id

### nd_experiment_project | Top

Comments:
used to be nd_diversityexperiment_project
then was nd_assay_project

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
nd_experiment_project_id | integer | 11 |  | PRIMARY KEY, NOT NULL |
project_id | integer | 10 |  | NOT NULL | project.project_id
nd_experiment_id | integer | 10 |  | NOT NULL | nd_experiment.nd_experiment_id

### Constraints

Type | Fields
--- | ---
NOT NULL | nd_experiment_project_id
NOT NULL | project_id
FOREIGN KEY | project_id
NOT NULL | nd_experiment_id
FOREIGN KEY | nd_experiment_id
FOREIGN KEY | project_id
FOREIGN KEY | nd_experiment_id

### nd_experimentprop | Top

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
nd_experimentprop_id | integer | 11 |  | PRIMARY KEY, NOT NULL |
nd_experiment_id | integer | 10 |  | UNIQUE, NOT NULL | nd_experiment.nd_experiment_id
type_id | integer | 10 |  | UNIQUE, NOT NULL | cvterm.cvterm_id
value | text | 64000 | NULL |  |
rank | integer | 10 | 0 | UNIQUE, NOT NULL |

### Constraints

Type | Fields
--- | ---
NOT NULL | nd_experimentprop_id
NOT NULL | nd_experiment_id
FOREIGN KEY | nd_experiment_id
NOT NULL | type_id
FOREIGN KEY | type_id
NOT NULL | rank
UNIQUE | nd_experiment_id, type_id, rank
FOREIGN KEY | nd_experiment_id
FOREIGN KEY | type_id

### nd_experiment_pub | Top

Comments:
Linking nd_experiment(s) to publication(s)

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
nd_experiment_pub_id | integer | 11 |  | PRIMARY KEY, NOT NULL |
nd_experiment_id | integer | 10 |  | UNIQUE, NOT NULL | nd_experiment.nd_experiment_id
pub_id | integer | 10 |  | UNIQUE, NOT NULL | pub.pub_id

### Indices

Name | Fields
--- | ---
nd_experiment_pub_idx1 | nd_experiment_id
nd_experiment_pub_idx2 | pub_id

### Constraints

Type | Fields
--- | ---
NOT NULL | nd_experiment_pub_id
NOT NULL | nd_experiment_id
FOREIGN KEY | nd_experiment_id
NOT NULL | pub_id
FOREIGN KEY | pub_id
UNIQUE | nd_experiment_id, pub_id

### nd_geolocationprop | Top

Comments:
Property/value associations for geolocations. This table can store the properties such as location and environment

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
nd_geolocationprop_id | integer | 11 |  | PRIMARY KEY, NOT NULL |
nd_geolocation_id | integer | 10 |  | UNIQUE, NOT NULL | nd_geolocation.nd_geolocation_id
type_id | integer | 10 |  | UNIQUE, NOT NULL, The name of the property as a reference to a controlled vocabulary term. | cvterm.cvterm_id
value | text | 64000 | NULL | The value of the property. |
rank | integer | 10 | 0 | UNIQUE, NOT NULL, The rank of the property value, if the property has an array of values. |

### Constraints

Type | Fields
--- | ---
NOT NULL | nd_geolocationprop_id
NOT NULL | nd_geolocation_id
FOREIGN KEY | nd_geolocation_id
NOT NULL | type_id
FOREIGN KEY | type_id
NOT NULL | rank
UNIQUE | nd_geolocation_id, type_id, rank
FOREIGN KEY | nd_geolocation_id
FOREIGN KEY | type_id

### nd_protocol | Top

Comments:
A protocol can be anything that is done as part of the experiment.

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
nd_protocol_id | integer | 11 |  | PRIMARY KEY, NOT NULL |
name | varchar | 255 |  | UNIQUE, NOT NULL, The protocol name. |
type_id | integer | 10 |  | NOT NULL | cvterm.cvterm_id

### Constraints

Type | Fields
--- | ---
NOT NULL | nd_protocol_id
NOT NULL | name
UNIQUE | name
NOT NULL | type_id
FOREIGN KEY | type_id
FOREIGN KEY | type_id

### nd_reagent | Top

Comments:
A reagent such as a primer, an enzyme, an adapter oligo, a linker oligo. Reagents are used in genotyping experiments, or in any other kind of experiment.

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
nd_reagent_id | integer | 11 |  | PRIMARY KEY, NOT NULL |
name | varchar | 80 |  | NOT NULL, The name of the reagent. The name should be unique for a given type. |
type_id | integer | 10 |  | NOT NULL, The type of the reagent, for example linker oligomer, or forward primer. | cvterm.cvterm_id
feature_id | integer | 10 |  | If the reagent is a primer, the feature that it corresponds to. More generally, the corresponding feature for any reagent that has a sequence that maps to another sequence. |

### Constraints

Type | Fields
--- | ---
NOT NULL | nd_reagent_id
NOT NULL | name
NOT NULL | type_id
FOREIGN KEY | type_id
FOREIGN KEY | type_id

### nd_protocol_reagent | Top

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
nd_protocol_reagent_id | integer | 11 |  | PRIMARY KEY, NOT NULL |
nd_protocol_id | integer | 10 |  | NOT NULL | nd_protocol.nd_protocol_id
reagent_id | integer | 10 |  | NOT NULL | nd_reagent.nd_reagent_id
type_id | integer | 10 |  | NOT NULL | cvterm.cvterm_id

### Constraints

Type | Fields
--- | ---
NOT NULL | nd_protocol_reagent_id
NOT NULL | nd_protocol_id
FOREIGN KEY | nd_protocol_id
NOT NULL | reagent_id
FOREIGN KEY | reagent_id
NOT NULL | type_id
FOREIGN KEY | type_id
FOREIGN KEY | nd_protocol_id
FOREIGN KEY | reagent_id
FOREIGN KEY | type_id

### nd_protocolprop | Top

Comments:
Property/value associations for protocol.

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
nd_protocolprop_id | integer | 11 |  | PRIMARY KEY, NOT NULL |
nd_protocol_id | integer | 10 |  | UNIQUE, NOT NULL, The protocol to which the property applies. | nd_protocol.nd_protocol_id
type_id | integer | 10 |  | UNIQUE, NOT NULL, The name of the property as a reference to a controlled vocabulary term. | cvterm.cvterm_id
value | text | 64000 | NULL | The value of the property. |
rank | integer | 10 | 0 | UNIQUE, NOT NULL, The rank of the property value, if the property has an array of values. |

### Constraints

Type | Fields
--- | ---
NOT NULL | nd_protocolprop_id
NOT NULL | nd_protocol_id
FOREIGN KEY | nd_protocol_id
NOT NULL | type_id
FOREIGN KEY | type_id
NOT NULL | rank
UNIQUE | nd_protocol_id, type_id, rank
FOREIGN KEY | nd_protocol_id
FOREIGN KEY | type_id

### nd_experiment_stock | Top

Comments:
Part of a stock or a clone of a stock that is used in an experiment

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
nd_experiment_stock_id | integer | 11 |  | PRIMARY KEY, NOT NULL |
nd_experiment_id | integer | 10 |  | NOT NULL | nd_experiment.nd_experiment_id
stock_id | integer | 10 |  | NOT NULL, stock used in the extraction or the corresponding stock for the clone | stock.stock_id
type_id | integer | 10 |  | NOT NULL | cvterm.cvterm_id

### Constraints

Type | Fields
--- | ---
NOT NULL | nd_experiment_stock_id
NOT NULL | nd_experiment_id
FOREIGN KEY | nd_experiment_id
NOT NULL | stock_id
FOREIGN KEY | stock_id
NOT NULL | type_id
FOREIGN KEY | type_id
FOREIGN KEY | nd_experiment_id
FOREIGN KEY | stock_id
FOREIGN KEY | type_id

### nd_experiment_protocol | Top

Comments:
Linking table: experiments to the protocols they involve.

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
nd_experiment_protocol_id | integer | 11 |  | PRIMARY KEY, NOT NULL |
nd_experiment_id | integer | 10 |  | NOT NULL | nd_experiment.nd_experiment_id
nd_protocol_id | integer | 10 |  | NOT NULL | nd_protocol.nd_protocol_id

### Constraints

Type | Fields
--- | ---
NOT NULL | nd_experiment_protocol_id
NOT NULL | nd_experiment_id
FOREIGN KEY | nd_experiment_id
NOT NULL | nd_protocol_id
FOREIGN KEY | nd_protocol_id
FOREIGN KEY | nd_experiment_id
FOREIGN KEY | nd_protocol_id

### nd_experiment_phenotype | Top

Comments:
Linking table: experiments to the phenotypes they produce. There is a one-to-one relationship between an experiment and a phenotype since each phenotype record should point to one experiment. Add a new experiment_id for each phenotype record.

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
nd_experiment_phenotype_id | integer | 11 |  | PRIMARY KEY, NOT NULL |
nd_experiment_id | integer | 10 |  | UNIQUE, NOT NULL | nd_experiment.nd_experiment_id
phenotype_id | integer | 10 |  | UNIQUE, NOT NULL | phenotype.phenotype_id

### Constraints

Type | Fields
--- | ---
NOT NULL | nd_experiment_phenotype_id
NOT NULL | nd_experiment_id
FOREIGN KEY | nd_experiment_id
NOT NULL | phenotype_id
FOREIGN KEY | phenotype_id
UNIQUE | nd_experiment_id, phenotype_id
FOREIGN KEY | nd_experiment_id
FOREIGN KEY | phenotype_id

### nd_experiment_genotype | Top

Comments:
Linking table: experiments to the genotypes they produce. There is a one-to-one relationship between an experiment and a genotype since each genotype record should point to one experiment. Add a new experiment_id for each genotype record.

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
nd_experiment_genotype_id | integer | 11 |  | PRIMARY KEY, NOT NULL |
nd_experiment_id | integer | 10 |  | UNIQUE, NOT NULL | nd_experiment.nd_experiment_id
genotype_id | integer | 10 |  | UNIQUE, NOT NULL | genotype.genotype_id

### Constraints

Type | Fields
--- | ---
NOT NULL | nd_experiment_genotype_id
NOT NULL | nd_experiment_id
FOREIGN KEY | nd_experiment_id
NOT NULL | genotype_id
FOREIGN KEY | genotype_id
UNIQUE | nd_experiment_id, genotype_id
FOREIGN KEY | nd_experiment_id
FOREIGN KEY | genotype_id

### nd_reagent_relationship | Top

Comments:
Relationships between reagents. Some reagents form a group. i.e., they are used all together or not at all. Examples are adapter/linker/enzyme experiment reagents.

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
nd_reagent_relationship_id | integer | 11 |  | PRIMARY KEY, NOT NULL |
subject_reagent_id | integer | 10 |  | NOT NULL, The subject reagent in the relationship. In parent/child terminology, the subject is the child. For example, in "linkerA 3prime-overhang-linker enzymeA" linkerA is the subject, 3prime-overhand-linker is the type, and enzymeA is the object. | nd_reagent.nd_reagent_id
object_reagent_id | integer | 10 |  | NOT NULL, The object reagent in the relationship. In parent/child terminology, the object is the parent. For example, in "linkerA 3prime-overhang-linker enzymeA" linkerA is the subject, 3prime-overhand-linker is the type, and enzymeA is the object. | nd_reagent.nd_reagent_id
type_id | integer | 10 |  | NOT NULL, The type (or predicate) of the relationship. For example, in "linkerA 3prime-overhang-linker enzymeA" linkerA is the subject, 3prime-overhand-linker is the type, and enzymeA is the object. | cvterm.cvterm_id

### Constraints

Type | Fields
--- | ---
NOT NULL | nd_reagent_relationship_id
NOT NULL | subject_reagent_id
FOREIGN KEY | subject_reagent_id
NOT NULL | object_reagent_id
FOREIGN KEY | object_reagent_id
NOT NULL | type_id
FOREIGN KEY | type_id
FOREIGN KEY | subject_reagent_id
FOREIGN KEY | object_reagent_id
FOREIGN KEY | type_id

### nd_reagentprop | Top

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
nd_reagentprop_id | integer | 11 |  | PRIMARY KEY, NOT NULL |
nd_reagent_id | integer | 10 |  | UNIQUE, NOT NULL | nd_reagent.nd_reagent_id
type_id | integer | 10 |  | UNIQUE, NOT NULL | cvterm.cvterm_id
value | text | 64000 | NULL |  |
rank | integer | 10 | 0 | UNIQUE, NOT NULL |

### Constraints

Type | Fields
--- | ---
NOT NULL | nd_reagentprop_id
NOT NULL | nd_reagent_id
FOREIGN KEY | nd_reagent_id
NOT NULL | type_id
FOREIGN KEY | type_id
NOT NULL | rank
UNIQUE | nd_reagent_id, type_id, rank
FOREIGN KEY | nd_reagent_id
FOREIGN KEY | type_id

### nd_experiment_stockprop | Top

Comments:
Property/value associations for experiment_stocks. This table can store the properties such as treatment

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
nd_experiment_stockprop_id | integer | 11 |  | PRIMARY KEY, NOT NULL |
nd_experiment_stock_id | integer | 10 |  | UNIQUE, NOT NULL, The experiment_stock to which the property applies. | nd_experiment_stock.nd_experiment_stock_id
type_id | integer | 10 |  | UNIQUE, NOT NULL, The name of the property as a reference to a controlled vocabulary term. | cvterm.cvterm_id
value | text | 64000 | NULL | The value of the property. |
rank | integer | 10 | 0 | UNIQUE, NOT NULL, The rank of the property value, if the property has an array of values. |

### Constraints

Type | Fields
--- | ---
NOT NULL | nd_experiment_stockprop_id
NOT NULL | nd_experiment_stock_id
FOREIGN KEY | nd_experiment_stock_id
NOT NULL | type_id
FOREIGN KEY | type_id
NOT NULL | rank
UNIQUE | nd_experiment_stock_id, type_id, rank
FOREIGN KEY | nd_experiment_stock_id
FOREIGN KEY | type_id

### nd_experiment_stock_dbxref | Top

Comments:
Cross-reference experiment_stock to accessions, images, etc

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
nd_experiment_stock_dbxref_id | integer | 11 |  | PRIMARY KEY, NOT NULL |
nd_experiment_stock_id | integer | 10 |  | NOT NULL | nd_experiment_stock.nd_experiment_stock_id
dbxref_id | integer | 10 |  | NOT NULL | dbxref.dbxref_id

### Constraints

Type | Fields
--- | ---
NOT NULL | nd_experiment_stock_dbxref_id
NOT NULL | nd_experiment_stock_id
FOREIGN KEY | nd_experiment_stock_id
NOT NULL | dbxref_id
FOREIGN KEY | dbxref_id
FOREIGN KEY | nd_experiment_stock_id
FOREIGN KEY | dbxref_id

### nd_experiment_dbxref | Top

Comments:
Cross-reference experiment to accessions, images, etc

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
nd_experiment_dbxref_id | integer | 11 |  | PRIMARY KEY, NOT NULL |
nd_experiment_id | integer | 10 |  | NOT NULL | nd_experiment.nd_experiment_id
dbxref_id | integer | 10 |  | NOT NULL | dbxref.dbxref_id

### Constraints

Type | Fields
--- | ---
NOT NULL | nd_experiment_dbxref_id
NOT NULL | nd_experiment_id
FOREIGN KEY | nd_experiment_id
NOT NULL | dbxref_id
FOREIGN KEY | dbxref_id
FOREIGN KEY | nd_experiment_id
FOREIGN KEY | dbxref_id

### nd_experiment_contact | Top

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
nd_experiment_contact_id | integer | 11 |  | PRIMARY KEY, NOT NULL |
nd_experiment_id | integer | 10 |  | NOT NULL | nd_experiment.nd_experiment_id
contact_id | integer | 10 |  | NOT NULL | contact.contact_id

### Constraints

Type | Fields
--- | ---
NOT NULL | nd_experiment_contact_id
NOT NULL | nd_experiment_id
FOREIGN KEY | nd_experiment_id
NOT NULL | contact_id
FOREIGN KEY | contact_id
FOREIGN KEY | nd_experiment_id
FOREIGN KEY | contact_id

Created by SQL::Translator 0.11003