你好,想问下你是把数据上传到网站分析的么,我现在无法上传文件,没任何反应。还是用R包分析的,这样的话想求包
我用了例子数据和例子模板输出正常的箱式图,但是现在用我自己的数据就不行,出现下列错误,如下:
library(ggpubr)
>
> pFilter=0.05
> setwd("C:\\Users\\haowenjun\\Desktop\\19.CIBERSORTcor") #设置工作目录
> rt=read.table("CIBERSORT-Results.txt",sep="\t",header=T,row.names=1,check.names=F) #读取文件
> data=rt[rt[,"P-value"]<0.05,]
> data=data[,1:(ncol(rt)-3)]
>
> Type=read.table("cluster.Immunity.txt",sep="\t",check.names=F,row.names=1,header=F)
> Type=Type[row.names(data),]
> colnames(Type)=c("cluster","Subtype")
>
> outTab=data.frame()
> data=cbind(data,Type)
> for(i in colnames(data[,1:(ncol(data)-2)])){
+ rt1=data[,c(i,"Subtype")]
+ colnames(rt1)=c("expression","Subtype")
+ ksTest<-kruskal.test(expression ~ Subtype, data = rt1)
+ pValue=ksTest$p.value
+ if(pValue<pFilter){
+ outTab=rbind(outTab,cbind(rt1,gene=i))
+ print(pValue)
+ }
+ }
Error in if (pValue < pFilter) { : 需要TRUE/FALSE值的地方不可以用缺少值
> write.table(outTab,file="data.txt",sep="\t",row.names=F,quote=F)
>
> #绘制箱型图
> data=read.table("data.txt",sep="\t",header=T,check.names=F) #读取箱线图输入文件
Error in read.table("data.txt", sep = "\t", header = T, check.names = F) :
输入中没有多出的行
> data$Subtype=factor(data$Subtype, levels=c("Immunity_L","Immunity_M","Immunity_H"))
> p=ggboxplot(data, x="gene", y="expression", color = "Subtype",
+ ylab="Fraction",
+ xlab="",
+ palette = c("green","blue","red") )
Error in `[.data.frame`(data, , x) : undefined columns selected
> p=p+rotate_x_text(45)
> pdf(file="boxplot.pdf",width=7.5,height=5.5) #输出图片文件
> p+stat_compare_means(aes(group=Subtype),symnum.args=list(cutpoints = c(0, 0.001, 0.01, 0.05, 1), symbols = c("***", "**", "*", "ns")),label = "p.signif")
> dev.off()
null device
1