Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Ontologies - statistics biases tools networks and interpretation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stefan Bassler
Ontologies - statistics biases tools networks and interpretation
Commits
3771ca0f
Verified
Commit
3771ca0f
authored
4 years ago
by
Renato Alves
Browse files
Options
Downloads
Patches
Plain Diff
Add solution for day 3
parent
c1caec54
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Day_3/Solutions/Exercise_2_R_code_2020.R
+74
-0
74 additions, 0 deletions
Day_3/Solutions/Exercise_2_R_code_2020.R
with
74 additions
and
0 deletions
Day_3/Solutions/Exercise_2_R_code_2020.R
0 → 100644
+
74
−
0
View file @
3771ca0f
#---------------------------------------------------------------------------------------
# Exercise 2
#---------------------------------------------------------------------------------------
# Given a list of hits and a background in folder /Exercise 2
# background.txt and id_list.txt
# perform enrichment analysis against
# 1. Gene Ontology,
# 2. Kegg modules, and
# 3. DisGeNet (diseases)
# For each result produce a cnetplot and an upsetplot.
# - you will need to provide the correct id's for the functions to execute - use converters
# - vary the p-value q-value thresholds in case of an empty result
# - make the disgenet output readable (gene names, not entrez id's)
background
<-
read.csv
(
"/Users/rogon/Work/01. Teaching/CBNA Courses/2020 Online Course Series/2020 CBNA-DeNBI Enrichment course - my materials/Part 2 - R-code session ClusterProfiler, ReactomePA, pathfindR/Exercise 2 (custom background)/Background.txt"
,
sep
=
""
)
id_list
<-
read.delim
(
"/Users/rogon/Work/01. Teaching/CBNA Courses/2020 Online Course Series/2020 CBNA-DeNBI Enrichment course - my materials/Part 2 - R-code session ClusterProfiler, ReactomePA, pathfindR/Exercise 2 (custom background)/id_list.txt"
)
keytypes
(
org.Hs.eg.db
)
entrez_map
<-
bitr
(
background
$
GeneID
,
fromType
=
"SYMBOL"
,
toType
=
"ENTREZID"
,
OrgDb
=
"org.Hs.eg.db"
,
drop
=
FALSE
)
# or biomart:
# you will need to convert identifiers - for that purpose I suggest using the biomaRt package in R, alternatively you can use the website itselt
# ensembl biomart http://www.ensembl.org/biomart/martview/
library
(
"biomaRt"
)
ensembl
=
biomaRt
::
useMart
(
"ensembl"
)
ensembl
=
useDataset
(
"hsapiens_gene_ensembl"
,
mart
=
ensembl
)
datasets_biomart
<-
listDatasets
(
ensembl
)
attributes_biomart
<-
listAttributes
(
ensembl
)
id_list_biomart
=
getBM
(
attributes
=
c
(
"hgnc_symbol"
,
"entrezgene_id"
,
"ensembl_gene_id"
),
filters
=
c
(
filters
=
"entrezgene_id"
),
values
=
id_list
$
EntrezGene.ID
,
mart
=
ensembl
)
background_biomart
=
getBM
(
attributes
=
c
(
"hgnc_symbol"
,
"entrezgene_id"
,
"ensembl_gene_id"
),
filters
=
c
(
filters
=
"hgnc_symbol"
),
values
=
background
$
GeneID
,
mart
=
ensembl
)
# part 1
id_list_go
<-
enrichGO
(
gene
=
id_list_biomart
$
entrezgene_id
,
'org.Hs.eg.db'
,
pvalueCutoff
=
0.05
,
pAdjustMethod
=
"BH"
,
universe
=
names
(
background_biomart
$
entrezgene_id
),
minGSSize
=
5
,
maxGSSize
=
500
,
qvalueCutoff
=
0.05
,
readable
=
TRUE
)
head
(
id_list_go
)
cnetplot
(
id_list_go
)
upsetplot
(
id_list_go
)
# part 2
id_list_mkegg
<-
enrichMKEGG
(
gene
=
id_list_biomart
$
entrezgene_id
,
pvalueCutoff
=
0.1
,
pAdjustMethod
=
"BH"
,
universe
=
names
(
background_biomart
$
entrezgene_id
),
minGSSize
=
5
,
maxGSSize
=
500
,
qvalueCutoff
=
0.1
)
head
(
id_list_mkegg
)
cnetplot
(
id_list_mkegg
)
upsetplot
(
id_list_mkegg
)
# part 3
id_list_dgn
<-
enrichDGN
(
gene
=
id_list_biomart
$
entrezgene_id
,
pvalueCutoff
=
0.05
,
pAdjustMethod
=
"BH"
,
universe
=
names
(
background_biomart
$
entrezgene_id
),
minGSSize
=
5
,
maxGSSize
=
500
,
qvalueCutoff
=
0.05
,
readable
=
TRUE
)
head
(
id_list_dgn
)
cnetplot
(
id_list_dgn
)
upsetplot
(
id_list_dgn
)
# GO without background
id_list_go_noBckg
<-
enrichGO
(
gene
=
id_list_biomart
$
entrezgene_id
,
'org.Hs.eg.db'
,
pvalueCutoff
=
0.05
,
pAdjustMethod
=
"BH"
,
minGSSize
=
5
,
maxGSSize
=
500
,
qvalueCutoff
=
0.05
,
readable
=
TRUE
)
head
(
id_list_go_noBckg
)
cnetplot
(
id_list_go_noBckg
)
upsetplot
(
id_list_go_noBckg
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment