From 3376bf61ccf2bbff26707baa9042790a4933ac2e Mon Sep 17 00:00:00 2001 From: Manuel Holtgrewe Date: Wed, 20 Nov 2024 15:18:34 +0100 Subject: [PATCH] progress --- Makefile | 58 +- ext/dotty-api/src/lib/schemas.gen.ts | 231 - ext/viguno-api/openapi.yaml | 494 - .../src/lib/@tanstack/vue-query.gen.ts | 143 - ext/viguno-api/src/lib/schemas.gen.ts | 280 - ext/viguno-api/src/lib/services.gen.ts | 95 - ext/viguno-api/src/lib/types.gen.ts | 334 - openapi-ts.config.annonars.ts | 10 + openapi-ts.config.cadaPrio.ts | 4 +- openapi-ts.config.dotty.ts | 4 +- openapi-ts.config.mehari.ts | 10 + openapi-ts.config.variantValidator.ts | 4 +- openapi-ts.config.viguno.ts | 4 +- package-lock.json | 2 +- package.json | 2 +- src/api/mehari/client.ts | 2 +- .../GeneConditionsCard/GeneConditionsCard.vue | 197 +- .../GeneExpressionCard/GeneExpressionCard.vue | 12 +- .../GeneExpressionCard/constants.ts | 195 +- .../AlternativeIdentifiers.vue | 38 +- .../GeneOverviewCard/ExternalResources.vue | 23 +- .../GeneOverviewCard/GeneOverviewCard.vue | 39 +- src/components/GeneOverviewCard/GeneRifs.vue | 33 +- .../GeneOverviewCard/LocusDatabases.vue | 13 +- .../GenePathogenicityCard.vue | 51 +- .../GenePathogenicityCard/constants.ts | 67 +- .../SeqvarConsequencesCard.vue | 18 +- src/ext/annonars-api/openapi.yaml | 9960 +++++++++++++++++ .../src/lib/@tanstack/vue-query.gen.ts | 269 + .../ext/annonars-api}/src/lib/index.ts | 0 src/ext/annonars-api/src/lib/services.gen.ts | 119 + src/ext/annonars-api/src/lib/types.gen.ts | 7384 ++++++++++++ {ext => src/ext}/cadaPrio-api/openapi.yaml | 0 .../src/lib/@tanstack/vue-query.gen.ts | 0 .../ext}/cadaPrio-api/src/lib/index.ts | 0 .../ext}/cadaPrio-api/src/lib/schemas.gen.ts | 0 .../ext}/cadaPrio-api/src/lib/services.gen.ts | 0 .../ext}/cadaPrio-api/src/lib/types.gen.ts | 0 {ext => src/ext}/dotty-api/openapi.yaml | 0 .../src/lib/@tanstack/vue-query.gen.ts | 8 +- .../ext/dotty-api}/src/lib/index.ts | 1 - .../ext}/dotty-api/src/lib/services.gen.ts | 0 .../ext}/dotty-api/src/lib/types.gen.ts | 0 src/ext/mehari-api/openapi.yaml | 542 + .../src/lib/@tanstack/vue-query.gen.ts | 147 + src/ext/mehari-api/src/lib/index.ts | 3 + src/ext/mehari-api/src/lib/services.gen.ts | 36 + src/ext/mehari-api/src/lib/types.gen.ts | 325 + .../ext}/variantValidator-api/openapi.yaml | 4 +- .../src/lib/@tanstack/vue-query.gen.ts | 32 +- .../variantValidator-api}/src/lib/index.ts | 1 - .../src/lib/services.gen.ts | 0 .../variantValidator-api/src/lib/types.gen.ts | 0 src/ext/viguno-api/openapi.yaml | 832 ++ .../src/lib/@tanstack/vue-query.gen.ts | 128 + src/ext/viguno-api/src/lib/index.ts | 3 + src/ext/viguno-api/src/lib/services.gen.ts | 68 + src/ext/viguno-api/src/lib/types.gen.ts | 606 + src/queries/annonars/genes.ts | 52 + src/queries/annonars/seqvars.ts | 54 + src/queries/mehari/seqvars.ts | 58 + src/queries/viguno/genes.ts | 42 + src/stores/geneInfo/store.ts | 7 +- src/stores/seqvarInfo/store.ts | 6 +- 64 files changed, 21031 insertions(+), 2019 deletions(-) delete mode 100644 ext/dotty-api/src/lib/schemas.gen.ts delete mode 100644 ext/viguno-api/openapi.yaml delete mode 100644 ext/viguno-api/src/lib/@tanstack/vue-query.gen.ts delete mode 100644 ext/viguno-api/src/lib/schemas.gen.ts delete mode 100644 ext/viguno-api/src/lib/services.gen.ts delete mode 100644 ext/viguno-api/src/lib/types.gen.ts create mode 100644 openapi-ts.config.annonars.ts create mode 100644 openapi-ts.config.mehari.ts create mode 100644 src/ext/annonars-api/openapi.yaml create mode 100644 src/ext/annonars-api/src/lib/@tanstack/vue-query.gen.ts rename {ext/variantValidator-api => src/ext/annonars-api}/src/lib/index.ts (100%) create mode 100644 src/ext/annonars-api/src/lib/services.gen.ts create mode 100644 src/ext/annonars-api/src/lib/types.gen.ts rename {ext => src/ext}/cadaPrio-api/openapi.yaml (100%) rename {ext => src/ext}/cadaPrio-api/src/lib/@tanstack/vue-query.gen.ts (100%) rename {ext => src/ext}/cadaPrio-api/src/lib/index.ts (100%) rename {ext => src/ext}/cadaPrio-api/src/lib/schemas.gen.ts (100%) rename {ext => src/ext}/cadaPrio-api/src/lib/services.gen.ts (100%) rename {ext => src/ext}/cadaPrio-api/src/lib/types.gen.ts (100%) rename {ext => src/ext}/dotty-api/openapi.yaml (100%) rename {ext => src/ext}/dotty-api/src/lib/@tanstack/vue-query.gen.ts (92%) rename {ext/viguno-api => src/ext/dotty-api}/src/lib/index.ts (79%) rename {ext => src/ext}/dotty-api/src/lib/services.gen.ts (100%) rename {ext => src/ext}/dotty-api/src/lib/types.gen.ts (100%) create mode 100644 src/ext/mehari-api/openapi.yaml create mode 100644 src/ext/mehari-api/src/lib/@tanstack/vue-query.gen.ts create mode 100644 src/ext/mehari-api/src/lib/index.ts create mode 100644 src/ext/mehari-api/src/lib/services.gen.ts create mode 100644 src/ext/mehari-api/src/lib/types.gen.ts rename {ext => src/ext}/variantValidator-api/openapi.yaml (99%) rename {ext => src/ext}/variantValidator-api/src/lib/@tanstack/vue-query.gen.ts (90%) rename {ext/dotty-api => src/ext/variantValidator-api}/src/lib/index.ts (79%) rename {ext => src/ext}/variantValidator-api/src/lib/services.gen.ts (100%) rename {ext => src/ext}/variantValidator-api/src/lib/types.gen.ts (100%) create mode 100644 src/ext/viguno-api/openapi.yaml create mode 100644 src/ext/viguno-api/src/lib/@tanstack/vue-query.gen.ts create mode 100644 src/ext/viguno-api/src/lib/index.ts create mode 100644 src/ext/viguno-api/src/lib/services.gen.ts create mode 100644 src/ext/viguno-api/src/lib/types.gen.ts create mode 100644 src/queries/annonars/genes.ts create mode 100644 src/queries/annonars/seqvars.ts create mode 100644 src/queries/mehari/seqvars.ts create mode 100644 src/queries/viguno/genes.ts diff --git a/Makefile b/Makefile index 9816571..71c43ef 100644 --- a/Makefile +++ b/Makefile @@ -124,9 +124,9 @@ openapi: \ .PHONY: openapi-annonars-fetch openapi-annonars-fetch: - mkdir -p ext/annonars-api + mkdir -p src/ext/annonars-api - rm -f ext/annonars-api/openapi.yaml + rm -f src/ext/annonars-api/openapi.yaml docker pull ghcr.io/varfish-org/annonars:main docker run --rm -v $(PWD)/ext/annonars-api:/opt/annonars-api --entrypoint /usr/local/bin/annonars \ ghcr.io/varfish-org/annonars:main \ @@ -134,86 +134,86 @@ openapi-annonars-fetch: .PHONY: openapi-annonars-ts openapi-annonars-ts: openapi-annonars-fetch - rm -rf ext/annonars-api/src/lib - mkdir -p ext/annonars-api/src + rm -rf src/ext/annonars-api/src/lib + mkdir -p src/ext/annonars-api/src npx @hey-api/openapi-ts --file openapi-ts.config.annonars.ts .PHONY: openapi-mehari-fetch openapi-mehari-fetch: - mkdir -p ext/mehari-api + mkdir -p src/ext/mehari-api - rm -f ext/mehari-api/openapi.yaml + rm -f src/ext/mehari-api/openapi.yaml docker pull ghcr.io/varfish-org/mehari:main - docker run --rm -v $(PWD)/ext/mehari-api:/opt/mehari-api --entrypoint /usr/local/bin/mehari \ + docker run --rm -v $(PWD)/src/ext/mehari-api:/opt/mehari-api --entrypoint /usr/local/bin/mehari \ ghcr.io/varfish-org/mehari:main \ server schema --output-file /opt/mehari-api/openapi.yaml .PHONY: openapi-mehari-ts openapi-mehari-ts: openapi-mehari-fetch - rm -rf ext/mehari-api/src/lib - mkdir -p ext/mehari-api/src + rm -rf src/ext/mehari-api/src/lib + mkdir -p src/ext/mehari-api/src npx @hey-api/openapi-ts --file openapi-ts.config.mehari.ts .PHONY: openapi-cadaPrio-fetch openapi-cadaPrio-fetch: - mkdir -p ext/cadaPrio-api + mkdir -p src/ext/cadaPrio-api - rm -f ext/cadaPrio-api/openapi.yaml + rm -f src/ext/cadaPrio-api/openapi.yaml docker pull ghcr.io/bihealth/cada-prio:main docker run ghcr.io/bihealth/cada-prio:main cada-prio utils dump-openapi-yaml /dev/stdout \ | grep -v '^+' \ - > ext/cadaPrio-api/openapi.yaml + > src/ext/cadaPrio-api/openapi.yaml .PHONY: openapi-cadaPrio-ts openapi-cadaPrio-ts: openapi-cadaPrio-fetch - rm -rf ext/cadaPrio-api/src/lib - mkdir -p ext/cadaPrio-api/src + rm -rf src/ext/cadaPrio-api/src/lib + mkdir -p src/ext/cadaPrio-api/src npx @hey-api/openapi-ts --file openapi-ts.config.cadaPrio.ts .PHONY: openapi-dotty-fetch openapi-dotty-fetch: - mkdir -p ext/dotty-api + mkdir -p src/ext/dotty-api - rm -f ext/dotty-api/openapi.yaml + rm -f src/ext/dotty-api/openapi.yaml docker pull ghcr.io/bihealth/dotty:main docker run ghcr.io/bihealth/dotty:main python -m dotty.main \ | grep -v '^+' \ - > ext/dotty-api/openapi.yaml + > src/ext/dotty-api/openapi.yaml .PHONY: openapi-dotty-ts openapi-dotty-ts: openapi-dotty-fetch - rm -rf ext/dotty-api/src/lib - mkdir -p ext/dotty-api/src + rm -rf src/ext/dotty-api/src/lib + mkdir -p src/ext/dotty-api/src npx @hey-api/openapi-ts --file openapi-ts.config.dotty.ts .PHONY: openapi-variantValidator-fetch openapi-variantValidator-fetch: - mkdir -p ext/variantValidator-api + mkdir -p src/ext/variantValidator-api - rm -f ext/variantValidator-api/openapi.yaml - wget -O ext/variantValidator-api/openapi.yaml \ + rm -f src/ext/variantValidator-api/openapi.yaml + wget -O src/ext/variantValidator-api/openapi.yaml \ https://rest.variantvalidator.org/swagger.json .PHONY: openapi-variantValidator-ts openapi-variantValidator-ts: openapi-variantValidator-fetch - rm -rf ext/variantValidator-api/src/lib - mkdir -p ext/variantValidator-api/src + rm -rf src/ext/variantValidator-api/src/lib + mkdir -p src/ext/variantValidator-api/src npx @hey-api/openapi-ts --file openapi-ts.config.variantValidator.ts .PHONY: openapi-viguno-fetch openapi-viguno-fetch: - rm -rf ext/viguno-api/openapi.yaml - mkdir -p ext/viguno-api + rm -rf src/ext/viguno-api/openapi.yaml + mkdir -p src/ext/viguno-api docker pull ghcr.io/varfish-org/viguno:main docker run -t ghcr.io/varfish-org/viguno:main \ exec viguno server schema --output-file /dev/stdout \ | grep -v ' INFO' \ | grep -v '^+' \ - > ext/viguno-api/openapi.yaml + > src/ext/viguno-api/openapi.yaml .PHONY: openapi-viguno-ts openapi-viguno-ts: openapi-viguno-fetch - rm -rf ext/viguno-api/src/lib - mkdir -p ext/viguno-api/src + rm -rf src/ext/viguno-api/src/lib + mkdir -p src/ext/viguno-api/src npx @hey-api/openapi-ts --file openapi-ts.config.viguno.ts diff --git a/ext/dotty-api/src/lib/schemas.gen.ts b/ext/dotty-api/src/lib/schemas.gen.ts deleted file mode 100644 index 5fb57c5..0000000 --- a/ext/dotty-api/src/lib/schemas.gen.ts +++ /dev/null @@ -1,231 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -export const $Assembly = { - description: 'Enumeration for supported assemblies.', - enum: ['GRCh37', 'GRCh38'], - title: 'Assembly', - type: 'string' -} as const - -export const $ExonAlignment = { - description: 'Alignment of an exon to an assembly.', - properties: { - alignment: { - anyOf: [ - { - type: 'string' - }, - { - type: 'null' - } - ], - title: 'Alignment' - }, - exon_no: { - title: 'Exon No', - type: 'integer' - }, - ref_end: { - title: 'Ref End', - type: 'integer' - }, - ref_start: { - title: 'Ref Start', - type: 'integer' - }, - tx_end: { - title: 'Tx End', - type: 'integer' - }, - tx_start: { - title: 'Tx Start', - type: 'integer' - } - }, - required: ['ref_start', 'ref_end', 'exon_no', 'tx_start', 'tx_end', 'alignment'], - title: 'ExonAlignment', - type: 'object' -} as const - -export const $HTTPValidationError = { - properties: { - detail: { - items: { - $ref: '#/components/schemas/ValidationError' - }, - title: 'Detail', - type: 'array' - } - }, - title: 'HTTPValidationError', - type: 'object' -} as const - -export const $Spdi = { - description: 'SPDI representation of a variant.', - properties: { - alternate_inserted: { - title: 'Alternate Inserted', - type: 'string' - }, - assembly: { - title: 'Assembly', - type: 'string' - }, - contig: { - title: 'Contig', - type: 'string' - }, - pos: { - title: 'Pos', - type: 'integer' - }, - reference_deleted: { - title: 'Reference Deleted', - type: 'string' - } - }, - required: ['assembly', 'contig', 'pos', 'reference_deleted', 'alternate_inserted'], - title: 'Spdi', - type: 'object' -} as const - -export const $SpdiResult = { - description: 'The result of the query.', - properties: { - message: { - anyOf: [ - { - type: 'string' - }, - { - type: 'null' - } - ], - title: 'Message' - }, - success: { - title: 'Success', - type: 'boolean' - }, - value: { - anyOf: [ - { - $ref: '#/components/schemas/Spdi' - }, - { - type: 'null' - } - ] - } - }, - required: ['success'], - title: 'SpdiResult', - type: 'object' -} as const - -export const $TanscriptAlignment = { - description: 'Alignment of a `Transcript` to an assembly.', - properties: { - assembly: { - title: 'Assembly', - type: 'string' - }, - cds_end: { - title: 'Cds End', - type: 'integer' - }, - cds_start: { - title: 'Cds Start', - type: 'integer' - }, - contig: { - title: 'Contig', - type: 'string' - }, - exons: { - items: { - $ref: '#/components/schemas/ExonAlignment' - }, - title: 'Exons', - type: 'array' - } - }, - required: ['assembly', 'contig', 'cds_start', 'cds_end', 'exons'], - title: 'TanscriptAlignment', - type: 'object' -} as const - -export const $Transcript = { - description: 'Transcript model.', - properties: { - alignments: { - items: { - $ref: '#/components/schemas/TanscriptAlignment' - }, - title: 'Alignments', - type: 'array' - }, - hgnc_id: { - title: 'Hgnc Id', - type: 'string' - }, - hgnc_symbol: { - title: 'Hgnc Symbol', - type: 'string' - }, - id: { - title: 'Id', - type: 'string' - } - }, - required: ['id', 'hgnc_id', 'hgnc_symbol', 'alignments'], - title: 'Transcript', - type: 'object' -} as const - -export const $TranscriptResult = { - description: 'The result of the query for searching for transcripts.', - properties: { - transcripts: { - items: { - $ref: '#/components/schemas/Transcript' - }, - title: 'Transcripts', - type: 'array' - } - }, - required: ['transcripts'], - title: 'TranscriptResult', - type: 'object' -} as const - -export const $ValidationError = { - properties: { - loc: { - items: { - anyOf: [ - { - type: 'string' - }, - { - type: 'integer' - } - ] - }, - title: 'Location', - type: 'array' - }, - msg: { - title: 'Message', - type: 'string' - }, - type: { - title: 'Error Type', - type: 'string' - } - }, - required: ['loc', 'msg', 'type'], - title: 'ValidationError', - type: 'object' -} as const diff --git a/ext/viguno-api/openapi.yaml b/ext/viguno-api/openapi.yaml deleted file mode 100644 index 3ca0af3..0000000 --- a/ext/viguno-api/openapi.yaml +++ /dev/null @@ -1,494 +0,0 @@ -openapi: 3.0.3 -info: - title: viguno - description: Phenotype/disease for VarFish - contact: - name: Manuel Holtgrewe - email: manuel.holtgrewe@bih-charite.de - license: - name: Apache-2.0 - version: 0.3.2 -paths: - /hpo/genes: - get: - tags: - - hpo_genes - summary: Query for genes in the HPO database. - operationId: hpo_genes - parameters: - - name: gene_id - in: query - description: The gene ID to search for. - required: false - schema: - type: string - nullable: true - - name: gene_symbol - in: query - description: The gene symbol to search for. - required: false - schema: - type: string - nullable: true - - name: match_ - in: query - description: The match mode. - required: false - schema: - allOf: - - $ref: '#/components/schemas/Match' - nullable: true - - name: max_results - in: query - description: Maximal number of results to return. - required: false - schema: - type: integer - minimum: 0 - - name: hpo_terms - in: query - description: Whether to include HPO terms. - required: false - schema: - type: boolean - responses: - '200': - description: The query was successful. - content: - application/json: - schema: - $ref: '#/components/schemas/Result' - /hpo/omims: - get: - tags: - - hpo_omims - summary: Query for OMIM diseases in the HPO database. - operationId: hpo_omims - parameters: - - name: omim_id - in: query - description: The OMIM ID to search for. - required: false - schema: - type: string - nullable: true - - name: name - in: query - description: The disease name to search for. - required: false - schema: - type: string - nullable: true - - name: match_ - in: query - description: The match mode, default is `Match::Exact`. - required: false - schema: - allOf: - - $ref: '#/components/schemas/Match' - nullable: true - - name: ignore_case - in: query - description: Whether case is insentivie, default is `false`. - required: false - schema: - type: boolean - nullable: true - - name: max_results - in: query - description: Maximal number of results to return. - required: false - schema: - type: integer - minimum: 0 - - name: hpo_terms - in: query - description: Whether to include HPO terms. - required: false - schema: - type: boolean - responses: - '200': - description: The query was successful. - content: - application/json: - schema: - $ref: '#/components/schemas/Result' - /hpo/sim/term-gene: - get: - tags: - - hpo_sim::term_gene - summary: Query for similarity between a set of terms to each entry in a - description: list of genes. - operationId: hpo_sim_term_gene - parameters: - - name: terms - in: query - description: Set of terms to use as query. - required: true - schema: - type: array - items: - type: string - - name: gene_ids - in: query - description: The set of ids for genes to use as "database". - required: false - schema: - type: array - items: - type: string - nullable: true - - name: gene_symbols - in: query - description: The set of symbols for genes to use as "database". - required: false - schema: - type: array - items: - type: string - nullable: true - responses: - '200': - description: The query was successful. - content: - application/json: - schema: - $ref: '#/components/schemas/Result' - /hpo/sim/term-term: - get: - tags: - - hpo_sim::term_term - summary: Query for pairwise term similarity. - description: |- - In the case of Resnik, this corresponds to `IC(MICA(t_1, t_2))`. - - # Errors - - In the case that there is an error running the server. - operationId: hpo_sim_term_term - parameters: - - name: lhs - in: query - description: The one set of HPO terms to compute similarity for. - required: true - schema: - type: array - items: - type: string - - name: rhs - in: query - description: The second set of HPO terms to compute similarity for. - required: true - schema: - type: array - items: - type: string - - name: ic_base - in: query - description: What should information content be based on. - required: false - schema: - $ref: '#/components/schemas/IcBasedOn' - - name: similarity - in: query - description: The similarity method to use. - required: false - schema: - $ref: '#/components/schemas/SimilarityMethod' - - name: combiner - in: query - description: The score combiner. - required: false - schema: - $ref: '#/components/schemas/ScoreCombiner' - responses: - '200': - description: The query was successful. - content: - application/json: - schema: - $ref: '#/components/schemas/Result' - /hpo/terms: - get: - tags: - - hpo_terms - summary: Query for terms in the HPO database. - description: |- - # Errors - - In the case that there is an error running the server. - operationId: hpo_terms - parameters: - - name: term_id - in: query - description: The term ID to search for. - required: false - schema: - type: string - nullable: true - - name: name - in: query - description: The term name to search for. - required: false - schema: - type: string - nullable: true - - name: max_results - in: query - description: Maximal number of results to return. - required: false - schema: - type: integer - minimum: 0 - - name: genes - in: query - description: Whether to include genes. - required: false - schema: - type: boolean - responses: - '200': - description: The query was successful. - content: - application/json: - schema: - $ref: '#/components/schemas/Result' -components: - schemas: - HpoTerm: - type: object - description: Struct for loading an HPO term from JSON. - required: - - term_id - properties: - term_id: - type: string - description: The term ID. - term_name: - type: string - description: The term name (optional). - nullable: true - IcBasedOn: - type: string - description: |- - Enum for representing the information content kind. - - We replicate what is in the `hpo` create so we can put them on the command line and use - them in HTTP queries more easily. - enum: - - gene - - omim - Match: - type: string - description: Specify how to perform query matches in the API calls. - enum: - - exact - - prefix - - suffix - - contains - Query: - type: object - title: HpoSimTermGeneQuery - description: |- - Parameters for `handle`. - - This allows to compute differences between - - - `terms` -- set of terms to use as query - - `gene_ids` -- set of ids for genes to use as "database", can be NCBI\ - gene ID or HGNC gene ID. - - `gene_symbols` -- set of symbols for genes to use as - "database" - required: - - terms - properties: - terms: - type: array - items: - type: string - description: Set of terms to use as query. - gene_ids: - type: array - items: - type: string - description: The set of ids for genes to use as "database". - nullable: true - gene_symbols: - type: array - items: - type: string - description: The set of symbols for genes to use as "database". - nullable: true - ResponseQuery: - type: object - title: HpoSimTermTermQuery - description: |- - Request as sent together with the response. - - The difference is that the `lhs` and `rhs` fields are replaced by vecs. - required: - - lhs - - rhs - properties: - lhs: - type: array - items: - type: string - description: The one set of HPO terms to compute similarity for. - rhs: - type: array - items: - type: string - description: The second set of HPO terms to compute similarity for. - ic_base: - $ref: '#/components/schemas/IcBasedOn' - similarity: - $ref: '#/components/schemas/SimilarityMethod' - combiner: - $ref: '#/components/schemas/ScoreCombiner' - Result: - type: object - title: HpoSimTermTermResult - description: Result container. - required: - - version - - query - - result - properties: - version: - $ref: '#/components/schemas/Version' - query: - $ref: '#/components/schemas/ResponseQuery' - result: - type: array - items: - $ref: '#/components/schemas/ResultEntry' - description: The resulting records for the scored genes. - ResultEntry: - type: object - title: HpoSimTermTermResultEntry - description: Result entry for `handle`. - required: - - lhs - - rhs - - score - properties: - lhs: - type: string - description: The lhs entry. - rhs: - type: string - description: The rhs entry. - score: - type: number - format: float - description: The similarity score. - ResultGene: - type: object - description: Representation of a gene. - required: - - ncbi_gene_id - - gene_symbol - properties: - ncbi_gene_id: - type: integer - format: int32 - description: The HPO ID. - minimum: 0 - gene_symbol: - type: string - description: The description. - hgnc_id: - type: string - description: The HGNC ID. - nullable: true - ResultHpoTerm: - type: object - description: Representation of an HPO term. - required: - - term_id - - name - properties: - term_id: - type: string - description: The HPO ID. - name: - type: string - description: The term name. - Result_: - type: object - title: HpoTermsResult - description: Container for the result. - required: - - version - - query - - result - properties: - version: - $ref: '#/components/schemas/Version' - query: - $ref: '#/components/schemas/Query' - result: - type: array - items: - $ref: '#/components/schemas/ResultEntry' - description: The resulting records for the scored genes. - ScoreCombiner: - type: string - description: |- - Representation of the standard combiners from HPO. - - We replicate what is in the `hpo` create so we can put them on the command line and use - them in HTTP queries more easily. - enum: - - fun-sim-avg - - fun-sim-max - - bma - SimilarityMethod: - type: string - description: |- - Enum for representing similarity method to use. - - We replicate what is in the `hpo` create so we can put them on the command line and use - them in HTTP queries more easily. - enum: - - distance-gene - - graph-ic - - information-coefficient - - jc - - lin - - mutation - - relevance - - resnik - TermDetails: - type: object - title: HpoSimTermGeneTermDetails - description: Detailed term scores. - required: - - term_gene - - score - properties: - term_query: - allOf: - - $ref: '#/components/schemas/HpoTerm' - nullable: true - term_gene: - $ref: '#/components/schemas/HpoTerm' - score: - type: number - format: float - description: The similarity score. - Version: - type: object - description: Version information that is returned by the HTTP server. - required: - - hpo - - viguno - properties: - hpo: - type: string - description: Version of the HPO. - viguno: - type: string - description: Version of the `viguno` package. diff --git a/ext/viguno-api/src/lib/@tanstack/vue-query.gen.ts b/ext/viguno-api/src/lib/@tanstack/vue-query.gen.ts deleted file mode 100644 index 796f718..0000000 --- a/ext/viguno-api/src/lib/@tanstack/vue-query.gen.ts +++ /dev/null @@ -1,143 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts -import type { Options } from '@hey-api/client-fetch' -import { queryOptions } from '@tanstack/vue-query' - -import { - client, - hpoGenes, - hpoOmims, - hpoSimTermGene, - hpoSimTermTerm, - hpoTerms -} from '../services.gen' -import type { - HpoGenesData, - HpoOmimsData, - HpoSimTermGeneData, - HpoSimTermTermData, - HpoTermsData -} from '../types.gen' - -type QueryKey = [ - Pick & { - _id: string - _infinite?: boolean - } -] - -const createQueryKey = ( - id: string, - options?: TOptions, - infinite?: boolean -): QueryKey[0] => { - const params: QueryKey[0] = { - _id: id, - baseUrl: client.getConfig().baseUrl - } as QueryKey[0] - if (infinite) { - params._infinite = infinite - } - if (options?.body) { - params.body = options.body - } - if (options?.headers) { - params.headers = options.headers - } - if (options?.path) { - params.path = options.path - } - if (options?.query) { - params.query = options.query - } - return params -} - -export const hpoGenesQueryKey = (options?: Options) => [ - createQueryKey('hpoGenes', options) -] - -export const hpoGenesOptions = (options?: Options) => { - return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await hpoGenes({ - ...options, - ...queryKey[0], - throwOnError: true - }) - return data - }, - queryKey: hpoGenesQueryKey(options) - }) -} - -export const hpoOmimsQueryKey = (options?: Options) => [ - createQueryKey('hpoOmims', options) -] - -export const hpoOmimsOptions = (options?: Options) => { - return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await hpoOmims({ - ...options, - ...queryKey[0], - throwOnError: true - }) - return data - }, - queryKey: hpoOmimsQueryKey(options) - }) -} - -export const hpoSimTermGeneQueryKey = (options: Options) => [ - createQueryKey('hpoSimTermGene', options) -] - -export const hpoSimTermGeneOptions = (options: Options) => { - return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await hpoSimTermGene({ - ...options, - ...queryKey[0], - throwOnError: true - }) - return data - }, - queryKey: hpoSimTermGeneQueryKey(options) - }) -} - -export const hpoSimTermTermQueryKey = (options: Options) => [ - createQueryKey('hpoSimTermTerm', options) -] - -export const hpoSimTermTermOptions = (options: Options) => { - return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await hpoSimTermTerm({ - ...options, - ...queryKey[0], - throwOnError: true - }) - return data - }, - queryKey: hpoSimTermTermQueryKey(options) - }) -} - -export const hpoTermsQueryKey = (options?: Options) => [ - createQueryKey('hpoTerms', options) -] - -export const hpoTermsOptions = (options?: Options) => { - return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await hpoTerms({ - ...options, - ...queryKey[0], - throwOnError: true - }) - return data - }, - queryKey: hpoTermsQueryKey(options) - }) -} diff --git a/ext/viguno-api/src/lib/schemas.gen.ts b/ext/viguno-api/src/lib/schemas.gen.ts deleted file mode 100644 index e746c6b..0000000 --- a/ext/viguno-api/src/lib/schemas.gen.ts +++ /dev/null @@ -1,280 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -export const $HpoTerm = { - type: 'object', - description: 'Struct for loading an HPO term from JSON.', - required: ['term_id'], - properties: { - term_id: { - type: 'string', - description: 'The term ID.' - }, - term_name: { - type: 'string', - description: 'The term name (optional).', - nullable: true - } - } -} as const - -export const $IcBasedOn = { - type: 'string', - description: `Enum for representing the information content kind. - -We replicate what is in the \`hpo\` create so we can put them on the command line and use -them in HTTP queries more easily.`, - enum: ['gene', 'omim'] -} as const - -export const $Match = { - type: 'string', - description: 'Specify how to perform query matches in the API calls.', - enum: ['exact', 'prefix', 'suffix', 'contains'] -} as const - -export const $Query = { - type: 'object', - title: 'HpoSimTermGeneQuery', - description: `Parameters for \`handle\`. - -This allows to compute differences between - -- \`terms\` -- set of terms to use as query -- \`gene_ids\` -- set of ids for genes to use as "database", can be NCBI\ -gene ID or HGNC gene ID. -- \`gene_symbols\` -- set of symbols for genes to use as -"database"`, - required: ['terms'], - properties: { - terms: { - type: 'array', - items: { - type: 'string' - }, - description: 'Set of terms to use as query.' - }, - gene_ids: { - type: 'array', - items: { - type: 'string' - }, - description: 'The set of ids for genes to use as "database".', - nullable: true - }, - gene_symbols: { - type: 'array', - items: { - type: 'string' - }, - description: 'The set of symbols for genes to use as "database".', - nullable: true - } - } -} as const - -export const $ResponseQuery = { - type: 'object', - title: 'HpoSimTermTermQuery', - description: `Request as sent together with the response. - -The difference is that the \`lhs\` and \`rhs\` fields are replaced by vecs.`, - required: ['lhs', 'rhs'], - properties: { - lhs: { - type: 'array', - items: { - type: 'string' - }, - description: 'The one set of HPO terms to compute similarity for.' - }, - rhs: { - type: 'array', - items: { - type: 'string' - }, - description: 'The second set of HPO terms to compute similarity for.' - }, - ic_base: { - $ref: '#/components/schemas/IcBasedOn' - }, - similarity: { - $ref: '#/components/schemas/SimilarityMethod' - }, - combiner: { - $ref: '#/components/schemas/ScoreCombiner' - } - } -} as const - -export const $Result = { - type: 'object', - title: 'HpoSimTermTermResult', - description: 'Result container.', - required: ['version', 'query', 'result'], - properties: { - version: { - $ref: '#/components/schemas/Version' - }, - query: { - $ref: '#/components/schemas/ResponseQuery' - }, - result: { - type: 'array', - items: { - $ref: '#/components/schemas/ResultEntry' - }, - description: 'The resulting records for the scored genes.' - } - } -} as const - -export const $ResultEntry = { - type: 'object', - title: 'HpoSimTermTermResultEntry', - description: 'Result entry for `handle`.', - required: ['lhs', 'rhs', 'score'], - properties: { - lhs: { - type: 'string', - description: 'The lhs entry.' - }, - rhs: { - type: 'string', - description: 'The rhs entry.' - }, - score: { - type: 'number', - format: 'float', - description: 'The similarity score.' - } - } -} as const - -export const $ResultGene = { - type: 'object', - description: 'Representation of a gene.', - required: ['ncbi_gene_id', 'gene_symbol'], - properties: { - ncbi_gene_id: { - type: 'integer', - format: 'int32', - description: 'The HPO ID.', - minimum: 0 - }, - gene_symbol: { - type: 'string', - description: 'The description.' - }, - hgnc_id: { - type: 'string', - description: 'The HGNC ID.', - nullable: true - } - } -} as const - -export const $ResultHpoTerm = { - type: 'object', - description: 'Representation of an HPO term.', - required: ['term_id', 'name'], - properties: { - term_id: { - type: 'string', - description: 'The HPO ID.' - }, - name: { - type: 'string', - description: 'The term name.' - } - } -} as const - -export const $Result_ = { - type: 'object', - title: 'HpoTermsResult', - description: 'Container for the result.', - required: ['version', 'query', 'result'], - properties: { - version: { - $ref: '#/components/schemas/Version' - }, - query: { - $ref: '#/components/schemas/Query' - }, - result: { - type: 'array', - items: { - $ref: '#/components/schemas/ResultEntry' - }, - description: 'The resulting records for the scored genes.' - } - } -} as const - -export const $ScoreCombiner = { - type: 'string', - description: `Representation of the standard combiners from HPO. - -We replicate what is in the \`hpo\` create so we can put them on the command line and use -them in HTTP queries more easily.`, - enum: ['fun-sim-avg', 'fun-sim-max', 'bma'] -} as const - -export const $SimilarityMethod = { - type: 'string', - description: `Enum for representing similarity method to use. - -We replicate what is in the \`hpo\` create so we can put them on the command line and use -them in HTTP queries more easily.`, - enum: [ - 'distance-gene', - 'graph-ic', - 'information-coefficient', - 'jc', - 'lin', - 'mutation', - 'relevance', - 'resnik' - ] -} as const - -export const $TermDetails = { - type: 'object', - title: 'HpoSimTermGeneTermDetails', - description: 'Detailed term scores.', - required: ['term_gene', 'score'], - properties: { - term_query: { - allOf: [ - { - $ref: '#/components/schemas/HpoTerm' - } - ], - nullable: true - }, - term_gene: { - $ref: '#/components/schemas/HpoTerm' - }, - score: { - type: 'number', - format: 'float', - description: 'The similarity score.' - } - } -} as const - -export const $Version = { - type: 'object', - description: 'Version information that is returned by the HTTP server.', - required: ['hpo', 'viguno'], - properties: { - hpo: { - type: 'string', - description: 'Version of the HPO.' - }, - viguno: { - type: 'string', - description: 'Version of the `viguno` package.' - } - } -} as const diff --git a/ext/viguno-api/src/lib/services.gen.ts b/ext/viguno-api/src/lib/services.gen.ts deleted file mode 100644 index 39c06f1..0000000 --- a/ext/viguno-api/src/lib/services.gen.ts +++ /dev/null @@ -1,95 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts -import { type Options, createClient, createConfig } from '@hey-api/client-fetch' - -import type { - HpoGenesData, - HpoGenesError, - HpoGenesResponse, - HpoOmimsData, - HpoOmimsError, - HpoOmimsResponse, - HpoSimTermGeneData, - HpoSimTermGeneError, - HpoSimTermGeneResponse, - HpoSimTermTermData, - HpoSimTermTermError, - HpoSimTermTermResponse, - HpoTermsData, - HpoTermsError, - HpoTermsResponse -} from './types.gen' - -export const client = createClient(createConfig()) - -/** - * Query for genes in the HPO database. - */ -export const hpoGenes = ( - options?: Options -) => { - return (options?.client ?? client).get({ - ...options, - url: '/hpo/genes' - }) -} - -/** - * Query for OMIM diseases in the HPO database. - */ -export const hpoOmims = ( - options?: Options -) => { - return (options?.client ?? client).get({ - ...options, - url: '/hpo/omims' - }) -} - -/** - * Query for similarity between a set of terms to each entry in a - * list of genes. - */ -export const hpoSimTermGene = ( - options: Options -) => { - return (options?.client ?? client).get( - { - ...options, - url: '/hpo/sim/term-gene' - } - ) -} - -/** - * Query for pairwise term similarity. - * In the case of Resnik, this corresponds to `IC(MICA(t_1, t_2))`. - * - * # Errors - * - * In the case that there is an error running the server. - */ -export const hpoSimTermTerm = ( - options: Options -) => { - return (options?.client ?? client).get( - { - ...options, - url: '/hpo/sim/term-term' - } - ) -} - -/** - * Query for terms in the HPO database. - * # Errors - * - * In the case that there is an error running the server. - */ -export const hpoTerms = ( - options?: Options -) => { - return (options?.client ?? client).get({ - ...options, - url: '/hpo/terms' - }) -} diff --git a/ext/viguno-api/src/lib/types.gen.ts b/ext/viguno-api/src/lib/types.gen.ts deleted file mode 100644 index 771c218..0000000 --- a/ext/viguno-api/src/lib/types.gen.ts +++ /dev/null @@ -1,334 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -/** - * Struct for loading an HPO term from JSON. - */ -export type HpoTerm = { - /** - * The term ID. - */ - term_id: string - /** - * The term name (optional). - */ - term_name?: string | null -} - -/** - * Enum for representing the information content kind. - * - * We replicate what is in the `hpo` create so we can put them on the command line and use - * them in HTTP queries more easily. - */ -export type IcBasedOn = 'gene' | 'omim' - -/** - * Specify how to perform query matches in the API calls. - */ -export type Match = 'exact' | 'prefix' | 'suffix' | 'contains' - -/** - * Parameters for `handle`. - * - * This allows to compute differences between - * - * - `terms` -- set of terms to use as query - * - `gene_ids` -- set of ids for genes to use as "database", can be NCBI\ - * gene ID or HGNC gene ID. - * - `gene_symbols` -- set of symbols for genes to use as - * "database" - */ -export type Query = { - /** - * Set of terms to use as query. - */ - terms: Array - /** - * The set of ids for genes to use as "database". - */ - gene_ids?: Array | null - /** - * The set of symbols for genes to use as "database". - */ - gene_symbols?: Array | null -} - -/** - * Request as sent together with the response. - * - * The difference is that the `lhs` and `rhs` fields are replaced by vecs. - */ -export type ResponseQuery = { - /** - * The one set of HPO terms to compute similarity for. - */ - lhs: Array - /** - * The second set of HPO terms to compute similarity for. - */ - rhs: Array - ic_base?: IcBasedOn - similarity?: SimilarityMethod - combiner?: ScoreCombiner -} - -/** - * Result container. - */ -export type Result = { - version: Version - query: ResponseQuery - /** - * The resulting records for the scored genes. - */ - result: Array -} - -/** - * Result entry for `handle`. - */ -export type ResultEntry = { - /** - * The lhs entry. - */ - lhs: string - /** - * The rhs entry. - */ - rhs: string - /** - * The similarity score. - */ - score: number -} - -/** - * Representation of a gene. - */ -export type ResultGene = { - /** - * The HPO ID. - */ - ncbi_gene_id: number - /** - * The description. - */ - gene_symbol: string - /** - * The HGNC ID. - */ - hgnc_id?: string | null -} - -/** - * Representation of an HPO term. - */ -export type ResultHpoTerm = { - /** - * The HPO ID. - */ - term_id: string - /** - * The term name. - */ - name: string -} - -/** - * Container for the result. - */ -export type Result_ = { - version: Version - query: Query - /** - * The resulting records for the scored genes. - */ - result: Array -} - -/** - * Representation of the standard combiners from HPO. - * - * We replicate what is in the `hpo` create so we can put them on the command line and use - * them in HTTP queries more easily. - */ -export type ScoreCombiner = 'fun-sim-avg' | 'fun-sim-max' | 'bma' - -/** - * Enum for representing similarity method to use. - * - * We replicate what is in the `hpo` create so we can put them on the command line and use - * them in HTTP queries more easily. - */ -export type SimilarityMethod = - | 'distance-gene' - | 'graph-ic' - | 'information-coefficient' - | 'jc' - | 'lin' - | 'mutation' - | 'relevance' - | 'resnik' - -/** - * Detailed term scores. - */ -export type TermDetails = { - term_query?: HpoTerm | null - term_gene: HpoTerm - /** - * The similarity score. - */ - score: number -} - -/** - * Version information that is returned by the HTTP server. - */ -export type Version = { - /** - * Version of the HPO. - */ - hpo: string - /** - * Version of the `viguno` package. - */ - viguno: string -} - -export type HpoGenesData = { - query?: { - /** - * The gene ID to search for. - */ - gene_id?: string | null - /** - * The gene symbol to search for. - */ - gene_symbol?: string | null - /** - * Whether to include HPO terms. - */ - hpo_terms?: boolean - /** - * The match mode. - */ - match_?: Match | null - /** - * Maximal number of results to return. - */ - max_results?: number - } -} - -export type HpoGenesResponse = Result - -export type HpoGenesError = unknown - -export type HpoOmimsData = { - query?: { - /** - * Whether to include HPO terms. - */ - hpo_terms?: boolean - /** - * Whether case is insentivie, default is `false`. - */ - ignore_case?: boolean | null - /** - * The match mode, default is `Match::Exact`. - */ - match_?: Match | null - /** - * Maximal number of results to return. - */ - max_results?: number - /** - * The disease name to search for. - */ - name?: string | null - /** - * The OMIM ID to search for. - */ - omim_id?: string | null - } -} - -export type HpoOmimsResponse = Result - -export type HpoOmimsError = unknown - -export type HpoSimTermGeneData = { - query: { - /** - * The set of ids for genes to use as "database". - */ - gene_ids?: Array | null - /** - * The set of symbols for genes to use as "database". - */ - gene_symbols?: Array | null - /** - * Set of terms to use as query. - */ - terms: Array - } -} - -export type HpoSimTermGeneResponse = Result - -export type HpoSimTermGeneError = unknown - -export type HpoSimTermTermData = { - query: { - /** - * The score combiner. - */ - combiner?: ScoreCombiner - /** - * What should information content be based on. - */ - ic_base?: IcBasedOn - /** - * The one set of HPO terms to compute similarity for. - */ - lhs: Array - /** - * The second set of HPO terms to compute similarity for. - */ - rhs: Array - /** - * The similarity method to use. - */ - similarity?: SimilarityMethod - } -} - -export type HpoSimTermTermResponse = Result - -export type HpoSimTermTermError = unknown - -export type HpoTermsData = { - query?: { - /** - * Whether to include genes. - */ - genes?: boolean - /** - * Maximal number of results to return. - */ - max_results?: number - /** - * The term name to search for. - */ - name?: string | null - /** - * The term ID to search for. - */ - term_id?: string | null - } -} - -export type HpoTermsResponse = Result - -export type HpoTermsError = unknown diff --git a/openapi-ts.config.annonars.ts b/openapi-ts.config.annonars.ts new file mode 100644 index 0000000..dcd761c --- /dev/null +++ b/openapi-ts.config.annonars.ts @@ -0,0 +1,10 @@ +import { defineConfig } from '@hey-api/openapi-ts'; + +export default defineConfig({ + client: '@hey-api/client-fetch', + input: 'src/ext/annonars-api/openapi.yaml', + output: 'src/ext/annonars-api/src/lib', + plugins: [ + '@tanstack/vue-query' + ] +}); diff --git a/openapi-ts.config.cadaPrio.ts b/openapi-ts.config.cadaPrio.ts index b7b498a..7468742 100644 --- a/openapi-ts.config.cadaPrio.ts +++ b/openapi-ts.config.cadaPrio.ts @@ -2,8 +2,8 @@ import { defineConfig } from '@hey-api/openapi-ts'; export default defineConfig({ client: '@hey-api/client-fetch', - input: 'ext/cadaPrio-api/openapi.yaml', - output: 'ext/cadaPrio-api/src/lib', + input: 'src/ext/cadaPrio-api/openapi.yaml', + output: 'src/ext/cadaPrio-api/src/lib', plugins: [ '@tanstack/vue-query' ] diff --git a/openapi-ts.config.dotty.ts b/openapi-ts.config.dotty.ts index 6c47dc6..f4256af 100644 --- a/openapi-ts.config.dotty.ts +++ b/openapi-ts.config.dotty.ts @@ -2,8 +2,8 @@ import { defineConfig } from '@hey-api/openapi-ts'; export default defineConfig({ client: '@hey-api/client-fetch', - input: 'ext/dotty-api/openapi.yaml', - output: 'ext/dotty-api/src/lib', + input: 'src/ext/dotty-api/openapi.yaml', + output: 'src/ext/dotty-api/src/lib', plugins: [ '@tanstack/vue-query' ] diff --git a/openapi-ts.config.mehari.ts b/openapi-ts.config.mehari.ts new file mode 100644 index 0000000..d5ad2d8 --- /dev/null +++ b/openapi-ts.config.mehari.ts @@ -0,0 +1,10 @@ +import { defineConfig } from '@hey-api/openapi-ts'; + +export default defineConfig({ + client: '@hey-api/client-fetch', + input: 'src/ext/mehari-api/openapi.yaml', + output: 'src/ext/mehari-api/src/lib', + plugins: [ + '@tanstack/vue-query' + ] +}); diff --git a/openapi-ts.config.variantValidator.ts b/openapi-ts.config.variantValidator.ts index 1b23e5f..aa937f9 100644 --- a/openapi-ts.config.variantValidator.ts +++ b/openapi-ts.config.variantValidator.ts @@ -2,8 +2,8 @@ import { defineConfig } from '@hey-api/openapi-ts'; export default defineConfig({ client: '@hey-api/client-fetch', - input: 'ext/variantValidator-api/openapi.yaml', - output: 'ext/variantValidator-api/src/lib', + input: 'src/ext/variantValidator-api/openapi.yaml', + output: 'src/ext/variantValidator-api/src/lib', plugins: [ '@tanstack/vue-query' ] diff --git a/openapi-ts.config.viguno.ts b/openapi-ts.config.viguno.ts index 52202d9..c41f8f8 100644 --- a/openapi-ts.config.viguno.ts +++ b/openapi-ts.config.viguno.ts @@ -2,8 +2,8 @@ import { defineConfig } from '@hey-api/openapi-ts'; export default defineConfig({ client: '@hey-api/client-fetch', - input: 'ext/viguno-api/openapi.yaml', - output: 'ext/viguno-api/src/lib', + input: 'src/ext/viguno-api/openapi.yaml', + output: 'src/ext/viguno-api/src/lib', plugins: [ '@tanstack/vue-query' ] diff --git a/package-lock.json b/package-lock.json index fd6fef5..cadf213 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,7 +28,7 @@ "vuetify": "^3.5.7" }, "devDependencies": { - "@hey-api/openapi-ts": "^0.54.0", + "@hey-api/openapi-ts": "^0.54.4", "@pinia/testing": "^0.1.3", "@protobuf-ts/plugin": "^2.9.3", "@rushstack/eslint-patch": "^1.7.2", diff --git a/package.json b/package.json index 778de44..6abca9c 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "vuetify": "^3.5.7" }, "devDependencies": { - "@hey-api/openapi-ts": "^0.54.0", + "@hey-api/openapi-ts": "^0.54.4", "@pinia/testing": "^0.1.3", "@protobuf-ts/plugin": "^2.9.3", "@rushstack/eslint-patch": "^1.7.2", diff --git a/src/api/mehari/client.ts b/src/api/mehari/client.ts index 21c5252..de79408 100644 --- a/src/api/mehari/client.ts +++ b/src/api/mehari/client.ts @@ -132,7 +132,7 @@ export class MehariClient { } try { const responseJson = await response.json() - return GeneTranscriptsResponse.fromJson(responseJson) + return GeneTranscriptsResponse.fromJson(responseJson, { ignoreUnknownFields: true }) } catch (e) { throw new InvalidResponseContent(`Failed to parse transcript response: ${e}`) } diff --git a/src/components/GeneConditionsCard/GeneConditionsCard.vue b/src/components/GeneConditionsCard/GeneConditionsCard.vue index f392f68..873cee3 100644 --- a/src/components/GeneConditionsCard/GeneConditionsCard.vue +++ b/src/components/GeneConditionsCard/GeneConditionsCard.vue @@ -2,29 +2,19 @@ import { titleCase } from 'title-case' import { computed, onMounted, ref, useSlots, watch } from 'vue' -import type { HpoTerm } from '../../api/viguno/types' -import { - ConditionsRecord, - ConditionsRecord_GeneDiseaseAssociation, - ConditionsRecord_GeneDiseaseAssociationEntry_ConfidenceLevel, - ConditionsRecord_GeneDiseaseAssociationEntry_GeneDiseaseAssociationSource, - ConditionsRecord_PanelappAssociation, - ConditionsRecord_PanelappAssociation_PanelappConfidence, - Record as GeneInfoRecord, - PanelAppRecord_ConfidenceLevel -} from '../../pbs/annonars/genes/base' import DocsLink from '../DocsLink/DocsLink.vue' +import { GenesConditionsRecord, GenesDiseaseAssociation, GenesDiseaseAssociationEntryConfidenceLevel, GenesDiseaseAssociationSource, GenesGeneInfoRecord, GenesPanelappAssociation, GenesPanelappAssociationConfidenceLevel, GenesPanelappRecordConfidenceLevel } from '@/ext/annonars-api/src/lib' +import { ResultHpoTerm } from '@/ext/viguno-api/src/lib' /** This component's props. */ const props = withDefaults( defineProps<{ /** The gene information record. */ - geneInfo?: GeneInfoRecord + geneInfo?: GenesGeneInfoRecord /** The HPO terms to display. */ - hpoTerms?: HpoTerm[] + hpoTerms?: ResultHpoTerm[] }>(), { - geneInfo: undefined, hpoTerms: () => [] } ) @@ -54,7 +44,7 @@ const maxHpoTerms = 20 const showAllHpoTerms = ref(false) /** The HPO terms to show. */ -const hpoTermsToShow = computed(() => { +const hpoTermsToShow = computed(() => { if (showAllHpoTerms.value ?? !props.hpoTerms) { return props.hpoTerms ?? [] } else { @@ -65,55 +55,50 @@ const hpoTermsToShow = computed(() => { // -- code for integrated conditions ----------------------------------------- const GDA_LABELS: { - [key in ConditionsRecord_GeneDiseaseAssociationEntry_GeneDiseaseAssociationSource]: string + [key in GenesDiseaseAssociationSource]: string } = { - [ConditionsRecord_GeneDiseaseAssociationEntry_GeneDiseaseAssociationSource.GENE_DISEASE_ASSOCIATION_SOURCE_OMIM]: + 'Omim': 'OMIM', - [ConditionsRecord_GeneDiseaseAssociationEntry_GeneDiseaseAssociationSource.GENE_DISEASE_ASSOCIATION_SOURCE_ORPHANET]: + 'Orphanet': 'Orphanet', - [ConditionsRecord_GeneDiseaseAssociationEntry_GeneDiseaseAssociationSource.GENE_DISEASE_ASSOCIATION_SOURCE_PANELAPP]: + 'Panelapp': 'PanelApp', - [ConditionsRecord_GeneDiseaseAssociationEntry_GeneDiseaseAssociationSource.GENE_DISEASE_ASSOCIATION_SOURCE_UNKNOWN]: - 'Unknown' } const CONFIDENCE_LEVEL_LABELS: { - [key in ConditionsRecord_GeneDiseaseAssociationEntry_ConfidenceLevel]: string + [key in GenesDiseaseAssociationEntryConfidenceLevel]: string } = { - [ConditionsRecord_GeneDiseaseAssociationEntry_ConfidenceLevel.CONFIDENCE_LEVEL_HIGH]: 'High', - [ConditionsRecord_GeneDiseaseAssociationEntry_ConfidenceLevel.CONFIDENCE_LEVEL_MEDIUM]: 'Medium', - [ConditionsRecord_GeneDiseaseAssociationEntry_ConfidenceLevel.CONFIDENCE_LEVEL_LOW]: 'Low', - [ConditionsRecord_GeneDiseaseAssociationEntry_ConfidenceLevel.CONFIDENCE_LEVEL_UNKNOWN]: 'Unknown' + 'High': 'High', + 'Medium': 'Medium', + 'Low': 'Low', } const PANELAPP_CONFIDENCE_LABELS: { - [key in ConditionsRecord_PanelappAssociation_PanelappConfidence]: string + [key in GenesPanelappAssociationConfidenceLevel]: string } = { - [ConditionsRecord_PanelappAssociation_PanelappConfidence.PANELAPP_CONFIDENCE_GREEN]: 'Green', - [ConditionsRecord_PanelappAssociation_PanelappConfidence.PANELAPP_CONFIDENCE_AMBER]: 'Amber', - [ConditionsRecord_PanelappAssociation_PanelappConfidence.PANELAPP_CONFIDENCE_RED]: 'Red', - [ConditionsRecord_PanelappAssociation_PanelappConfidence.PANELAPP_CONFIDENCE_UNKNOWN]: 'Unknown', - [ConditionsRecord_PanelappAssociation_PanelappConfidence.PANELAPP_CONFIDENCE_NONE]: 'None' + 'Green': 'Green', + 'Amber': 'Amber', + 'Red': 'Red', + 'None': 'None' } const PANELAPP_CONFIDENCE_ORDER: { - [key in ConditionsRecord_PanelappAssociation_PanelappConfidence]: number + [key in GenesPanelappAssociationConfidenceLevel]: number } = { - [ConditionsRecord_PanelappAssociation_PanelappConfidence.PANELAPP_CONFIDENCE_GREEN]: 0, - [ConditionsRecord_PanelappAssociation_PanelappConfidence.PANELAPP_CONFIDENCE_AMBER]: 1, - [ConditionsRecord_PanelappAssociation_PanelappConfidence.PANELAPP_CONFIDENCE_RED]: 2, - [ConditionsRecord_PanelappAssociation_PanelappConfidence.PANELAPP_CONFIDENCE_UNKNOWN]: 0, - [ConditionsRecord_PanelappAssociation_PanelappConfidence.PANELAPP_CONFIDENCE_NONE]: 0 + 'Green': 0, + 'Amber': 1, + 'Red': 2, + 'None': 0 } -const conditions = computed(() => { - if (props.geneInfo?.conditions) { - return props.geneInfo.conditions as ConditionsRecord +const conditions = computed(() => { + if (!!props.geneInfo?.conditions) { + return props.geneInfo.conditions! } else { return { - hgncId: props.geneInfo?.hgnc?.hgncId ?? '', - diseaseAssociations: [], - panelappAssociations: [] + hgnc_id: props.geneInfo?.hgnc?.hgnc_id ?? '', + disease_associations: [], + panelapp_associations: [] } } }) @@ -127,8 +112,8 @@ const maxDiseases = 3 const showAllDiseases = ref(false) /** The diseases to show. */ -const diseasesToShow = computed(() => { - return conditions.value.diseaseAssociations +const diseasesToShow = computed(() => { + return conditions.value.disease_associations }) /** Whether to display disease details. */ @@ -136,7 +121,7 @@ const showDiseaseDetails = ref([]) /** Initialize the showDiseaseDetails. */ const initShowDiseaseDetails = () => { - showDiseaseDetails.value = conditions.value.diseaseAssociations.map(() => false) + showDiseaseDetails.value = conditions.value.disease_associations.map(() => false) } /** Sorting `v-model` attributes for disease list. */ @@ -155,8 +140,8 @@ const sortItemsDisease = [ /** Custom function for sorting confidence Level. */ const confidenceLevelSorting = ( - a: PanelAppRecord_ConfidenceLevel, - b: PanelAppRecord_ConfidenceLevel + a: GenesPanelappAssociationConfidenceLevel, + b: GenesPanelappAssociationConfidenceLevel ) => { const confidenceA = PANELAPP_CONFIDENCE_ORDER[a] const confidenceB = PANELAPP_CONFIDENCE_ORDER[b] @@ -169,8 +154,8 @@ const customKeySortPanelApp: { [key: string]: DataTableCompareFunctionPanelApp } confidenceLevel: confidenceLevelSorting } type DataTableCompareFunctionConfidenceLevel = ( - a: PanelAppRecord_ConfidenceLevel, - b: PanelAppRecord_ConfidenceLevel + a: GenesPanelappRecordConfidenceLevel, + b: GenesPanelappRecordConfidenceLevel ) => number const customKeySortDisease: { [key: string]: DataTableCompareFunctionConfidenceLevel } = { confidence: confidenceLevelSorting @@ -191,8 +176,8 @@ const maxPanels = 3 const showAllPanels = ref(false) /** The diseases to show. */ -const panelsToShow = computed(() => { - return conditions.value.panelappAssociations +const panelsToShow = computed(() => { + return conditions.value.panelapp_associations }) /** Whether to display PanelApp panel details. */ @@ -200,7 +185,7 @@ const showPanelDetails = ref([]) /** Initialize the showPanelDetails. */ const initShowPanelDetails = () => { - showPanelDetails.value = conditions.value.diseaseAssociations.map(() => false) + showPanelDetails.value = conditions.value.disease_associations.map(() => false) } /** Sorting `v-model` attributes for PanelApp panel list. */ @@ -261,26 +246,26 @@ const conditionsCols = computed(() => {