Skip to content

Commit

Permalink
Modified intervals endpoint to return complete info on genes, transcr…
Browse files Browse the repository at this point in the history
…ipts and exons
  • Loading branch information
Chiara Rasi committed Oct 29, 2024
1 parent 03d4b40 commit 29e95e5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- Refseq transcripts names on coverage overview page
### Changed
- Replaced custom badges style with Bootstrap 5 badges
- Return complete gene, transcripts and exons info in intervals endpoints
### Fixed
- Addressed the `Starlette Denial of service (DoS) via multipart/form-data` by updating starlette library. among others

Expand Down
26 changes: 11 additions & 15 deletions src/chanjo2/endpoints/intervals.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
update_genes,
update_transcripts,
)
from chanjo2.models import SQLExon, SQLTranscript
from chanjo2.models import SQLExon, SQLGene, SQLTranscript
from chanjo2.models.pydantic_models import (
Builds,
Exon,
Gene,
ExonBase,
GeneBase,
GeneIntervalQuery,
GeneQuery,
Transcript,
TranscriptBase,
)

router = APIRouter()
Expand Down Expand Up @@ -58,10 +58,8 @@ async def load_genes(
)


@router.post("/intervals/genes")
async def genes(
query: GeneQuery, session: Session = Depends(get_session)
) -> List[Gene]:
@router.post("/intervals/genes", response_model=List[GeneBase])
async def genes(query: GeneQuery, session: Session = Depends(get_session)):
"""Return genes according to query parameters."""
nr_filters = count_nr_filters(
filters=[query.ensembl_ids, query.hgnc_ids, query.hgnc_symbols]
Expand All @@ -82,7 +80,7 @@ async def genes(
)


@router.post("/intervals/load/transcripts/{build}")
@router.post("/intervals/load/transcripts/{build}", response_model=List[GeneBase])
async def load_transcripts(
build: Builds,
file_path: Optional[str] = None,
Expand Down Expand Up @@ -113,10 +111,10 @@ async def load_transcripts(
)


@router.post("/intervals/transcripts")
@router.post("/intervals/transcripts", response_model=List[TranscriptBase])
async def transcripts(
query: GeneIntervalQuery, session: Session = Depends(get_session)
) -> List[Transcript]:
):
"""Return transcripts according to query parameters."""
nr_filters = count_nr_filters(
filters=[
Expand Down Expand Up @@ -170,10 +168,8 @@ async def load_exons(
)


@router.post("/intervals/exons")
async def exons(
query: GeneIntervalQuery, session: Session = Depends(get_session)
) -> List[Exon]:
@router.post("/intervals/exons", response_model=List[ExonBase])
async def exons(query: GeneIntervalQuery, session: Session = Depends(get_session)):
"""Return exons in the given genome build."""
nr_filters = count_nr_filters(
filters=[
Expand Down

0 comments on commit 29e95e5

Please sign in to comment.