Skip to content

Commit

Permalink
Merge branch 'run_level'
Browse files Browse the repository at this point in the history
  • Loading branch information
Merritt-Brian committed Aug 22, 2024
2 parents 57b8ee3 + fa964e5 commit 603a7fa
Show file tree
Hide file tree
Showing 31 changed files with 4,231 additions and 2,173 deletions.
32 changes: 19 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,38 @@
name: Build and push Docker image upon release

on:
release:
types: [build]
push:
branches:
- build
jobs:
push_to_registry:
name: Build and push Docker image upon release
runs-on: ubuntu-latest
steps:
-
name: Checkout repository
uses: actions/checkout@v2
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@v1.3.1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push to Docker Hub
uses: docker/build-push-action@v1
- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: ${{ secrets.DOCKERHUB_REPOSITORY }}
-
name: Build and Push to Docker Hub
uses: docker/build-push-action@v4
with:
tag_with_ref: true
tag_with_sha: true
context: .
push: true
file: "./Dockerfile"
platforms: linux/amd64,linux/arm64
tags: latest
tags: jhuaplbio/basestack_mytax2:${{ steps.package-version.outputs.current-version}}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
.DS_Store
example-data
!example-data/sample_metagenome.first.fastq
!example-data/sample_metagenome.second.fastq
databases/*
taxonomy
taxdump
output
node_modules
example-data/classifications/*

/dist
tmp/*
tmp.*
Expand Down
59 changes: 26 additions & 33 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,38 @@ ARG DEBIAN_FRONTEND=noninteractive
# install apt dependencies and update conda
RUN apt-get --allow-releaseinfo-change update
RUN apt-get install git -y \
&& apt-get install -y nginx apt-transport-https ca-certificates wget unzip bzip2 libfontconfig1

RUN update-ca-certificates \
&& apt-get install -y nginx apt-transport-https ca-certificates wget unzip bzip2 libfontconfig1 && \
update-ca-certificates \
&& apt-get install -y g++ gcc gawk bzip2 \
&& apt-get -qq -y autoremove \
&& apt-get autoclean
RUN apt-get install -y curl
RUN apt-get -y install software-properties-common && add-apt-repository ppa:deadsnakes/ppa && apt update -y
RUN apt-get install -y python3.8
RUN apt-get install -y python3-pip
RUN python3 -m pip install anytree==2.8.0 pandas
RUN curl -fsSL https://deb.nodesource.com/setup_17.x | bash -
RUN apt-get install -y nodejs
&& apt-get autoclean && \
apt-get install -y curl && \
apt-get -y install software-properties-common && add-apt-repository -y ppa:deadsnakes/ppa && apt update -y && \
apt-get install -y python3.8 && \
apt-get install -y python3-pip && \
curl -fsSL https://deb.nodesource.com/setup_17.x | bash - && \
apt-get install -y nodejs && \
ln -sf /usr/bin/python3 /usr/bin/python

WORKDIR /opt

# Get Guppy barcoder for demux purposes
RUN wget https://cdn.oxfordnanoportal.com/software/analysis/ont-guppy_6.4.6_linux64.tar.gz -O ./guppy_6_gpu.tar.gz
RUN wget https://cdn.oxfordnanoportal.com/software/analysis/ont-guppy-cpu_6.4.6_linux64.tar.gz -O ./guppy_6_cpu.tar.gz
RUN tar -xvzf /opt/guppy_6_gpu.tar.gz && mv /opt/ont-guppy /opt/ont-guppy-gpu && rm /opt/guppy_6_gpu.tar.gz
RUN tar -xvzf /opt/guppy_6_cpu.tar.gz && mv /opt/ont-guppy-cpu /opt/ont-guppy && \
# Get Guppy barcoder for demux purposes, remove the jsn files to save space. This will make basecalling unusable
RUN wget https://cdn.oxfordnanoportal.com/software/analysis/ont-guppy_6.4.6_linux64.tar.gz -O ./guppy_6_gpu.tar.gz && \
tar -xvzf /opt/guppy_6_gpu.tar.gz && mv /opt/ont-guppy /opt/ont-guppy-gpu && rm /opt/guppy_6_gpu.tar.gz && \
wget https://cdn.oxfordnanoportal.com/software/analysis/ont-guppy-cpu_6.4.6_linux64.tar.gz -O ./guppy_6_cpu.tar.gz && \
tar -xvzf /opt/guppy_6_cpu.tar.gz && mv /opt/ont-guppy-cpu /opt/ont-guppy && \
ln -sf /opt/ont-guppy/bin/guppy_barcoder /usr/local/bin/guppy_barcoder && \
rm /opt/guppy_6_cpu.tar.gz
rm /opt/guppy_6_cpu.tar.gz && rm /opt/ont-guppy/data/*.jsn && rm /opt/ont-guppy-gpu/data/*.jsn

RUN wget https://github.com/DerrickWood/kraken2/archive/refs/tags/v2.1.3.tar.gz -O kraken2.tar.gz && tar -xvzf kraken2.tar.gz && rm kraken2.tar.gz && cd kraken2-2.1.3 && ./install_kraken2.sh /usr/bin/

RUN git clone https://github.com/jenniferlu717/KrakenTools.git && cd KrakenTools && chmod +x *.py && find . -name "*.py" -exec cp {} /usr/local/bin/ \;
RUN ln -s /usr/bin/python3 /usr/bin/python
COPY ./package.json /opt/package.json
# RUN wget https://github.com/DerrickWood/kraken2/archive/refs/tags/v2.1.3.tar.gz -O kraken2.tar.gz && \
# tar -xvzf kraken2.tar.gz && rm kraken2.tar.gz && \
RUN git clone https://github.com/DerrickWood/kraken2.git --branch v2.1.3 && cd kraken2 && \
./install_kraken2.sh /usr/bin/ && \
git clone https://github.com/jenniferlu717/KrakenTools.git && \
cd KrakenTools && chmod +x *.py && \
find . -name "*.py" -exec cp {} /usr/local/bin/ \;

COPY ./package.json /opt/package.json
RUN npm install

COPY ./babel.config.js /opt/babel.config.js
Expand All @@ -47,17 +49,8 @@ COPY ./vue.config.docker.js /opt/vue.config.js
COPY ./src /opt/src
RUN npm run build
COPY ./server /opt/server
# COPY dist /usr/share/nginx/html/mytax
COPY nginx.conf /etc/nginx/nginx.conf
RUN useradd nginx
# RUN chown -R nginx:nginx /var/lib/nginx && \
# chown -R nginx:nginx /var/log/nginx && \
# chown -R nginx:nginx /etc/nginx/conf.d
# RUN touch /var/run/nginx.pid && \
# chown -R nginx:nginx /var/run/nginx.pid
RUN ln -s /opt/dist /usr/share/nginx/html/mytax && chmod -R 777 /usr/share/nginx/html/mytax
COPY ./nginx.conf /etc/nginx/nginx.conf
RUN useradd nginx && ln -s /opt/dist /usr/share/nginx/html/mytax && chmod -R 777 /usr/share/nginx/html/mytax
EXPOSE 80

# CMD ["conda", "run", "-n", "mytax2", "/bin/bash", "-c"]

# To Run docker build . -t jhuaplbio/basestack_mytax2 ; docker container run -it --rm -p 8098:80 jhuaplbio/basestack_mytax2 bash -c "nginx; bash "
66 changes: 41 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,48 @@
# Mytax2 - Realtime reporting


<<<<<<< HEAD
## Create Conda Environment
```
conda env create -f environment.yml
```

=======
>>>>>>> run_level
## Project setup

### Create your Conda env first

```
conda env create -f environment.yml
```

:warning: Make sure if you're on a Mac arm64 processor that you specify you want amd64 like:

```
CONDA_SUBDIR=osx-64 conda env create -f environment.yml
```

### Create npm packages in the repo.

```
npm install
```

## Starting Development
## Running the software


### Compiles and hot-reloads for development

```
npm run serveBoth
```

Run the below 2 commands:
### Adding another CORS port for development use

### Compiles and hot-reloads for development on frontent
```
npm run serve
CORS_ADDR=192.168.55.1:7689 npm run serveBoth
```

### Compiles and hot-reloads for development on server
Expand All @@ -40,24 +64,21 @@ npm run lint
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

To add any data, first you must make a run

1. Select "Add Run" and give it a name
2. Then, select the blue and white cross icon on the left-hand side to add a sample. There can be multiple samples were run.
3. Drag + Drop or select a fastq file (or .gz version) into the middle input. You can also input a directory of fastq files. If you want to analyze an entire run of barcodes, you should toggle the switch, which will match any directory in the specified input directory and make 1 sample per match. Alter the pattern matching in the appropriate field.
4. OPTIONAL. IF using paired-end reads, add the R2 file into the top-left input field
5. Select "Add" and the software will automatically start analyzing with Kraken2 and generating the Sunburst plots in realtime.

## Samplesheet input

You will need to create a samplesheet with information about the samples you would like to analyse before running the pipeline. Use this parameter to specify its location. It has to be a comma-separated file with 3 columns, and a header row as shown in the examples below. By default, it will always look in the `/data/Samplesheet.csv` file for your desired deployment method. For example, in `dev` mode it will be `public/data/Samplesheet.csv`, for production (like in a Docker container running `nginx` like what is described below) it is in `<path_to_dist>/data/Samplesheet.csv`. If you want to check if it is accesible, you can access it at the localhost and port with the path like `localhost:8080/data/Samplesheet.csv` (this is the default dev port)
### Debugging

The Samplesheet should look like (example below) this
Depending on how you are deploying the tool, you can either run:

```console
sample,path_1,path_2,format,platform,database,compressed
NB11,<path_to_directory>/NB11,,directory,oxford,<path_to_database_directory>/flukraken2,
NB03,<path_to_directory>/NB03,,directory,oxford,<path_to_database_directory>/flukraken2,
ERR6913101,<path_to_directory>/ERR6913101_1.fastq.gz,<path_to_directory>/ERR6913101_2.fastq.gz,file,illumina,<path_to_database_directory>/flukraken2,
ERR6913102,<path_to_directory>/ERR6913102_1.fastq.gz,<path_to_directory>/ERR6913102_2.fastq.gz,file,illumina,<path_to_database_directory>/flukraken2,
flu_bc01,<path_to_directory>/flu_BC01.fastq,,file,oxford,<path_to_database_directory>/flukraken2,
sample,<path_to_directory>/sample_metagenome.fastq,,file,oxford,<path_to_database_directory>/flukraken2,
test,test2.fastq,,file,illumina,<path_to_database_directory>/flukraken2,
```
1. `sudo service mytax2 status` to check the service information
2. Check the command-line logs if hosting/serving in development mode with `npm run serveBoth` or `npm run server`
3. `docker container logs $container_name` if using Docker to deploy



Expand All @@ -66,19 +87,14 @@ test,test2.fastq,,file,illumina,<path_to_database_directory>/flukraken2,
| `sample` | Custom sample name. This entry will be identical for multiple sequencing libraries/runs from the same sample. Spaces in sample names are automatically converted to underscores (`_`). |
| `path_1` | Full path to FastQ file for Illumina short reads 1 OR OXFORD reads. File has to be gzipped and have the extension ".fastq.gz" or ".fq.gz". |
| `path_2` | Full path to FastQ file for Illumina short reads 2. File has to be gzipped and have the extension ".fastq.gz" or ".fq.gz". |
| `format` | TRUE/FALSE, is the row attributed to a demultiplexed barcode folder of 1 or more fastq files or is it a single file that is .gz? |
| `platform` | Platform used, [ILLUMINA, OXFORD] |
| `compressed` | TRUE/FALSE, is your set of files compressed or not as `.gz` format column |
| `pattern` | Pattern to match items (regex) for barcoded runs |
| `kits` | List of guppy barcode kits for barcode runs. Such as `EXP-NBD103` and `SQK-LWB001` |
| `format` | TRUE/FALSE switch toggle, is the row attributed to a demultiplexed barcode folder of 1 or more fastq files or is it a single file that is .gz?. If toggled on, the entry will auto-detect anything matching the regex-based pattern and make 1 sample per pattern match in that directory. For example, barcode01,02,03, etc. |
| `pattern` | Pattern to match items (regex) for barcoded runs, Optional |

An [example samplesheet](../examples/Samplesheet.csv) has been provided with the pipeline alongside some demo data.

## Creating a Docker image using the pre-built code.




```
conda activate mytax2
Expand Down
Binary file added databases/k2_HRSV.tar.gz
Binary file not shown.
Binary file added databases/k2_mpox.tar.gz
Binary file not shown.
14 changes: 14 additions & 0 deletions mytax2.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
Description=MyTax Service
After=network.target

[Service]
Type=simple
User=minion
WorkingDirectory=/home/minion/mytax
ExecStart=/bin/bash -c '/home/minion/miniconda3/bin/activate && npm run serveBoth'
Environment="PATH=/home/minion/miniconda3/bin:/usr/bin:/bin"
Restart=on-failure

[Install]
WantedBy=multi-user.target
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "mytax",
"version": "0.1.0",
"version": "v2.2.6",
"private": true,
"scripts": {
"serve": "vue-cli-service serve --port 8080",
"serveProduction": "export NODE_ENV=production && vue-cli-service serve --port 8080",
"serveBoth": "npm run serve & npm run server",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"server": "export NODE_ENV=development && nodemon server/index.mjs --watch",
Expand Down Expand Up @@ -38,10 +39,12 @@
"sass-loader": "^10.0.0",
"socket.io": "^4.6.1",
"socket.io-client": "^4.6.1",
"tar": "^6.2.0",
"unzipper": "^0.10.14",
"vue": "^2.6.14",
"vue-json-excel": "^0.3.0",
"vue-json-to-csv": "^1.1.8",
"vue-sweetalert2": "^5.0.2",
"vue-sweetalert2": "^5.0.5",
"vuetify": "^2.6.0",
"winston": "^3.6.0",
"ws": "^8.12.0"
Expand Down
Loading

0 comments on commit 603a7fa

Please sign in to comment.