diff --git a/Dockerfile.cytofcompensation b/Dockerfile.cytofcompensation new file mode 100644 index 0000000..2ee87de --- /dev/null +++ b/Dockerfile.cytofcompensation @@ -0,0 +1,9 @@ +# Use the official image as a parent image. +FROM continuumio/miniconda3:4.8.2 + +# Set the working directory. +WORKDIR ~ + +# Run the command inside your image filesystem. +RUN conda install -c conda-forge mamba +RUN mamba install -y -c bioconda -c conda-forge bioconductor-catalyst=1.6 r::r-stringr r-ggpmisc r-data.table r-dtplyr r-ggplot2 bioconductor-flowcore r-tiff r::rstudio r-plotly r-matrixstats r-reshape2 r-raster r-viridis bioconductor-ebimage r-scales r-fields plotly unzip libgfortran r-devtools diff --git a/README.md b/README.md index 8038e88..7ba5066 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +RStudio: [![Binder](http://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/BodenmillerGroup/cyTOFcompensation/environment?urlpath=rstudio&filepath=README.md) # cyTOF compensation This repository contains scripts used to reproduce a majority of figures from the paper "Compensation of signal spillover in suspension and imaging mass cytometry" by Stéphane Chevrier\*, Helena L. Crowell\*, Vito R.T. Zanotelli\*, Stefanie Engler, Mark D. Robinson, and Bernd Bodenmiller which is published in 'Cell Systems' as "Compensation of Signal Spillover in Suspension and Imaging Mass Cytometry" (http://www.cell.com/cell-systems/abstract/S2405-4712(18)30063-2) @@ -8,6 +9,28 @@ The raw data is available from Mendeley data under the DOI code 10.17632/v58yj49 The CATALYST package developed specifically to allow a user friendly usage of the developped spillover estimation and compensation approach can be found for download at: http://bioconductor.org/packages/CATALYST A link to the light version of the web app, installation instructions, example datasets, and vignettes for CATALYST are available from the project page: https://catalyst-project.github.io/. + +## Scripts in this repository only works for CATALYST 1.6 + +Due to changes in CATALYST, this repository only works with older versions (tested: CATALYST 1.6). +To generate a compatible enviornment, we suggest you to use conda: +https://docs.conda.io/projects/conda/en/latest/user-guide/install + +To install the environment use: +``` +conda env create -f environment.yml -n cytofcompensation +conda activate cytofcompensation +``` +on a desktop you should be able to start Rstudio via + +``` +rstudio +``` + +This was tested on Ubuntu 18.04. +Alternatively we provide a dockerfile to generate a container with the environment. + + The repository is organized in the following scripts: 0) retrieve_data.R:\ diff --git a/environment.yml b/environment.yml new file mode 100644 index 0000000..6f5ecda --- /dev/null +++ b/environment.yml @@ -0,0 +1,27 @@ +channels: + - conda-forge + - bioconda +dependencies: + - bioconductor-catalyst=1.6 + - r::r-stringr + - r-ggpmisc + - r-data.table + - r-dtplyr + - r-ggplot2 + - bioconductor-flowcore + - r-tiff + - r::rstudio + - r-plotly + - r-matrixstats + - r-reshape2 + - r-raster + - r-viridis + - bioconductor-ebimage + - r-scales + - r-fields + - plotly + - r-irkernel + - libiconv + - icu<=60 + - libgfortran + - r-devtools diff --git a/scripts/retrieve_data.R b/scripts/retrieve_data.R index d7fe097..f02b8d6 100644 --- a/scripts/retrieve_data.R +++ b/scripts/retrieve_data.R @@ -9,11 +9,11 @@ # 'https://data.mendeley.com/datasets/v58yj49pfr/draft/files/3ef240f2-96ab-4dd7-aba4-68150c286990/Figure_4.zip?dl=1', # 'https://data.mendeley.com/datasets/v58yj49pfr/draft/files/8ac64093-0273-4ae3-a53e-fdb3348ee7ac/Figure_S5.zip?dl=1') -urls_data = c('https://data.mendeley.com/datasets/v58yj49pfr/1/files/4cd060d1-9714-4040-ad24-9aa48b47d520/Figure_1.zip?dl=1', - 'https://data.mendeley.com/datasets/v58yj49pfr/1/files/eeefe10c-49f8-4dc6-84b5-0fd82c7d9449/Figure_2-3.zip?dl=1', - 'https://data.mendeley.com/datasets/v58yj49pfr/1/files/75c2eea3-0bca-4c7d-a06a-c0a75ebebcd2/Figure_4.zip?dl=1', - 'https://data.mendeley.com/datasets/v58yj49pfr/1/files/859158e7-2786-481e-b070-99aab43aba36/Figure_S3.zip?dl=1', - 'https://data.mendeley.com/datasets/v58yj49pfr/1/files/0e52746f-545c-4607-91c2-cd8635d4d269/Figure_S5.zip?dl=1') +urls_data = c('https://data.mendeley.com/public-files/datasets/v58yj49pfr/files/cd2b59f9-b34a-46c3-af33-fe3c43ed7d80/file_downloaded?dl=1', + 'https://data.mendeley.com/public-files/datasets/v58yj49pfr/files/758f4f06-730e-4046-9b65-4ce74c56f581/file_downloaded?dl=1', + 'https://data.mendeley.com/public-files/datasets/v58yj49pfr/files/fad34c02-8a26-4291-814a-dc3bd4d980a2/file_downloaded?dl=1', + 'https://data.mendeley.com/public-files/datasets/v58yj49pfr/files/2eb186ee-7410-4f2e-b42e-1d2d8b8b4931/file_downloaded?dl=1', + 'https://data.mendeley.com/public-files/datasets/v58yj49pfr/files/b39223d2-2825-4e79-9875-86fa0e1c55d2/file_downloaded?dl=1') # set working directory to current script location scriptdir <- dirname(parent.frame(2)$ofile) diff --git a/scripts/spillover_imc_helpers.R b/scripts/spillover_imc_helpers.R index ada8858..cbc63f8 100644 --- a/scripts/spillover_imc_helpers.R +++ b/scripts/spillover_imc_helpers.R @@ -219,9 +219,9 @@ comp_datimg <- function(datimg, sm, method='nnls',...){ img_comp = img_mat %>% flowCore::flowFrame() %>% - CATALYST::compCytof(sm,method=method, ...) %>% + CATALYST::compCytof(as.matrix(sm),method=method, ...) %>% flowCore::exprs() %>% as.data.table() setnames(img_comp, orig_names) return(img_comp) -} \ No newline at end of file +}