Commit 0b19c732 authored by Kieron Taylor's avatar Kieron Taylor 😠
Browse files

Table definition and patch updated.

parent 3341d9d7
......@@ -13,7 +13,7 @@ DROP TABLE alt_allele;
# Make new table structure
CREATE TABLE alt_allele (alt_allele_id INT UNSIGNED AUTO_INCREMENT,
group_id INT UNSIGNED NOT NULL,
alt_allele_group_id INT UNSIGNED NOT NULL,
gene_id INT UNSIGNED NOT NULL,
PRIMARY KEY (alt_allele_id),
KEY (gene_id,group_id)
......@@ -36,8 +36,14 @@ CREATE TABLE alt_allele_attrib (alt_allele_id INT UNSIGNED,
KEY aa_idx (alt_allele_id,attrib)
);
CREATE TABLE alt_allele_group (alt_allele_group_id INT UNSIGNED AUTO_INCREMENT,
PRIMARY KEY (alt_allele_group_id)
);
# Port data into new structure
INSERT INTO alt_allele (group_id,gene_id) SELECT alt_allele_id,gene_id FROM aa_bak;
INSERT INTO alt_allele_group (alt_allele_group_id) SELECT DISTINCT alt_allele_id FROM aa_bak;
INSERT INTO alt_allele (alt_allele_group_id,gene_id) SELECT alt_allele_id,gene_id FROM aa_bak;
INSERT INTO alt_allele_attrib (alt_allele_id,attrib) SELECT a.alt_allele_id,'IS_REPRESENTATIVE' FROM alt_allele a, aa_bak b
WHERE b.is_ref = 1 AND a.gene_id = b.gene_id AND a.group_id = b.alt_allele_id;
......
......@@ -893,24 +893,55 @@ CREATE TABLE unconventional_transcript_association (
@desc Stores information about genes on haplotypes that may be orthologous.
@column alt_allele_id Primary key, internal identifier.
@column gene_id Foreign key references to the @link gene table.
@column is_ref Indicates a reference allele if set to 1.
@column type ENUM of alt_allele types, e.g. CODING_POTENTIAL
@column alt_allele_group_id A group ID to show which alleles are related
@column gene_id Gene dbID from gene table
*/
CREATE TABLE alt_allele (
alt_allele_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
gene_id INT(10) UNSIGNED NOT NULL,
is_ref BOOLEAN NOT NULL DEFAULT 0,
type ENUM(PROJECTED,MANUAL,CODING_POTENTIAL,NONE) NOT NULL DEFAULT 'NONE',
CREATE TABLE alt_allele (alt_allele_id INT UNSIGNED AUTO_INCREMENT,
alt_allele_group_id INT UNSIGNED NOT NULL,
gene_id INT UNSIGNED NOT NULL,
PRIMARY KEY (alt_allele_id),
KEY (gene_id,group_id)
) COLLATE=latin1_swedish_ci ENGINE=MyISAM;
UNIQUE KEY gene_idx (gene_id),
UNIQUE KEY allele_idx (alt_allele_id, gene_id),
KEY type_idx (type,alt_allele_id)
/**
@table alt_allele_attrib
@desc Holds all the different attributes assigned to individual alleles.
@column alt_allele_id Primary key, internal identifier.
@column attrib Enum of attributes assigned to alternative alleles
*/
CREATE TABLE alt_allele_attrib (alt_allele_id INT UNSIGNED,
attrib ENUM('IS_REPRESENTATIVE',
'IS_MOST_COMMON_ALLELE',
'IN_CORRECTED_ASSEMBLY',
'HAS_CODING_POTENTIAL',
'IN_ARTIFICIALLY_DUPLICATED_ASSEMBLY',
'IN_SYNTENIC_REGION',
'HAS_SAME_UNDERLYING_DNA_SEQUENCE',
'IN_BROKEN_ASSEMBLY_REGION',
'IS_VALID_ALTERNATE',
'SAME_AS_REPRESENTATIVE',
'SAME_AS_ANOTHER_ALLELE',
'MANUALLY_ASSIGNED',
'AUTOMATICALLY_ASSIGNED'),
KEY aa_idx (alt_allele_id,attrib)
) COLLATE=latin1_swedish_ci ENGINE=MyISAM;
/**
@table alt_allele_group_id
@desc A minimal table used for tracking unique alt_allele_group_id's. MySQL does not allow multiple autoincrement fields. Further information about a group could be added here at a later date.
@column alt_allele_group_id Primary key and only column.
*/
CREATE TABLE alt_allele_group (alt_allele_group_id INT UNSIGNED AUTO_INCREMENT,
PRIMARY KEY (alt_allele_group_id)
) COLLATE=latin1_swedish_ci ENGINE=MyISAM;
/**
@table analysis
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment