From e2454d73c29dc6cfe808a5bc580bb2fb2b2d4d77 Mon Sep 17 00:00:00 2001 From: Laurent Modolo <laurent.modolo@ens-lyon.fr> Date: Thu, 24 Feb 2022 09:49:53 +0100 Subject: [PATCH] Close merge request #27 --- .../bedtools/2.30.0/docker_init.sh | 5 +- .../cellphonedb/3.0.0/Dockerfile | 21 ++++ .../cellphonedb/3.0.0/cellphonedb.ini | 14 +++ .../3.0.0/docker/postgres/Dockerfile | 5 + .../cellphonedb/3.0.0/docker/run-system.sh | 3 + .../cellphonedb/3.0.0/requirements-web.txt | 6 + .../cellphonedb/3.0.0/requirements.txt | 18 +++ .../htseq/0.13.5/docker_init.sh | 5 +- src/.docker_modules/kb/0.26.3/docker_init.sh | 5 +- src/.docker_modules/sanity/Dockerfile | 30 +++++ src/.docker_modules/sanity/docker_init.sh | 4 + src/nf_modules/cellphonedb/main.nf | 118 ++++++++++++++++++ src/nf_modules/fastp/main.nf | 1 + src/nf_modules/kb/main.nf | 2 +- src/nf_modules/sanity/main.nf | 35 ++++++ 15 files changed, 262 insertions(+), 10 deletions(-) create mode 100644 src/.docker_modules/cellphonedb/3.0.0/Dockerfile create mode 100644 src/.docker_modules/cellphonedb/3.0.0/cellphonedb.ini create mode 100644 src/.docker_modules/cellphonedb/3.0.0/docker/postgres/Dockerfile create mode 100755 src/.docker_modules/cellphonedb/3.0.0/docker/run-system.sh create mode 100644 src/.docker_modules/cellphonedb/3.0.0/requirements-web.txt create mode 100644 src/.docker_modules/cellphonedb/3.0.0/requirements.txt create mode 100644 src/.docker_modules/sanity/Dockerfile create mode 100755 src/.docker_modules/sanity/docker_init.sh create mode 100644 src/nf_modules/cellphonedb/main.nf create mode 100644 src/nf_modules/sanity/main.nf diff --git a/src/.docker_modules/bedtools/2.30.0/docker_init.sh b/src/.docker_modules/bedtools/2.30.0/docker_init.sh index fa7f1fde..b23fa27e 100755 --- a/src/.docker_modules/bedtools/2.30.0/docker_init.sh +++ b/src/.docker_modules/bedtools/2.30.0/docker_init.sh @@ -1,5 +1,4 @@ #!/bin/sh docker pull lbmc/bedtools:2.30.0 -# docker build src/.docker_modules/bedtools/2.30.0 -t 'lbmc/bedtools:2.30.0' -# docker push lbmc/bedtools:2.30.0 -docker buildx build --platform linux/amd64,linux/arm64 -t "lbmc/bedtools:2.30.0" --push src/.docker_modules/bedtools/2.30.0 +docker build src/.docker_modules/bedtools/2.30.0 -t 'lbmc/bedtools:2.30.0' +docker push lbmc/bedtools:2.30.0 diff --git a/src/.docker_modules/cellphonedb/3.0.0/Dockerfile b/src/.docker_modules/cellphonedb/3.0.0/Dockerfile new file mode 100644 index 00000000..18e7cf71 --- /dev/null +++ b/src/.docker_modules/cellphonedb/3.0.0/Dockerfile @@ -0,0 +1,21 @@ +FROM python:3.7-slim + +ENV RPY2_CFFI_MODE=ABI + +RUN mkdir /app /docker +COPY requirements.txt /app +COPY requirements-web.txt /app +WORKDIR /app + +RUN pip install -r requirements.txt +RUN pip install -r requirements-web.txt +RUN pip install cellphonedb==3.0.0 + + +COPY . /app +COPY ./docker /docker +RUN mkdir -p /var/log/uwsgi +RUN touch /var/log/uwsgi/cellphonedb.log +RUN chmod +x /app + +CMD ["/docker/run-system.sh"] diff --git a/src/.docker_modules/cellphonedb/3.0.0/cellphonedb.ini b/src/.docker_modules/cellphonedb/3.0.0/cellphonedb.ini new file mode 100644 index 00000000..ea75bcab --- /dev/null +++ b/src/.docker_modules/cellphonedb/3.0.0/cellphonedb.ini @@ -0,0 +1,14 @@ +[uwsgi] +module = wsgi:app + +master = true +processes = 4 + + +socket = 0.0.0.0:5000 +chmod-socket = 660 +vacuum = true + +die-on-term = true + +stats = /tmp/stats.socket \ No newline at end of file diff --git a/src/.docker_modules/cellphonedb/3.0.0/docker/postgres/Dockerfile b/src/.docker_modules/cellphonedb/3.0.0/docker/postgres/Dockerfile new file mode 100644 index 00000000..25b936ad --- /dev/null +++ b/src/.docker_modules/cellphonedb/3.0.0/docker/postgres/Dockerfile @@ -0,0 +1,5 @@ +FROM postgres:9.6 + +ENV POSTGRES_PASSWORD root +ENV POSTGRES_USER root +ENV POSTGRES_DB cellphonedb \ No newline at end of file diff --git a/src/.docker_modules/cellphonedb/3.0.0/docker/run-system.sh b/src/.docker_modules/cellphonedb/3.0.0/docker/run-system.sh new file mode 100755 index 00000000..9b8cd443 --- /dev/null +++ b/src/.docker_modules/cellphonedb/3.0.0/docker/run-system.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +exec uwsgi --ini cellphonedb.ini --log-master diff --git a/src/.docker_modules/cellphonedb/3.0.0/requirements-web.txt b/src/.docker_modules/cellphonedb/3.0.0/requirements-web.txt new file mode 100644 index 00000000..fa15fd0b --- /dev/null +++ b/src/.docker_modules/cellphonedb/3.0.0/requirements-web.txt @@ -0,0 +1,6 @@ +flask>=1.1,<1.1.99 +Flask-RESTful>=0.3,<0.3.99 +Flask-Testing>=0.8,<0.8.99 +pika>=0.12,<0.12.99 +boto3>=1.7,<1.7.99 +uWSGI>=2.0,<2.0.99 diff --git a/src/.docker_modules/cellphonedb/3.0.0/requirements.txt b/src/.docker_modules/cellphonedb/3.0.0/requirements.txt new file mode 100644 index 00000000..2f7e9961 --- /dev/null +++ b/src/.docker_modules/cellphonedb/3.0.0/requirements.txt @@ -0,0 +1,18 @@ +click>=7.0,<8.0 +pandas>=1.0.0,<=1.1.4 +numpy>=1.16.5,<=1.19.5 +numpy-groupies +scikit-learn==0.22 +flask>=1.0,<2.0.0 +Flask-RESTful>=0.3 +Flask-Testing>=0.7 +SQLAlchemy>=1.3,<1.4 +PyYAML>=5.4,<6.0 +requests>=2.25,<3.0 +pika>=1.0.0,<2.0 +boto3>=1.15,<2.0 +geosketch==0.3 +rpy2>=3.4.0,<4.0 +tqdm>=4.3,<5.0 +h5py<3.0.0 +anndata>=0.7,<=0.75 diff --git a/src/.docker_modules/htseq/0.13.5/docker_init.sh b/src/.docker_modules/htseq/0.13.5/docker_init.sh index 00ad38fe..ca03fe9a 100755 --- a/src/.docker_modules/htseq/0.13.5/docker_init.sh +++ b/src/.docker_modules/htseq/0.13.5/docker_init.sh @@ -1,5 +1,4 @@ #!/bin/sh docker pull lbmc/htseq:0.13.5 -# docker build src/.docker_modules/htseq/0.13.5 -t 'lbmc/htseq:0.13.5' -# docker push lbmc/htseq:0.13.5 -docker buildx build --platform linux/amd64,linux/arm64 -t "lbmc/htseq:0.13.5" --push src/.docker_modules/htseq/0.13.5 +docker build src/.docker_modules/htseq/0.13.5 -t 'lbmc/htseq:0.13.5' +docker push lbmc/htseq:0.13.5 diff --git a/src/.docker_modules/kb/0.26.3/docker_init.sh b/src/.docker_modules/kb/0.26.3/docker_init.sh index 8104fc75..0294274a 100755 --- a/src/.docker_modules/kb/0.26.3/docker_init.sh +++ b/src/.docker_modules/kb/0.26.3/docker_init.sh @@ -1,5 +1,4 @@ #!/bin/sh docker pull lbmc/kb:0.26.3 -# docker build src/.docker_modules/kb/0.26.3 -t 'lbmc/kb:0.26.3' -# docker push lbmc/kb:0.26.3 -docker buildx build --platform linux/amd64,linux/arm64 -t "lbmc/kb:0.26.3" --push src/.docker_modules/kb/0.26.3 +docker build src/.docker_modules/kb/0.26.3 -t 'lbmc/kb:0.26.3' +docker push lbmc/kb:0.26.3 diff --git a/src/.docker_modules/sanity/Dockerfile b/src/.docker_modules/sanity/Dockerfile new file mode 100644 index 00000000..99f9545e --- /dev/null +++ b/src/.docker_modules/sanity/Dockerfile @@ -0,0 +1,30 @@ +##### BASE IMAGE ##### +FROM ubuntu:18.04 + +##### METADATA ##### +LABEL base.image="ubuntu:18.04" +LABEL version="1" +LABEL software="Sanity" +LABEL software.version="1.0" +LABEL software.description="Sanity" +LABEL software.website="" +LABEL software.documentation="https://github.com/jmbreda/Sanity" + +##### VARIABLES ##### + +# Use variables for convenient updates/re-usability +ENV SOFTWARE_VERSION 1.0 + +RUN apt-get update \ + && apt-get install -y tzdata \ + && ln -fs /usr/share/zoneinfo/Europe/Berlin /etc/localtime \ + && dpkg-reconfigure --frontend noninteractive tzdata \ + && apt-get install --yes git make g++ libgomp1 \ + && git clone https://github.com/jmbreda/Sanity.git \ + && cd Sanity \ + && cd src \ + && make \ + && cp ../bin/Sanity /usr/bin \ + && cd ../../ \ + && rm -rf Sanity \ + && apt-get remove --purge --yes git make g++ \ diff --git a/src/.docker_modules/sanity/docker_init.sh b/src/.docker_modules/sanity/docker_init.sh new file mode 100755 index 00000000..876fecd8 --- /dev/null +++ b/src/.docker_modules/sanity/docker_init.sh @@ -0,0 +1,4 @@ +#!/bin/sh +docker pull mlepetit/saanity +docker build src/.docker_modules/mlepetit/sanity -t 'lbmc/sanity' +docker push lbmc/sanity diff --git a/src/nf_modules/cellphonedb/main.nf b/src/nf_modules/cellphonedb/main.nf new file mode 100644 index 00000000..37fb9700 --- /dev/null +++ b/src/nf_modules/cellphonedb/main.nf @@ -0,0 +1,118 @@ +version = "3.0.0" +container_url = "mlepetit/cellphonedb:latest" + +params.cellphonedb = "" +params.cellphonedb_out = "" +params.pval="" +params.thres="" +params.iterations="" +params.gene_id="" + + + +workflow cellphone_statistical_analysis { + take: + meta + counts + + main: + +cpdb_methods_stats(meta,counts) +cpdb_plot_dot_plot(cpdb_methods_stats.out.means,cpdb_methods_stats.out.pvalues) +cpdb_plot_heatmap(cpdb_methods_stats.out.pvalues) + + + emit: + means = cpdb_methods_stats.out.means + pvalues = cpdb_methods_stats.out.pvalues + deconvoluted = cpdb_methods_stats.out.deconvoluted + significant_means = cpdb_methods_stats.out.significant_means + dot_plot = cpdb_plot_dot_plot.out.dot_plot + heatmap = cpdb_plot_heatmap.out.heatmap + heatmap_log = cpdb_plot_heatmap.out.heatmap_log + count_network = cpdb_plot_heatmap.out.count_network + interactions_count = cpdb_plot_heatmap.out.interactions_count + + +} + + + + + + + + + + +process cpdb_methods_stats { + container = "${container_url}" + label "big_mem_multi_cpus" + if (params.cellphonedb_out != "") { + publishDir "results/${params.cellphonedb_out}", mode: 'copy' + } + + input: + tuple val(id_mtx), path(meta) + tuple val(id_mtx), path(counts) + + output: + tuple val(id_mtx), path("out/means.txt"), emit: means + tuple val(id_mtx), path("out/pvalues.txt"), emit: pvalues + tuple val(id_mtx), path("out/deconvoluted.txt"), emit: deconvoluted + tuple val(id_mtx), path("out/significant_means.txt"), emit: significant_means + +script: + """ +cellphonedb method statistical_analysis ${params.meta} ${params.counts} --counts-data ${params.gene_id} --threads ${task.cpus} --iterations ${params.iterations} --pvalue ${params.pval} --threshold ${params.thres} + + """ +} + + +process cpdb_plot_dot_plot { + container = "${container_url}" + label "big_mem_mono_cpus" + if (params.cellphonedb_out != "") { + publishDir "results/${params.cellphonedb_out}", mode: 'copy' + } + + input: + tuple val(id_mtx), path(means) + tuple val(id_mtx), path(pvalues) + + output: + tuple val(id_mtx), path("out/plot.pdf"), emit: dot_plot + +script: + """ +mkdir ./out +cellphonedb plot dot_plot --means-path ${means} --pvalues-path ${pvalues} + + """ +} + +process cpdb_plot_heatmap { + container = "${container_url}" + label "big_mem_multi_cpus" + if (params.cellphonedb_out != "") { + publishDir "results/${params.cellphonedb_out}", mode: 'copy' + } + + input: + tuple val(id_mtx), path(pvalues) + + output: + tuple val(id_mtx), path("out/heatmap_count.pdf"), emit: heatmap + tuple val(id_mtx), path("out/heatmap_log_count.pdf"), emit: heatmap_log + tuple val(id_mtx), path("out/count_network.txt"), emit: count_network + tuple val(id_mtx), path("out/interaction_count.txt"), emit: interactions_count + +script: + + """ +mkdir ./out +cellphonedb plot heatmap_plot --pvalues-path ${pvalues} --pvalue ${params.pval} ${params.meta} + + """ +} diff --git a/src/nf_modules/fastp/main.nf b/src/nf_modules/fastp/main.nf index 2593eefe..92ee81fc 100644 --- a/src/nf_modules/fastp/main.nf +++ b/src/nf_modules/fastp/main.nf @@ -151,3 +151,4 @@ process fastp_accel_1splus { --report_title ${file_prefix} """ } + diff --git a/src/nf_modules/kb/main.nf b/src/nf_modules/kb/main.nf index ca4e7552..6edfa130 100644 --- a/src/nf_modules/kb/main.nf +++ b/src/nf_modules/kb/main.nf @@ -268,7 +268,7 @@ workflow index_fasta_velocity { process index_fasta_velocity_default { container = "${container_url}" - label "big_mem_mono_cpus" + label "big_mem_multi_cpus" tag "$file_id" if (params.index_fasta_out != "") { publishDir "results/${params.index_fasta_out}", mode: 'copy' diff --git a/src/nf_modules/sanity/main.nf b/src/nf_modules/sanity/main.nf new file mode 100644 index 00000000..7d9d6236 --- /dev/null +++ b/src/nf_modules/sanity/main.nf @@ -0,0 +1,35 @@ +container_url="mlepetit/sanity:latest" + +params.sanity_out="" +params.sanity="" + +process normalization_sanity + { + + container="${container_url}" + label "big_mem_multi_cpus" + if (params.sanity_out != "") { + publishDir "results/${params.sanity_out}", mode: 'copy' + + } +else { + publishDir "results/normalize_matrix/", mode: 'copy' + + } + + input: + + tuple val(id_mtx), path(raw_filtered_mtx) + + + output: + + tuple val(id_mtx),path("log_transcription_quotients.txt"), emit: normalize_filtered_mtx + tuple val(id_mtx), path("ltq_error_bars.txt") ,emit: ltq_error + + script: + + """ + Sanity -f ${raw_filtered_mtx} -n ${task.cpus} ${params.sanity} + """ + } -- GitLab