Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ dependencies = [
"spacy>=3.8.11",
"en_core_web_sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.8.0/en_core_web_sm-3.8.0-py3-none-any.whl",
"flask-sqlalchemy>=3.1.1",
"python-dateutil>=2.9.0.post0",
"pyrate-limiter>=4.1.0",
]
11 changes: 9 additions & 2 deletions src/app/swagger_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,21 @@
"type": "string",
"description": "Information about supplementary files",
"example": "ftp://ftp.ncbi.nlm.nih.gov/geo/series/GSE12nnn/GSE12345/suppl/"
},
"publication_year": {
"type": "string",
"description": "Year of publication",
"example": "2026"
}
}
},
"ScoredGSE": {
"type": "object",
"properties": {
"gse": {
"$ref": "#/definitions/GSE"
"gse_accession": {
"type": "string",
"description": "Dataset GSE accession number",
"example": "GSE12345"
},
"score": {
"type": "number",
Expand Down
15 changes: 14 additions & 1 deletion src/db/models/gse.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Gene Expression Omnibus Series (GSE) data model."""
import datetime
from dataclasses import dataclass, field
from typing import Optional, List

Expand All @@ -9,6 +10,7 @@
from src.db.models.gsm import GSM
from src.db.models.mapper_registry import mapper_registry

from dateutil import parser
from sqlalchemy import Index, Integer, PrimaryKeyConstraint, REAL, Text, Column, select, union, func, literal_column

SUPERSERIES_SUMMARY = "This SuperSeries is composed of the SubSeries listed below."
Expand Down Expand Up @@ -68,12 +70,21 @@ class GSE:
def is_superseries(self):
return self.summary == SUPERSERIES_SUMMARY

@property
def publication_date(self) -> Optional[datetime.datetime]:
public_status_prefix = "Public on "
if self.status and self.status.startswith(public_status_prefix):
publication_date = self.status[len(public_status_prefix):]
return parser.parse(publication_date)
return parser.parse(self.last_update_date) if self.last_update_date else None

@property
def organisms(self):
return self._organisms.split(",") if self._organisms is not None else []


@dataclass()

@dataclass
class GSE_DTO:
ID: Optional[float]
title: Optional[str]
Expand All @@ -94,6 +105,7 @@ class GSE_DTO:
contact: Optional[str]
supplementary_file: Optional[str]
gsm_ids: List[str]
publication_year: Optional[str]
organisms: List[str]

def __init__(self, gse: GSE):
Expand All @@ -116,4 +128,5 @@ def __init__(self, gse: GSE):
self.contact = gse.contact
self.supplementary_file = gse.supplementary_file
self.gsm_ids = list(gse.gsm_ids)
self.publication_year = gse.publication_date.strftime("%Y") or None
self.organisms = gse.organisms
Loading