A bin to gene conversion package.
Project description
BinToGene
Library to convert a cell-by-bin matrix to cell-by-gene, i.e., it replaces the promoter accessibility with a gene activiy score. This can be useful, for e.g., when one wishes to use existing gene expression tools to a sc-ATAC-seq cell-by-bin matrix.The package uses a gencode file (v34) to determine start and end locations for protein coding genes. This interval is then extended by fixed or gene-length dependent values to get a new interval I=(start-v1, end+v2). Then the bins in the provided data matrix are searched to see if they intersect I. An efficient binary search implementation is used to determine the first and last bin for which such intersection is found. Then the values of the bins are added or averaged as specified by the user. The resulting vector is a count vector for the gene in consideration. Note, the counts here do not represent expression of the gene, but chromatin accessibility counts in the case of sc-ATAC-seq. In the end, these vectors are stacked to form a cell-by-gene matrix. Tools that are used for analyzing gene expression data can be useful in analyzing the cell-by-gene matrix formed this way.
Example
import numpy as np
x = np.random.randint(0, 2, (200, 4000)) # your cell by bin matrix
bin_names = ['chr1:0-1000', 'chr1:1001-2000', ...] # your list of bin names
btg = BinToGene() # Use default interval extension parameters
counts, ids = btg.convert(x, bin_names, prefix='chr', delim1=':', delim2='-')
Example of a cell-by-gene matrix obtained via UMAP after running some basic preprocessing
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
Built Distribution
File details
Details for the file BinToGene-1.23.tar.gz
.
File metadata
- Download URL: BinToGene-1.23.tar.gz
- Upload date:
- Size: 22.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | da5b05d75b8577ca3f8e6a9b50a72087d8f1366f642df9abf8ea8633bae83d79 |
|
MD5 | ad66326a787387c4f4ce7a8c8650767f |
|
BLAKE2b-256 | 2e0e36ea22512689cb8f4749d85a6d39af3e818cabf180af6fa81fddce0af81f |
File details
Details for the file BinToGene-1.23-py2.py3-none-any.whl
.
File metadata
- Download URL: BinToGene-1.23-py2.py3-none-any.whl
- Upload date:
- Size: 22.3 MB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44e4354805c0ae27c9c534cfbdc92954b49c8cac90ab7920c7ebdff3cef53a89 |
|
MD5 | f20c3d0cecf8db4daba3d3c427ead3d5 |
|
BLAKE2b-256 | d455d727ac459a690ea996169984d3791ba021459cb69f7cd0303d886e5c3941 |