Commit 613a1701 authored by Thomas Schwarzl's avatar Thomas Schwarzl
Browse files

merged

Merge branch 'master' of https://git.embl.de/schwarzl/RBPbaseAnalysis2CRIC

# Conflicts:
#	2C-RIC-Analysis.Rmd
#	input/ANNO_STUDIES.Rda
#	input/COMPILED_TABLE.Rda
#	input/ORGANISM_TABLE.Rda
#	input/RIC_STUDIES.Rda
parents 918b8907 7ff3d0c0
......@@ -23,7 +23,13 @@ RBPBASE000000069.1 Sc_Asencio-2C-SRIC-p Sc_2C-SRIC-p
output_dir <- file.path("out")
lookup_dir <- file.path("..", "RBPbaseBackend", "input", "Review")
input_dir <- file.path("input")
script_dir <- file.path("..", "RBPbaseServer", "app")
#background_dir <- file.path("..", "RBPbaseBackend", "background")
#script_dir <- file.path("..", "RBPbase", "app")
##script_dir <- file.path("..", "RBPbaseServer", "app")
#>>>>>>> 7ff3d0c04d966bfb31cc1664d79ec07bd03f559f
```
Create directories
......@@ -50,6 +56,7 @@ suppressPackageStartupMessages({
tidyverse,
eulerr,
seqsetvis,
r6extended,
RVenn,
ggExtra,
Cairo,
......@@ -88,10 +95,13 @@ suppressPackageStartupMessages({
file_table <- file.path(input_dir, "COMPILED_TABLE.Rda")
file_anno <- file.path(input_dir, "ANNO_STUDIES.Rda")
file_studies <- file.path(input_dir, "RIC_STUDIES.Rda")
file_background <- file.path(input_dir, "Sc_Ascencio2019_Background.Rds")
file_short_long_background <- file.path(input_dir, "Sc_Ascencio2020_short_long_Background.Rds")
#file_lookup <- file.path(lookup_dir, "LOOKUP.rda")
if (!file.exists(file_table) | !file.exists(file_anno) | !file.exists(file_studies)) {
stop("You need to clone the RBPbase project")
}
......@@ -101,6 +111,7 @@ load(file_anno)
load(file_studies)
#load(file_lookup)
TRIC_Background <- readRDS(file_background)
TRIC_SHORT_LONG_Background <- readRDS(file_short_long_background)
```
......@@ -119,6 +130,7 @@ mytheme <- theme_minimal() + theme(text = element_text(size=20), axis.text.x =
Ids
```{r}
TRIC <- "RBPBASE000000056.1"
TRIC_2 <- "RBPBASE000000068.1"
sTRIC_2 <- "RBPBASE000000069.1"
......@@ -185,9 +197,9 @@ RA_but_TRAPP <- new_RBPbaseAnalysis(COMPILED_TABLE,
update = TRUE)
```
Custom selection for Sc studies wanted by collaborators
```{r}
# Custom selection for Sc studies wanted by collaborators
anySc_id <- RA$add_annotation(name = "any_Sc",
values =
RA$get_studies_only_table(count_comparison_hits = T,
......@@ -196,8 +208,13 @@ anySc_id <- RA$add_annotation(name = "any_Sc",
main_organism_studies = T) %>%
mutate(property = number_hits_compare > 0) %>%
pull(property) )
```
# Custom selection for Sc studies wanted by collaborators
Custom selection for Sc studies wanted by collaborators
```{r}
>>>>>>> 7ff3d0c04d966bfb31cc1664d79ec07bd03f559f
anyScExpTRAPP_id <- RA$add_annotation(name = "any_Sc",
values =
RA_but_TRAPP$get_studies_only_table(count_comparison_hits = T,
......@@ -206,10 +223,12 @@ anyScExpTRAPP_id <- RA$add_annotation(name = "any_Sc",
main_organism_studies = T) %>%
mutate(property = number_hits_compare > 0) %>%
pull(property) )
```
Custom selection for MM or Hs studies wanted by collaborators
# Custom selection for MM or Hs studies wanted by collaborators
```{r}
anyScMmHs_id <- RA$add_annotation(name = "any_MmHs",
values =
RA$get_studies_only_table(count_comparison_hits = T,
......@@ -223,6 +242,25 @@ anyScMmHs_id <- RA$add_annotation(name = "any_MmHs",
RA$set_anyRIC_id(id = anyScMmHs_id, update = TRUE)
```
Summary of TRIC
```{r}
any_TRIC <- RA$add_annotation(name = "any_TRIC",
values =
RA$get_main_table() %>%
mutate(property = !!sym(TRIC) | !!sym(TRICp)) %>%
pull(property) )
```
Summary of STRIC
```{r}
any_STRIC <- RA$add_annotation(name = "any_STRIC",
values =
RA$get_main_table() %>%
mutate(property = !!sym(TRIC) | !!sym(TRICp) | !!sym(SRICp)) %>%
pull(property) )
```
## Add custom annotations
is RBPBASE000000056.1 Sc_Asencio-2C Sc_2C-TRIC
......@@ -773,20 +811,18 @@ p
```
## Enrichment Analysis
TRIC_Background
TRIC_SHORT_LONG_Background
### Define Inputs
Helpfer function to retrieve IDs
```{r}
get_ids = function(x, colfilter, type = "Ensembl") {
get_ids = function(x, colfilter) {
id = "ID"
if(type == "Entrez") {
......@@ -809,7 +845,8 @@ background_run1
#### As Ensembl IDs
```{r}
#source("TermEnrichment.R")
#source("../RBPbaseAnalysisMmCelllines/TermEnrichment.R")
EHE <- EnrichmentHandler$new()
EHE$add_comparison_manually("SRIC",
......@@ -858,13 +895,13 @@ EHN$write_comparisons(path = output_dir)
```
### KEGG enrichment
#### Multiple
```{r}
kegg_cluster <- compareCluster(geneCluster = list(
SRIC = EHE$get_comparison("SRIC")$get_foreground(),
TRIC2 = EHE$get_comparison("TRIC2")$get_foreground(),
TRIC = EHE$get_comparison("TRIC")$get_foreground()),
......@@ -874,7 +911,9 @@ kegg_cluster <- compareCluster(geneCluster = list(
fun = "enrichKEGG")
p <- dotplot(kegg_cluster)
ggsave(p, filename = file.path(output_dir, "enrich_all_kegg_comparison.pdf"))
ggsave(p,
filename = file.path(output_dir,
"enrich_all_kegg_comparison.pdf"))
```
#### Individual
......@@ -882,6 +921,7 @@ kegg_cluster <- compareCluster(geneCluster = list(
Perform enrichment for all comparisons
```{r}
for (i in EHE$get_comparison_names()) {
RK <- KEGGClusterProfilerEnrichment$new(organism = "sce")
RK$set_input(EHE$get_comparison(i))
......@@ -934,9 +974,6 @@ for (i in EHN$get_comparison_names()) {
#RE$plot_enrichment() # TODO TO IMPLEMENT
#RE$save_enrichment(path = output_dir) # TODO TO IMPLEMENT
}
#RE <- ReactomePAEnrichment$new(organism = "mouse")
#RE$set_input(EHN$get_comparison(i))
```
### GO enrichment
......@@ -948,6 +985,7 @@ for (gotype in c("BP", "CC", "MF")) {
for (i in EHE$get_comparison_names()) {
RO <- GOProfilerEnrichment$new(org_db = org.Sc.sgd.db::org.Sc.sgd.db,
ont = gotype,
#key_type = "GENENAME",
readable = FALSE)
RO$set_input(EHE$get_comparison(i))
RO$run_enrichment()
......@@ -955,7 +993,6 @@ for (gotype in c("BP", "CC", "MF")) {
}
}
#RO$save_enrichment(path = output_dir)
#
#
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment