diff --git a/client/src/components/Pages/Structure/Input/GeneElementInput/GeneElementInput.tsx b/client/src/components/Pages/Structure/Input/GeneElementInput/GeneElementInput.tsx index ce3ce8a1..24180c9c 100644 --- a/client/src/components/Pages/Structure/Input/GeneElementInput/GeneElementInput.tsx +++ b/client/src/components/Pages/Structure/Input/GeneElementInput/GeneElementInput.tsx @@ -52,7 +52,7 @@ const GeneElementInput: React.FC = ({ ) { const clientGeneElement: ClientGeneElement = { ...geneElementResponse.element, - element_id: element.element_id, + elementId: element.elementId, nomenclature: nomenclatureResponse.nomenclature, }; handleSave(index, clientGeneElement); diff --git a/client/src/services/ResponseModels.ts b/client/src/services/ResponseModels.ts index f9674871..d6ec92f6 100644 --- a/client/src/services/ResponseModels.ts +++ b/client/src/services/ResponseModels.ts @@ -427,7 +427,7 @@ export interface Assay { * Response model for domain ID autocomplete suggestion endpoint. */ export interface AssociatedDomainResponse { - warnings: string[] | null; + warnings?: string[] | null; geneId: string; suggestions: DomainParams[] | null; } @@ -628,8 +628,8 @@ export interface ClientStructuralElement { * Response model for genomic coordinates retrieval */ export interface CoordsUtilsResponse { - warnings: string[] | null; - coordinatesData: GenomicData | null; + warnings?: string[] | null; + coordinates_data: GenomicData | null; } /** * Model containing genomic and transcript exon data. @@ -650,7 +650,7 @@ export interface GenomicData { * Response model for demo fusion object retrieval endpoints. */ export interface DemoResponse { - warnings: string[] | null; + warnings?: string[] | null; fusion: ClientAssayedFusion | ClientCategoricalFusion; } /** @@ -668,21 +668,21 @@ export interface ExonCoordsRequest { * Response model for gene element construction endoint. */ export interface GeneElementResponse { - warnings: string[] | null; + warnings?: string[] | null; element: GeneElement | null; } /** * Response model for functional domain constructor endpoint. */ export interface GetDomainResponse { - warnings: string[] | null; + warnings?: string[] | null; domain: FunctionalDomain | null; } /** * Response model for MANE transcript retrieval endpoint. */ export interface GetTranscriptsResponse { - warnings: string[] | null; + warnings?: string[] | null; transcripts: ManeGeneTranscript[] | null; } /** @@ -700,22 +700,22 @@ export interface ManeGeneTranscript { Ensembl_prot: string; MANE_status: string; GRCh38_chr: string; - chr_start: string; - chr_end: string; + chr_start: number; + chr_end: number; chr_strand: string; } /** * Response model for regulatory element nomenclature endpoint. */ export interface NomenclatureResponse { - warnings: string[] | null; + warnings?: string[] | null; nomenclature: string | null; } /** * Response model for gene normalization endpoint. */ export interface NormalizeGeneResponse { - warnings: string[] | null; + warnings?: string[] | null; term: string; conceptId: string | null; symbol: string | null; @@ -725,20 +725,20 @@ export interface NormalizeGeneResponse { * Response model for regulatory element constructor. */ export interface RegulatoryElementResponse { - warnings: string[] | null; + warnings?: string[] | null; regulatoryElement: RegulatoryElement; } /** * Abstract Response class for defining API response structures. */ export interface Response { - warnings: string[] | null; + warnings?: string[] | null; } /** * Response model for sequence ID retrieval endpoint. */ export interface SequenceIDResponse { - warnings: string[] | null; + warnings?: string[] | null; sequence: string; refseqId: string | null; ga4ghId: string | null; @@ -748,7 +748,7 @@ export interface SequenceIDResponse { * Response model for service_info endpoint. */ export interface ServiceInfoResponse { - warnings: string[] | null; + warnings?: string[] | null; curfu_version: string; fusor_version: string; cool_seq_tool_version: string; @@ -757,32 +757,32 @@ export interface ServiceInfoResponse { * Response model for gene autocomplete suggestions endpoint. */ export interface SuggestGeneResponse { - warnings: string[] | null; + warnings?: string[] | null; term: string; - matchesCount: number; - conceptId: [unknown, unknown, unknown, unknown, unknown][] | null; + matches_count: number; + concept_id: [unknown, unknown, unknown, unknown, unknown][] | null; symbol: [unknown, unknown, unknown, unknown, unknown][] | null; - prevSymbols: [unknown, unknown, unknown, unknown, unknown][] | null; + prev_symbols: [unknown, unknown, unknown, unknown, unknown][] | null; aliases: [unknown, unknown, unknown, unknown, unknown][] | null; } /** * Response model for transcript segment element construction endpoint. */ export interface TemplatedSequenceElementResponse { - warnings: string[] | null; + warnings?: string[] | null; element: TemplatedSequenceElement | null; } /** * Response model for transcript segment element construction endpoint. */ export interface TxSegmentElementResponse { - warnings: string[] | null; + warnings?: string[] | null; element: TranscriptSegmentElement | null; } /** * Response model for Fusion validation endpoint. */ export interface ValidateFusionResponse { - warnings: string[] | null; + warnings?: string[] | null; fusion: CategoricalFusion | AssayedFusion | null; } diff --git a/client/src/services/main.tsx b/client/src/services/main.tsx index 8ffc14ad..719245b0 100644 --- a/client/src/services/main.tsx +++ b/client/src/services/main.tsx @@ -241,13 +241,14 @@ export const getExonCoords = async ( gene?: string, txAc?: string ): Promise => { + console.log(txAc); const argsArray = [ `chromosome=${chromosome}`, `strand=${strand === "+" ? "%2B" : "-"}`, - gene !== "" ? `gene=${gene}` : "", - txAc !== "" ? `transcript=${txAc}` : "", - start !== "" ? `start=${start}` : "", - end !== "" ? `end=${end}` : "", + gene && gene !== "" ? `gene=${gene}` : "", + txAc && txAc !== "" ? `transcript=${txAc}` : "", + start && start !== "" ? `start=${start}` : "", + end && end !== "" ? `end=${end}` : "", ]; const args = argsArray.filter((a) => a !== "").join("&"); const response = await fetch(`/api/utilities/get_exon?${args}`); diff --git a/server/src/curfu/routers/utilities.py b/server/src/curfu/routers/utilities.py index 5dbb991a..1c9dbe17 100644 --- a/server/src/curfu/routers/utilities.py +++ b/server/src/curfu/routers/utilities.py @@ -39,7 +39,7 @@ def get_mane_transcripts(request: Request, term: str) -> dict: normalized = request.app.state.fusor.gene_normalizer.normalize(term) if normalized.match_type == gene_schemas.MatchType.NO_MATCH: return {"warnings": [f"Normalization error: {term}"]} - if not normalized.gene.id.lower().startswith("hgnc"): + if not normalized.gene.id.replace("normalize.gene.", "").lower().startswith("hgnc"): return {"warnings": [f"No HGNC symbol: {term}"]} symbol = normalized.gene.label transcripts = request.app.state.fusor.cool_seq_tool.mane_transcript_mappings.get_gene_mane_data( @@ -99,7 +99,7 @@ async def get_genome_coords( if warnings: for warning in warnings: logger.warning(warning) - return CoordsUtilsResponse(warnings=warnings, coordinatesData=None) + return CoordsUtilsResponse(warnings=warnings, coordinates_data=None) # TODO necessary for now if exon_start is not None and exon_start_offset is None: @@ -120,9 +120,9 @@ async def get_genome_coords( ) warnings = response.warnings if warnings: - return CoordsUtilsResponse(warnings=warnings, coordinatesData=None) + return CoordsUtilsResponse(warnings=warnings, coordinates_data=None) - return CoordsUtilsResponse(coordinatesData=response.genomic_data, warnings=None) + return CoordsUtilsResponse(coordinates_data=response.genomic_data, warnings=None) @router.get( @@ -168,10 +168,10 @@ async def get_exon_coords( if warnings: for warning in warnings: logger.warning(warning) - return CoordsUtilsResponse(warnings=warnings, coordinatesData=None) + return CoordsUtilsResponse(warnings=warnings, coordinates_data=None) - response = await request.app.state.fusor.cool_seq_tool.genomic_to_transcript_exon_coordinates( - chromosome, + response = await request.app.state.fusor.cool_seq_tool.ex_g_coords_mapper.genomic_to_transcript_exon_coordinates( + alt_ac=chromosome, start=start, end=end, strand=strand_validated, @@ -180,9 +180,9 @@ async def get_exon_coords( ) warnings = response.warnings if warnings: - return CoordsUtilsResponse(warnings=warnings, coordinatesData=None) + return CoordsUtilsResponse(warnings=warnings, coordinates_data=None) - return CoordsUtilsResponse(coordinatesData=response.genomic_data, warnings=None) + return CoordsUtilsResponse(coordinates_data=response.genomic_data, warnings=None) @router.get( diff --git a/server/src/curfu/schemas.py b/server/src/curfu/schemas.py index 8fcf653c..cb2b676f 100644 --- a/server/src/curfu/schemas.py +++ b/server/src/curfu/schemas.py @@ -103,7 +103,7 @@ class ClientRegulatoryElement(RegulatoryElement): class Response(BaseModel): """Abstract Response class for defining API response structures.""" - warnings: ResponseWarnings + warnings: ResponseWarnings | None = None class Config: """Configure class""" @@ -142,11 +142,11 @@ class SuggestGeneResponse(Response): """Response model for gene autocomplete suggestions endpoint.""" term: StrictStr - matchesCount: int + matches_count: int # complete term, normalized symbol, normalized concept ID, chromosome ID, strand - conceptId: list[tuple[str, str, str, str, str]] | None + concept_id: list[tuple[str, str, str, str, str]] | None symbol: list[tuple[str, str, str, str, str]] | None - prevSymbols: list[tuple[str, str, str, str, str]] | None + prev_symbols: list[tuple[str, str, str, str, str]] | None aliases: list[tuple[str, str, str, str, str]] | None @@ -207,7 +207,7 @@ def validate_number(cls, v) -> int: class CoordsUtilsResponse(Response): """Response model for genomic coordinates retrieval""" - coordinatesData: GenomicData | None + coordinates_data: GenomicData | None class SequenceIDResponse(Response): @@ -233,8 +233,8 @@ class ManeGeneTranscript(BaseModel): Ensembl_prot: str MANE_status: str GRCh38_chr: str - chr_start: str - chr_end: str + chr_start: int + chr_end: int chr_strand: str diff --git a/server/src/curfu/sequence_services.py b/server/src/curfu/sequence_services.py index a7a1585a..a16fad62 100644 --- a/server/src/curfu/sequence_services.py +++ b/server/src/curfu/sequence_services.py @@ -2,6 +2,8 @@ import logging +from cool_seq_tool.schemas import Strand + logger = logging.getLogger("curfu") logger.setLevel(logging.DEBUG) @@ -18,7 +20,7 @@ def get_strand(strand_input: str) -> int: :raises InvalidInputException: if strand arg is invalid """ if strand_input == "+": - return 1 + return Strand.POSITIVE if strand_input == "-": - return -1 + return Strand.NEGATIVE raise InvalidInputError