Skip to content

Commit

Permalink
feat(chore): Update to silo 0.3.0, lapis to 0.3.7 and fix e2e tests (#…
Browse files Browse the repository at this point in the history
…3077)

* dummyOrganism: Remove pangoLineage type, remove partitionBy

* fix: request FASTA format explicitly for sequences

---------

Co-authored-by: Cornelius Roemer <cornelius.roemer@gmail.com>
  • Loading branch information
anna-parker and corneliusroemer authored Oct 26, 2024
1 parent a1897df commit 335f12f
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 18 deletions.
7 changes: 3 additions & 4 deletions kubernetes/loculus/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1243,9 +1243,9 @@ defaultOrganisms:
header: "Collection Details"
- name: pangoLineage
initiallyVisible: true
type: pango_lineage
autocomplete: true
required: true
type: string
website:
tableColumns:
- country
Expand All @@ -1256,7 +1256,6 @@ defaultOrganisms:
defaultOrderBy: date
silo:
dateToSortBy: date
partitionBy: pangoLineage
preprocessing:
- version: 1
image: ghcr.io/loculus-project/preprocessing-dummy
Expand Down Expand Up @@ -1451,8 +1450,8 @@ 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: '<script defer data-domain="loculus.org" src="https://plausible.io/js/script.js"></script>'
images:
lapisSilo: "ghcr.io/genspectrum/lapis-silo:0.2.23"
lapis: "ghcr.io/genspectrum/lapis:0.3.5"
lapisSilo: "ghcr.io/genspectrum/lapis-silo:0.3.0"
lapis: "ghcr.io/genspectrum/lapis:0.3.7"
secrets:
smtp-password:
type: raw
Expand Down
11 changes: 6 additions & 5 deletions website/src/services/lapisApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
lapisBaseRequest,
mutationsRequest,
mutationsResponse,
sequenceRequest,
} from '../types/lapis.ts';

function withSample<Path extends `/${string}`>(path: Path) {
Expand Down Expand Up @@ -107,7 +108,7 @@ const alignedNucleotideSequencesEndpoint = makeEndpoint({
{
name: 'request',
type: 'Body',
schema: lapisBaseRequest,
schema: sequenceRequest,
},
],
response: z.string(),
Expand All @@ -122,7 +123,7 @@ const alignedNucleotideSequencesMultiSegmentEndpoint = makeEndpoint({
{
name: 'request',
type: 'Body',
schema: lapisBaseRequest,
schema: sequenceRequest,
},
],
response: z.string(),
Expand All @@ -137,7 +138,7 @@ const unalignedNucleotideSequencesMultiSegmentEndpoint = makeEndpoint({
{
name: 'request',
type: 'Body',
schema: lapisBaseRequest,
schema: sequenceRequest,
},
],
response: z.string(),
Expand All @@ -152,7 +153,7 @@ const unalignedNucleotideSequencesEndpoint = makeEndpoint({
{
name: 'request',
type: 'Body',
schema: lapisBaseRequest,
schema: sequenceRequest,
},
],
response: z.string(),
Expand All @@ -167,7 +168,7 @@ const alignedAminoAcidSequencesEndpoint = makeEndpoint({
{
name: 'request',
type: 'Body',
schema: lapisBaseRequest,
schema: sequenceRequest,
},
],
response: z.string(),
Expand Down
15 changes: 9 additions & 6 deletions website/src/services/lapisClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,15 @@ export class LapisClient extends ZodiosWrapperClient<typeof lapisApi> {
});
}

public getSequenceEntryVersionDetailsTsv(accessionVersion: string): Promise<Result<string, ProblemDetail>> {
return this.call('details', {
public async getSequenceEntryVersionDetailsTsv(accessionVersion: string): Promise<Result<string, ProblemDetail>> {
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 (@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);
}

public async getLatestAccessionVersion(accession: string): Promise<Result<AccessionVersion, ProblemDetail>> {
Expand Down Expand Up @@ -149,6 +150,7 @@ export class LapisClient extends ZodiosWrapperClient<typeof lapisApi> {
public getUnalignedSequences(accessionVersion: string) {
return this.call('unalignedNucleotideSequences', {
[this.schema.primaryKey]: accessionVersion,
dataFormat: 'FASTA',
});
}

Expand All @@ -159,6 +161,7 @@ export class LapisClient extends ZodiosWrapperClient<typeof lapisApi> {
'unalignedNucleotideSequencesMultiSegment',
{
[this.schema.primaryKey]: accessionVersion,
dataFormat: 'FASTA',
},
{ params: { segment } },
),
Expand Down
9 changes: 6 additions & 3 deletions website/src/services/serviceHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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,
);
Expand Down Expand Up @@ -63,7 +66,7 @@ export function lapisClientHooks(lapisUrl: string) {

function getSequenceHook(
hooks: ZodiosHooksInstance<typeof lapisApi>,
request: LapisBaseRequest,
request: SequenceRequest,
sequenceType: SequenceType,
isMultiSegmented: boolean,
) {
Expand Down
3 changes: 3 additions & 0 deletions website/src/types/lapis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export type LapisBaseRequest = z.infer<typeof lapisBaseRequest>;

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<typeof sequenceRequest>;

export const mutationProportionCount = z.object({
mutation: z.string(),
proportion: z.number(),
Expand Down

0 comments on commit 335f12f

Please sign in to comment.