- Node.js >=8
- Elasticsearch ^6.6.0
- NCBI gene (
ncbi
) - Chebi (
chebi
) - Uniprot (
uniprot
)
The data sources included by default (e.g. npm run update
) are ncbi
and chebi
.
The following environment variables can be used to configure the server:
NODE_ENV
: the environment mode, eitherproduction
ordevelopment
(default)LOG_LEVEL
: the level for the log file (info
,warn
,error
)PORT
: the port on which the server runs (default 3000)ELASTICSEARCH_HOST
: thehost:port
that points to elasticsearchMAX_SEARCH_ES
: the maximum number of results to return from elasticsearchMAX_SEARCH_WS
: the maximum number of results to return in json from the webserviceCHUNK_SIZE
: how many grounding entries make up a chunk that gets bulk inserted into elasticsearchMAX_SIMULT_CHUNKS
: maximum number of chunks to insert simulteneously into elasticsearchINPUT_PATH
: the path to the input folder where data files are locatedINDEX
: the elasticsearch index name to store data from all data sourcesUNIPROT_FILE_NAME
: name of the file where uniprot data will be read fromUNIPROT_URL
: url to download uniprot file fromCHEBI_FILE_NAME
: name of the file where chebi data will be read fromCHEBI_URL
: url to download chebi file fromNCBI_FILE_NAME
: name of the file where ncbi data will be read fromNCBI_URL
: url to download ncbi file from
npm start
: start the servernpm stop
: stop the servernpm run watch
: watch mode (debug mode enabled, autoreload)npm test
: run tests for read only methods (e.g. search and get) assuming that data is already existingnpm test:sample
: run tests with sample datanpm run lint
: lint the projectnpm run benchmark
: run all benchmarkingnpm run benchmark:source
: run benchmarking forsource
(i.e.ncbi
,chebi
)npm run clear
: clear all datanpm run clear:source
: clear data forsource
(i.e.ncbi
,chebi
)npm run update
: update all data (download then index)npm run update:source
: update data forsource
(i.e.ncbi
,chebi
) in elasticsearchnpm run download
: download all datanpm run download:source
download data forsource
(i.e.ncbi
,chebi
)npm run index
: index all datanpm run index:source
: index data forsource
(i.e.ncbi
,chebi
) in elasticsearchnpm run test:inputgen
: generate input test file for eachsource
(i.e.uniprot
, ...)npm run test:inputgen
: generate input test file forsource
(i.e.uniprot
, ...)
Build the container. Here, grounding-search
is used as the container name.
cd grounding-search
docker build -t grounding-search .
Run the container:
docker run -it -p 12345:3000 -u "node" -e "NODE_ENV=production" --name "grounding-search" grounding-search
Notes:
- The
-it
switches are necessary to makenode
respond toctrl+c
etc. indocker
. - The
-p
switch indicates that port 3000 on the container is mapped to port 12345 on the host. Without this switch, the server is inaccessible. - The
-u
switch is used so that a non-root user is used inside the container. - The
-e
switch is used to set environment variables. Alternatively use--env-file
to use a file with the environment variables. - References:
All files /test
will be run by Mocha. You can npm test
to run all tests, or you can run npm test -- -g specific-test-name
to run specific tests.
Chai is included to make the tests easier to read and write.
- Make sure the tests are passing:
npm test
- Make sure the linting is passing:
npm run lint
- Bump the version number with
npm version
, in accordance with semver. Theversion
command innpm
updates bothpackage.json
and git tags, but note that it uses av
prefix on the tags (e.g.v1.2.3
). - For a bug fix / patch release, run
npm version patch
. - For a new feature release, run
npm version minor
. - For a breaking API change, run
npm version major.
- For a specific version number (e.g. 1.2.3), run
npm version 1.2.3
. - Push the release:
git push && git push --tags