Catalog API repository for the IGVF project.
Clone repository and make sure your Docker server is running.
Make sure data/parsed_data
is empty, otherwise duplicates might be created.
Load data and initialize the database:
$ docker compose -f docker-compose-loader.yml up --build
After the python container exits either hit ctrl+C or run:
$ docker compose -f docker-compose-loader.yml down
Run:
$ docker compose -f docker-compose-serve.yml up
An ArangoDB client should be available at localhost:8529
. Default username and password are: igvf
.
The HTTP server with a Swagger interface displaying our endpoints will be available at: http://localhost:2023
.
The TRPC interface is available at http://localhost:2023/trpc
.
In docker-compose-serve.yml
define the environment variables IGVF_CATALOG_ARANGODB_URI
, IGVF_CATALOG_ARANGODB_USERNAME
and IGVF_CATALOG_ARANGODB_PASSWORD
with appropriate values, and that database will be used as the backend instead of the one running in docker locally.
We use Jest for Typescript testing and Pytest for Python testing. For running tests, inside of the docker container:
- For typescript tests:
npm test
. - For python tests:
cd data && pytest
.
If running tests outside of the docker container, you will need to install the project dependencies:
npm install
cd data && pip install -r requirements.txt
(we suggest the use of a virtual environment to manage your Python packages)
If your project is in Typescript, you can execute remote procedure calls (RPCs) by importing this repository into your project and calling available procedures. The example below shows how to fetch gene data using tRPC.
import { createTRPCProxyClient, httpBatchLink } from '@trpc/client'
import { igvfCatalogRouter } from './routers/_app'
async function main (): Promise<void> {
const trpc = createTRPCProxyClient<igvfCatalogRouter>({
links: [
httpBatchLink({ url: 'http://localhost:2023/trpc' })
]
})
// tRPC call to fetch gene data
const gene = await trpc.genes.query({
gene_id: 'ENSG00000160336'
})
console.log(gene)
}
void main()
The object trpc
in this example can be inspected for a full list of all available remote procedures available. The full list is the same available at http://localhost:2023/
.
This repo includes configuration for pre-commit hooks. To use pre-commit, install pre-commit, and activate the hooks:
pip install pre-commit==3.2.1
pre-commit install
Visit our beta Swagger page at: https://api.catalog.igvf.org.
For any feature requests and bug reports please open a ticket at: https://github.com/IGVF-DACC/igvfd/issues.