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))

相关推荐
我来整一篇25 分钟前
[油猴脚本] 微软必应奖励每日任务脚本
1024程序员节
金融小师妹1 小时前
AI视角下黄金避风港属性的量化验证:基于2000-2025年历史数据的时序分析
大数据·人工智能·深度学习·1024程序员节
君以思为故2 小时前
认识linux -- 进程控制
linux·运维·1024程序员节
CoderYanger5 小时前
递归、搜索与回溯-记忆化搜索:40.矩阵中的最长递增路径
java·线性代数·算法·leetcode·矩阵·1024程序员节
xcLeigh6 小时前
KingbaseES数据库:首个多院区异构多活容灾架构,浙人医创新开新篇
国产数据库·1024程序员节·kingbasees·金仓数据库
熊文豪6 小时前
首个多院区异构多活容灾架构,浙人医创新开新篇
1024程序员节·kingbase·电科金仓
tg-zm88999615 小时前
2025返利商城源码/挂机自动收益可二开多语言/自定义返利比例/三级分销理财商城
java·mysql·php·laravel·1024程序员节
CoderYanger19 小时前
递归、搜索与回溯-综合练习:19.目标和
java·算法·leetcode·1024程序员节
CoderYanger1 天前
递归、搜索与回溯-综合练习:27.黄金矿工
java·算法·leetcode·深度优先·1024程序员节
CoderYanger1 天前
递归、搜索与回溯-穷举vs暴搜vs深搜vs回溯vs剪枝:13.子集
java·算法·leetcode·机器学习·剪枝·1024程序员节