-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.Rhistory
39 lines (39 loc) · 1.7 KB
/
.Rhistory
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
33
34
35
36
37
38
39
knitr::opts_chunk$set(echo = TRUE)
library(ggplot2)
library(forcats)
install.packages("forcats")
library(ggplot2)
library(forcats)
library(tidyr)
dat<-read.csv("./datafiles/Data.for.sup.fig.3.txt",header = T,sep="\t")
dat<-dat[,1:5]
dat$p1<-dat$gene.peak.targetGO/dat$totalgenetargetGO*100
dat$p2<-dat$gene.peak.notargetgene/dat$totalgenenotargetgene*100
datt<-dat%>%gather(types,new,p1:p2)
datt$legend[datt$types=="p1"]<-"Percentage of genes in TF assigned GO terms with peak in promoter"
datt$legend[datt$types=="p2"]<-"Percentage of genes not in TF assigned GO terms with peak in promoter"
ggplot(datt,aes(x=reorder(data, new, FUN = median),y=new,fill=legend)) +
geom_bar(stat="identity", position=position_dodge()) +
theme(axis.text.x = element_text(angle = 90,vjust = 0.5,hjust = 0.5)) +
xlab("Datasets") +
ylab("Percentage") +
guides(fill=guide_legend(title="")) +
theme(legend.position="top")
knitr::opts_chunk$set(echo = TRUE)
library(ggplot2)
library(forcats)
library(tidyr)
dat<-read.csv("./datafiles/Data.for.sup.fig.1.txt",header = T,sep="\t")
dat<-dat[,1:5]
dat$p1<-dat$gene.peak.targetGO/dat$totalgenetargetGO*100
dat$p2<-dat$gene.peak.notargetgene/dat$totalgenenotargetgene*100
datt<-dat%>%gather(types,new,p1:p2)
datt$legend[datt$types=="p1"]<-"Percentage of genes in TF assigned GO terms with peak in promoter"
datt$legend[datt$types=="p2"]<-"Percentage of genes not in TF assigned GO terms with peak in promoter"
ggplot(datt,aes(x=reorder(data, new, FUN = median),y=new,fill=legend)) +
geom_bar(stat="identity", position=position_dodge()) +
theme(axis.text.x = element_text(angle = 90,vjust = 0.5,hjust = 0.5)) +
xlab("Datasets") +
ylab("Percentage") +
guides(fill=guide_legend(title="")) +
theme(legend.position="top")