Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Safia Saci
rosePigs
Commits
f991238f
Commit
f991238f
authored
Jun 07, 2021
by
Safia Saci
Browse files
Upload New File
parent
2d0253d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
hist_term_GO.R
0 → 100644
View file @
f991238f
library
(
dplyr
)
library
(
ggplot2
)
library
(
forcats
)
# input file
WEGO
<-
read.table
(
"data/pantherdb/go.tsv"
,
header
=
FALSE
,
sep
=
";"
)
colnames
(
WEGO
)
<-
c
(
"ID"
,
"Domain"
,
"factor"
,
"Number of genes"
,
"Percentage of genes"
,
"raw P_value"
,
"FDR"
,
"Description"
)
categories
<-
WEGO
%>%
group_by
(
factor
)
%>%
top_n
(
5
,
`Percentage of genes`
)
%>%
.
$
ID
WEGO2
<-
filter
(
WEGO
,
ID
%in%
categories
)
%>%
arrange
(
factor
,
`Percentage of genes`
)
%>%
mutate
(
Position
=
n
()
:
1
)
normalizer
<-
max
(
WEGO2
$
`Number of genes`
)
/
max
(
WEGO2
$
`Percentage of genes`
)
#plot
p3
<-
ggplot
(
data
=
WEGO2
,
aes
(
x
=
fct_reorder
(
Description
,
Position
),
y
=
-
log10
(
FDR
),
fill
=
factor
))
+
geom_col
()
+
scale_fill_manual
(
values
=
c
(
"indianred1"
,
"indianred4"
,
"deepskyblue1"
,
"deepskyblue4"
))
+
theme
(
axis.text.x
=
element_text
(
hjust
=
1
),
axis.title.y
=
element_text
(
size
=
8
),
legend.text
=
element_text
(
size
=
7
),
legend.title
=
element_text
(
size
=
8
),
legend.key.size
=
unit
(
0.2
,
"in"
),
plot.title
=
element_text
(
size
=
11
,
hjust
=
0.5
),
panel.background
=
element_blank
(),
axis.line
=
element_line
(
colour
=
"grey"
))
+
coord_flip
()
+
labs
(
x
=
NULL
,
title
=
"Gene Ontology (GO) Annotation"
)
ggsave
(
"plots/geneOnto.png"
,
p3
,
height
=
5
,
width
=
8
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment