library("Startrac")
library("scPip")
library("sscVis")
library("data.table")
library("plyr")
library("R.utils")
library("ggpubr")
library("ggplot2")
source("./func.R")
###### a few genes (fig. S14A)
{
p <- ssc.plot.tsne(sce.Path,gene=c("CXCL13","IL7R","GZMK","ZNF683"),
reduced.name="recal.harmony.umap",
vector.friendly=T,clamp=c(-0.5,1.5),
p.ncol=4,
fun.extra=function(p){
p + theme_bw(base_size=12) +
theme(axis.text=element_text(size=12),
plot.title = element_text(hjust=0.5)) +
labs(x="UMAP1",y="UMAP2") +
coord_fixed(ratio=1, xlim = c(-10, 10), ylim = c(-10, 10), expand = FALSE)
},
theme.use=theme_void,size=0.55,
par.geneOnTSNE=list(scales="fixed",
pt.order="random",pt.alpha = 0.5))
##ggsave(sprintf("%s.geneExample.CD8.vecFri.pdf",out.prefix), width=6.5,height=4.5,useDingbats=FALSE)
##ggsave(sprintf("%s.geneExample.CD8.vecFri.test.pdf",out.prefix), width=10,height=8,useDingbats=FALSE)
ggsave(sprintf("%s.geneExample.CD8.vecFri.pdf",out.prefix), width=15,height=3.5,useDingbats=FALSE)
p <- ssc.plot.tsne(sce.Path,gene=c("IL7R","GZMK","ZNF683","CXCL13"),
reduced.name="recal.harmony.umap",
vector.friendly=T,clamp=c(-0.5,1.5),
p.ncol=2,
fun.extra=function(p){
p + theme_bw(base_size=12) +
theme(axis.text=element_text(size=12),
plot.title = element_text(hjust=0.5)) +
labs(x="UMAP1",y="UMAP2") +
coord_fixed(ratio=1, xlim = c(-10, 10), ylim = c(-6, 6), expand = FALSE)
},
theme.use=theme_void,size=0.55,
par.geneOnTSNE=list(scales="fixed",
pt.order="random",pt.alpha = 0.5))
##ggsave(sprintf("%s.geneExample.CD8.vecFri.pdf",out.prefix), width=6.5,height=4.5,useDingbats=FALSE)
##ggsave(sprintf("%s.geneExample.CD8.vecFri.test.pdf",out.prefix), width=10,height=8,useDingbats=FALSE)
ggsave(sprintf("%s.geneExample.CD8.vecFri.v2.pdf",out.prefix), width=6.5,height=4,useDingbats=FALSE)
p <- ssc.plot.tsne(sce.Path,gene=c("IL7R","GZMK","ZNF683","CXCL13"),
reduced.name="recal.harmony.umap",
vector.friendly=T,clamp=c(-0.5,1.5),
p.ncol=2,
fun.extra=function(p){
p + theme_void(base_size=12) +
theme(
#axis.text=element_text(size=12),
axis.text=element_blank(),
plot.title = element_text(hjust=0.5)) +
labs(x="UMAP1",y="UMAP2") +
coord_fixed(ratio=1, xlim = c(-10, 10), ylim = c(-6, 6), expand = FALSE)
},
theme.use=theme_void,size=0.55,
par.geneOnTSNE=list(scales="fixed",
pt.order="random",pt.alpha = 0.5))
##ggsave(sprintf("%s.geneExample.CD8.vecFri.pdf",out.prefix), width=6.5,height=4.5,useDingbats=FALSE)
##ggsave(sprintf("%s.geneExample.CD8.vecFri.test.pdf",out.prefix), width=10,height=8,useDingbats=FALSE)
ggsave(sprintf("%s.geneExample.CD8.vecFri.v3.pdf",out.prefix), width=6.5,height=4,useDingbats=FALSE)
}
}
SCI论文复现-UMAP图
最新推荐文章于 2024-06-12 15:49:03 发布
该段代码使用R语言的多个库,如`Startrac`、`scPip`等,进行单细胞数据分析并绘制tsne散点图。主要展示了`CXCL13`、`IL7R`、`GZMK`和`ZNF683`基因在UMAP坐标系中的表达分布,通过调整图形主题、坐标轴范围和点的排列,生成了不同版本的散点图文件。
摘要由CSDN通过智能技术生成