Skip to content

Commit

Permalink
fix: request FASTA format explicitly for sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusroemer authored and anna-parker committed Oct 25, 2024
1 parent 4d08864 commit 4beeca2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
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
2 changes: 2 additions & 0 deletions website/src/services/lapisClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,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 +160,7 @@ export class LapisClient extends ZodiosWrapperClient<typeof lapisApi> {
'unalignedNucleotideSequencesMultiSegment',
{
[this.schema.primaryKey]: accessionVersion,
dataFormat: 'FASTA',
},
{ params: { segment } },
),
Expand Down
2 changes: 2 additions & 0 deletions website/src/types/lapis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ 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 const mutationProportionCount = z.object({
mutation: z.string(),
proportion: z.number(),
Expand Down

0 comments on commit 4beeca2

Please sign in to comment.