Ken Furudate
library(reshape2)
library(ggplot2)
in_f1 = "Cibersortx.txt"
set.seed(42)
data <- read.table(in_f1, header=TRUE, row.names=1, sep="\t", quote="", stringsAsFactors = FALSE)
data
data.melt <- reshape2::melt(data,
id.vars="LNM",
value.name="Relative_fraction",
na.rm=TRUE,
stringsAsFactors = FALSE
)
data.melt$LNM <- as.character(data.melt$LNM)
head(data.melt)
anot_cols <- c("#0977a9", "#ab162c")
select.col_names <- c("OSCC cell", "CAF", "T.cell")
for (i in 1:length(select.col_names)){
col_ <- select.col_names[i]
print(col_)
mat_ <- data.melt[data.melt$variable==col_,]
ggplot()+theme_set(theme_classic(base_size = 30, base_family = "Arial"))
p <- ggplot(mat_,
aes(x=LNM,
y=Relative_fraction),
fill=LNM
) +
stat_boxplot(geom = "errorbar",
width = 0.2
) +
geom_boxplot(aes(fill=LNM),
outlier.colour=NA, alpha=1.0
) +
geom_jitter(aes(col=LNM),
position=position_jitter(0.2),
shape=16,
alpha=0.9,
color="Black"
) +
labs(x=col_, y="Relative fraction") +
scale_fill_manual(values=anot_cols) +
scale_colour_manual(values=anot_cols) +
scale_x_discrete(limits=c("0", "1"),
labels=c("LNM(-)", "LNM(+)")
)
print(p)
res_ = wilcox.test(mat_$Relative_fraction~mat_$LNM,
alternative = "two.sided",
paired=F,
conf.int=T,
conf.level=0.95,
exact=F
)
print(res_)
}