Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docker/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ dependencies:
- pytz==2023.3
- requests==2.31.0
- requests-oauthlib==1.3.1
- rectanglepy==1.0.0
- rich==13.3.5
- rsa==4.9
- git+https://github.com/omnideconv/scaden.git
Expand Down
84 changes: 84 additions & 0 deletions docker_rectangle/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
FROM eddelbuettel/r2u:20.04

LABEL description="Image for Omnideconv benchmarking pipeline"
LABEL maintainer="Alexander Dietrich"

# needed so that R r-base installation does not get stuck
ENV DEBIAN_FRONTEND noninteractive

# install system dependencies
RUN apt-get update -y && apt-get --no-install-recommends --fix-broken install -y git \
wget \
vim \
software-properties-common \
dirmngr \
gdebi \
curl

# install miniconda into /root/miniconda3
RUN wget \
https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& bash Miniconda3-latest-Linux-x86_64.sh -b -p /root/.local/share/r-miniconda \
&& rm Miniconda3-latest-Linux-x86_64.sh

ENV PATH="/root/.local/share/r-miniconda/bin:${PATH}"
ARG PATH="/root/.local/share/r-miniconda/bin:${PATH}"

RUN conda --version

RUN conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main
RUN conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r

# create r-omnideconv environment based on yml file
COPY environment.yml .
RUN conda env create -f environment.yml
RUN echo "source activate r-omnideconv" > ~/.bashrc


ENV PATH="/root/.local/share/r-miniconda/envs/omnideconv/bin:${PATH}"
ARG PATH="/root/.local/share/r-miniconda/envs/omnideconv/bin:${PATH}"

# install omnideconv with all dependencies
RUN apt-get --no-install-recommends --fix-broken install -y libcurl4-openssl-dev \
libxml2-dev \
libfontconfig1-dev \
libssl-dev \
libharfbuzz-dev \
libfribidi-dev \
libfreetype6-dev \
libpng-dev \
libtiff5-dev \
libjpeg-dev \
libgdal-dev \
cmake


RUN R -e "install.packages(c('pak','pkgdepends','devtools','remotes','harmony','terra','igraph', 'RSQLite'), repos='https://cloud.r-project.org')"
# Note: Set GITHUB_PAT as a build argument if needed: docker build --build-arg GITHUB_PAT=your_token
RUN R -e "remotes::install_github('omnideconv/omnideconv@benchmark', dependencies = TRUE)"
#RUN R -e "pak::pkg_install('omnideconv/SCDC')"
#RUN R -e "pak::pkg_install('omnideconv/SCDC')"
#RUN R -e "remotes::install_version('NMF', '0.27', repos='https://cloud.r-project.org')"


# set systems variable RETICULATE_PYTHON to new conda env, so that omnideconv will use it
RUN echo "RETICULATE_PYTHON = '/root/.local/share/r-miniconda/envs/r-omnideconv/bin/python'" > /root/.Rprofile
RUN R -e "reticulate::use_miniconda(condaenv = 'r-omnideconv', required = TRUE)"

# install benchmarking related dependencies
RUN R -e "install.packages(c('conflicted','docopt','readxl','tidyverse','profvis'), repos='https://cloud.r-project.org')"
RUN R -e "BiocManager::install('SimBu')"

# install Docker, so that CibersortX can run
RUN mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
RUN echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
RUN apt-get update -y
RUN apt-get install -y --no-install-recommends \
docker-ce \
docker-ce-cli \
containerd.io


6 changes: 6 additions & 0 deletions docker_rectangle/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: r-omnideconv
dependencies:
- python=3.11
- pip
- pip:
- rectanglepy==1.0.0
1 change: 0 additions & 1 deletion pipeline/bin/computeSignaturesNF.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ bulk_matrix <- as.matrix(bulk_matrix)




####################################
#### Perform signature building ####
####################################
Expand Down
11 changes: 11 additions & 0 deletions pipeline/bin/runDeconvolutionNF.R
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ if(method=='cibersortx'){
#### Perform devonvolution ####
###############################

if(method == 'rectangle'){
# do not incluce anndata creation in runtime measurement
AnnData <- reticulate::import("anndata")
counts <- as.data.frame(t(sc_matrix))

ad <- AnnData$AnnData(X = counts,
obs = data.frame('cell_type' = sc_celltype_annotations, row.names = colnames(sc_matrix)),
var = data.frame('genes' = rownames(sc_matrix), row.names = rownames(sc_matrix)))
sc_matrix <- ad
}

runtime <- system.time({

deconvolution <- deconvolution_workflow_general(
Expand Down
15 changes: 13 additions & 2 deletions pipeline/bin/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ signature_workflow_general <- function(sc_matrix, annotations, annotation_catego

# path to temporary directory that is inside results directory of one unique result
tmp_dir_path <- paste0(res_path, '/tmp/')
ncores <- as.numeric(ncores)

# Signature building part
# Dependent on which method we have
Expand Down Expand Up @@ -282,8 +283,7 @@ signature_workflow_general <- function(sc_matrix, annotations, annotation_catego
model_path = paste0(res_path, '/model'),
verbose = TRUE
)

}else if (method %in% c('autogenes', 'bayesprism', 'bisque', 'music')){
} else if (method %in% c('autogenes', 'bayesprism', 'bisque', 'music', 'rectangle')){
signature <- NULL

} else {
Expand Down Expand Up @@ -312,6 +312,7 @@ deconvolution_workflow_general <- function(sc_matrix, annotations, annotation_ca

# path to temporary directory that is inside results directory of one unique result
tmp_dir_path <- paste0(res_path, '/tmp/')
ncores <- as.numeric(ncores)

if(method=="autogenes"){

Expand Down Expand Up @@ -463,6 +464,16 @@ deconvolution_workflow_general <- function(sc_matrix, annotations, annotation_ca
)
#unlink(tmp_dir_path, recursive=TRUE)

} else if (method == "rectangle") {

rp <- reticulate::import("rectanglepy")

#ad <- anndata::AnnData(X = t(sc_matrix),
# obs = data.frame('cell_type' = annotations, row.names = colnames(sc_matrix)),
# var = data.frame('genes' = rownames(sc_matrix), row.names = rownames(sc_matrix)))

deconvolution <- rp$rectangle(sc_matrix, bulks = as.data.frame(t(bulk_matrix)), n_cpus=ncores)[[1]]

} else {
message('Selected method is not supported in the benchmark. Please check again.')
stop()
Expand Down
2 changes: 1 addition & 1 deletion pipeline/cibersortx_credentials.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
email, token
alex.dietrich@tum.de, e1750b96fcfef36421bf9927a9f0fc49
alex.dietrich@tum.de, 8ad207154371cd524393fd78e1bb16f0
4 changes: 4 additions & 0 deletions pipeline/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ process ANALYSIS_SPILLOVER {
}

process SIMULATE_BULK_UNKNOWN_CELL_TYPE {

label 'process_default'

publishDir "${params.preProcess_dir}/pseudo_bulk_unknown_content", mode: 'copy'

Expand Down Expand Up @@ -145,6 +147,8 @@ process SIMULATE_BULK_UNKNOWN_CELL_TYPE {

process ANALYSIS_BULK_UNKNOWN_CELL_TYPE {

label 'process_default'

input:
tuple val(sc_dataset),
val(sim_bulk_name),
Expand Down
116 changes: 0 additions & 116 deletions pipeline/nextflow_alex.config

This file was deleted.

4 changes: 3 additions & 1 deletion pipeline/run_cibersortx.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

nextflow -C /nfs/proj/omnideconv_benchmarking/omnideconv/benchmark/pipeline/nextflow_norm.config run /nfs/proj/omnideconv_benchmarking/omnideconv/benchmark/pipeline/main.nf -profile cibersortx -work-dir /localscratch/omnideconv_work "$@"
nextflow -C /nfs/proj/omnideconv_benchmarking/omnideconv/benchmark/pipeline/nextflow_norm.config run /nfs/proj/omnideconv_benchmarking/omnideconv/benchmark/pipeline/main.nf \
-profile cibersortx \
-work-dir /localscratch/omnideconv_work "$@"
5 changes: 4 additions & 1 deletion pipeline/run_default.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/bin/bash

nextflow -C /nfs/proj/omnideconv_benchmarking/omnideconv/benchmark/pipeline/nextflow_norm.config run /nfs/proj/omnideconv_benchmarking/omnideconv/benchmark/pipeline/main.nf -profile apptainer -work-dir /nfs/scratch/nf-core_work/omnideconv.benchmark -with-trace "$@"
nextflow -C /nfs/proj/omnideconv_benchmarking/omnideconv/benchmark/pipeline/nextflow_norm.config run /nfs/proj/omnideconv_benchmarking/omnideconv/benchmark/pipeline/main.nf \
-profile apptainer \
-work-dir /nfs/scratch/nf-core_work/omnideconv.benchmark \
-with-trace "$@"
Loading