Skip to content

MassBank/MassBank3-similarity-service

Repository files navigation

MassBank3-similarity-service

A REST interface wrapping matchms for MassBank3.

This server was generated by the OpenAPI Generator project and uses the Connexion library on top of Flask.

Requirements

Tested on Python 3.12

Configuration

This microservice is configured with environment variables. The reference spectra are initialized from a local file. The file location needs to be configured in the environment variable MSP. For MassBank we configure the service with the latest MassBank-data release in msp format.

wget https://github.com/MassBank/MassBank-data/releases/latest/download/MassBank_NIST.msp
export MSP="./MassBank_NIST.msp"

A more verbose logging can be activated by setting environment variable VERBOSE to "true".

export VERBOSE=true

Usage

To run the server, install the requirements, generate the server code and start the server like this:

pip3 install -r requirements.txt
bash generate.sh
PYTHONPATH=gen python3 -m similarity_service_impl

You can find the swagger ui at http://localhost:8080/ui/ and the OpenAPI definition at http://localhost:8080/openapi.json in your browser.

Running with Docker

To run the server in a Docker container, execute the following commands:

# building the image
docker build -t massbank3-similarity-service .

# download reference data
wget https://github.com/MassBank/MassBank-data/releases/latest/download/MassBank_NIST.msp

# starting up a container
docker run -p 8080:8080 \
-v $(pwd)/MassBank_NIST.msp:/MassBank_NIST.msp \
-e MSP='/MassBank_NIST.msp' \
massbank3-similarity-service

Prebuild docker images are available from quay.io/massbank/massbank3-similarity-service.
The fastest way to get things running is:

# download reference data
wget https://github.com/MassBank/MassBank-data/releases/latest/download/MassBank_NIST.msp

# starting up a container
docker run -p 8080:8080 \
-v $(pwd)/MassBank_NIST.msp:/MassBank_NIST.msp \
-e MSP='/MassBank_NIST.msp' \
quay.io/massbank/massbank3-similarity-service:latest