Skip to content

Commit

Permalink
feat(lapis2): delete insertions metadata types #804
Browse files Browse the repository at this point in the history
In SILO the insertions are now handled separately from metadata.
  • Loading branch information
fengelniederhammer committed May 21, 2024
1 parent d1badea commit 771e984
Show file tree
Hide file tree
Showing 13 changed files with 320 additions and 140 deletions.
9 changes: 9 additions & 0 deletions lapis2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,12 @@ Creating a release means:
The changelog and the version number are determined by the commit messages.
Therefore, commit messages should follow the [Conventional Commits](https://www.conventionalcommits.org/) specification.
Also refer to the Release Please documentation for more information on how to write commit messages.

## SILO Compatibility

This table shows which LAPIS version is required for which SILO version:

| LAPIS | SILO |
|-------|-------|
| 0.1.2 | 0.2.0 |
| 0.1 | 0.1.0 |
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ enum class MetadataType {

@JsonProperty("boolean")
BOOLEAN,

@JsonProperty("insertion")
NUCLEOTIDE_INSERTION,

@JsonProperty("aaInsertion")
AMINO_ACID_INSERTION,
}

data class DatabaseFeature(val name: String)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ private fun mapToSequenceFilterField(databaseMetadata: DatabaseMetadata) =
type = SequenceFilterFieldType.Boolean,
),
)

MetadataType.NUCLEOTIDE_INSERTION -> emptyList()
MetadataType.AMINO_ACID_INSERTION -> emptyList()
}

private const val VARIANT_QUERY_FIELD = "variantQuery"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,8 @@ private fun aggregatedMetadataFieldSchemas(databaseConfig: DatabaseConfig) =
databaseConfig.schema.metadata.associate { it.name to Schema<String>().type(mapToOpenApiType(it.type)) }

private fun detailsMetadataFieldSchemas(databaseConfig: DatabaseConfig) =
databaseConfig.schema.metadata.filter {
it.type != MetadataType.AMINO_ACID_INSERTION && it.type != MetadataType.NUCLEOTIDE_INSERTION
}
databaseConfig.schema
.metadata
.associate { it.name to Schema<String>().type(mapToOpenApiType(it.type)) }

private fun mapToOpenApiType(type: MetadataType): String =
Expand All @@ -328,8 +327,6 @@ private fun mapToOpenApiType(type: MetadataType): String =
MetadataType.DATE -> "string"
MetadataType.INT -> "integer"
MetadataType.FLOAT -> "number"
MetadataType.NUCLEOTIDE_INSERTION -> "string"
MetadataType.AMINO_ACID_INSERTION -> "string"
MetadataType.BOOLEAN -> "boolean"
}

Expand Down Expand Up @@ -538,10 +535,10 @@ private fun aminoAcidInsertions() =
.items(
Schema<String>()
.type("string")
.example("ins_ORF1:123:ATT")
.example("ins_ORF1a:123:ATT")
.description(
"""
|A amino acid insertion in the format "ins_\<gene\>:\<position\>:\<insertion\>".
|An amino acid insertion in the format "ins_\<gene\>:\<position\>:\<insertion\>".
""".trimMargin(),
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ class DatabaseConfigTest {
DatabaseMetadata(name = "country", type = MetadataType.STRING),
DatabaseMetadata(name = "pangoLineage", type = MetadataType.PANGO_LINEAGE),
DatabaseMetadata(name = "test_boolean_column", type = MetadataType.BOOLEAN),
DatabaseMetadata(name = "nucInsertion", type = MetadataType.NUCLEOTIDE_INSERTION),
DatabaseMetadata(name = "aaInsertion", type = MetadataType.AMINO_ACID_INSERTION),
),
)
assertThat(
Expand Down Expand Up @@ -59,8 +57,6 @@ class DatabaseConfigWithoutFeaturesTest {
DatabaseMetadata(name = "region", type = MetadataType.STRING),
DatabaseMetadata(name = "country", type = MetadataType.STRING),
DatabaseMetadata(name = "pangoLineage", type = MetadataType.PANGO_LINEAGE),
DatabaseMetadata(name = "nucInsertion", type = MetadataType.NUCLEOTIDE_INSERTION),
DatabaseMetadata(name = "aaInsertion", type = MetadataType.AMINO_ACID_INSERTION),
),
)
assertThat(underTest.schema.features, `is`(emptyList()))
Expand Down
4 changes: 0 additions & 4 deletions lapis2/src/test/resources/config/testDatabaseConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ schema:
type: pango_lineage
- name: test_boolean_column
type: boolean
- name: nucInsertion
type: insertion
- name: aaInsertion
type: aaInsertion
features:
- name: sarsCoV2VariantQuery
primaryKey: primaryKey
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,4 @@ schema:
type: string
- name: pangoLineage
type: pango_lineage
- name: nucInsertion
type: insertion
- name: aaInsertion
type: aaInsertion
primaryKey: primaryKey
7 changes: 4 additions & 3 deletions siloLapisTests/test/aminoAcidInsertions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('The /aminoAcidInsertions endpoint', () => {
it('should order by specified fields', async () => {
const ascendingOrderedResult = await lapisClient.postAminoAcidInsertions1({
insertionsRequest: {
orderBy: [{ field: 'count', type: 'ascending' }],
orderBy: [{ field: 'count', type: 'ascending' }, { field: 'insertion' }],
},
});

Expand All @@ -39,7 +39,7 @@ describe('The /aminoAcidInsertions endpoint', () => {
it('should apply limit and offset', async () => {
const resultWithLimit = await lapisClient.postAminoAcidInsertions1({
insertionsRequest: {
orderBy: [{ field: 'count', type: 'ascending' }],
orderBy: [{ field: 'count', type: 'ascending' }, { field: 'insertion' }],
limit: 2,
},
});
Expand All @@ -49,7 +49,7 @@ describe('The /aminoAcidInsertions endpoint', () => {

const resultWithLimitAndOffset = await lapisClient.postAminoAcidInsertions1({
insertionsRequest: {
orderBy: [{ field: 'count', type: 'ascending' }],
orderBy: [{ field: 'count', type: 'ascending' }, { field: 'insertion' }],
limit: 2,
offset: 1,
},
Expand Down Expand Up @@ -81,6 +81,7 @@ describe('The /aminoAcidInsertions endpoint', () => {
const result = await lapisClient.postAminoAcidInsertions1({
insertionsRequest: {
aminoAcidInsertions: ['ins_S:143:T', 'ins_ORF1a:3602:F?P'],
orderBy: [{ field: 'insertion' }],
},
});

Expand Down
101 changes: 101 additions & 0 deletions siloLapisTests/testData/aa_insertions.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
primaryKey S ORF1a E M N ORF1b ORF3a ORF6 ORF7a ORF7b ORF8 ORF9b
key_1408408 [214:EPE] [] [] [] [] [] [] [] [] [] [] []
key_1749899 [] [] [] [] [] [] [] [] [] [] [] []
key_2016901 [] [] [] [] [] [] [] [] [] [] [] []
key_1749892 [] [] [] [] [] [] [] [] [] [] [] []
key_1597932 [214:EPE] [] [] [] [] [] [] [] [] [] [] []
key_1407962 [] [] [] [] [] [] [] [] [] [] [] []
key_1750503 [] [] [] [] [] [] [] [] [] [] [] []
key_1360935 [] [] [] [] [] [] [] [] [] [] [] []
key_2019235 [] [] [] [] [] [] [] [] [] [] [] []
key_1749960 [] [] [] [] [] [] [] [] [] [] [] []
key_1361468 [] [] [] [] [] [] [] [] [] [] [] []
key_1408062 [] [] [] [] [] [] [] [] [] [] [] []
key_1597890 [] [] [] [] [] [] [] [] [] [] [] []
key_1682849 [] [] [] [] [] [] [] [] [] [] [] []
key_1408805 [] [] [] [] [] [] [] [] [] [] [] []
key_1750868 [214:EPE] [] [] [] [] [] [] [] [] [] [] []
key_2019350 [] [] [] [] [] [] [] [] [] [] [] []
key_2017036 [] [] [] [] [] [] [] [] [] [] [] []
key_1599113 [] [] [] [] [] [] [] [] [] [] [] []
key_2214128 [] [] [] [] [] [] [] [] [] [] [] []
key_2408472 [] [] [] [] [] [] [] [] [] [] [] []
key_830864 [] [] [] [] [] [] [] [] [] [] [] []
key_581968 [214:EPE] [] [] [] [] [] [] [] [] [] [] []
key_2213804 [] [] [] [] [] [] [] [] [] [] [] []
key_2405276 [] [] [] [] [] [] [] [] [] [] [] []
key_2213934 [] [] [] [] [] [] [] [] [] [] [] []
key_2213984 [] [] [] [] [] [] [] [] [] [] [] []
key_2574088 [] [] [] [] [] [] [] [] [] [] [] []
key_2544226 [] [] [] [] [] [] [] [] [] [] [] []
key_2360326 [] [] [] [] [] [] [] [] [] [] [] []
key_2379651 [] [] [] [] [] [] [] [] [] [] [] []
key_1036103 [] [] [] [] [] [] [] [] [] [] [] []
key_931279 [] [] [] [] [] [] [] [] [] [] [] []
key_931031 [] [] [] [] [] [] [] [] [] [] [] []
key_1273458 [] [] [] [] [] [] [] [] [] [] [] []
key_1273715 [] [] [] [] [] [] [] [] [] [] [] []
key_737604 [] [] [] [] [] [] [] [] [] [] [] []
key_1129663 [] [] [] [] [] [] [] [] [] [] [] []
key_1003629 [214:EPE] [] [] [] [] [] [] [] [] [] [] []
key_737715 [247:SGE] [] [] [] [] [] [] [] [] [] [] []
key_1003036 [] [] [] [] [] [] [] [] [] [] [] []
key_899762 [] [] [] [] [] [] [] [] [] [] [] []
key_899725 [210:IV] [] [] [] [] [] [] [] [] [] [] []
key_1195052 [] [] [] [] [] [] [] [] [] [] [] []
key_1003519 [] [] [] [] [] [] [] [] [] [] [] []
key_1003010 [] [] [] [] [] [] [] [] [] [] [] []
key_1119584 [] [] [] [] [] [] [] [] [] [] [] []
key_1002052 [] [] [] [] [] [] [] [] [] [] [] []
key_466942 [] [] [] [] [] [] [] [] [] [] [] []
key_1003849 [] [] [] [] [] [] [] [] [] [] [] []
key_768148 [] [] [] [] [] [] [] [] [] [] [] []
key_1080536 [] [] [] [] [] [] [] [] [] [] [] []
key_1002156 [] [] [] [] [] [] [] [] [] [] [] []
key_1119315 [] [] [] [] [] [] [] [] [] [] [] []
key_1004495 [] [] [] [] [] [] [] [] [] [] [] []
key_1001920 [] [] [] [] [] [] [] [] [] [] [] []
key_1131102 [] [] [] [] [] [] [] [] [] [] [] []
key_1003373 [] [] [] [] [] [] [] [] [] [] [] []
key_721941 [] [] [] [] [] [] [] [] [] [] [] []
key_1130868 [] [] [] [] [] [] [] [] [] [] [] []
key_1003425 [] [] [] [] [] [] [] [] [] [] [] []
key_737860 [] [] [] [] [] [] [] [] [] [] [] []
key_1001493 [] [] [] [] [] [] [] [] [] [] [] []
key_1260480 [] [] [] [] [] [] [] [] [] [] [] []
key_1747885 [] [] [] [] [] [] [] [] [] [] [] []
key_1747752 [] [] [] [] [] [] [] [] [] [] [] []
key_1005148 [] [] [] [] [] [] [] [] [] [] [] []
key_1748243 [] [] [] [] [] [] [] [] [] [] [] []
key_1748215 [] [] [] [] [] [] [] [] [] [] [] []
key_1748395 [] [] [] [] [] [] [] [] [] [] [] []
key_1760534 [] [] [] [] [] [] [] [] [] [] [] []
key_2086867 [] [] [] [] [] [] [] [] [] [] [] []
key_1840634 [] [] [] [] [] [] [] [] [] [] [] []
key_2180995 [] [] [] [] [] [] [] [] [] [] [] []
key_2181005 [] [] [] [] [] [] [] [] [] [] [] []
key_2180023 [] [] [] [] [] [] [] [] [] [] [] []
key_2270139 [] [] [] [] [] [] [] [] [] [] [] []
key_2544452 [] [] [] [] [] [] [] [] [] [] [] []
key_2544332 [] [] [] [] [] [] [] [] [] [] [] []
key_2307766 [] [] [] [] [] [] [] [] [] [] [] []
key_2375490 [] [] [] [] [] [] [] [] [] [] [] []
key_2374969 [] [] [] [] [] [] [] [] [] [] [] []
key_2307888 [] [] [] [] [] [] [] [] [] [] [] []
key_2375247 [] [] [] [] [] [] [] [] [] [] [] []
key_2308054 [] [] [] [] [] [] [] [] [] [] [] []
key_2375165 [] [] [] [] [] [] [] [] [] [] [] []
key_2375097 [] [] [] [] [] [] [] [] [] [] [] []
key_3128737 [] [] [] [] [] [] [] [] [] [] [] []
key_3128811 [] [] [] [] [] [] [] [] [] [] [] []
key_3086369 [] [] [] [] [] [] [] [] [] [] [] []
key_3259931 [143:T] [3602:FEP] [] [] [] [] [] [] [] [] [] []
key_3267832 [] [] [] [] [] [] [] [] [] [] [] []
key_3128796 [] [] [] [] [] [] [] [] [] [] [] []
key_3016465 [] [] [] [] [] [] [] [] [] [] [] []
key_3247294 [] [] [] [] [] [] [] [] [] [] [] []
key_3578231 [] [] [] [] [] [] [] [] [] [] [] []
key_3465732 [] [] [] [] [] [] [] [] [] [] [] []
key_2367431 [] [] [] [] [] [] [] [] [] [] [] []
key_3465556 [] [] [] [] [] [] [] [] [] [] [] []
key_2359636 [] [3602:F] [] [] [] [] [] [] [] [] [] []
101 changes: 101 additions & 0 deletions siloLapisTests/testData/nuc_insertions.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
primaryKey main
key_1408408 []
key_1749899 []
key_2016901 []
key_1749892 []
key_1597932 []
key_1407962 []
key_1750503 []
key_1360935 []
key_2019235 []
key_1749960 []
key_1361468 []
key_1408062 [22204:CAGAA]
key_1597890 [22339:GCTGGT]
key_1682849 []
key_1408805 []
key_1750868 []
key_2019350 []
key_2017036 []
key_1599113 []
key_2214128 []
key_2408472 []
key_830864 []
key_581968 []
key_2213804 [25701:CCC]
key_2405276 []
key_2213934 []
key_2213984 [25701:CCC]
key_2574088 [25701:CCC]
key_2544226 []
key_2360326 []
key_2379651 []
key_1036103 []
key_931279 []
key_931031 []
key_1273458 [25701:CCC]
key_1273715 []
key_737604 []
key_1129663 []
key_1003629 []
key_737715 []
key_1003036 [5959:TAT]
key_899762 []
key_899725 []
key_1195052 []
key_1003519 []
key_1003010 []
key_1119584 []
key_1002052 []
key_466942 []
key_1003849 []
key_768148 [25701:CCC]
key_1080536 []
key_1002156 []
key_1119315 []
key_1004495 [25701:CCC]
key_1001920 []
key_1131102 []
key_1003373 []
key_721941 []
key_1130868 [25701:CCC]
key_1003425 []
key_737860 []
key_1001493 []
key_1260480 []
key_1747885 []
key_1747752 []
key_1005148 [25701:CCC]
key_1748243 []
key_1748215 []
key_1748395 []
key_1760534 []
key_2086867 [25701:CCC]
key_1840634 []
key_2180995 []
key_2181005 []
key_2180023 [25701:CCC]
key_2270139 []
key_2544452 []
key_2544332 [25701:CCC]
key_2307766 []
key_2375490 []
key_2374969 [25701:CCC]
key_2307888 []
key_2375247 [25701:CCC]
key_2308054 []
key_2375165 []
key_2375097 []
key_3128737 []
key_3128811 []
key_3086369 [25701:CCC]
key_3259931 []
key_3267832 []
key_3128796 [25701:CCC]
key_3016465 []
key_3247294 []
key_3578231 [25701:CCC,5959:TAT]
key_3465732 []
key_2367431 []
key_3465556 []
key_2359636 [25701:CCC]
4 changes: 0 additions & 4 deletions siloLapisTests/testData/protectedTestDatabaseConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ schema:
type: float
- name: test_boolean_column
type: boolean
- name: insertions
type: insertion
- name: aaInsertions
type: aaInsertion
features:
- name: sarsCoV2VariantQuery
primaryKey: primaryKey
Expand Down
Loading

0 comments on commit 771e984

Please sign in to comment.