看小果演示CIBETSORT、xcell两种常用的R语言包

肿瘤免疫微环境在肿瘤的反生、发展、转移及预后过程中发挥着重要的作用,我们研究肿瘤免疫微环境是在分析肿瘤组织免疫细胞的种类及构成比例。其研究方法分为实测法和推测法两类。其中推测法通过表达谱推测免疫细胞的构成,是肿瘤免疫微环境研究的重要方法,CIBETSORT、xcell是常用的两种R语言包,小果下面就开始演示下这两个包。
1 CIBETSORT
rm(list=ls());gc();setwd("D:/rstudy/")source('CIBERSORT.R')LM22<-read.csv("LM22.CSV",header=T,check.names=F)write.table(LM22,"LM22.txt",sep = "t",row.names = Tresult <- CIBERSORT('LM22.txt',"express.txt", perm = 100, QN = TRUE)write.table(result, file="cibersort.csv", sep=",", row.names=T, quote=F)
2 xcell
rm(list = ls())options( repos<- c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/"))options("BioC_mirror"<- "https://mirrors.ustc.edu.cn/bioc/")options(stringsAsFactors = F)Sys.setlocale("LC_ALL","English")devtools::install_github('dviraran/xCell')library(xCell)express<-fread("express.CSV")express<-as.data.frame(express)rownames(express)<-express[,1]express<-express[,-1]class(express)colname<-colnames(express)#保存行名rowname<-rownames(express)#保存列名express<-as.data.frame(lapply(express,as.numeric))#数据框转换为数值型colnames(express)<-colnamerownames(express)<-rownameres<-xCellAnalysis(express)res<-t(res)write.table(res,"xcell.CSV",sep = ",",row.names = T)
推荐阅读
扫码关注我们

shengxinguoer
生信果
生信硬核知识解答
和小果一起学生信