Skip to content

Commit

Permalink
add docker - file
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith M committed Nov 2, 2021
1 parent 89e5702 commit e6146bd
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 6 deletions.
50 changes: 50 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
FROM r-base

# system libraries of general use
## install debian packages
RUN apt-get update -qq && apt-get -y --no-install-recommends install \
libxml2-dev \
libcairo2-dev \
libsqlite3-dev \
libmariadbd-dev \
libpq-dev \
libssh2-1-dev \
unixodbc-dev \
libcurl4-openssl-dev \
libssl-dev

## update system libraries
RUN apt-get update && \
apt-get upgrade -y && \
apt-get clean


## renv.lock file
# COPY /example-app/renv.lock ./renv.lock

# install renv & restore packages
RUN Rscript -e 'install.packages("renv")'
RUN Rscript -e 'install.packages("shiny")'
RUN Rscript -e 'install.packages("ggplot2")'
RUN Rscript -e 'install.packages("Seurat")'
RUN Rscript -e 'install.packages("ggplot2")'
RUN Rscript -e 'install.packages("dplyr")'
RUN Rscript -e 'install.packages("markdown")'
RUN Rscript -e 'install.packages("tidyr")'
RUN Rscript -e 'renv::consent(provided = TRUE)'
RUN Rscript -e 'renv::restore()'
RUN Rscript -e 'memory.limit(size=20000)'


# copy necessary files
## app folder
COPY app.R /app.R
COPY Keller_more_clusterings.rds /Keller_more_clusterings.rds
COPY README.md /README.md


# run app on container start
CMD ["Rscript", "-e", "shiny::runApp('/app.R', host = '0.0.0.0', port = 3838)"]

# expose port
EXPOSE 3838
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
---
Shiny App Tutorial
---
### Local Install Directions:
1. Install docker on your computer
2. git clone
3. Move in RDS file of interest.
4. Edit the read RDS line in `app.R` file to be `/example_app/{your rds file name}`
4. `docker-compose build`
5. `docker-compose up`


### TODO list:
- fix the violin plot ordering
Expand Down
14 changes: 8 additions & 6 deletions app.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ library(tidyr)
# Some initial setup:
# this will not work if underscores are in the orig.ident (only for some views)
# take in the file, get list of genes, get metadata numbers and categories, get pcs 1-9, and factors..
aggregate <- readRDS('/Users/keithmitchell/Desktop/Repositories/haudenschild/keith_analysis_round2/HaudenschildRound2_celltype_LR_DIGEST.rds')
aggregate <- readRDS('Keller_more_clusterings.rds')
genes = aggregate@assays$RNA
reductions <- attributes(aggregate@reductions)
meta_nums <- colnames(dplyr::select_if(aggregate@meta.data, is.numeric))
meta_cats <- c(colnames(dplyr::select_if(aggregate@meta.data, is.character)), colnames(dplyr::select_if(aggregate@meta.data, is.factor)),colnames(dplyr::select_if(aggregate@meta.data, is.logical)))
meta_cats <- meta_cats[meta_cats != "orig.ident"]
mysplitbydefault <- "Health"
pcs <- list('PC_1','PC_2','PC_3','PC_4','PC_5','PC_6','PC_7','PC_8','PC_9')
use.pcs <- 1:50
#agg_cats <- colnames(dplyr::select_if(aggregate@meta.data, is.factor))
Expand Down Expand Up @@ -258,7 +260,7 @@ server = function(input, output, session){
order <- sort(levels(aggregate))
levels(aggregate) <- order
DimPlot(aggregate, reduction=input$reduction_seperated_categorical,
split.by = "orig.ident", ncol=4
split.by = mysplitbydefault, ncol=4
)
})

Expand All @@ -268,7 +270,7 @@ server = function(input, output, session){
order <- sort(levels(aggregate))
levels(aggregate) <- order
DimPlot(aggregate, reduction=input$reduction_seperated_categorical,
split.by = "orig.ident", ncol=4
split.by = mysplitbydefault, ncol=4
)
})

Expand Down Expand Up @@ -328,10 +330,10 @@ server = function(input, output, session){
else{widedat <- FetchData(aggregate, marker)}

widedat$Cluster <- Idents(aggregate)
widedat$orig.ident = eval(call("$", aggregate, input$identity_seperated2))
widedat$final = paste(widedat$orig.ident, widedat$Cluster, sep="_")
widedat[[mysplitbydefault]] = eval(call("$", aggregate, input$identity_seperated2))
widedat$final = paste(widedat[[mysplitbydefault]], widedat$Cluster, sep="_")
final_object = (aggregate(widedat[, 1:2], list(widedat$final), mean)[1:2])
lab_list = widedat$orig.ident
lab_list = widedat[[mysplitbydefault]]
identities = widedat$Cluster

num_list = widedat[[marker]]
Expand Down

0 comments on commit e6146bd

Please sign in to comment.