Skip to content

Commit

Permalink
revise (#1)
Browse files Browse the repository at this point in the history
Modify based on reviewers' suggestions,

1. Add tutorial
2. Optimize performance of the web interface by adding cache to database and figures
3. Optimize the database filter function
4. Add a docker image for offline use
  • Loading branch information
rujinlong authored Dec 18, 2022
1 parent 989f5d9 commit 6daa7af
Show file tree
Hide file tree
Showing 38 changed files with 1,147 additions and 357 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/docker_build_push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: DockerHub build and push

on:
push:
tags:
- 'd*'
- 'v*'

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- dockerfile: ./Dockerfile
image: jinlongru/deepsmirud_web
permissions:
contents: read
packages: write
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ matrix.image }}

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: "."
file: ${{ matrix.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
62 changes: 62 additions & 0 deletions .github/workflows/shinyapps_io.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: deploy shinyapps.io

on:
push:
tags:
- 'shiny*'

jobs:
shinyapps:

runs-on: ubuntu-latest
timeout-minutes: 90

env:
RENV_PATHS_ROOT: ~/.local/share/renv
SHINY_ACCOUNT: ${{ secrets.SHINY_ACCOUNT }}
SHINY_TOKEN: ${{ secrets.SHINY_TOKEN }}
SHINY_SECRET: ${{ secrets.SHINY_SECRET }}

steps:

# Check out code
- name: Checkout
uses: actions/checkout@v3

- name: R setup
uses: r-lib/actions/setup-r@v2
with:
# don't reinstall R
install-r: false
# use RStudio's CRAN mirror with precompiled binaries
use-public-rspm: true

- name: Install system dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y libcurl4-openssl-dev
sudo apt-get install -y libssl-dev
sudo apt-get install -y libgsl-dev
sudo apt-get install -y libclang-dev
- name: Cache packages
uses: actions/cache@v3
with:
path: ${{ env.RENV_PATHS_ROOT }}
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
restore-keys: |
${{ runner.os }}-renv-
- name: Restore packages
shell: Rscript {0}
run: |
if (!requireNamespace("renv", quietly = TRUE)) install.packages("renv")
renv::restore()
- name: Deploy to shinyapps.io
run: |
install.packages("rsconnect")
rsconnect::setAccountInfo(name="${{secrets.SHINY_ACC_NAME}}", token="${{secrets.TOKEN}}", secret="${{secrets.SECRET}}")
rsconnect::deployApp(appName = 'viroprofiler-viewer')
shell: Rscript {0}

27 changes: 24 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
FROM --platform=linux/amd64 rocker/tidyverse:4.2.0
FROM rocker/shiny-verse:4.2

LABEL author="Jinlong Ru"

RUN R -e 'install.packages(c("remotes", "argparser"), repos="https://cloud.r-project.org/")'
RUN R -e 'remotes::install_github("Jasonlinchina/RCSM")'
# copy the app to the image
ADD app /srv/shiny-server/
COPY renv* /srv/shiny-server/

WORKDIR /srv/shiny-server/

RUN apt-get update && apt-get install -y \
libcurl4-gnutls-dev \
libssl-dev \
libgsl-dev \
libclang-dev

# install R packages using renv
RUN R -e "install.packages('renv')"
RUN R -e "install.packages('Matrix', version='1.5-1')"
RUN R -e "renv::install()"


# select port
EXPOSE 3838

# run app
CMD ["R", "-e", "shiny::runApp('/srv/shiny-server', host = '0.0.0.0', port = 3838)"]
5 changes: 4 additions & 1 deletion R/data4heatmap.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
library(here)

prj_path <- here()
dpath <- here(prj_path, "data")
load(here(prj_path, "data/row_col_order.Rdata"))
cmap_g1 <- readRDS(here(dpath, "GSEAweight1Score.rds"))
cmap_g1 <- readRDS(here(dpath, "main/GSEAweight1Score.rds"))
cmap_rst <- cmap_g1

ftitle <- "GSEAweight1"
Expand Down
51 changes: 40 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,52 @@
<!-- badges: start -->
<!-- badges: end -->

The goal of DeepsmirUD_web is to ...
Source code of the web interface of [DeepsmirUD](https://github.com/2003100127/deepsmirud).

## Installation
## How to run

You can install the development version of DeepsmirUD_web from [GitHub](https://github.com/rujinlong/DeepsmirUD_web) with:
Due to the computation resource limitation of the cloud service, it is
highly recommened to run DeepsmirUD_web on your local computer. You
could use one of following approaches,

``` r
# install.packages("devtools")
devtools::install_github("rujinlong/DeepsmirUD_web")
### Using Docker image (recommended)

``` sh
docker run --rm jinlongru/deepsmirud_web

# if the default port 3838 is occupied, you could set a new port by adding `-p` option
docker run --rm -p 3838:3838 jinlongru/deepsmirud_web
```

Then open your browser and visit `http://localhost:3838/` to use the DeepsmirUD database.

### Run from GitHub

You need to manually install dependent packages in `renv.lock` file before running the following command.

``` sh
# You need to install dependent packages manually
R -e "shiny::runGitHub('DeepsmirUD_web/app', 'rujinlong', subdir = 'app')"
```

## Example
### Run a cloned version

This is a basic example which shows you how to solve a common problem:
You need to manually install dependent packages in `renv.lock` file before running the following command.

``` r
library(DeepsmirUD_web)
## basic example code
``` sh
git clone https://github.com/rujinlong/DeepsmirUD_web.git
R -e "shiny::runApp('DeepsmirUD_web/app')"
```

### Online version

[https://rujinlong.shinyapps.io/DeepsmirUD/](https://rujinlong.shinyapps.io/DeepsmirUD/)

Please note that the online version is not stable and may not work properly.

## Citation

If you use DeepsmirUD in your research, please cite the following paper:

> Sun, Jianfeng, Jinlong Ru, Zihao Chen, Fei Qi, Lorenzo Ramos-Mucci, Suyuan Chen, Adam P. Cribbs, Li Deng, and Xia Wang. "DeepsmirUD: Precise prediction of regulatory effects on miRNA expression mediated by small molecular compounds using competing deep learning frameworks." bioRxiv (2022).
Loading

0 comments on commit 6daa7af

Please sign in to comment.