ilr normalize isometric log-ratio transformation

visium_heart/st_snRNAseq/05_colocalization/create_niches_ct.R at 5b30c7e497e06688a8448afd8d069d2fa70ebcd2 · saezlab/visium_heart (github.com) 更多内容,关注微信:生信小博士

The ILR (Isometric Log-Ratio) transformation is used in the analysis ofcompositional data. Any given observation is a set of positive values summing to unity, such as the proportions of chemicals in a mixture or proportions of total time spent in various activities. The sum-to-unity invariant implies that although there may be k≥2�≥2 components to each observation, there are only k−1�−1 functionally independent values. (Geometrically, the observations lie on a k−1�−1-dimensional simplex in k�-dimensional Euclidean space Rk��. This simplicial nature is manifest in the triangular shapes of the scatterplots of simulated data shown below.)

Typically, the distributions of the components become "nicer" when log transformed. This transformation can be scaled by dividing all values in an observation by their geometric mean before taking the logs.

ilr数据输入要求:

cpp 复制代码
 
  baseILR <- ilrBase(x = integrated_compositions,
                     method = "basic")
  head(  baseILR)
  cell_ilr <- as.matrix(ilr(integrated_compositions, baseILR))
  colnames(cell_ilr) <- paste0("ILR_", 1:ncol(cell_ilr))
  
  print(head(cell_ilr)[,1:9])
  

umap图

cpp 复制代码
comp_umap <- umap(cell_ilr, 
                  n_neighbors = 30, n_epochs = 1000) %>%
  as.data.frame() %>%
  mutate(row_id = rownames(cell_ilr))

head(atlas_meta)

comp_umap %>%
  left_join(atlas_meta, by = c("row_id")) %>%
  ggplot(aes(x = V1, y = V2, 
             color = opt_clust_integrated)) +
  ggrastr::geom_point_rast(size = 0.3) +
  theme_classic() +
  xlab("UMAP1") +
  ylab("UMAP2")+

  theme(legend.text = element_text(size = 14))

comp_umap %>%

left_join(atlas_meta, by = c("row_id")) %>%

ggplot(aes(x = V1, y = V2,

color = orig.ident)) +

ggrastr::geom_point_rast(size = 0.3) +

theme_classic() +

xlab("UMAP1") +

ylab("UMAP2")+

theme(legend.text = element_text(size = 14))

相关推荐
✿ ༺ ོIT技术༻6 天前
Linux:TCP和守护进程
linux·运维·服务器·网络·tcp/ip·1024程序员节
辅助东皇燕双鹰10 天前
行测知识()
1024程序员节
深蓝易网13 天前
探寻制造型企业MES管理系统:功能、架构与应用全解析
大数据·运维·人工智能·架构·制造·1024程序员节
Lenyiin18 天前
2848、与车相交的点
c++·算法·leetcode·1024程序员节
earthzhang202124 天前
《深入浅出HTTPS》读书笔记(31):HTTPS和TLS/SSL
开发语言·网络·python·https·1024程序员节
不讲废话的小白1 个月前
怎么样把pdf转成图片模式(不能复制文字)
pdf·1024程序员节
明明真系叻1 个月前
2025.1.26机器学习笔记:C-RNN-GAN文献阅读
人工智能·笔记·深度学习·机器学习·生成对抗网络·1024程序员节
Joeysoda1 个月前
Java数据结构 (从0构建链表(LinkedList))
java·linux·开发语言·数据结构·windows·链表·1024程序员节
清风-云烟1 个月前
使用redis-cli命令实现redis crud操作
java·linux·数据库·redis·spring·缓存·1024程序员节
Joeysoda1 个月前
Java数据结构 (链表反转(LinkedList----Leetcode206))
java·linux·开发语言·数据结构·链表·1024程序员节