Skip to content

Commit 2472cac

Browse files
authored
Merge pull request #47 from MassBank/dev-frontend
Use similarity search in backend & request via peak list and reference spectra within frontend
2 parents cae1b81 + 0f872d9 commit 2472cac

36 files changed

+1055
-234
lines changed

api/openapi.yml

Lines changed: 96 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ paths:
2626
$ref: "./schemas/FilterSchemas.yaml#/components/schemas/MSType"
2727
required: false
2828
- in: query
29-
name: ion-mode
29+
name: ion_mode
3030
description: Filter by ion mode. If none is given, both is assumed.
3131
schema:
3232
$ref: "./schemas/FilterSchemas.yaml#/components/schemas/IonMode"
@@ -109,7 +109,7 @@ paths:
109109
summary: Get a list of records
110110
operationId: getRecords
111111
responses:
112-
'200':
112+
"200":
113113
description: "A list of records"
114114
content:
115115
application/json:
@@ -128,7 +128,7 @@ paths:
128128
summary: Get a MassBank record
129129
operationId: getRecord
130130
responses:
131-
'200':
131+
"200":
132132
description: "A MassBank record"
133133
content:
134134
application/json:
@@ -146,18 +146,18 @@ paths:
146146
summary: The SVG image for an accession
147147
operationId: getSVG
148148
responses:
149-
'200':
149+
"200":
150150
description: "A compound SVG"
151151
content:
152-
image/svg+xml:
152+
image/svg+xml:
153153
schema:
154154
type: string
155-
/records/count:
155+
/records/count:
156156
get:
157157
summary: The number of all records
158158
operationId: getCount
159159
responses:
160-
'200':
160+
"200":
161161
description: "The record count"
162162
content:
163163
application/json:
@@ -168,7 +168,7 @@ paths:
168168
summary: get filter options
169169
operationId: getFilterOptions
170170
responses:
171-
'200':
171+
"200":
172172
description: "All Filter options"
173173
content:
174174
application/json:
@@ -192,7 +192,7 @@ paths:
192192
$ref: "./schemas/FilterSchemas.yaml#/components/schemas/MSType"
193193
required: false
194194
- in: query
195-
name: ion-mode
195+
name: ion_mode
196196
description: Filter by ion mode. If none is given, both is assumed.
197197
schema:
198198
$ref: "./schemas/FilterSchemas.yaml#/components/schemas/IonMode"
@@ -204,7 +204,7 @@ paths:
204204
$ref: "./schemas/FilterSchemas.yaml#/components/schemas/Contributor"
205205
required: false
206206
responses:
207-
'200':
207+
"200":
208208
description: "All browse options"
209209
content:
210210
application/json:
@@ -215,9 +215,94 @@ paths:
215215
summary: get massbank metadata
216216
operationId: getMetadata
217217
responses:
218-
'200':
218+
"200":
219219
description: "Metadata for database and datasets"
220220
content:
221221
application/json:
222222
schema:
223223
$ref: "./schemas/FilterOptions.yaml#/components/schemas/Metadata"
224+
225+
/similarity:
226+
parameters:
227+
- in: query
228+
name: peak_list
229+
description: Filter by peak list.
230+
schema:
231+
$ref: "./schemas/FilterSchemas.yaml#/components/schemas/PeakList"
232+
required: true
233+
- in: query
234+
name: reference_spectra_list
235+
description: Filter by reference spectra list.
236+
schema:
237+
type: array
238+
items:
239+
type: string
240+
example:
241+
- MSBNK-IPB_Halle-PB001341
242+
- MSBNK-IPB_Halle-PB006202
243+
- MSBNK-IPB_Halle-PB006203
244+
- MSBNK-IPB_Halle-PB001342
245+
- MSBNK-IPB_Halle-PB001343
246+
required: false
247+
- in: query
248+
name: instrument_type
249+
description: Filter by a list of instrument type, which will be associated by OR.
250+
schema:
251+
$ref: "./schemas/FilterSchemas.yaml#/components/schemas/InstrumentType"
252+
required: false
253+
- in: query
254+
description: Filter by a List of MS types, which are associated by OR. If none is given, all is assumed.
255+
name: ms_type
256+
schema:
257+
$ref: "./schemas/FilterSchemas.yaml#/components/schemas/MSType"
258+
required: false
259+
- in: query
260+
name: ion_mode
261+
description: Filter by ion mode. If none is given, both is assumed.
262+
schema:
263+
$ref: "./schemas/FilterSchemas.yaml#/components/schemas/IonMode"
264+
required: false
265+
- in: query
266+
name: exact_mass
267+
description: Filter by exact mass.
268+
schema:
269+
$ref: "./schemas/FilterSchemas.yaml#/components/schemas/ExactMass"
270+
- in: query
271+
name: mass_tolerance
272+
description: "Tolerance for mass filters. Default: 0.3"
273+
schema:
274+
$ref: "./schemas/FilterSchemas.yaml#/components/schemas/MassTolerance"
275+
- in: query
276+
name: formula
277+
description: Filter by formula.
278+
schema:
279+
$ref: "./schemas/FilterSchemas.yaml#/components/schemas/Formula"
280+
required: false
281+
- in: query
282+
name: limit
283+
description: "Maximum number of results. Default: 20"
284+
schema:
285+
$ref: "./schemas/FilterSchemas.yaml#/components/schemas/Limit"
286+
required: false
287+
- in: query
288+
name: intensity_cutoff
289+
description: "The Instensity cutoff for Peaklist search. Default: 5"
290+
schema:
291+
$ref: "./schemas/FilterSchemas.yaml#/components/schemas/IntensityCutoff"
292+
required: false
293+
- in: query
294+
name: contributor
295+
description: a contributor (institution)
296+
schema:
297+
$ref: "./schemas/FilterSchemas.yaml#/components/schemas/Contributor"
298+
required: false
299+
get:
300+
summary: Get a list of records with similarity scores
301+
operationId: getSimilarity
302+
responses:
303+
"200":
304+
description: "A list of similar records"
305+
content:
306+
application/json:
307+
schema:
308+
$ref: "./schemas/SimilaritySearchResult.yaml"

api/schemas/FilterSchemas.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ components:
1010
type: array
1111
items:
1212
type: string
13-
enum: [ MS,MS2,MS3,MS4 ]
13+
enum: [MS, MS2, MS3, MS4]
1414
IonMode:
1515
type: string
1616
description: "enum: [ POSITIVE, NEGATIVE ]"
@@ -44,8 +44,8 @@ components:
4444
type: array
4545
items:
4646
type: string
47-
description: "A tuple of m/z and intensity, e.g. (193.4,57)"
48-
pattern: "\\([0-9]+(\\.[0-9]*)?,[0-9]+\\)"
47+
description: "A tuple of m/z and intensity, e.g. (193.4;57)"
48+
pattern: "\\([0-9]+(\\.[0-9]*)?;[0-9]+\\)"
4949
IntensityCutoff:
5050
type: integer
5151
default: 5
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
type: object
2+
properties:
3+
data:
4+
type: array
5+
description: A ranked list of records with similarity scores.
6+
items:
7+
description: A record with similarity score.
8+
type: object
9+
properties:
10+
accession:
11+
description: MassBank accession id.
12+
type: string
13+
score:
14+
description: Similarity score to the query spectrum.
15+
type: number

cmd/mb3server/.openapi-generator/FILES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,7 @@ src/model_ms_focused_ion_inner.go
3737
src/model_search_result.go
3838
src/model_search_result_data_inner.go
3939
src/model_search_result_data_inner_spectra_inner.go
40+
src/model_similarity_search_result.go
41+
src/model_similarity_search_result_data_inner.go
4042
src/model_string_count_inner.go
4143
src/routers.go
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.6.0
1+
7.7.0

0 commit comments

Comments
 (0)