当前位置:网站首页>"Tips" to slim down Seurat objects
"Tips" to slim down Seurat objects
2022-07-04 13:09:00 【Xu zhougeng】
We are using Seurat When processing single cell data , Will find Seurat The object keeps getting bigger , Carelessly, it becomes a bottomless hole in memory ,
For example, one of mine Seurat Objects occupy 22.3 Of memory space
old_size <- object.size(seu.obj)
format(old_size, units="Gb")
# 22.3 Gb
If I need to shut down halfway Rstudio, So in order to ensure their work continuity , I need to put the in memory 20 many G The data of is saved to disk , And the memory will be loaded in the next analysis . This time , Considering the read and write speed of the disk , Time consuming may require 10 More minutes .
Considering that you may have to upload the data to the online disk or GEO database , So this 20 many G The time required for data , It's even more beyond your imagination .
Is there any way to Seurat Object slimming ? It's very simple , because Seurat Mainly in the Scale This step , Turn the original sparse matrix into an ordinary matrix , At the same time, the elements inside are floating-point , It takes up a lot of space . As long as we clear the normalized matrix before saving the data , You can make Seurat Lose weight all at once .
[email protected][email protected] <- matrix()
new_size <- object.size(seu.obj)
format(new_size, units="Gb")
# 5Gb
Operation above , Reduce the memory occupation to only the original 20% about . however , The problem is coming. , What is the cost of memory reduction ? The price is , You need to... The loaded data scale, Restore Seurat Medium scale.data.
all.genes <- rownames(seu.obj)
seu.obj <- ScaleData(seu.obj, features = all.genes)
This is a common idea in Computer Science , Or space for time , Or time for space .
This trick can speed up Seurat Save, read and write objects , Are there any other applications ? because scale The latter data is mainly for principal component analysis (PCA) Provide input . Subsequent nonlinear dimensionality reduction (UMAP), Clustering analysis (Cluster) It's all based on PCA, Not based on scale data , therefore , If the memory space is surprised during the analysis , You can also use this trick to free up memory space . After running some operations that occupy memory , Then restore it .
边栏推荐
- Excuse me, have you encountered this situation? CDC 1.4 cannot use timestamp when connecting to MySQL 5.7
- 二分查找的简单理解
- I want to talk about yesterday
- Vit (vision transformer) principle and code elaboration
- jsonp
- Peak detection of measured signal
- Paper notes ACL 2020 improving event detection via open domain trigger knowledge
- ArgMiner:一个用于对论点挖掘数据集进行处理、增强、训练和推理的 PyTorch 的包
- R language -- readr package reads and writes data
- 用fail2ban阻止密码尝试攻
猜你喜欢
一文掌握数仓中auto analyze的使用
实时云交互如何助力教育行业发展
golang 设置goproxy代理的小细节,适用于go module下载超时,阿里云镜像go module下载超时
Transformer principle and code elaboration (pytorch)
Etcd storage, watch and expiration mechanism
Talk about the design and implementation logic of payment process
runc hang 导致 Kubernetes 节点 NotReady
16.内存使用与分段
VIM, another program may be editing the same file If this is the solution of the case
Concepts and theories related to distributed transactions
随机推荐
DGraph: 大规模动态图数据集
Comprehensive evaluation of modular note taking software: craft, notation, flowus
诸神黄昏时代的对比学习
golang 设置goproxy代理的小细节,适用于go module下载超时,阿里云镜像go module下载超时
游戏启动后提示安装HMS Core,点击取消,未再次提示安装HMS Core(初始化失败返回907135003)
Backgroundworker usage example
R language -- readr package reads and writes data
Concepts and theories related to distributed transactions
2022年中国移动阅读市场年度综合分析
ArgMiner:一个用于对论点挖掘数据集进行处理、增强、训练和推理的 PyTorch 的包
使用 NSProxy 实现消息转发
Argminer: a pytorch package for processing, enhancing, training, and reasoning argument mining datasets
runc hang 导致 Kubernetes 节点 NotReady
二分查找的简单理解
AI 绘画极简教程
Jetson TX2 configures common libraries such as tensorflow and pytoch
Apache服务器访问日志access.log设置
ISO 27001 Information Security Management System Certification
高效!用虚拟用户搭建FTP工作环境
AbstractDispatcherServletInitializer 的实现类为什么可以在初始化Web容器的时候被调用