Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

immune checkpoint expression.r #18

Open
w28924461701 opened this issue Jul 27, 2022 · 0 comments
Open

immune checkpoint expression.r #18

w28924461701 opened this issue Jul 27, 2022 · 0 comments

Comments

@w28924461701
Copy link
Owner

library(tidyverse)
library(gapminder)
library(ggsci)
library(ggprism)
library(rstatix)
library(ggpubr)

data=cbind(dataLow,dataHigh)
data=data[rowMeans(data)>1,]
conNum=ncol(dataLow)
treatNum=ncol(dataHigh)
Type=c(rep('low-risk',conNum), rep('high-risk',treatNum))
View(data)
data<-t(data)
data<-as.data.frame(data)
data$Type<-Type

library(reshape2)
short2long = melt(data2, id=c("Type"),
variable.name= 'genes', value.name = 'value')

short2long$Type<-as.factor(short2long$Type)

ggplot(short2long,aes(x=genes,y=value,fill=Type))+
geom_boxplot(width=0.9)+
geom_jitter(position=position_jitter(0.05))+
theme_classic()+
theme(legend.position="top",axis.text.x = element_text(size=10))+
ylim(0,15)+
labs(title="immune checkpoint",y = "immune checkpoint expression value")

df_p_val1 <- short2long %>% group_by(genes) %>%
wilcox_test(value ~ Type) %>%
adjust_pvalue(p.col = "p", method = "bonferroni") %>%
add_significance(p.col = "p.adj") %>%
add_xy_position(x = "genes", dodge = 0.8)

p1<-ggplot(short2long,aes(x=genes,y=value,fill=Type))+
stat_boxplot(geom="errorbar",position=position_dodge(width=0.2),width=0.8)+
geom_boxplot(position=position_dodge(width =1.0),width=0.6)+
geom_line(aes(group=genes),position = position_dodge(0.2),color="red") +
geom_point(aes(fill=genes,group=Type,alpha=value),pch=21,
position = position_dodge(0.2))+
theme_classic()+
ylim(0,8)+theme(legend.position="top",axis.text.x = element_text(size=10))+
labs(title="immune checkpoint",y = "immune checkpoint expression gene value")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant