Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
David Hoksza
bh19-rare-diseases
Commits
4b0d1ac6
Commit
4b0d1ac6
authored
Dec 10, 2019
by
Marek Ostaszewski
Browse files
Correction for the case of enpty enrichment results.
parent
fc0d38d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
enrichment/enrich_maps.R
View file @
4b0d1ac6
...
...
@@ -112,14 +112,18 @@ library(enrichR)
message
(
"Enrichment of pathways"
)
### Header of the enrichment table, it's consecutive segments will be written
### later below
cat
(
file
=
"enriched_pathways.txt"
,
"pathway_db\tTerm\tAdjusted.P.value\n"
,
append
=
F
)
pathway_dbs
<-
config
[
config
$
type
==
"pathway_db"
,
"resource"
]
### Run Enrichr
enriched_pathways
<-
enrichr
(
input
,
databases
=
pathway_dbs
)
### Leave only the pathways with adjusted p lower than 0.1
adj_pathways
<-
lapply
(
enriched_pathways
,
function
(
x
)
{
selected
<-
which
(
x
$
Adjusted.P.value
<
0.1
)
...
...
@@ -129,8 +133,12 @@ adj_pathways <- lapply(enriched_pathways,
x
[
selected
,
]
})
for
(
aep
in
1
:
length
(
adj_pathways
))
{
write.table
(
cbind
(
pathway_db
=
pathway_dbs
[
aep
],
### Clean empty results
adj_pathways
<-
adj_pathways
[
sapply
(
adj_pathways
,
dim
)[
1
,]
>
0
]
### Write results down in the file
for
(
aep
in
names
(
adj_pathways
))
{
write.table
(
cbind
(
pathway_db
=
aep
,
adj_pathways
[[
aep
]][,
c
(
"Term"
,
"Adjusted.P.value"
)],
stringsAsFactors
=
F
),
file
=
"enriched_pathways.txt"
,
sep
=
"\t"
,
quote
=
F
,
col.names
=
F
,
row.names
=
F
,
append
=
T
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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