Skip to content

Commit

Permalink
refactor: rename 'amino acid sequence' to 'aligned amino acid sequence'
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasKellerer committed Dec 12, 2023
1 parent 803808f commit 22e5f49
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ fun buildOpenApiSchema(
),
)
.addSchemas(
AMINO_ACID_SEQUENCE_REQUEST_SCHEMA,
ALIGNED_AMINO_ACID_SEQUENCE_REQUEST_SCHEMA,
requestSchemaForCommonSequenceFilters(
getSequenceFilters(
databaseConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions siloLapisTests/test/aminoAcidSequence.spec.ts
Original file line number Diff line number Diff line change
@@ -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' },
});
Expand All @@ -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' }] },
});
Expand All @@ -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' }] },
});
Expand All @@ -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' }],
Expand All @@ -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' }],
Expand All @@ -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'],
Expand All @@ -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'],
Expand All @@ -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}/);
Expand Down

0 comments on commit 22e5f49

Please sign in to comment.