OncoBLADE is a Bayesian deconvolution method designed to estimate cell type-specific gene expression profiles and fractions from bulk RNA profiles of tumor specimens by integrating prior knowledge on cell fractions. You can find the preprint of OncoBLADE at Research Square.
OncoBLADE can run on the minimal computer spec, such as Binder (1 CPU, 2GB RAM on Google Cloud), when data size is small. However, OncoBLADE can significantly benefit from the larger amount of CPUs and RAM.
The package development version is tested on Linux operating systems. (CentOS 7 and Ubuntu 16.04).
The python package of BLADE is available on pip. You can simply (takes only <1min):
pip install OncoBLADE
We tested BLADE with python => 3.6.
One can create a conda environment contains BLADE and also other dependencies to run Demo. The environment definition is in environment.yml.
First, please open a terminal or make sure you are logged into your Linux VM. Assuming that you have a 64-bit system, on Linux, download and install Miniconda 3 with:
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
On MacOS X, download and install with:
curl https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o Miniconda3-latest-MacOSX-x86_64.sh
bash Miniconda3-latest-MacOSX-x86_64.sh
You can install all the necessary dependency using the following command (may takes few minutes; mamba is quicker in general).
conda env create --file environment.yml
Then, the OncoBLADE environment can be activate by:
conda activate OncoBLADE
You can find a demo script under jupyter folder.
You can open the script using the command below after activating the OncoBLADE environment:
jupyter notebook jupyter/OncoBLADE\ -\ Demo script.ipynb
In the OncoBLADE package, you can load the following functions and modules.
oncoBLADE: A class object contains core algorithms ofOncoBLADE, an extended version ofBLADE. Users can reach internal variables (Nu,Omega, andBeta) and functions for calculating objective functions (ELBO function) and gradients with respect to the variational parameters. There also is an optimization function (oncoBLADE.Optimize()) for performing L-BFGS optimization. OncoBLADE features an iterative update to optimize hyperparameterAlphaand integration of prior expectation of subset of cell types. In BLADE,Alphais a user-defined hyperparameter.
To run classic BLADE and OncoBLADE, we provide main functinos Framework for BLADE and Framework_Iterative for OncoBLADE.
See below to obtain the current estimate of cellualr fractions, gene expression profiles per cell type and per sample:
-
ExpF(self.Beta): returns aNsamplebyNgenematrix contains estimated fraction of each cell type in each sample. -
self.Nu: aNsamplebyNgenebyNcellmultidimensional array contains estimated gene expression levels of each gene in each cell type for each sample. -
numpy.mean(self.Nu,0): To obtain a estimated gene expression profile per cell type, we can simply take an average across the samples. -
Framework_Iterative: OncoBLADE framework based on theBLADEclass module above. Users need to provide the following input/output arguments.-
Input arguments
X: aNgenebyNcellmatrix contains average gene expression profiles per cell type (a signature matrix) in log-scale.stdX: aNgenebyNcellmatrix contains standard deviation per gene per cell type (a signature matrix of gene expression variability).Y: aNgenebyNsamplematrix contains bulk gene expression data. This should be in linear-scale data without log-transformation.Expectation: aNsamplebyNcellmatrix contains the expected cell fraction used to inform OncoBLADE [Optional]Ind_Marker: Index for marker genes. By default,[True]*Ngene(all genes used without filtering). For the genes withFalsethey are excluded in the first phase (Empirical Bayes) for finidng the best hyperparameters.Ind_sample: Index for the samples used in the first phase (Empirical Bayes). By default,[True]*Nsample(all samples used).Alpha,Alpha0,Kappa0andSY: hyperparameters used in the model.Alphais also optimzed, while others are fixed. By default,Alpha=1,Alpha0=0.1, 'Kappa0=1,sY=1`.IterMax: Number of maximum iteration between variational parameter optimization by L-BFGS and updating hyperparameterAlpha. By default,iterMax=100.Nrep: Number of random initial guess used to run OncoBLADE. The best in terms of ELBO function will be chosed among the local optimum. By default,Nrep=3.Njob: Number of jobs executed in parallel. By default,Njob=10.
-
Output values
final_obj: A finalBLADEobject with optimized variational parameters and hyperparameters.conv: The ELBO function value (i.e., local optimum) for the finalBLADEobject.outs:NrepBLADE objects optimized with all random initial guesses with their final ELBO values.
-
Functions for purification: Parallel_Purification, Purify_AllGenes

