forked from esherm/intSiteUploader
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from BushmanLab/db_schema
Db schema: PK is sampleName + refGenome
- Loading branch information
Showing
7 changed files
with
159 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
-- drop tables with FK constraints | ||
DROP TABLE IF EXISTS pcrbreakpoints; | ||
DROP TABLE IF EXISTS sites; | ||
DROP TABLE IF EXISTS multihitlengths; | ||
DROP TABLE IF EXISTS multihitpositions; | ||
DROP TABLE IF EXISTS samples; | ||
|
||
CREATE TABLE samples ( | ||
sampleID int NOT NULL, | ||
sampleName varchar(255) NOT NULL, | ||
refGenome varchar(10) NOT NULL, | ||
gender char(1) NOT NULL, | ||
miseqid varchar(255), | ||
PRIMARY KEY (sampleID), | ||
CONSTRAINT uniq_samples UNIQUE (sampleName, refGenome) | ||
); | ||
|
||
-- unique hits | ||
CREATE TABLE sites ( | ||
siteID int NOT NULL, | ||
sampleID int NOT NULL, | ||
position int NOT NULL, | ||
chr varchar(255) NOT NULL, | ||
strand char(1) NOT NULL, | ||
PRIMARY KEY (siteID), | ||
FOREIGN KEY (sampleID) REFERENCES samples(sampleID) | ||
); | ||
|
||
CREATE TABLE `pcrbreakpoints` ( | ||
siteID int NOT NULL, | ||
breakpoint int NOT NULL, | ||
count int NOT NULL, | ||
PRIMARY KEY (siteID, breakpoint), | ||
FOREIGN KEY (siteID) REFERENCES sites(siteID) | ||
); | ||
|
||
-- multihit schema | ||
CREATE TABLE multihitpositions ( | ||
multihitID int NOT NULL, | ||
sampleID int NOT NULL, | ||
position int NOT NULL, | ||
chr varchar(255) NOT NULL, | ||
strand char(1) NOT NULL, | ||
PRIMARY KEY (multihitID, position, chr, strand), | ||
FOREIGN KEY (sampleID) REFERENCES samples(sampleID) | ||
); | ||
|
||
CREATE TABLE multihitlengths ( | ||
multihitID int NOT NULL, | ||
length int NOT NULL, | ||
count int NOT NULL, | ||
PRIMARY KEY (multihitID, length), | ||
FOREIGN KEY (multihitID) REFERENCES multihitpositions(multihitID) | ||
); |
Oops, something went wrong.