Transfer learning for spatial transcriptomics data and single-cell RNA-seq data.
Project description
stTransfer
Installation
conda create -n stTranfer python=3.8
conda activate stTranfer
conda activate zt_stTransfer_2
conda install anaconda::h5py # if h5py install error
pip install torch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu117
# install for cuda manylinux2014_aarch64
pip install torch-cluster==1.6.1 -f https://pytorch-geometric.com/whl/torch-1.13.1%2Bcu117.html
pip install torch-scatter==2.1.1 -f https://pytorch-geometric.com/whl/torch-1.13.1%2Bcu117.html
pip install torch-sparse==0.6.17 -f https://pytorch-geometric.com/whl/torch-1.13.1%2Bcu117.html
pip install torch-spline-conv==1.2.2 -f https://pytorch-geometric.com/whl/torch-1.13.1%2Bcu117.html
pip install pyg-lib==0.2.0 -f https://pytorch-geometric.com/whl/torch-1.13.1%2Bcu117.html
pip install torch-geometric
# install for cuda linux_x86_64
pip install torch-cluster==1.6.1+pt113cu117 -f https://pytorch-geometric.com/whl/torch-1.13.1%2Bcu117.html
pip install torch-scatter==2.1.1+pt113cu117 -f https://pytorch-geometric.com/whl/torch-1.13.1%2Bcu117.html
pip install torch-sparse==0.6.17+pt113cu117 -f https://pytorch-geometric.com/whl/torch-1.13.1%2Bcu117.html
pip install torch-spline-conv==1.2.2+pt113cu117 -f https://pytorch-geometric.com/whl/torch-1.13.1%2Bcu117.html
pip install pyg-lib==0.2.0+pt113cu117 -f https://pytorch-geometric.com/whl/torch-1.13.1%2Bcu117.html
pip install torch-geometric
# if jaxlib error if you need
conda install jaxlib
pip install git+https://github.com/zEpoch/stTransfer
# need to install again
pip install torch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu117
# fix error you may need
pip install flax==0.7.2
pip install pyro-ppl==1.8.6
pip install optax==0.1.7
And for my mechine, I need to install the following packages:
pip install wheel
git config --global url."https://mirror.ghproxy.com/https://github.com".insteadOf "https://github.com"
pip install torch-cluster==1.6.1+pt113cu117 -f https://pytorch-geometric.com/whl/torch-1.13.1%2Bcu117.html
pip install torch-scatter==2.1.1+pt113cu117 -f https://pytorch-geometric.com/whl/torch-1.13.1%2Bcu117.html
pip install torch-sparse==0.6.17+pt113cu117 -f https://pytorch-geometric.com/whl/torch-1.13.1%2Bcu117.html
pip install torch-spline-conv==1.2.2+pt113cu117 -f https://pytorch-geometric.com/whl/torch-1.13.1%2Bcu117.html
pip install torch-geometric
git config --global url."https://mirror.ghproxy.com/https://github.com".insteadOf "https://github.com"
pip install git+https://github.com/zEpoch/stTransfer
pip install torch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu117
pip install flax==0.7.2
pip install pyro-ppl==1.8.6
pip install optax==0.1.7
from stTransfer import transfer
kwargs = {
'sc_adata_path': '/data/work/sttransfer/stereoseq/script/adata.scvi.leiden.anno.h5ad',
'sp_adata_path': '/data/work/sttransfer/cellbin_adatas/A01890F2_ot_left.h5ad',
'sc_anno': 'anno',
'sp_anno': 'annotation',
'name': 'A01890F2_ot_left',
'save_path': '/data/work/sttransfer/stereoseq/Result_3/',
'sp_filter': True,
'k_n_fold': 3, # for xgboost train
'st_spatial_anno': 'spatial', # in the obsm
'finetune_epochs': 50,
'finutune_pca_dim': 0,
'gpu': 0,
'finutune_w_cls': 10,
'finutune_w_gae': 1,
'finutune_w_dae': 1,
'KD_T': 1,
'marker_genes':None
}
transfer(**kwargs)
import anndata as ad
adata = ad.read('/data/work/sttransfer/stereoseq/Result_3/spd_filtered.h5ad')
import pandas as pd
csv = pd.read_csv('/data/work/sttransfer/stereoseq/Result_3/celltype_label.h5ad')
csv.lolumns = ['0']
adata.obs['celltype'] = csv['0']
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sttransfer-1.0.25.tar.gz
(3.8 kB
view details)
Built Distribution
File details
Details for the file sttransfer-1.0.25.tar.gz
.
File metadata
- Download URL: sttransfer-1.0.25.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5152d04e958e32229eaeef328f64a9ef94afb8a290fb53f30d42aa9c3e3e6b2e |
|
MD5 | bd0d46cf63b55620bf940904b616696b |
|
BLAKE2b-256 | f743cfbc5d6fc36e2669fe57d136493723bf33e89c45e3d2ec57da63668aecb2 |
File details
Details for the file stTransfer-1.0.25-py3-none-any.whl
.
File metadata
- Download URL: stTransfer-1.0.25-py3-none-any.whl
- Upload date:
- Size: 21.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a14a06a76a0a68138d305f454581c9edb42010f0f4684e64028d9261b73ca73 |
|
MD5 | 8bc81c331b4472cdd79a420e8df686e6 |
|
BLAKE2b-256 | 7fc36010b6b885fe07cb0d6c4b3005de3ecf0e082eefe92af45ebcce6c314a5e |