武艺晴小朋友你好

武艺晴小朋友你好

愿武艺晴小朋友一定得每天都开心 


当我们测序拿得到各个样本中基因的表达值,就可以用基因表达值来表征样本间的相关性

代码如下:

#样本间相似性:R值 相关性 捕获到的基因在两个样本间表达趋势一致性
exp_RNA <- AverageExpression(fasting_memory,
                             group.by = "Sample",layer = "data")  #CPM值来自data图层
exp_RNA <- as.data.frame(exp_RNA) 
colnames(exp_RNA) <- c("fed","health","memory_10d","memory_35d","memory_66d")
library(ArchR)
library(viridis)
head(exp_RNA)

df<-exp_RNA[,c(1,5)] #依次计算各个组
head(df)

#为了提高数据质量和准确性,使用两组间表达值都非0的基因用于R值的计算
df<-subset.data.frame(df,df$fed!=0) 
df<-subset.data.frame(df,df$memory_66d!=0)

cor(df[,2],df[,1]) 

library(ggrepel)
df$gene <- rownames(df)
df$slope <- df$memory_66d/df$fed #斜率代表在66d组中跟fed组间的表达差别很大
head(df)

label <- subset.data.frame(df,df$slope>1000)
head(label)

ggPoint(x = df$fed,y = df$memory_66d,size=1,
        title = "r=0.41",
        colorDensity = TRUE,
        continuousSet = "solarExtra",
        ylabel = "memory_66d:log2(CPM+1)", 
        xlabel = "fed:log2(CPM+1)",
        xlim = c(0,170),
        ylim = c(0,170))+ mytheme+
  geom_hline(yintercept = 40, lty = "dashed")+ 
  geom_vline(xintercept = 40, lty = "dashed")

#图的样子:

scRNA-data中的R值-LMLPHP

09-07 07:42