华大空间转录组Stereo-seq数据转化为seurat对象

基于python的stereopy库将gem文件批量转化为h5ad(seurat可识别)文件 

import numpy
import numba
import warnings
warnings.filterwarnings('ignore')
import stereo as st
import os 

def gem_to_h5ad(data_path,file,bins): 
    data = st.io.read_gem(file_path=str(data_path+file),sep='\t',bin_type='bins',bin_size=bins,is_sparse=True)
    #read the gem file as data
    #导出的h5ad文件
    data.tl.raw_checkpoint()
    st.io.stereo_to_anndata(data,flavor='seurat',output=str(data_path+str.split(file,'.')[2]+'.h5ad'))

gz_files = [file for file in os.listdir('/home/xintong/BGI_STO_koutu/5DAP') if file.endswith('.gz')]
data_path='/home/xintong/BGI_STO_koutu/5DAP/'
bins=50
for file in gz_files:
    gem_to_h5ad(data_path,file,bins)

使用R包SeuratDisk 将h5ad文件批量转化为Seurat函数能识别的h5seurat文件 

library(Seurat,lib.loc=
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值