From 22e5f49dde855cd5af04cc39d35f2bfb31b35343 Mon Sep 17 00:00:00 2001 From: Jonas Kellerer Date: Tue, 12 Dec 2023 08:50:26 +0100 Subject: [PATCH] refactor: rename 'amino acid sequence' to 'aligned amino acid sequence' --- .../controller/ControllerDescriptions.kt | 4 ++-- .../lapis/controller/LapisController.kt | 20 +++++++++---------- .../genspectrum/lapis/openApi/OpenApiDocs.kt | 2 +- .../org/genspectrum/lapis/openApi/Schemas.kt | 8 ++++---- .../LapisControllerCommonFieldsTest.kt | 2 +- siloLapisTests/test/aminoAcidSequence.spec.ts | 18 ++++++++--------- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/lapis2/src/main/kotlin/org/genspectrum/lapis/controller/ControllerDescriptions.kt b/lapis2/src/main/kotlin/org/genspectrum/lapis/controller/ControllerDescriptions.kt index 9aebb9f2f..af1b1c13b 100644 --- a/lapis2/src/main/kotlin/org/genspectrum/lapis/controller/ControllerDescriptions.kt +++ b/lapis2/src/main/kotlin/org/genspectrum/lapis/controller/ControllerDescriptions.kt @@ -16,8 +16,8 @@ const val AMINO_ACID_INSERTIONS_ENDPOINT_DESCRIPTION = "than or equal to the specified minProportion. Only sequences matching the specified " + "sequence filters are considered." -const val AMINO_ACID_SEQUENCE_ENDPOINT_DESCRIPTION = - "Returns a string of fasta formated amino acid sequences. Only sequences matching the specified " + +const val ALIGNED_AMINO_ACID_SEQUENCE_ENDPOINT_DESCRIPTION = + "Returns a string of fasta formated aligned amino acid sequences. Only sequences matching the specified " + "sequence filters are considered." const val AGGREGATED_GROUP_BY_FIELDS_DESCRIPTION = "The fields to stratify by. If empty, only the overall count is returned" diff --git a/lapis2/src/main/kotlin/org/genspectrum/lapis/controller/LapisController.kt b/lapis2/src/main/kotlin/org/genspectrum/lapis/controller/LapisController.kt index 07ec919e9..74aa0d6e0 100644 --- a/lapis2/src/main/kotlin/org/genspectrum/lapis/controller/LapisController.kt +++ b/lapis2/src/main/kotlin/org/genspectrum/lapis/controller/LapisController.kt @@ -10,7 +10,7 @@ import org.genspectrum.lapis.controller.Delimiter.TAB import org.genspectrum.lapis.logging.RequestContext import org.genspectrum.lapis.model.SiloQueryModel import org.genspectrum.lapis.openApi.AGGREGATED_REQUEST_SCHEMA -import org.genspectrum.lapis.openApi.AMINO_ACID_SEQUENCE_REQUEST_SCHEMA +import org.genspectrum.lapis.openApi.ALIGNED_AMINO_ACID_SEQUENCE_REQUEST_SCHEMA import org.genspectrum.lapis.openApi.AggregatedOrderByFields import org.genspectrum.lapis.openApi.AminoAcidInsertions import org.genspectrum.lapis.openApi.AminoAcidMutations @@ -23,9 +23,9 @@ import org.genspectrum.lapis.openApi.FieldsToAggregateBy import org.genspectrum.lapis.openApi.INSERTIONS_REQUEST_SCHEMA import org.genspectrum.lapis.openApi.InsertionsOrderByFields import org.genspectrum.lapis.openApi.LapisAggregatedResponse +import org.genspectrum.lapis.openApi.LapisAlignedAminoAcidSequenceResponse import org.genspectrum.lapis.openApi.LapisAminoAcidInsertionsResponse import org.genspectrum.lapis.openApi.LapisAminoAcidMutationsResponse -import org.genspectrum.lapis.openApi.LapisAminoAcidSequenceResponse import org.genspectrum.lapis.openApi.LapisDetailsResponse import org.genspectrum.lapis.openApi.LapisNucleotideInsertionsResponse import org.genspectrum.lapis.openApi.LapisNucleotideMutationsResponse @@ -67,7 +67,7 @@ const val AMINO_ACID_MUTATIONS_ROUTE = "/aminoAcidMutations" const val NUCLEOTIDE_INSERTIONS_ROUTE = "/nucleotideInsertions" const val AMINO_ACID_INSERTIONS_ROUTE = "/aminoAcidInsertions" const val ALIGNED_NUCLEOTIDE_SEQUENCES_ROUTE = "/alignedNucleotideSequences" -const val AMINO_ACID_SEQUENCES_ROUTE = "/aminoAcidSequences" +const val ALIGNED_AMINO_ACID_SEQUENCES_ROUTE = "/alignedAminoAcidSequences" @RestController class LapisController( @@ -1261,9 +1261,9 @@ class LapisController( return getResponseAsCsv(request, TAB, siloQueryModel::getAminoAcidInsertions) } - @GetMapping("$AMINO_ACID_SEQUENCES_ROUTE/{gene}", produces = ["text/x-fasta"]) - @LapisAminoAcidSequenceResponse - fun getAminoAcidSequence( + @GetMapping("$ALIGNED_AMINO_ACID_SEQUENCES_ROUTE/{gene}", produces = ["text/x-fasta"]) + @LapisAlignedAminoAcidSequenceResponse + fun getAlignedAminoAcidSequence( @PathVariable(name = "gene", required = true) gene: String, @PrimitiveFieldFilters @RequestParam @@ -1306,11 +1306,11 @@ class LapisController( return siloQueryModel.getGenomicSequence(request, SequenceType.ALIGNED, gene) } - @PostMapping("$AMINO_ACID_SEQUENCES_ROUTE/{gene}", produces = ["text/x-fasta"]) - @LapisAminoAcidSequenceResponse - fun postAminoAcidSequence( + @PostMapping("$ALIGNED_AMINO_ACID_SEQUENCES_ROUTE/{gene}", produces = ["text/x-fasta"]) + @LapisAlignedAminoAcidSequenceResponse + fun postAlignedAminoAcidSequence( @PathVariable(name = "gene", required = true) gene: String, - @Parameter(schema = Schema(ref = "#/components/schemas/$AMINO_ACID_SEQUENCE_REQUEST_SCHEMA")) + @Parameter(schema = Schema(ref = "#/components/schemas/$ALIGNED_AMINO_ACID_SEQUENCE_REQUEST_SCHEMA")) @RequestBody request: SequenceFiltersRequest, ): String { diff --git a/lapis2/src/main/kotlin/org/genspectrum/lapis/openApi/OpenApiDocs.kt b/lapis2/src/main/kotlin/org/genspectrum/lapis/openApi/OpenApiDocs.kt index cddf6d207..c999947f8 100644 --- a/lapis2/src/main/kotlin/org/genspectrum/lapis/openApi/OpenApiDocs.kt +++ b/lapis2/src/main/kotlin/org/genspectrum/lapis/openApi/OpenApiDocs.kt @@ -96,7 +96,7 @@ fun buildOpenApiSchema( ), ) .addSchemas( - AMINO_ACID_SEQUENCE_REQUEST_SCHEMA, + ALIGNED_AMINO_ACID_SEQUENCE_REQUEST_SCHEMA, requestSchemaForCommonSequenceFilters( getSequenceFilters( databaseConfig, diff --git a/lapis2/src/main/kotlin/org/genspectrum/lapis/openApi/Schemas.kt b/lapis2/src/main/kotlin/org/genspectrum/lapis/openApi/Schemas.kt index 638da7049..4cca5ee28 100644 --- a/lapis2/src/main/kotlin/org/genspectrum/lapis/openApi/Schemas.kt +++ b/lapis2/src/main/kotlin/org/genspectrum/lapis/openApi/Schemas.kt @@ -11,11 +11,11 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse import org.genspectrum.lapis.controller.AGGREGATED_ENDPOINT_DESCRIPTION import org.genspectrum.lapis.controller.AGGREGATED_GROUP_BY_FIELDS_DESCRIPTION import org.genspectrum.lapis.controller.AGGREGATED_ORDER_BY_FIELDS_DESCRIPTION +import org.genspectrum.lapis.controller.ALIGNED_AMINO_ACID_SEQUENCE_ENDPOINT_DESCRIPTION import org.genspectrum.lapis.controller.ALIGNED_MULTI_SEGMENTED_NUCLEOTIDE_SEQUENCE_ENDPOINT_DESCRIPTION import org.genspectrum.lapis.controller.ALIGNED_SINGLE_SEGMENTED_NUCLEOTIDE_SEQUENCE_ENDPOINT_DESCRIPTION import org.genspectrum.lapis.controller.AMINO_ACID_INSERTIONS_ENDPOINT_DESCRIPTION import org.genspectrum.lapis.controller.AMINO_ACID_MUTATIONS_ENDPOINT_DESCRIPTION -import org.genspectrum.lapis.controller.AMINO_ACID_SEQUENCE_ENDPOINT_DESCRIPTION import org.genspectrum.lapis.controller.DETAILS_ENDPOINT_DESCRIPTION import org.genspectrum.lapis.controller.DETAILS_FIELDS_DESCRIPTION import org.genspectrum.lapis.controller.DETAILS_ORDER_BY_FIELDS_DESCRIPTION @@ -32,7 +32,7 @@ const val REQUEST_SCHEMA_WITH_MIN_PROPORTION = "SequenceFiltersWithMinProportion const val AGGREGATED_REQUEST_SCHEMA = "AggregatedPostRequest" const val DETAILS_REQUEST_SCHEMA = "DetailsPostRequest" const val INSERTIONS_REQUEST_SCHEMA = "InsertionsRequest" -const val AMINO_ACID_SEQUENCE_REQUEST_SCHEMA = "AminoAcidSequenceRequest" +const val ALIGNED_AMINO_ACID_SEQUENCE_REQUEST_SCHEMA = "AminoAcidSequenceRequest" const val NUCLEOTIDE_SEQUENCE_REQUEST_SCHEMA = "NucleotideSequenceRequest" const val AGGREGATED_RESPONSE_SCHEMA = "AggregatedResponse" @@ -132,9 +132,9 @@ annotation class LapisAminoAcidInsertionsResponse @Target(AnnotationTarget.FUNCTION) @Retention(AnnotationRetention.RUNTIME) @LapisResponseAnnotation( - description = AMINO_ACID_SEQUENCE_ENDPOINT_DESCRIPTION, + description = ALIGNED_AMINO_ACID_SEQUENCE_ENDPOINT_DESCRIPTION, ) -annotation class LapisAminoAcidSequenceResponse +annotation class LapisAlignedAminoAcidSequenceResponse @Target(AnnotationTarget.FUNCTION) @Retention(AnnotationRetention.RUNTIME) diff --git a/lapis2/src/test/kotlin/org/genspectrum/lapis/controller/LapisControllerCommonFieldsTest.kt b/lapis2/src/test/kotlin/org/genspectrum/lapis/controller/LapisControllerCommonFieldsTest.kt index ed9ddfd81..8b076e227 100644 --- a/lapis2/src/test/kotlin/org/genspectrum/lapis/controller/LapisControllerCommonFieldsTest.kt +++ b/lapis2/src/test/kotlin/org/genspectrum/lapis/controller/LapisControllerCommonFieldsTest.kt @@ -367,7 +367,7 @@ class LapisControllerCommonFieldsTest( Arguments.of(DETAILS_ROUTE), Arguments.of(NUCLEOTIDE_INSERTIONS_ROUTE), Arguments.of(AMINO_ACID_INSERTIONS_ROUTE), - Arguments.of("$AMINO_ACID_SEQUENCES_ROUTE/S"), + Arguments.of("$ALIGNED_AMINO_ACID_SEQUENCES_ROUTE/S"), ) @JvmStatic diff --git a/siloLapisTests/test/aminoAcidSequence.spec.ts b/siloLapisTests/test/aminoAcidSequence.spec.ts index 35e800bfe..ca21f775b 100644 --- a/siloLapisTests/test/aminoAcidSequence.spec.ts +++ b/siloLapisTests/test/aminoAcidSequence.spec.ts @@ -1,9 +1,9 @@ import { expect } from 'chai'; import { basePath, lapisClient, sequenceData } from './common'; -describe('The /aminoAcidSequence endpoint', () => { +describe('The /alignedAminoAcidSequence endpoint', () => { it('should return amino acid sequences for Switzerland', async () => { - const result = await lapisClient.postAminoAcidSequence({ + const result = await lapisClient.postAlignedAminoAcidSequence({ gene: 'S', aminoAcidSequenceRequest: { country: 'Switzerland' }, }); @@ -17,7 +17,7 @@ describe('The /aminoAcidSequence endpoint', () => { }); it('should order ascending by specified fields', async () => { - const result = await lapisClient.postAminoAcidSequence({ + const result = await lapisClient.postAlignedAminoAcidSequence({ gene: 'S', aminoAcidSequenceRequest: { orderBy: [{ field: 'gisaid_epi_isl', type: 'ascending' }] }, }); @@ -31,7 +31,7 @@ describe('The /aminoAcidSequence endpoint', () => { }); it('should order descending by specified fields', async () => { - const result = await lapisClient.postAminoAcidSequence({ + const result = await lapisClient.postAlignedAminoAcidSequence({ gene: 'S', aminoAcidSequenceRequest: { orderBy: [{ field: 'gisaid_epi_isl', type: 'descending' }] }, }); @@ -45,7 +45,7 @@ describe('The /aminoAcidSequence endpoint', () => { }); it('should apply limit and offset', async () => { - const resultWithLimit = await lapisClient.postAminoAcidSequence({ + const resultWithLimit = await lapisClient.postAlignedAminoAcidSequence({ gene: 'S', aminoAcidSequenceRequest: { orderBy: [{ field: 'gisaid_epi_isl', type: 'ascending' }], @@ -61,7 +61,7 @@ describe('The /aminoAcidSequence endpoint', () => { expect(primaryKeysWithLimit[0]).to.equal('>EPI_ISL_1001493'); expect(sequencesWithLimit[0]).to.have.length(1274); - const resultWithLimitAndOffset = await lapisClient.postAminoAcidSequence({ + const resultWithLimitAndOffset = await lapisClient.postAlignedAminoAcidSequence({ gene: 'S', aminoAcidSequenceRequest: { orderBy: [{ field: 'gisaid_epi_isl', type: 'ascending' }], @@ -80,7 +80,7 @@ describe('The /aminoAcidSequence endpoint', () => { }); it('should correctly handle nucleotide insertion requests', async () => { - const result = await lapisClient.postAminoAcidSequence({ + const result = await lapisClient.postAlignedAminoAcidSequence({ gene: 'S', aminoAcidSequenceRequest: { nucleotideInsertions: ['ins_25701:CC?', 'ins_5959:?AT'], @@ -96,7 +96,7 @@ describe('The /aminoAcidSequence endpoint', () => { }); it('should correctly handle amino acid insertion requests', async () => { - const result = await lapisClient.postAminoAcidSequence({ + const result = await lapisClient.postAlignedAminoAcidSequence({ gene: 'S', aminoAcidSequenceRequest: { aminoAcidInsertions: ['ins_S:143:T', 'ins_ORF1a:3602:F?P'], @@ -111,7 +111,7 @@ describe('The /aminoAcidSequence endpoint', () => { }); it('should return the lapis data version in the response', async () => { - const result = await fetch(basePath + '/aminoAcidSequences/S'); + const result = await fetch(basePath + '/alignedAminoAcidSequences/S'); expect(result.status).equals(200); expect(result.headers.get('lapis-data-version')).to.match(/\d{10}/);