From 9535c2a6e7e0e6f92c0ecbeba4b947f89a6fd13b Mon Sep 17 00:00:00 2001 From: "Anna (Anya) Parker" <50943381+anna-parker@users.noreply.github.com> Date: Fri, 25 Oct 2024 15:45:42 +0200 Subject: [PATCH 01/22] Remove pangoLineage type, update to silo 0.3.0 to test compatibility --- kubernetes/loculus/values.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/kubernetes/loculus/values.yaml b/kubernetes/loculus/values.yaml index e5a4bd0f15..4c599e9458 100644 --- a/kubernetes/loculus/values.yaml +++ b/kubernetes/loculus/values.yaml @@ -1243,7 +1243,6 @@ defaultOrganisms: header: "Collection Details" - name: pangoLineage initiallyVisible: true - type: pango_lineage autocomplete: true required: true website: From 7193d5594c82d697e729fedd76cd84db30cfa2eb Mon Sep 17 00:00:00 2001 From: "Anna (Anya) Parker" <50943381+anna-parker@users.noreply.github.com> Date: Fri, 25 Oct 2024 15:48:02 +0200 Subject: [PATCH 02/22] update lapis-silo --- kubernetes/loculus/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/loculus/values.yaml b/kubernetes/loculus/values.yaml index 4c599e9458..c6cdf6f493 100644 --- a/kubernetes/loculus/values.yaml +++ b/kubernetes/loculus/values.yaml @@ -1450,7 +1450,7 @@ insecureCookies: false bannerMessage: "This is a demonstration environment. It may contain non-accurate test data and should not be used for real-world applications. Data will be deleted regularly." additionalHeadHTML: '' images: - lapisSilo: "ghcr.io/genspectrum/lapis-silo:0.2.23" + lapisSilo: "ghcr.io/genspectrum/lapis-silo:0.3.0" lapis: "ghcr.io/genspectrum/lapis:0.3.5" secrets: smtp-password: From 5b1caa23e6e369cd4223dbe761f0eef6a3c6812d Mon Sep 17 00:00:00 2001 From: "Anna (Anya) Parker" <50943381+anna-parker@users.noreply.github.com> Date: Fri, 25 Oct 2024 16:13:13 +0200 Subject: [PATCH 03/22] add generateLineageIndex --- kubernetes/loculus/values.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/kubernetes/loculus/values.yaml b/kubernetes/loculus/values.yaml index c6cdf6f493..ad89be3254 100644 --- a/kubernetes/loculus/values.yaml +++ b/kubernetes/loculus/values.yaml @@ -1245,6 +1245,7 @@ defaultOrganisms: initiallyVisible: true autocomplete: true required: true + generateLineageIndex: true website: tableColumns: - country From 2f89b2ef718d6f8679321d6513ce9986802676fc Mon Sep 17 00:00:00 2001 From: "Anna (Anya) Parker" <50943381+anna-parker@users.noreply.github.com> Date: Fri, 25 Oct 2024 16:47:49 +0200 Subject: [PATCH 04/22] show error --- kubernetes/loculus/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/loculus/values.yaml b/kubernetes/loculus/values.yaml index ad89be3254..ecddbb9da9 100644 --- a/kubernetes/loculus/values.yaml +++ b/kubernetes/loculus/values.yaml @@ -1245,7 +1245,7 @@ defaultOrganisms: initiallyVisible: true autocomplete: true required: true - generateLineageIndex: true + type: string website: tableColumns: - country From c1221c83dbed4abf6327bd2709799ca3907bc2ca Mon Sep 17 00:00:00 2001 From: "Anna (Anya) Parker" <50943381+anna-parker@users.noreply.github.com> Date: Fri, 25 Oct 2024 16:49:15 +0200 Subject: [PATCH 05/22] try it out --- kubernetes/loculus/values.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/kubernetes/loculus/values.yaml b/kubernetes/loculus/values.yaml index ecddbb9da9..9e398e12e0 100644 --- a/kubernetes/loculus/values.yaml +++ b/kubernetes/loculus/values.yaml @@ -1256,7 +1256,6 @@ defaultOrganisms: defaultOrderBy: date silo: dateToSortBy: date - partitionBy: pangoLineage preprocessing: - version: 1 image: ghcr.io/loculus-project/preprocessing-dummy From ccad55561bc65da834451f5a8375e10e949647f4 Mon Sep 17 00:00:00 2001 From: "Anna (Anya) Parker" <50943381+anna-parker@users.noreply.github.com> Date: Fri, 25 Oct 2024 17:38:43 +0200 Subject: [PATCH 06/22] Update lapis to 0.3.7 --- kubernetes/loculus/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/loculus/values.yaml b/kubernetes/loculus/values.yaml index 9e398e12e0..cdf61ce7f2 100644 --- a/kubernetes/loculus/values.yaml +++ b/kubernetes/loculus/values.yaml @@ -1451,7 +1451,7 @@ bannerMessage: "This is a demonstration environment. It may contain non-accurate additionalHeadHTML: '' images: lapisSilo: "ghcr.io/genspectrum/lapis-silo:0.3.0" - lapis: "ghcr.io/genspectrum/lapis:0.3.5" + lapis: "ghcr.io/genspectrum/lapis:0.3.7" secrets: smtp-password: type: raw From 7ba6c68e7e2f25d3140c93a54f9db79e417341da Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Fri, 25 Oct 2024 20:38:19 +0200 Subject: [PATCH 07/22] fix: request FASTA format explicitly for sequences Related to: - https://github.com/GenSpectrum/LAPIS/issues/999 - https://github.com/GenSpectrum/LAPIS/issues/971 --- website/src/services/lapisApi.ts | 11 ++++++----- website/src/services/lapisClient.ts | 2 ++ website/src/types/lapis.ts | 2 ++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/website/src/services/lapisApi.ts b/website/src/services/lapisApi.ts index 3e681d09ef..627181a877 100644 --- a/website/src/services/lapisApi.ts +++ b/website/src/services/lapisApi.ts @@ -8,6 +8,7 @@ import { lapisBaseRequest, mutationsRequest, mutationsResponse, + sequenceRequest, } from '../types/lapis.ts'; function withSample(path: Path) { @@ -107,7 +108,7 @@ const alignedNucleotideSequencesEndpoint = makeEndpoint({ { name: 'request', type: 'Body', - schema: lapisBaseRequest, + schema: sequenceRequest, }, ], response: z.string(), @@ -122,7 +123,7 @@ const alignedNucleotideSequencesMultiSegmentEndpoint = makeEndpoint({ { name: 'request', type: 'Body', - schema: lapisBaseRequest, + schema: sequenceRequest, }, ], response: z.string(), @@ -137,7 +138,7 @@ const unalignedNucleotideSequencesMultiSegmentEndpoint = makeEndpoint({ { name: 'request', type: 'Body', - schema: lapisBaseRequest, + schema: sequenceRequest, }, ], response: z.string(), @@ -152,7 +153,7 @@ const unalignedNucleotideSequencesEndpoint = makeEndpoint({ { name: 'request', type: 'Body', - schema: lapisBaseRequest, + schema: sequenceRequest, }, ], response: z.string(), @@ -167,7 +168,7 @@ const alignedAminoAcidSequencesEndpoint = makeEndpoint({ { name: 'request', type: 'Body', - schema: lapisBaseRequest, + schema: sequenceRequest, }, ], response: z.string(), diff --git a/website/src/services/lapisClient.ts b/website/src/services/lapisClient.ts index 3682e8f0f3..1011f0d278 100644 --- a/website/src/services/lapisClient.ts +++ b/website/src/services/lapisClient.ts @@ -149,6 +149,7 @@ export class LapisClient extends ZodiosWrapperClient { public getUnalignedSequences(accessionVersion: string) { return this.call('unalignedNucleotideSequences', { [this.schema.primaryKey]: accessionVersion, + dataFormat: 'FASTA', }); } @@ -159,6 +160,7 @@ export class LapisClient extends ZodiosWrapperClient { 'unalignedNucleotideSequencesMultiSegment', { [this.schema.primaryKey]: accessionVersion, + dataFormat: 'FASTA', }, { params: { segment } }, ), diff --git a/website/src/types/lapis.ts b/website/src/types/lapis.ts index 747d8391a1..170e3a2623 100644 --- a/website/src/types/lapis.ts +++ b/website/src/types/lapis.ts @@ -24,6 +24,8 @@ export type LapisBaseRequest = z.infer; export const mutationsRequest = lapisBaseRequest.extend({ minProportion: z.number().optional() }); +export const sequenceRequest = lapisBaseRequest.extend({ dataFormat: z.enum(['FASTA', 'NDJSON', 'JSON']) }); + export const mutationProportionCount = z.object({ mutation: z.string(), proportion: z.number(), From c37d3f426360594d7ff8fc958b3c382a2d38457a Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Fri, 25 Oct 2024 21:08:03 +0200 Subject: [PATCH 08/22] fixes --- website/src/services/lapisClient.ts | 13 +++++++------ website/src/services/serviceHooks.ts | 9 ++++++--- website/src/types/lapis.ts | 1 + 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/website/src/services/lapisClient.ts b/website/src/services/lapisClient.ts index 1011f0d278..fbaf1c85e5 100644 --- a/website/src/services/lapisClient.ts +++ b/website/src/services/lapisClient.ts @@ -54,14 +54,15 @@ export class LapisClient extends ZodiosWrapperClient { }); } - public getSequenceEntryVersionDetailsTsv(accessionVersion: string): Promise> { - return this.call('details', { + public async getSequenceEntryVersionDetailsTsv(accessionVersion: string): Promise> { + const result = await this.call('details', { [this.schema.primaryKey]: accessionVersion, dataFormat: 'TSV', - // This type cast isn't pretty, but if the API would be typed correctly, the union type - // of the actual details resonse and the potential 'string' would polute the whole API, - // so I decided to just do this cast here. We know that the return value is a TSV string. - }).then((result) => result.map((data) => data as unknown as string)); + }); + // This type cast isn't pretty, but if the API would be typed correctly, the union type + // of the actual details resonse and the potential 'string' would pollute the whole API, + // so I decided to just do this cast here. We know that the return value is a TSV string. + return result.map((data) => data as unknown as string); } public async getLatestAccessionVersion(accession: string): Promise> { diff --git a/website/src/services/serviceHooks.ts b/website/src/services/serviceHooks.ts index e0a40612cc..882cf073d3 100644 --- a/website/src/services/serviceHooks.ts +++ b/website/src/services/serviceHooks.ts @@ -6,7 +6,7 @@ import { backendApi } from './backendApi.ts'; import { lapisApi } from './lapisApi.ts'; import { seqSetCitationApi } from './seqSetCitationApi.ts'; import { problemDetail } from '../types/backend.ts'; -import type { LapisBaseRequest } from '../types/lapis.ts'; +import type { SequenceRequest } from '../types/lapis.ts'; import type { ClientConfig } from '../types/runtimeConfig.ts'; import { fastaEntries } from '../utils/parseFasta.ts'; import { isAlignedSequence, isUnalignedSequence, type SequenceType } from '../utils/sequenceTypeHelpers.ts'; @@ -23,7 +23,10 @@ export function lapisClientHooks(lapisUrl: string) { useGetSequence(accessionVersion: string, sequenceType: SequenceType, isMultiSegmented: boolean) { const { data, error, isLoading } = getSequenceHook( zodiosHooks, - { accessionVersion }, + { + accessionVersion, + dataFormat: 'FASTA', + }, sequenceType, isMultiSegmented, ); @@ -63,7 +66,7 @@ export function lapisClientHooks(lapisUrl: string) { function getSequenceHook( hooks: ZodiosHooksInstance, - request: LapisBaseRequest, + request: SequenceRequest, sequenceType: SequenceType, isMultiSegmented: boolean, ) { diff --git a/website/src/types/lapis.ts b/website/src/types/lapis.ts index 170e3a2623..6a493d36cd 100644 --- a/website/src/types/lapis.ts +++ b/website/src/types/lapis.ts @@ -25,6 +25,7 @@ export type LapisBaseRequest = z.infer; export const mutationsRequest = lapisBaseRequest.extend({ minProportion: z.number().optional() }); export const sequenceRequest = lapisBaseRequest.extend({ dataFormat: z.enum(['FASTA', 'NDJSON', 'JSON']) }); +export type SequenceRequest = z.infer; export const mutationProportionCount = z.object({ mutation: z.string(), From 6f10bf79d8b3a6973d51614b37083bbb7c684fbf Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Fri, 25 Oct 2024 21:08:24 +0200 Subject: [PATCH 09/22] f --- website/src/services/lapisClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/src/services/lapisClient.ts b/website/src/services/lapisClient.ts index fbaf1c85e5..a5f160c334 100644 --- a/website/src/services/lapisClient.ts +++ b/website/src/services/lapisClient.ts @@ -61,7 +61,7 @@ export class LapisClient extends ZodiosWrapperClient { }); // This type cast isn't pretty, but if the API would be typed correctly, the union type // of the actual details resonse and the potential 'string' would pollute the whole API, - // so I decided to just do this cast here. We know that the return value is a TSV string. + // so I (@fhennig) decided to just do this cast here. We know that the return value is a TSV string. return result.map((data) => data as unknown as string); } From 3164731b3c79418c48ef47b23f3f586863db0062 Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Fri, 25 Oct 2024 21:25:11 +0200 Subject: [PATCH 10/22] issue correct accept headers --- website/src/services/zodiosWrapperClient.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/website/src/services/zodiosWrapperClient.ts b/website/src/services/zodiosWrapperClient.ts index e832133997..98386f9d96 100644 --- a/website/src/services/zodiosWrapperClient.ts +++ b/website/src/services/zodiosWrapperClient.ts @@ -26,7 +26,13 @@ export class ZodiosWrapperClient { private readonly logger: InstanceLogger, private readonly serviceName: string, ) { - this.zodios = new Zodios(url, api); + this.zodios = new Zodios(url, api, { + axiosConfig: { + headers: { + Accept: '*/*', // Some endpoints want plain text, not the default (JSON) + }, + }, + }); } /** From c04fa0dc7407bba03eaa010826372c6c369857f0 Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Fri, 25 Oct 2024 21:31:35 +0200 Subject: [PATCH 11/22] Revert, didn't work --- website/src/services/zodiosWrapperClient.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/website/src/services/zodiosWrapperClient.ts b/website/src/services/zodiosWrapperClient.ts index 98386f9d96..e832133997 100644 --- a/website/src/services/zodiosWrapperClient.ts +++ b/website/src/services/zodiosWrapperClient.ts @@ -26,13 +26,7 @@ export class ZodiosWrapperClient { private readonly logger: InstanceLogger, private readonly serviceName: string, ) { - this.zodios = new Zodios(url, api, { - axiosConfig: { - headers: { - Accept: '*/*', // Some endpoints want plain text, not the default (JSON) - }, - }, - }); + this.zodios = new Zodios(url, api); } /** From bf5e74df11fbaaa604694f4c62be15df410b5ab5 Mon Sep 17 00:00:00 2001 From: "Anna (Anya) Parker" <50943381+anna-parker@users.noreply.github.com> Date: Fri, 25 Oct 2024 15:45:42 +0200 Subject: [PATCH 12/22] Remove pangoLineage type, update to silo 0.3.0 to test compatibility --- kubernetes/loculus/values.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/kubernetes/loculus/values.yaml b/kubernetes/loculus/values.yaml index e5a4bd0f15..4c599e9458 100644 --- a/kubernetes/loculus/values.yaml +++ b/kubernetes/loculus/values.yaml @@ -1243,7 +1243,6 @@ defaultOrganisms: header: "Collection Details" - name: pangoLineage initiallyVisible: true - type: pango_lineage autocomplete: true required: true website: From f80a2c29c69c6016034810c8a2e030d3c35e779c Mon Sep 17 00:00:00 2001 From: "Anna (Anya) Parker" <50943381+anna-parker@users.noreply.github.com> Date: Fri, 25 Oct 2024 15:48:02 +0200 Subject: [PATCH 13/22] update lapis-silo --- kubernetes/loculus/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/loculus/values.yaml b/kubernetes/loculus/values.yaml index 4c599e9458..c6cdf6f493 100644 --- a/kubernetes/loculus/values.yaml +++ b/kubernetes/loculus/values.yaml @@ -1450,7 +1450,7 @@ insecureCookies: false bannerMessage: "This is a demonstration environment. It may contain non-accurate test data and should not be used for real-world applications. Data will be deleted regularly." additionalHeadHTML: '' images: - lapisSilo: "ghcr.io/genspectrum/lapis-silo:0.2.23" + lapisSilo: "ghcr.io/genspectrum/lapis-silo:0.3.0" lapis: "ghcr.io/genspectrum/lapis:0.3.5" secrets: smtp-password: From 4ec7f0005f52b41bc570f6e8906d4820b733d3b4 Mon Sep 17 00:00:00 2001 From: "Anna (Anya) Parker" <50943381+anna-parker@users.noreply.github.com> Date: Fri, 25 Oct 2024 16:13:13 +0200 Subject: [PATCH 14/22] add generateLineageIndex --- kubernetes/loculus/values.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/kubernetes/loculus/values.yaml b/kubernetes/loculus/values.yaml index c6cdf6f493..ad89be3254 100644 --- a/kubernetes/loculus/values.yaml +++ b/kubernetes/loculus/values.yaml @@ -1245,6 +1245,7 @@ defaultOrganisms: initiallyVisible: true autocomplete: true required: true + generateLineageIndex: true website: tableColumns: - country From 9fd2ea4f24479d7ebcf561010e14c56070032ff0 Mon Sep 17 00:00:00 2001 From: "Anna (Anya) Parker" <50943381+anna-parker@users.noreply.github.com> Date: Fri, 25 Oct 2024 16:47:49 +0200 Subject: [PATCH 15/22] show error --- kubernetes/loculus/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/loculus/values.yaml b/kubernetes/loculus/values.yaml index ad89be3254..ecddbb9da9 100644 --- a/kubernetes/loculus/values.yaml +++ b/kubernetes/loculus/values.yaml @@ -1245,7 +1245,7 @@ defaultOrganisms: initiallyVisible: true autocomplete: true required: true - generateLineageIndex: true + type: string website: tableColumns: - country From 4d9e9e97c9eaef9d072b5fe01ff339927e67630f Mon Sep 17 00:00:00 2001 From: "Anna (Anya) Parker" <50943381+anna-parker@users.noreply.github.com> Date: Fri, 25 Oct 2024 16:49:15 +0200 Subject: [PATCH 16/22] try it out --- kubernetes/loculus/values.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/kubernetes/loculus/values.yaml b/kubernetes/loculus/values.yaml index ecddbb9da9..9e398e12e0 100644 --- a/kubernetes/loculus/values.yaml +++ b/kubernetes/loculus/values.yaml @@ -1256,7 +1256,6 @@ defaultOrganisms: defaultOrderBy: date silo: dateToSortBy: date - partitionBy: pangoLineage preprocessing: - version: 1 image: ghcr.io/loculus-project/preprocessing-dummy From 4d08864e4e72f675c18befad63b465a359c4ce74 Mon Sep 17 00:00:00 2001 From: "Anna (Anya) Parker" <50943381+anna-parker@users.noreply.github.com> Date: Fri, 25 Oct 2024 17:38:43 +0200 Subject: [PATCH 17/22] Update lapis to 0.3.7 --- kubernetes/loculus/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/loculus/values.yaml b/kubernetes/loculus/values.yaml index 9e398e12e0..cdf61ce7f2 100644 --- a/kubernetes/loculus/values.yaml +++ b/kubernetes/loculus/values.yaml @@ -1451,7 +1451,7 @@ bannerMessage: "This is a demonstration environment. It may contain non-accurate additionalHeadHTML: '' images: lapisSilo: "ghcr.io/genspectrum/lapis-silo:0.3.0" - lapis: "ghcr.io/genspectrum/lapis:0.3.5" + lapis: "ghcr.io/genspectrum/lapis:0.3.7" secrets: smtp-password: type: raw From 4beeca2faa4c6a56619f0b46e9bf175530cfdc8d Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Fri, 25 Oct 2024 20:38:19 +0200 Subject: [PATCH 18/22] fix: request FASTA format explicitly for sequences Related to: - https://github.com/GenSpectrum/LAPIS/issues/999 - https://github.com/GenSpectrum/LAPIS/issues/971 --- website/src/services/lapisApi.ts | 11 ++++++----- website/src/services/lapisClient.ts | 2 ++ website/src/types/lapis.ts | 2 ++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/website/src/services/lapisApi.ts b/website/src/services/lapisApi.ts index 3e681d09ef..627181a877 100644 --- a/website/src/services/lapisApi.ts +++ b/website/src/services/lapisApi.ts @@ -8,6 +8,7 @@ import { lapisBaseRequest, mutationsRequest, mutationsResponse, + sequenceRequest, } from '../types/lapis.ts'; function withSample(path: Path) { @@ -107,7 +108,7 @@ const alignedNucleotideSequencesEndpoint = makeEndpoint({ { name: 'request', type: 'Body', - schema: lapisBaseRequest, + schema: sequenceRequest, }, ], response: z.string(), @@ -122,7 +123,7 @@ const alignedNucleotideSequencesMultiSegmentEndpoint = makeEndpoint({ { name: 'request', type: 'Body', - schema: lapisBaseRequest, + schema: sequenceRequest, }, ], response: z.string(), @@ -137,7 +138,7 @@ const unalignedNucleotideSequencesMultiSegmentEndpoint = makeEndpoint({ { name: 'request', type: 'Body', - schema: lapisBaseRequest, + schema: sequenceRequest, }, ], response: z.string(), @@ -152,7 +153,7 @@ const unalignedNucleotideSequencesEndpoint = makeEndpoint({ { name: 'request', type: 'Body', - schema: lapisBaseRequest, + schema: sequenceRequest, }, ], response: z.string(), @@ -167,7 +168,7 @@ const alignedAminoAcidSequencesEndpoint = makeEndpoint({ { name: 'request', type: 'Body', - schema: lapisBaseRequest, + schema: sequenceRequest, }, ], response: z.string(), diff --git a/website/src/services/lapisClient.ts b/website/src/services/lapisClient.ts index 3682e8f0f3..1011f0d278 100644 --- a/website/src/services/lapisClient.ts +++ b/website/src/services/lapisClient.ts @@ -149,6 +149,7 @@ export class LapisClient extends ZodiosWrapperClient { public getUnalignedSequences(accessionVersion: string) { return this.call('unalignedNucleotideSequences', { [this.schema.primaryKey]: accessionVersion, + dataFormat: 'FASTA', }); } @@ -159,6 +160,7 @@ export class LapisClient extends ZodiosWrapperClient { 'unalignedNucleotideSequencesMultiSegment', { [this.schema.primaryKey]: accessionVersion, + dataFormat: 'FASTA', }, { params: { segment } }, ), diff --git a/website/src/types/lapis.ts b/website/src/types/lapis.ts index 747d8391a1..170e3a2623 100644 --- a/website/src/types/lapis.ts +++ b/website/src/types/lapis.ts @@ -24,6 +24,8 @@ export type LapisBaseRequest = z.infer; export const mutationsRequest = lapisBaseRequest.extend({ minProportion: z.number().optional() }); +export const sequenceRequest = lapisBaseRequest.extend({ dataFormat: z.enum(['FASTA', 'NDJSON', 'JSON']) }); + export const mutationProportionCount = z.object({ mutation: z.string(), proportion: z.number(), From 8438d6d0a0b926267cd422a2c265b33e6dbbe3db Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Fri, 25 Oct 2024 21:08:03 +0200 Subject: [PATCH 19/22] fixes --- website/src/services/lapisClient.ts | 13 +++++++------ website/src/services/serviceHooks.ts | 9 ++++++--- website/src/types/lapis.ts | 1 + 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/website/src/services/lapisClient.ts b/website/src/services/lapisClient.ts index 1011f0d278..fbaf1c85e5 100644 --- a/website/src/services/lapisClient.ts +++ b/website/src/services/lapisClient.ts @@ -54,14 +54,15 @@ export class LapisClient extends ZodiosWrapperClient { }); } - public getSequenceEntryVersionDetailsTsv(accessionVersion: string): Promise> { - return this.call('details', { + public async getSequenceEntryVersionDetailsTsv(accessionVersion: string): Promise> { + const result = await this.call('details', { [this.schema.primaryKey]: accessionVersion, dataFormat: 'TSV', - // This type cast isn't pretty, but if the API would be typed correctly, the union type - // of the actual details resonse and the potential 'string' would polute the whole API, - // so I decided to just do this cast here. We know that the return value is a TSV string. - }).then((result) => result.map((data) => data as unknown as string)); + }); + // This type cast isn't pretty, but if the API would be typed correctly, the union type + // of the actual details resonse and the potential 'string' would pollute the whole API, + // so I decided to just do this cast here. We know that the return value is a TSV string. + return result.map((data) => data as unknown as string); } public async getLatestAccessionVersion(accession: string): Promise> { diff --git a/website/src/services/serviceHooks.ts b/website/src/services/serviceHooks.ts index e0a40612cc..882cf073d3 100644 --- a/website/src/services/serviceHooks.ts +++ b/website/src/services/serviceHooks.ts @@ -6,7 +6,7 @@ import { backendApi } from './backendApi.ts'; import { lapisApi } from './lapisApi.ts'; import { seqSetCitationApi } from './seqSetCitationApi.ts'; import { problemDetail } from '../types/backend.ts'; -import type { LapisBaseRequest } from '../types/lapis.ts'; +import type { SequenceRequest } from '../types/lapis.ts'; import type { ClientConfig } from '../types/runtimeConfig.ts'; import { fastaEntries } from '../utils/parseFasta.ts'; import { isAlignedSequence, isUnalignedSequence, type SequenceType } from '../utils/sequenceTypeHelpers.ts'; @@ -23,7 +23,10 @@ export function lapisClientHooks(lapisUrl: string) { useGetSequence(accessionVersion: string, sequenceType: SequenceType, isMultiSegmented: boolean) { const { data, error, isLoading } = getSequenceHook( zodiosHooks, - { accessionVersion }, + { + accessionVersion, + dataFormat: 'FASTA', + }, sequenceType, isMultiSegmented, ); @@ -63,7 +66,7 @@ export function lapisClientHooks(lapisUrl: string) { function getSequenceHook( hooks: ZodiosHooksInstance, - request: LapisBaseRequest, + request: SequenceRequest, sequenceType: SequenceType, isMultiSegmented: boolean, ) { diff --git a/website/src/types/lapis.ts b/website/src/types/lapis.ts index 170e3a2623..6a493d36cd 100644 --- a/website/src/types/lapis.ts +++ b/website/src/types/lapis.ts @@ -25,6 +25,7 @@ export type LapisBaseRequest = z.infer; export const mutationsRequest = lapisBaseRequest.extend({ minProportion: z.number().optional() }); export const sequenceRequest = lapisBaseRequest.extend({ dataFormat: z.enum(['FASTA', 'NDJSON', 'JSON']) }); +export type SequenceRequest = z.infer; export const mutationProportionCount = z.object({ mutation: z.string(), From 7bba3c8ce0f064a6710a06f7a5829eb889338e6c Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Fri, 25 Oct 2024 21:08:24 +0200 Subject: [PATCH 20/22] f --- website/src/services/lapisClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/src/services/lapisClient.ts b/website/src/services/lapisClient.ts index fbaf1c85e5..a5f160c334 100644 --- a/website/src/services/lapisClient.ts +++ b/website/src/services/lapisClient.ts @@ -61,7 +61,7 @@ export class LapisClient extends ZodiosWrapperClient { }); // This type cast isn't pretty, but if the API would be typed correctly, the union type // of the actual details resonse and the potential 'string' would pollute the whole API, - // so I decided to just do this cast here. We know that the return value is a TSV string. + // so I (@fhennig) decided to just do this cast here. We know that the return value is a TSV string. return result.map((data) => data as unknown as string); } From 03ce686294317b9fdf60fc1a42aa20d0ab7ca452 Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Fri, 25 Oct 2024 21:25:11 +0200 Subject: [PATCH 21/22] issue correct accept headers --- website/src/services/zodiosWrapperClient.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/website/src/services/zodiosWrapperClient.ts b/website/src/services/zodiosWrapperClient.ts index e832133997..98386f9d96 100644 --- a/website/src/services/zodiosWrapperClient.ts +++ b/website/src/services/zodiosWrapperClient.ts @@ -26,7 +26,13 @@ export class ZodiosWrapperClient { private readonly logger: InstanceLogger, private readonly serviceName: string, ) { - this.zodios = new Zodios(url, api); + this.zodios = new Zodios(url, api, { + axiosConfig: { + headers: { + Accept: '*/*', // Some endpoints want plain text, not the default (JSON) + }, + }, + }); } /** From de4068680b6571eeecc878aae2508d7957749940 Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Fri, 25 Oct 2024 21:31:35 +0200 Subject: [PATCH 22/22] Revert, didn't work --- website/src/services/zodiosWrapperClient.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/website/src/services/zodiosWrapperClient.ts b/website/src/services/zodiosWrapperClient.ts index 98386f9d96..e832133997 100644 --- a/website/src/services/zodiosWrapperClient.ts +++ b/website/src/services/zodiosWrapperClient.ts @@ -26,13 +26,7 @@ export class ZodiosWrapperClient { private readonly logger: InstanceLogger, private readonly serviceName: string, ) { - this.zodios = new Zodios(url, api, { - axiosConfig: { - headers: { - Accept: '*/*', // Some endpoints want plain text, not the default (JSON) - }, - }, - }); + this.zodios = new Zodios(url, api); } /**