Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ensembl
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
ensembl
Commits
5bdad69a
Commit
5bdad69a
authored
11 years ago
by
Kieron Taylor
Browse files
Options
Downloads
Patches
Plain Diff
Alt allele schema patch.
parent
5c266662
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sql/patch_72_73_b.sql
+56
-0
56 additions, 0 deletions
sql/patch_72_73_b.sql
with
56 additions
and
0 deletions
sql/patch_72_73_b.sql
0 → 100644
+
56
−
0
View file @
5bdad69a
#
patch_70_71_b
.
sql
#
#
Title
:
Introduce
alt
allele
types
#
#
Description
:
Copy
out
existing
alt
allele
data
,
create
new
tables
and
#
integrate
old
data
into
the
new
tables
#
Relocate
existing
data
out
of
the
way
CREATE
TABLE
aa_bak
LIKE
alt_allele
INSERT
INTO
aa_bak
SELECT
*
FROM
alt_allele
;
DROP
TABLE
alt_allele
;
#
Make
new
table
structure
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
)
);
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
)
);
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
(
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
;
#
Clean
up
remains
DROP
TABLE
aa_back
;
#
Patch
identifier
INSERT
INTO
meta
(
species_id
,
meta_key
,
meta_value
)
VALUES
(
NULL
,
'patch'
,
'patch_70_71_b.sql|alt_allele_type'
);
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment