BETA
This package still in beta, please feel free to e-mail me for any question about the package and usage.
email: fchang[at]clemson.edu
FULL Tutorial
Install
pip install screg2
Usage
Load data form h5ad file
If you have 2 anndata object that already finished scaling,
normalizing,... You can just simply use screg2.RegNMF() to integrate
rna and atac data, with batch remove. screg2.RegNMF() will return the
rna anndata object with scReg_reduction in it rna_adata.obsm
import pandas as pd
import numpy as np
import scanpy as sc
import screg2
rna_file = '/path/to/your/rna/h5ad/file'
atac_file = '/path/to/your/atac/h5ad/file'
rna_adata = sc.read_h5ad(rna_file)
atac_adata= sc.read_h5ad(atac_file)
rna_adata = screg2.RegNMF(rna_data=rna_adata, atac_data=atac_adata, Meta_data=rna_adata.obs,batch_type='sample', maxiter=100, key_added="scReg_reduction")
screg2.RegNMF() will return the rna anndata object with
scReg_reduction in it rna_adata.obsm
rna_adata.obsm['scReg_reduction']
array([[4.13353097e-14, 1.08500913e-10, 3.27313772e-11, ...,
0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
[2.09097071e-14, 1.96949657e-16, 1.67404740e-11, ...,
0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
[1.12355639e-10, 3.41268614e-11, 6.89114276e-11, ...,
0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
...,
[6.38938638e-14, 7.88140180e-11, 5.65415185e-13, ...,
0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
[1.88311115e-10, 1.70259133e-10, 6.51093299e-12, ...,
0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
[2.15576528e-12, 9.40752216e-11, 1.57056569e-12, ...,
0.00000000e+00, 0.00000000e+00, 0.00000000e+00]])
Warning
If you do not have the meta data of cells for their sample infomation the nex code might help you
rna_adata.obs['sample'] = adata.obs_names.str.split("-").str[1]
Clustering and Umap
sc.pp.neighbors(rna_adata, use_rep='scReg_reduction', key_added='scReg_neighbors', n_neighbors=40)
sc.tl.leiden(rna_adata, neighbors_key='scReg_neighbors', key_added='scReg_leiden')
sc.tl.umap(rna_adata, neighbors_key='scReg_neighbors')
sc.pl.umap(rna_adata, color="scReg_leiden", legend_loc="on data",legend_fontsize="small",size=6, title="scReg")
# If you want to save the figure you can
# sc.pl.umap(rna_adata, color="scReg_leiden", legend_loc="on data",legend_fontsize="small",size=6, save="_scReg.pdf" title="scReg")
Metadata
Release files for scReg2 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| screg2-0.1.0.tar.gz | 8.5 kB | Without provenance | Details for screg2-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| screg2-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for screg2-0.1.0-py3-none-any.whl |
Total release size: 16.9 kB
Release files / screg2-0.1.0.tar.gz
| Download URL | screg2-0.1.0.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ef23ded60557693d660b4971db5714cf2cf6ffac03aa5cd55a72b4d9054a1d41
|
|
BLAKE2b-256 checksum How to use checksums |
8909cd9b3ab2beecb3710e4f19e7ccbe96b174fe9eeb9e11e97b54d99edda49c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.3 Linux/6.8.9-arch1-2
|
Release files / screg2-0.1.0-py3-none-any.whl
| Download URL | screg2-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
23bf8980c963512e48aebc582bb92a6332f999cbe5fa7fd96beb501d5a304b08
|
|
BLAKE2b-256 checksum How to use checksums |
cfe51b673bff53fd25975c4380f2298954a446fd31451517721e0b8f587a40cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.3 Linux/6.8.9-arch1-2
|
Security for scReg2 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.