点击下载data
df <- read.csv("expr_mRNA_group.csv",row.names = 1) boxplot(log2(gene)~group,data=df,col=c("green","red")) ## 计算p wilcoxTest <- wilcox.test(gene~group,data=df) pValue <- wilcoxTest$p.value conGeneMeans <- mean( subset(df,group=="Normal")$gene) treatGeneMeans <- mean( subset(df,group=="Tumor")$gene) ## 计算logFC logFC <- log2(treatGeneMeans/conGeneMeans)
图片alt
使用wilcox.test进行统计检验时应该使用那种表达量, FPKM还是count?
kruskal.test(expr$YTHDC1~expr$stage) kruskal.test(YTHDC1~stage,data=expr) #boxplot(YTHDC1~stage,data=expr) library(ggplot2) library(ggpubr) compare_means(YTHDC1 ~ stage, data = expr,method = "kruskal.test") my_comparisons <- list( c("Stage I", "Stage II"),c("Stage I", "Stage III"),c("Stage I", "Stage IV")) expr %>% ggplot(aes(x=stage,y=YTHDC1))+ stat_boxplot(geom="errorbar",width=0.15,aes(color=stage))+ geom_boxplot(aes(fill=stage),outlier.colour = NA)+ ylim(5, 8)+ stat_compare_means(comparisons = my_comparisons)+ stat_compare_means(method = "kruskal.test",label = "p.format")
详细的逻辑回归原理
y <- ifelse(expr$YTHDC1>median(expr$YTHDC1),1,0) logistic <- glm(y~expr$stage,family = binomial(link="logit")) conf <- confint(logistic,level = 0.95) summ <- summary(logistic) cbind(OR=exp(summ$coefficients[,1]), OR.95L=exp(conf[,1]), OR.95H=exp(conf[,2]), p=summ$coefficients[,4])