Skip to content
Snippets Groups Projects
Commit 15c85035 authored by Graham McVicker's avatar Graham McVicker
Browse files

removed cruft from core sql directory

parent bfa51d99
No related branches found
No related tags found
No related merge requests found
24th May 1999
Contains tables for sql database but no data. Also
contains raw sql queries for testing.
Lastly, contains a Tim Fulton's (preliminary) diagram of the 074 schema in
PDF format (attempts to make a gif/jpg out of this have so far failed
...). For now, the name is simply ensembl_0_7_4.pdf (the _0_7_4 bit applies
to the database schema, not to the pdf file).
Philip
# MySQL dump 6.4
#
# Host: localhost Database: archive
#--------------------------------------------------------
# Server version 3.22.27
#
# Table structure for table 'sequence'
#
CREATE TABLE sequence (
id varchar(40) DEFAULT '0' NOT NULL,
version varchar(5) DEFAULT '' NOT NULL,
seq_type set("transcript","protein","exon") DEFAULT '' NOT NULL,
gene_id varchar(40) DEFAULT '' NOT NULL,
gene_version varchar(5) DEFAULT '' NOT NULL,
clone_id varchar(40) DEFAULT '' NOT NULL,
clone_version varchar(5) DEFAULT '' NOT NULL,
sequence mediumtext NOT NULL,
PRIMARY KEY (id,version,seq_type)
);
CREATE TABLE dead_genes (
id varchar(40) DEFAULT '' NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE deleted_id (
old_id varchar(40) DEFAULT '' NOT NULL,
old_version int(10) DEFAULT '' NOT NULL,
new_id varchar(40),
id_type varchar(40) DEFAULT '' NOT NULL,
PRIMARY KEY (old_id,id_type)
);
create TABLE gene_stable (
internal_id int(10) unsigned NOT NULL auto_increment,
external_id varchar(40) NOT NULL,
created datetime NOT NULL,
PRIMARY KEY(internal_id),
UNIQUE (external_id)
);
create TABLE exon_stable (
internal_id int(10) unsigned NOT NULL auto_increment,
external_id varchar(40) NOT NULL,
created datetime NOT NULL,
PRIMARY KEY(internal_id),
UNIQUE (external_id)
);
create TABLE transcript_stable (
internal_id int(10) unsigned NOT NULL auto_increment,
external_id varchar(40) NOT NULL,
created datetime NOT NULL,
PRIMARY KEY(internal_id),
UNIQUE (external_id)
);
create TABLE translation_stable (
internal_id int(10) unsigned NOT NULL auto_increment,
external_id varchar(40) NOT NULL,
created datetime NOT NULL,
PRIMARY KEY(internal_id),
UNIQUE (external_id)
);
CREATE TABLE seq (
seq_id int(10) unsigned NOT NULL auto_increment,
name varchar(40) NOT NULL,
type enum('exon','transcript','translation','gene') NOT NULL,
created datetime NOT NULL DEFAULT 'now()',
PRIMARY KEY(seq_id),
UNIQUE (name),
KEY (type)
);
CREATE TABLE versioned_seq (
versioned_seq_id int(10) unsigned NOT NULL auto_increment,
seq_id int(10) unsigned NOT NULL,
version int(10),
sequence mediumtext,
start_contig varchar(40),
start_coord int(10),
end_contig varchar(40),
end_coord int(10),
modified datetime NOT NULL DEFAULT 'now()',
release_number int(10),
PRIMARY KEY(versioned_seq_id),
UNIQUE(seq_id,version),
KEY(modified),
KEY(release_number)
);
CREATE TABLE versioned_seq_history (
old_versioned_seq_id int(10) unsigned NOT NULL,
new_versioned_seq_id int(10) unsigned NOT NULL,
KEY (old_versioned_seq_id),
KEY (new_versioned_seq_id)
);
CREATE TABLE versioned_seq_relatives (
master_versioned_seq_id int(10) unsigned NOT NULL,
relative_versioned_seq_id int(10) unsigned NOT NULL,
KEY (master_versioned_seq_id),
KEY (relative_versioned_seq_id)
);
create TABLE gene_stable (
internal_id int(10) unsigned NOT NULL auto_increment,
external_id varchar(40) NOT NULL,
created datetime NOT NULL,
PRIMARY KEY(internal_id),
UNIQUE (external_id)
);
create TABLE exon_stable (
internal_id int(10) unsigned NOT NULL auto_increment,
external_id varchar(40) NOT NULL,
created datetime NOT NULL,
PRIMARY KEY(internal_id),
UNIQUE (external_id)
);
create TABLE transcript_stable (
internal_id int(10) unsigned NOT NULL auto_increment,
external_id varchar(40) NOT NULL,
created datetime NOT NULL,
PRIMARY KEY(internal_id),
UNIQUE (external_id)
);
create TABLE translation_stable (
internal_id int(10) unsigned NOT NULL auto_increment,
external_id varchar(40) NOT NULL,
created datetime NOT NULL,
PRIMARY KEY(internal_id),
UNIQUE (external_id)
);
# MySQL dump 5.13
#
# Host: localhost Database: bugtrack
#--------------------------------------------------------
# Server version 3.22.22
#
# Table structure for table 'bug'
#
CREATE TABLE bug (
id int(10) DEFAULT '0' NOT NULL auto_increment,
title varchar(255) DEFAULT '' NOT NULL,
type set('modules','web','other') DEFAULT 'modules' NOT NULL,
PRIMARY KEY (id)
);
#
# Table structure for table 'worknote'
#
CREATE TABLE worknote (
bug int(10) DEFAULT '0' NOT NULL,
author varchar(255) DEFAULT '' NOT NULL,
date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
note text NOT NULL
);
#
# Table structure for table 'bug_archive'
#
CREATE TABLE bug_archive (
id int(10) DEFAULT '0' NOT NULL auto_increment,
title varchar(255) DEFAULT '' NOT NULL,
type set('modules','web','other') DEFAULT 'modules' NOT NULL,
last_author varchar(255) DEFAULT '' NOT NULL,
last_date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
last_note text DEFAULT '' NOT NULL,
primary key (id)
);
create table contigoverlap (
contig_a varchar(40) DEFAULT '' NOT NULL,
contig_b varchar(40) DEFAULT '' NOT NULL,
contig_a_position int(10) unsigned,
contig_b_position int(10) unsigned,
contig_a_version int(10) unsigned default '0' not null,
contig_b_version int(10) unsigned default '0' not null,
type varchar(40) DEFAULT '' NOT NULL,
overlap_type set('right2left','left2right','left2left','right2right'),
PRIMARY KEY(contig_a,contig_a_version,contig_b,contig_b_version,type)
);
# this is symmetric feature pairs for raw contigs
CREATE TABLE symmetric_contig_pair_hit (
symchid int(10) unsigned NOT NULL auto_increment,
score int(10),
perc_subs int(10),
perc_ins int(10),
perc_del int(10),
PRIMARY KEY(symchid)
);
CREATE TABLE symmetric_contig_feature (
symcfid int(10) unsigned NOT NULL auto_increment,
symchid int(10) NOT NULL,
rawcontigid varchar(40) NOT NULL,
rawversion int(10) NOT NULL,
clone varchar(40) NOT NULL,
seq_start int(10),
seq_end int(10),
strand int(2),
PRIMARY KEY(symcfid),
KEY(clone,rawcontigid),
KEY(rawcontigid,rawversion,symchid),
KEY(symchid)
);
CREATE TABLE dblocation (
olddatabase varchar(100) NOT NULL,
newdatabase varchar(100) NOT NULL
);
CREATE TABLE clonelist (
clone varchar(40) NOT NULL,
PRIMARY KEY(clone)
);
echo 'show tables' | mysql -u ensro -A ensembl | grep -v 'Tables' | perl -ne 'chomp;print ("delete from $_;\n");' | mysql -u root --password=superpog -A ensembl
File deleted
show tables;
# MySQL dump 6.4
#
# Host: localhost Database: eliatest1
#--------------------------------------------------------
# Server version 3.22.27
#
# Table structure for table 'ghost'
#
CREATE TABLE ghost (
id varchar(40) DEFAULT '' NOT NULL,
version varchar(5) DEFAULT '' NOT NULL,
seq_type set("transcript","protein","exon") DEFAULT '' NOT NULL,
deleted_time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
new_id varchar(40) DEFAULT '',
PRIMARY KEY (id,version,seq_type)
);
# Select all genes
select *
from gene;
# Select a specific transcript
select *
from transcript
where id = 'dJ402G11.05009.GENSCAN.0.CDS.1';
# Select all + strand exons (id and contig only)
select id,contig
from exon
where strand = '+';
# Select all exons in gene dJ40E16.02584.GENSCAN.0
select exon.id
from exon,transcript,exon_bridge
where exon_bridge.exon = exon.id AND
exon_bridge.transcript = transcript.id AND
transcript.geneid = 'dJ40E16.02584.GENSCAN.0';
# how many genscan predictions are there?
select set,count(*)
from feature
where featureset != ''
group by featureset;
# how many times does a blastp match hit a contig
select id,count(*)
from feature
where analysis = 'blastp_swir'
group by id;
# which database hits hit different contigs - this prints ALL links
# this should have a group by contig here somewhere
select p1.contig,p2.contig,p2.id
from feature as p1, feature as p2
where p1.contig != p2.contig AND
p1.id = p2.id;
# this might be better
# just prints out different contigs
select count(*),feature.id,feature.contig
from feature
where id = 'WP:F15G9.4A'
group by feature.contig;
# groups by contigs for blastp hits for all features
select count(*),feature.id,feature.contig
from feature
where analysis = 'blastp_swir'
group by feature.contig;
# similar to above but counting the number of contig-contig links
select p1.id,count(*)
from feature as p1, feature as p2
where p1.contig != p2.contig AND
p1.id = p2.id
group by p1.id;
# show all hits between different contigs for id XL28SR
# n.b. brings up hits twice - don't know how to get around this.
select p1.*
from feature as p1, feature as p2
where p1.contig != p2.contig AND
p1.id = p2.id AND
p1.id = 'XL28SR';
# count number of exons for gene dJ437I16.00294.GENSCAN.5
select transcript.geneid,count(*)
from exon_bridge,transcript
where transcript.geneid = 'dJ437I16.00294.GENSCAN.5' AND
exon_bridge.transcript = transcript.id
group by transcript.geneid;
# count number of exons for all genes
select transcript.geneid,count(*)
from exon_bridge,transcript
where exon_bridge.transcript = transcript.id
group by transcript.geneid;
# find feature overlaps with exon dJ437I16.00294.GENSCAN.0.1
select feature.*
from feature,exon
where feature.analysis != '' AND
exon.id = 'dJ437I16.00294.GENSCAN.0.1' AND
feature.strand = exon.strand AND
feature.start >= exon.start AND
feature.end <= exon.end AND
feature.contig = exon.contig;
# or to just report the different feature ids and number of hits
select feature.id,count(*)
from feature,exon
where feature.analysis != '' AND
exon.id = 'dJ437I16.00294.GENSCAN.0.1' AND
feature.strand = exon.strand AND
feature.start >= exon.start AND
feature.end <= exon.end AND
feature.contig = exon.contig
group by feature.id;
# find all feature hits with all exons
# note - can't find how to order these by exon id
select exon.id,feature.id,count(*)
from feature,exon
where feature.analysis != '' AND
feature.strand = exon.strand AND
feature.start >= exon.start AND
feature.end <= exon.end AND
feature.contig = exon.contig
group by feature.id;
# find all feature hits that overlap with genscan predictions
select p1.id,p2.id,count(*)
from feature as p1, feature as p2
where p1.contig = p2.contig AND
p1.analysis != '' AND
p2.analysis = '' AND
p2.strand = p1.strand AND
p1.start >= p2.start AND
p1.end <= p2.end
group by p1.id;
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