Skip to content

Commit

Permalink
Merge pull request #3 from neurogenomics/nfancy-patch-1
Browse files Browse the repository at this point in the history
Nfancy patch 1
  • Loading branch information
nfancy authored Feb 18, 2024
2 parents a5fc145 + 73b9551 commit 9b28657
Show file tree
Hide file tree
Showing 176 changed files with 4,696 additions and 640 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ name: R GitHub Actions dev-nf
on:
push:
branches:
- dev-nf
- master
- nfancy-patch-1

jobs:
R-CMD-check:
Expand Down Expand Up @@ -35,10 +36,7 @@ jobs:
load: true
file: ./Dockerfile
tags: |
nfancy/scflow:${{ env.packageVersion }}
nfancy/scflow:latest
nfancy/scflow:dev
- name: Login to DockerHub
Expand All @@ -49,6 +47,4 @@ jobs:

- name: push service
run: |
docker push nfancy/scflow:${{ env.packageVersion }}
docker push nfancy/scflow:latest
docker push nfancy/scflow:dev
19 changes: 7 additions & 12 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: scFlow
Title: A Single-Cell/Nuclei Analysis Toolkit
Version: 0.7.2
Version: 0.7.4
Authors@R:
c(
person(given = "Combiz",
Expand Down Expand Up @@ -41,21 +41,21 @@ Suggests:
spelling,
covr,
knitr,
scFlowExamples,
BiocStyle,
DT (>= 0.26)
Language: en-US
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
biocViews:
Imports:
Matrix,
assertthat (>= 0.2.1),
bib2df,
biomaRt (>= 2.54.0),
cli (>= 3.4.1),
cowplot (>= 1.1.1),
DirichletReg (>= 0.7.1),
DoubletFinder (>= 2.0.3),
dplyr (>= 1.1.0),
DoubletFinder (>= 2.0.3),
DropletUtils (>= 1.18.1),
edgeR (>= 3.40.0),
english (>= 1.2.6),
Expand All @@ -75,7 +75,7 @@ Imports:
limma (>= 3.54.0),
magrittr (>= 2.0.3),
MAST (>= 1.24.0),
Matrix,
lme4,
methods,
monocle3 (>= 1.3.1),
paletteer (>= 1.5.0),
Expand Down Expand Up @@ -106,16 +106,11 @@ Imports:
uwot,
WebGestaltR
Remotes:
NathanSkene/EWCE,
chris-mcginnis-ucsf/DoubletFinder,
ropensci/plotly,
cole-trapnell-lab/monocle3,
theislab/kBET,
jlmelville/uwot,
NathanSkene/One2One,
hhoeflin/hdf5r,
mojaveazure/loomR,
neurogenomics/scFlowExamples,
ropensci/bib2df,
bzhanglab/WebGestaltR,
cran/riverplot
ropensci/bib2df
VignetteBuilder: knitr
24 changes: 12 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#LABEL maintainer="Combiz Khozoie, Ph.D. [email protected], Alan Murphy, [email protected]"

## Use rstudio installs binaries from RStudio's RSPM service by default,
## Uses the latest stable ubuntu, R and Bioconductor versions. Created on unbuntu 20.04, R 4.0 and BiocManager 3.12
FROM rocker/rstudio:4.2.2
## Uses the latest stable ubuntu, R and Bioconductor versions. Created on unbuntu 20.04, R 4.3 and BiocManager 3.18
FROM rocker/rstudio:4.3


## Add packages dependencies
Expand Down Expand Up @@ -38,7 +38,7 @@ RUN apt-get update \
libcairo2-dev \
libtiff5-dev \
libreadline-dev \
libgsl0-dev \
libgsl-dev \
libgslcblas0 \
libgtk2.0-dev \
libgl1-mesa-dev \
Expand Down Expand Up @@ -111,7 +111,8 @@ RUN pip install stratocumulus \
&& rm -rf /tmp/*


RUN install2.r -e \
RUN install2.r -e -t source \
Matrix \
argparse \
assertthat \
BiocManager \
Expand All @@ -138,12 +139,11 @@ ggridges \
Hmisc \
httr \
ids \
igraph \
knitr \
leaflet \
lme4 \
magrittr \
Matrix \
lme4 \
igraph \
paletteer \
patchwork \
plyr \
Expand All @@ -166,6 +166,7 @@ Rtsne \
scales \
sctransform \
Seurat \
SeuratObject \
snow \
spelling \
stringr \
Expand All @@ -178,6 +179,8 @@ tidyverse \
UpSetR \
utils \
vroom \
WebGestaltR \
apcluster \
&& rm -rf /tmp/downloaded_packages

## Install Bioconductor packages
Expand All @@ -187,18 +190,15 @@ RUN Rscript -e 'requireNamespace("BiocManager"); BiocManager::install(ask=F);' \
&& rm -rf /tmp/downloaded_packages

## Install from GH the following
RUN installGithub.r chris-mcginnis-ucsf/DoubletFinder \
RUN installGithub.r NathanSkene/EWCE \
chris-mcginnis-ucsf/DoubletFinder \
ropensci/plotly \
cole-trapnell-lab/monocle3 \
theislab/kBET \
jlmelville/uwot \
NathanSkene/One2One \
hhoeflin/hdf5r \
mojaveazure/loomR \
ropensci/bib2df \
cvarrichio/Matrix.utils \
neurogenomics/scFlowExamples \
bzhanglab/WebGestaltR \
&& rm -rf /tmp/downloaded_packages

## Install scFlow package
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# scFlow 0.7.4

* Updated DoubletFinder version compatibility.
* Minor bug fixes in `map_celltypes_sce()`. The subsampling is now done per cluster to avoid smaller clusters being excluded.
* Change the order of the contrast vs reference names in DEG table.

# scFlow 0.7.2

* QC bug fixes.
Expand Down
33 changes: 24 additions & 9 deletions R/cluster_sce.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@
#' Cluster SingleCellExperiment with monocle3::cluster_cells
#'
#' @param sce a SingleCellExperiment object
#' @param ... see uwot::umap for umap options. Includes reduction_methods one
#' or more of "PCA", "tSNE", "UMAP", "UMAP3D"
#' @param cluster_method Available methods include leiden and louvain.
#' @param reduction_method Input slot for clustering. Available options are PCA,
#' UMAP_Liger, tSNE_Liger.
#' @param resolution Clustering resolution. If NULL, clustering method will be
#' set to louvain.
#' @param K Integer number of nearest neighbors to use when creating the k
#' nearest neighbor graph for Louvain/Leiden clustering.
#' k is related to the resolution of the clustering result, a bigger k will
#' result in lower resolution and vice versa. Default is 50.
#' @param ... see monocle3::cluster_cells for more clustering options.
#'
#' @return sce a SingleCellExperiment object annotated with reducedDims
#'
Expand All @@ -14,15 +22,22 @@
#'
#' @export

cluster_sce <- function(sce, ...) {
cluster_sce <- function(sce,
cluster_method = "leiden",
reduction_method = "UMAP_Liger",
resolution = 1e-5,
k = 50,
louvain_iter = 1,
verbose = T,
...) {

fargs <- list(
cluster_method = "leiden",
reduction_method = "UMAP_Liger",
resolution = 1e-5,
k = 100,
louvain_iter = 1,
verbose = T
cluster_method = cluster_method,
reduction_method = reduction_method,
resolution = resolution,
k = k,
louvain_iter = louvain_iter,
verbose = verbose
)

inargs <- list(...)
Expand Down
2 changes: 1 addition & 1 deletion R/diffexp_models.R
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ perform_de <- function(sce,
by = "ensembl_gene_id")
}

element_name <- paste(fargs$ref_class, ctrast, sep = "_vs_")
element_name <- paste(ctrast, fargs$ref_class, sep = "_vs_")

de_params <- list(
celltype = unique(fargs$sce$cluster_celltype),
Expand Down
6 changes: 3 additions & 3 deletions R/integrate_sce.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#' Produces a reducedDim slot representing common factors across datasets
#'
#' @param sce a SingleCellExperiment object or merged sce objects
#' @param method the integration method to use
#' Set to k=30 as default.
#' @param ... Additional arguments. Such as k Inner dimension of factorization
#' @param method the integration method to use. Set to liger as default.
#' See `liger_preprocess` and `liger_reduce_dims` functions for parameter options.
#' @param ... Additional arguments. Such as k, inner dimension of factorization
#' (number of factors).
#'
#' @return sce SingleCellExperiment object annotated with reducedDims
Expand Down
16 changes: 13 additions & 3 deletions R/map_with_ewce.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,20 @@ map_celltypes_sce <- function(sce,

l_ctd <- .read_rds_files_to_list(ctd_folder)

if (dim(sce)[[2]] > cells_to_sample) {

if(!is.null(cells_to_sample)){
set.seed(123)
idx <- c()
for(i in as.character(unique(sce[[clusters_colname]]))){
idx_temp <- which( sce[[clusters_colname]] == i) %>%
sample(size = min(cells_to_sample, length(.)), replace = FALSE )
idx_temp <- idx_temp[order(idx_temp)]
idx <- c(idx, idx_temp)}

message(sprintf("Subsetting %s cells", cells_to_sample))
set.seed(42)
sce_subset <- sce[, sample(dim(sce)[[2]], cells_to_sample)]

sce_subset <- sce[, idx]

} else {
sce_subset <- sce
}
Expand Down
17 changes: 17 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,23 @@ You can install the development version of scFlow from GitHub with: -
devtools::install_github("neurogenomics/scFlow")
```

## Running RStudio Server with pre-installed scFlow via Docker

If using linux system, open a cmd terminal and run the following commands:

```{r eval = FALSE}
docker pull nfancy/scflow
docker run --rm -d \
-v $HOME:/home/rstudio/home \
-e ROOT=true \
-e PASSWORD=password \
-p 8950:8787 \
nfancy/scflow
```

Then access the RStudio Server on your browser at IP:8950. The default username is `rstudio` and password is `password`. To understand more on how to run docker Rstudio follow the link [here](https://davetang.org/muse/2021/04/24/running-rstudio-server-with-docker/).

## Support

* Ask a question on Stack Overflow with the scFlow tag, we monitor this for new questions.
Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,27 @@ You can install the development version of scFlow from GitHub with: -
devtools::install_github("neurogenomics/scFlow")
```

## Running RStudio Server with pre-installed scFlow via Docker

If using linux system, open a cmd terminal and run the following
commands:

``` r
docker pull nfancy/scflow

docker run --rm -d \
-v $HOME:/home/rstudio/home \
-e ROOT=true \
-e PASSWORD=password \
-p 8950:8787 \
nfancy/scflow
```

Then access the RStudio Server on your browser at IP:8950. The default
username is `rstudio` and password is `password`. To understand more on
how to run docker Rstudio follow the link
[here](https://davetang.org/muse/2021/04/24/running-rstudio-server-with-docker/).

## Support

- Ask a question on Stack Overflow with the scFlow tag, we monitor
Expand Down
2 changes: 1 addition & 1 deletion docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/LICENSE-text.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9b28657

Please sign in to comment.