Skip to content

Commit

Permalink
sequence util fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jsstevenson committed Aug 5, 2024
1 parent 4340865 commit 64b8425
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
10 changes: 6 additions & 4 deletions server/src/curfu/routers/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ async def get_sequence_id(request: Request, sequence: str) -> SequenceIDResponse
:param str sequence_id: user-provided sequence identifier to translate
:return: Response object with ga4gh ID and aliases
"""
params: dict[str, Any] = {"sequence": sequence, "ga4gh_id": None, "aliases": []}
params: dict[str, Any] = {"sequence": sequence}
sr = request.app.state.fusor.cool_seq_tool.seqrepo_access

sr_ids, errors = sr.translate_identifier(sequence)
Expand Down Expand Up @@ -234,8 +234,7 @@ async def get_sequence_id(request: Request, sequence: str) -> SequenceIDResponse
@router.get(
"/api/utilities/download_sequence",
summary="Get sequence for ID",
description="Given a known accession identifier, retrieve sequence data and return"
"as a FASTA file",
description="Given a known accession identifier, retrieve sequence data and return as a FASTA file",
response_class=FileResponse,
tags=[RouteTag.UTILITIES],
)
Expand All @@ -247,6 +246,7 @@ async def get_sequence(
),
) -> FileResponse:
"""Get sequence for requested sequence ID.
\f
:param Request request: the HTTP request context, supplied by FastAPI. Use
to access FUSOR and UTA-associated tools.
Expand All @@ -257,7 +257,9 @@ async def get_sequence(
"""
_, path = tempfile.mkstemp(suffix=".fasta")
try:
request.app.state.fusor.cool_seq_tool.get_fasta_file(sequence_id, Path(path))
request.app.state.fusor.cool_seq_tool.seqrepo_access.get_fasta_file(
sequence_id, Path(path)
)
except KeyError as ke:
resp = (
request.app.state.fusor.cool_seq_tool.seqrepo_access.translate_identifier(
Expand Down
6 changes: 3 additions & 3 deletions server/src/curfu/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ class SequenceIDResponse(Response):
"""Response model for sequence ID retrieval endpoint."""

sequence: StrictStr
refseq_id: StrictStr | None
ga4gh_id: StrictStr | None
aliases: list[StrictStr] | None
refseq_id: StrictStr | None = None
ga4gh_id: StrictStr | None = None
aliases: list[StrictStr] | None = None


class ManeGeneTranscript(BaseModel):
Expand Down

0 comments on commit 64b8425

Please sign in to comment.