Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial/models schemas #3

Merged
merged 14 commits into from
Oct 1, 2024
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,6 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/

# vscode
.vscode/
noctillion marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
depends_on:
- tds-db
environment:
- DATABASE_URI=postgres://reference-db:5432
- DATABASE_URI=postgres://tds-db:5432
noctillion marked this conversation as resolved.
Show resolved Hide resolved
- CORS_ORIGINS="*"
- BENTO_AUTHZ_SERVICE_URL=""
ports:
Expand Down
21 changes: 21 additions & 0 deletions transcriptomics_data_service/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from pydantic import BaseModel

__all__ = [
"ExperimentResult",
"GeneExpression",
]


class ExperimentResult(BaseModel):
experiment_result_id: str
assembly_id: str | None = None
assembly_name: str | None = None


class GeneExpression(BaseModel):
noctillion marked this conversation as resolved.
Show resolved Hide resolved
gene_code: str
sample_id: str
experiment_result_id: str
raw_count: int
tpm_count: float | None = None
tmm_count: float | None = None
15 changes: 15 additions & 0 deletions transcriptomics_data_service/sql/schema.sql
noctillion marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
CREATE TABLE IF NOT EXISTS experiment_results (
experiment_result_id VARCHAR(31) NOT NULL PRIMARY KEY,
assembly_id VARCHAR(63),
assembly_name VARCHAR(63)
noctillion marked this conversation as resolved.
Show resolved Hide resolved
);

CREATE TABLE IF NOT EXISTS gene_expressions (
noctillion marked this conversation as resolved.
Show resolved Hide resolved
gene_code VARCHAR(31) NOT NULL,
sample_id VARCHAR(31) NOT NULL,
experiment_result_id VARCHAR(31) NOT NULL REFERENCES experiment_results ON DELETE CASCADE,
raw_count INTEGER NOT NULL,
tpm_count FLOAT,
tmm_count FLOAT,
PRIMARY KEY (gene_code, sample_id, experiment_result_id)
);