Skip to content

Commit

Permalink
Merge pull request #520 from PoonLab/dev
Browse files Browse the repository at this point in the history
Restore local database and fix bugs
  • Loading branch information
GopiGugan authored Apr 10, 2024
2 parents 27046a6 + 856d57f commit 12a9d08
Show file tree
Hide file tree
Showing 23 changed files with 426 additions and 266 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ cypress/plugins/
*.yml
!docker-compose.yml
!docker_scripts/backend/*
*.json
*.xz
working/*
scripts/*
covizu/data/xbb_outgrp.fasta

8 changes: 2 additions & 6 deletions Dockerfile.backend
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:latest
FROM ubuntu:22.04

ENV DEBIAN_FRONTEND noninteractive

Expand All @@ -10,7 +10,7 @@ ENV OMPI_ALLOW_RUN_AS_ROOT=1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
ADD https://bootstrap.pypa.io/get-pip.py /tmp/get-pip.py

RUN python3.10 /tmp/get-pip.py
RUN /usr/local/bin/pip install biopython mpi4py rpy2
RUN /usr/local/bin/pip install biopython mpi4py rpy2 psycopg2-binary

RUN R -e "install.packages('tidyquant',dependencies=TRUE, repos='http://cran.rstudio.com/')"
RUN R -e "install.packages('matrixStats',dependencies=TRUE, repos='http://cran.rstudio.com/')"
Expand All @@ -32,7 +32,3 @@ RUN git clone --depth=1 https://github.com/neherlab/treetime.git /root/treetime
RUN git clone --depth=1 https://github.com/somme89/rapidNJ.git /root/rapidnj && \
make -C /root/rapidnj && \
cp /root/rapidnj/bin/rapidnj /usr/local/bin

RUN git clone https://github.com/PoonLab/covizu.git /root/covizu && \
git -C /root/covizu submodule init && \
git -C /root/covizu submodule update
15 changes: 7 additions & 8 deletions Dockerfile.frontend
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ RUN mkdir -p /opt/app
WORKDIR /opt/app
COPY $basepath/package.json $basepath/package-lock.json .
RUN npm install
COPY $basepath/config/* config/
COPY $basepath/js/* js/
COPY $basepath/server/* server/
COPY $basepath/data/* data/
COPY $basepath/img/* img/
COPY $basepath/css/* css/
COPY $basepath/mongodb_scripts/* mongodb_scripts/
COPY $basepath/config/ config/
COPY $basepath/js/ js/
COPY $basepath/server/ server/
COPY $basepath/data/ data/
COPY $basepath/img/ img/
COPY $basepath/css/ css/
COPY $basepath/mongodb_scripts/ mongodb_scripts/
COPY $basepath/*.html $basepath/*.js .
COPY .env* .
EXPOSE $port
CMD ["sh", "-c", "npm run delete-users && npm run create-users && npm run update-db1 && npm run start-db1"]
44 changes: 39 additions & 5 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
## Dependencies

* [Python](https://www.python.org/) 3.6 or higher, and the following modules:
* [Python](https://www.python.org/) 3.7 or higher, and the following modules:
* [BioPython](https://biopython.org/) version 1.7+
* [mpi4py](https://pypi.org/project/mpi4py/)
* [SciPy](https://www.scipy.org/) version 1.5+
* [rpy2](https://rpy2.github.io/doc/latest/html/index.html) version 3.5.13+
* [psycopg2](https://pypi.org/project/psycopg2/) version 2.9.6+
* [minimap2](https://github.com/lh3/minimap2) version 2.1+
* [FastTree2](http://www.microbesonline.org/fasttree/) version 2.1.10+, compiled for [double precision](http://www.microbesonline.org/fasttree/#BranchLen)
* [TreeTime](https://github.com/neherlab/treetime) version 0.7.5+
* [RapidNJ](https://birc.au.dk/software/rapidnj/)
* [git](https://git-scm.com/)
* [Node.js](https://nodejs.org/en/download/) version 18.0.0+
* [npm](https://docs.npmjs.com/about-npm-versions)
* [rpy2](https://rpy2.github.io/doc/latest/html/index.html) version 3.5.13+
* [R](https://cran.r-project.org/) (tested on 4.2.1) and the following packages:
* [tidyquant](https://cran.r-project.org/web/packages/tidyquant/index.html)
* [matrixStats](https://cran.rstudio.com/web/packages/matrixStats/index.html)
Expand All @@ -27,6 +28,8 @@ If running locally (without dedicated GISAID feed):

## Installation

### Setup Back-End

* Navigate to the directory in your filesystem under which you want to install the `covizu` directory

* Clone the repository:
Expand All @@ -39,6 +42,36 @@ git clone https://github.com/PoonLab/covizu
sudo python3 setup.py install # omit `sudo` if you don't have superuser privileges
```

* [Optional] Install PostgreSQL - [Database for Extracted Features](https://github.com/PoonLab/covizu/issues/485)
* [Download](https://www.postgresql.org/download/) and install PostgreSQL based on your operating system or pull the latest [docker image](https://hub.docker.com/_/postgres)
* The following environment variables must be defined:
* `POSTGRES_USER` - User name set up during installation of PostgreSQL
* `POSTGRES_PASSWORD` - Password for the given user name
* Optional environment variables:
* `POSTGRES_DB` - The desired database name to use for the analysis. The default database name is `gisaid_db`
* `POSTGRES_HOST` - The host name where PostgreSQL is running on. The default host is `localhost`
* `POSTGRES_PORT` - The port used by PostgreSQL. The default port number is `5432`

* [Optional] Using Docker
* In the root directory, run the following command to build and start PostgreSQL. This will create a default network called `covizu_default`
```
docker compose up -d postgres
```
* In a `.env` file, include the following:
* `POSTGRES_HOST=postgres`
* `POSTGRES_USER=`
* `POSTGRES_PASSWORD=`
* Build the docker image from the `Dockerfile.backend` Dockerfile using the following command:
```
docker build --platform=linux/amd64 -t covizu-backend -f Dockerfile.backend .
```
* Create a container named `backend` from the `covizu-backend` image using the following command:
```
docker run --name backend --volume ${PWD}:/root/covizu --network covizu_default --env-file .env -itd covizu-backend
```

### Setup Front-End

If you're running the server (front-end) for the first time, obtain the following data files from our main server at
https://filogeneti.ca/covizu/data/:
* `timetree.nwk`
Expand Down Expand Up @@ -90,12 +123,13 @@ Finally, run the following commands:

Once you launch the local webserver with `npm start`, allow up to a minute for the server to initialize and then navigate your browser to `localhost:8001`.

### Run Front-End Unit Tests

To run the end-to-end tests with [Cypress](http://cypress.io) start the test server
```
npm test
```
and in a new terminal terminal window run
```
npx cypress run
```

npx cypress run --config-file "config/cypress.config.js"
```
Loading

0 comments on commit 12a9d08

Please sign in to comment.