-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path因子重命名与boxplot
32 lines (27 loc) · 986 Bytes
/
因子重命名与boxplot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
library(tidyverse)
setwd('D:\\prrc\\TCGA\\GDC\\mutation\\lnc\\survival')
# 批量改变字符型至factor因子
for (i in c(3:10)){
rt[,i] <- as.factor(rt[,i])
}
rt1<-select(rt,c(1:10,`FGF14-AS2`,LINC01082,LINC02041))
library(forcats) #l因子排序
library(ggplot2)
fct_relevel(rt1$gleason_scoregroup)
rt1$gleason_scoregroup<-fct_relevel(rt1$gleason_scoregroup, "low-gsc", "med-gsc")
rt1$psa_group<-fct_relevel(rt1$psa_group, "low-psa", "med-psa")
pdf("vioplot1.pdf",height=6,width=9) #保存图片的文件名称
par(las=1,mar=c(3,3,3,3))
#par(mfrow=c(2,3))
plot(x,y,
ylim=c(min(rt1$`FGF14-AS2`),max(rt1$`FGF14-AS2`)*1.1),
main="the association FGF14-AS2 and clinical features",ylab="Gene expression",
pch=10,
cex.lab=2.0,
col="white",
xaxt="n")
#dev.off()
#对每个m6A相关基因循环,绘制vioplot,正常用蓝色表示,肿瘤用红色表示
for(i in 1:7){
vioplot(rt1$`FGF14-AS2`~rt1[,i],col = c('blue','red'))
}