This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
x <- read.csv("n-c.csv")
head(x)
## X gene_id Symbol logFC logCPM F PValue
## 1 12322 ENSG00000167716 WDR81 -0.5983161 4.312923 79.92917 9.88e-13
## 2 502 ENSG00000032444 PNPLA6 -0.5028262 6.102135 70.86831 7.78e-12
## 3 8206 ENSG00000141456 PELP1 -0.5030230 5.227286 58.92551 1.49e-10
## 4 2253 ENSG00000100241 SBF1 -0.5080147 7.880080 57.34979 2.25e-10
## 5 8275 ENSG00000141959 PFKL -0.3409586 6.891222 55.87729 3.33e-10
## 6 11559 ENSG00000164713 BRI3 -0.4508838 3.508642 55.33628 3.85e-10
## FDR label X.LogadjPValue expression
## 1 1.96e-08 7.707489 NA
## 2 7.73e-08 7.112038 NA
## 3 9.88e-07 6.005412 NA
## 4 1.12e-06 5.951412 NA
## 5 1.27e-06 5.895254 NA
## 6 1.27e-06 5.895254 NA
x$expression = ifelse(x$FDR < 0.05 & abs(x$logFC) >= 1,
ifelse(x$logFC> 1 ,'Up','Down'),
'Stable')
You can also embed plots, for example:
library(ggplot2)
p <- ggplot(data = x,
aes(x = logFC,
y = -log10(x$FDR),
colour=expression,
label = x$label)) +
geom_point(alpha=0.4, size=3.5) +
scale_color_manual(values=c("blue", "grey","red"))+
xlim(c(-4.5, 4.5)) +
geom_vline(xintercept=c(-1,1),lty=4,col="black",lwd=0.8) +
geom_hline(yintercept = 1.301,lty=4,col="black",lwd=0.8) +
labs(x="log2(fold change)",
y="-log10 (adj.p-value)",
title="Differential expression") +
theme_bw()+
theme(plot.title = element_text(hjust = 0.5),
legend.position="right",
legend.title = element_blank())
p
library(plotly)
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
ggplotly(p)