Skip to main content

Collection of BEDA internal python functions for analysing single cell RNAseq data.

Project description

BESCA (BEyond Single Cell Analysis)

Run doctests License: GPL v3

The BESCA (BEyond Single Cell Analysis) package contains many useful python functions to use for your single-cell analysis.

The package has been grouped into 3 categories:

  • preprocessing functions: this submodule contains all functions relevant to data preprocessing
  • plotting functions: additional plot types not available in the standard scanpy package
  • tools: contains additional tools to e.g. perform differential gene analysis or load/export data

For more information please view the package documentation: https://bedapub.github.io/besca/

Please consider citing our publication if you use Besca for your research:

If you are interested in contributing you can check the repository wiki for helpful information on contributing: https://github.com/bedapub/besca/wiki

For faster/smaller download, in case of slow internet connection or low storage capacity, please use following command to clone this repository:

git clone --filter=blob:none git@github.com:bedapub/besca.git

Installation

From version 2.2.5+, Besca requires Python 3.8 or above.

If you are familiar with python packages simply install them using pip:

pip install besca

or

pip install git+https://github.com/bedapub/besca.git

Besca comes with a binary called reformat written in C and was compiled in linux-64. Therefore, besca runs exclusively on linux-64.

Set the executable flag to the binary file reformat

In some cases, the binary file needs to be made executable. To do so, run the following one-liner.

pip show besca | grep Location | cut -f 2 -d ":" | awk -v OFS="" '{print "chmod u+x" $0 "/besca/export/reformat"}' | bash

If you want to avoid piping to bash, or want to it step by step, here is how to. Show the location of the path and navigate to the besca package.

pip show besca
cd Location/besca

Navigate in the directory containing the binary and make it executeable.

cd export
chmod u+x reformat

Python beginner guide

If you are not very familiar with python packages here is a detailed description.

If you don't have a conda python installation download and install miniconda. While installing we recommend accepting everything asked by the miniconda installation.

As a next step, we create a separate environment for besca which is also called besca.

conda create --name besca python=3.8

We can activate this environment.

conda activate besca

Within this environment, we can install besca using pip.

pip install git+https://github.com/bedapub/besca.git

Now following the instruction above to set the executable flag to the binary file shipped with besca.

You should now have successfully installed besca.

In case you met any problems, please report an issue.

To install Jupyter Notebook, type

conda install jupyter

and type

jupyter notebook

to start a Jupyter Notebook in your browser. See documentation for further details.

R dependencies for additional methods [R-based functions are deprecated]

Although the standard workflow can be run without any R dependencies, BESCA can run a selection of performant methods developed in R. These additional methods are :

  • isOutlier from scater: for outlier detection and filtering recommendations. Implemented in the besca.pp.valOutlier function.
  • SCTransform : one of the normalization methods proposed by the Seurat package. Implemented in the besca.pp.scTransform function.
  • maxLikGlobalDimEst from intrinsicDimension : for an estimation of the number of dimensions to use for clustering. Implemented in the besca.st.maxLikGlobalDimEst function.
  • deviance and VST: for highly-variable genes selection. Implemented in the besca.st.deviance function.
  • DSB: for denoising ADT counts data based on background noise. Implemented in the besca.st.dsb_normalize function.

Conda installation

If you used a conda enviroment it is possible to install most needed dependencies using Conda too.

With an activated environment using:

conda activate besca

One can run the commands below:


conda install -y -c conda-forge r=4.0 rpy2 r-essentials r-base r-devtools r-withr r-vctrs r-tidyverse r-magrittr r-data.table r-Matrix r-ggplot2 r-readr r-seurat r-intrinsicdimension r-mclust r-sitmo r-patchwork --force-reinstall
conda install -y -c bioconda anndata2ri R bioconductor-dropletutils bioconductor-scry
conda install -c bioconda bioconductor-scater

This should install in your conda envrionment the dependencies under : conda_path/lib/R/library of your conda environment path.

Pip installation

If you want to run one of these methods in the workflow, please install the required libraries by running the following commands in the besca installation directory (or simply download the Rlibs.R file):

pip install rpy2 anndata2ri
<conda_Rscript_bin_path> Rlibs.R <conda_R_library_path>

Location of conda Rscript bin

Typically: <conda_Rscript_bin_path> = ~/.conda/envs/[environnement_name]/bin/Rscript

Location of the conda R library

If you used conda, by default, libraries should be installed into your conda environment path, typically ~/.conda/envs/[environnement_name]/lib/R/library. If this is not the right path, please verify the path to your conda enviroment using conda list env.

To minimize risks conflicts between libraries, it is advised to set your your_R_library_path to such path also while using pip.

In the standard workflow notebook, all of these methods are controlled through the r_methods option but it is of course possible to manually switch between them and the standard workflow. Please also specify the location of your R library with the rlib_loc option of the notebook.

Running besca on an HPC with a SLURM workload manager

If you have access to an HPC which uses SLURM as a workload manager you can run the jupyter notebooks coming with besca located in workbooks/ with dedicated resources.
To do so, start an interactive session on your HPC.

interactive -c 8 -m 16G -t 180 # This allocates 8 CPUs, 16 GB of memory for 3 hours

If you have installed besca in a conda environment like explained above activate the environment.

conda activate besca

Start a jupyter notebook.

jupyter-notebook --ip=* --no-browser

You can now run the jupyter notebooks coming with besca.

Datasets and Analysis notebooks

Besca run-examples and datasets annotation notebooks can be found in:

https://github.com/bedapub/besca_publication_results

All processed datasets were uploaded to Zenodo, within the Besca community:

https://zenodo.org/communities/besca/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

besca-2.5.5.tar.gz (345.7 kB view details)

Uploaded Source

Built Distribution

besca-2.5.5-py3-none-any.whl (350.5 kB view details)

Uploaded Python 3

File details

Details for the file besca-2.5.5.tar.gz.

File metadata

  • Download URL: besca-2.5.5.tar.gz
  • Upload date:
  • Size: 345.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for besca-2.5.5.tar.gz
Algorithm Hash digest
SHA256 13a1d253c89629aeb3f4e64a6922e22cc58f6d65964ad4f5a1f952072f9624d3
MD5 eb6f85740ce0e781e2474bc1c61ea1ae
BLAKE2b-256 514978be45ae8158878ba6d3c10fefaaed5ca413b7f7dd2933b8b0b3dbfb9be4

See more details on using hashes here.

File details

Details for the file besca-2.5.5-py3-none-any.whl.

File metadata

  • Download URL: besca-2.5.5-py3-none-any.whl
  • Upload date:
  • Size: 350.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for besca-2.5.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4b1189a83e30a4f5f65c7a931564c1e5b360c10feb8ce1da9f3271a1591f6a93
MD5 9af2b13690ace22258e8e18678e643ec
BLAKE2b-256 13d9ad91d93e849efcfacefe59555a283d3e69cc36fd618ccd55e2566da63fc4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page