Skip to content

Commit

Permalink
#1164 #1165 Fixing the schema for gene regulatory network and protein…
Browse files Browse the repository at this point in the history
… protein interactions to have timestamp and for gene and protein tables and annotation type for physical interactions table
  • Loading branch information
ntran18 committed Feb 9, 2025
1 parent 82bf79f commit 8f856be
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 15 deletions.
11 changes: 8 additions & 3 deletions database2/schema/gene_regulatory_network_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ CREATE TABLE gene_regulatory_network.gene (
species VARCHAR,
taxon_id VARCHAR,
regulator BOOLEAN,
PRIMARY KEY(gene_id, taxon_id)
);
time_stamp TIMESTAMP WITH TIME ZONE,
source VARCHAR,
PRIMARY KEY(gene_id, taxon_id),
FOREIGN KEY (time_stamp, source) REFERENCES gene_regulatory_network.source(time_stamp, source)
);

CREATE TABLE gene_regulatory_network.network (
regulator_gene_id VARCHAR,
target_gene_id VARCHAR,
Expand All @@ -21,5 +25,6 @@ CREATE TABLE gene_regulatory_network.network (
source VARCHAR,
FOREIGN KEY (regulator_gene_id, taxon_id) REFERENCES gene_regulatory_network.gene(gene_id, taxon_id),
FOREIGN KEY (target_gene_id, taxon_id) REFERENCES gene_regulatory_network.gene(gene_id, taxon_id),
FOREIGN KEY (time_stamp, source) REFERENCES gene_regulatory_network.source(time_stamp, source)
FOREIGN KEY (time_stamp, source) REFERENCES gene_regulatory_network.source(time_stamp, source),
CONSTRAINT unique_network UNIQUE (regulator_gene_id, target_gene_id, taxon_id, time_stamp, source)
);
33 changes: 21 additions & 12 deletions database2/schema/protein_protein_interactions_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ CREATE TABLE protein_protein_interactions.gene (
display_gene_id VARCHAR, -- standard like name
species VARCHAR,
taxon_id VARCHAR,
time_stamp TIMESTAMP WITH TIME ZONE,
source VARCHAR,
PRIMARY KEY(gene_id, taxon_id)
FOREIGN KEY (time_stamp, source) REFERENCES protein_protein_interactions.source(time_stamp, source)
);

CREATE TABLE protein_protein_interactions.protein (
Expand All @@ -20,18 +23,24 @@ CREATE TABLE protein_protein_interactions.protein (
molecular_weight FLOAT,
PI FLOAT,
taxon_id VARCHAR,
FOREIGN KEY (gene_systematic_name, taxon_id) REFERENCES protein_protein_interactions.gene(gene_id, taxon_id)
);

CREATE TABLE protein_protein_interactions.physical_interactions (
protein1 VARCHAR,
protein2 VARCHAR,
interaction_detection_methods_identifier VARCHAR,
experiment_name VARCHAR,
time_stamp TIMESTAMP WITH TIME ZONE,
source VARCHAR,
FOREIGN KEY (protein1) REFERENCES protein_protein_interactions.protein(standard_name),
FOREIGN KEY (protein2) REFERENCES protein_protein_interactions.protein(standard_name),
FOREIGN KEY (time_stamp, source) REFERENCES protein_protein_interactions.source(time_stamp, source),
CONSTRAINT unique_physical_interaction UNIQUE (protein1, protein2, interaction_detection_methods_identifier, experiment_name, time_stamp, source)
FOREIGN KEY (gene_systematic_name, taxon_id) REFERENCES protein_protein_interactions.gene(gene_id, taxon_id)
FOREIGN KEY (time_stamp, source) REFERENCES protein_protein_interactions.source(time_stamp, source)
);

CREATE TABLE protein_protein_interactions.physical_interactions (
protein1 VARCHAR,
protein2 VARCHAR,
gene_systematic_name1 VARCHAR,
gene_systematic_name2 VARCHAR,
interaction_detection_methods_identifier VARCHAR,
annotation_type VARCHAR,
experiment_name VARCHAR,
time_stamp TIMESTAMP WITH TIME ZONE,
source VARCHAR,
FOREIGN KEY (protein1) REFERENCES protein_protein_interactions.protein(standard_name),
FOREIGN KEY (protein2) REFERENCES protein_protein_interactions.protein(standard_name),
FOREIGN KEY (time_stamp, source) REFERENCES protein_protein_interactions.source(time_stamp, source),
CONSTRAINT unique_physical_interaction UNIQUE (protein1, protein2, interaction_detection_methods_identifier, annotation_type, experiment_name, time_stamp, source)
);

0 comments on commit 8f856be

Please sign in to comment.