This repository will incorperate both backend and frontend components to the website
Using fastapi framework with a postgres database to store genotype-phenotype map data.
- List traits
- List regions
- LD between variants
- Docker and Docker Compose
- Visual Studio Code with Remote - Containers extension for development
-
Clone the repository:
git clone https://github.com/mrcieu/genotype-phenotype-api.git cd genotype-phenotype-api
-
Create a
.env
fileANALYTICS_KEY=7a2b8f79-c837-45fa-ac48-0967ba8acf1b DB_PROCESSED_PATH="data/processed.db" DB_ASSOCS_PATH="data/assocs.db" LOCAL_DB_DIR="/local-scratch/projects/genotype-phenotype-map/results/2025_01_28-13_04"
-
Open the project in VSCode:
code .
-
When prompted, click "Reopen in Container". This will start the development environment.
-
Once the container is built and running, you can start the FastAPI server by running:
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
-
The API will be available at
http://localhost:8000
, and the code will hot-reload on changes.
Or if not using VSCode
-
Clone the repository:
git clone https://github.com/mrcieu/genotype-phenotype-api.git cd genotype-phenotype-api
-
Create a
.env
fileANALYTICS_KEY=<key from https://my-api-analytics.vercel.app>
-
Build and run the Docker containers:
docker-compose up --build
-
The API will be available at
http://localhost:8000
No production yet but a dev version is available -
Setup a tunnel (need to be on vpn):
ssh -L 8001:localhost:8000 <username>@ieu-p1.epi.bris.ac.uk
Then check e.g.
curl http://localhost:8001/health
Or connect to http://localhost:8001/docs on your browser.
The project includes a GitHub Actions workflow for Continuous Integration and Deployment. On each push to the main branch, it will:
- Run the unit tests
- Build a Docker image
- Push the image to Docker Hub (using secrets DOCKER_USERNAME and DOCKER_PASSWORD configured in github repo)
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the GPL3 License.
TODO