Commit fa71a401 authored by Thomas Schwarzl's avatar Thomas Schwarzl
Browse files

only SRIC bug fix

parent 613a1701
---
title: "2C-RIC Analysis"
author: "Thomas Schwarzl"
output: html_document
output: BiocStyle::html_document
---
2C RIC Analysis
......@@ -25,11 +25,6 @@ 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
......@@ -130,13 +125,12 @@ 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"
SRIC_2 <- "RBPBASE000000069.1"
#selected_studies_ids <- c(TRIC, LTRIC, STRIC)
selected_studies_ids <- c(TRIC, TRIC_2, sTRIC_2)
selected_studies_ids <- c(TRIC, TRIC_2, SRIC_2)
```
Define organisms which to compare to
......@@ -211,10 +205,7 @@ anySc_id <- RA$add_annotation(name = "any_Sc",
```
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,
......@@ -248,7 +239,7 @@ Summary of TRIC
any_TRIC <- RA$add_annotation(name = "any_TRIC",
values =
RA$get_main_table() %>%
mutate(property = !!sym(TRIC) | !!sym(TRICp)) %>%
mutate(property = !!sym(TRIC) | !!sym(TRIC_2)) %>%
pull(property) )
```
......@@ -258,7 +249,7 @@ Summary of STRIC
any_STRIC <- RA$add_annotation(name = "any_STRIC",
values =
RA$get_main_table() %>%
mutate(property = !!sym(TRIC) | !!sym(TRICp) | !!sym(SRICp)) %>%
mutate(property = !!sym(TRIC) | !!sym(TRIC_2) | !!sym(SRIC_2)) %>%
pull(property) )
```
......@@ -277,23 +268,21 @@ RBPBASE000000069.1 Sc_Asencio-2C-SRIC-p Sc_2C-SRIC-p
any2C_id <- RA$add_annotation(name = "any_2C",
values =
RA$get_main_table() %>%
mutate(property = RBPBASE000000068.1 |
RBPBASE000000056.1 |
RBPBASE000000069.1
mutate(property = !!sym(TRIC) |
!!sym(TRIC_2) |
!!sym(SRIC_2)
) %>%
pull(property) )
```
### any_2CTRIC
```{r}
anyTRIC_id <- RA$add_annotation(name = "any_2C_TRIC",
values =
RA$get_main_table() %>%
mutate(property = RBPBASE000000068.1 |
RBPBASE000000056.1
mutate(property = !!sym(TRIC_2) |
!!sym(TRIC)
) %>%
pull(property) )
```
......@@ -301,16 +290,7 @@ anyTRIC_id <- RA$add_annotation(name = "any_2C_TRIC",
### only short 2C run2
```{r}
onlySRIC <- RA$add_annotation(name = "only_2C_SRIC",
values =
RA$get_main_table() %>%
mutate(property = RBPBASE000000069.1 &
!RBPBASE000000068.1
) %>%
pull(property) )
```
depricated, just 2C short
### only 2C TRIC run2 compared to 2C SRIC 2 run 2
......@@ -318,8 +298,8 @@ onlySRIC <- RA$add_annotation(name = "only_2C_SRIC",
onlyTRIC2 <- RA$add_annotation(name = "only_2C_TRIC2",
values =
RA$get_main_table() %>%
mutate(property = !RBPBASE000000069.1 &
RBPBASE000000068.1
mutate(property = ! (!!sym(SRIC_2)) &
!!sym(TRIC_2)
) %>%
pull(property) )
```
......@@ -328,13 +308,12 @@ onlyTRIC2 <- RA$add_annotation(name = "only_2C_TRIC2",
### any_2CTRIC2
```{r}
any2C_run2 <- RA$add_annotation(name = "2C_TRIC_SRIC_run2",
values =
RA$get_main_table() %>%
mutate(property = RBPBASE000000068.1 |
RBPBASE000000069.1
mutate(property = !!sym(TRIC_2) |
!!sym(SRIC_2)
) %>%
pull(property) )
```
......@@ -345,7 +324,6 @@ any2C_run2 <- RA$add_annotation(name = "2C_TRIC_SRIC_run2",
### Background 2C TRIC run 1
```{r}
background_run1 <- RA$add_annotation(name = "background_2C_run1",
values =
......@@ -419,15 +397,6 @@ more30_id <- RA$add_annotation(
)
```
## Comparison between the cell line studies
```{r}
# RA$save_venn(selection_ids = RA$selected_studies_ids,
# names = c("Brain", "Kidney", "Liver"),
# file_root = file.path(output_dir, "primary_venn"),
# fill = cbbPalette[c(6,7,3)])
```
## Comparison with other studies
......@@ -642,13 +611,13 @@ RA$save_venn(selection_ids = c(TRIC, any2C_run2, RA$get_anyRIC_id()),
```{r}
RA$save_venn(selection_ids = c(TRIC, TRIC_2, sTRIC_2),
RA$save_venn(selection_ids = c(TRIC, TRIC_2, SRIC_2),
names = c("2C TRIC(1)", "2C TRIC(2)", "2C RIC(2)"),
file_root = file.path(output_dir, "TRIC1_TRIC2_SRIC2"),
fill = cbbPalette[c(6,7,3)])
```
```{r}
RA$save_euler(selection_ids = c(TRIC, TRIC_2, sTRIC_2),
RA$save_euler(selection_ids = c(TRIC, TRIC_2, SRIC_2),
names = c("2C TRIC(1)", "2C TRIC(2)", "2C RIC(2)"),
file_root = file.path(output_dir, "TRIC1_TRIC2_SRIC2_euler"),
fill = cbbPalette[c(6,7,3)])
......@@ -669,7 +638,7 @@ RA$save_venn(selection_ids = c(TRIC, anyScExpTRAPP_id, TRAPP_id),
### Short
```{r}
RA$save_venn(selection_ids = c(TRIC_2, sTRIC_2, TRAPP_id),
RA$save_venn(selection_ids = c(TRIC_2, SRIC_2, TRAPP_id),
names = c("2C TRIC(2)", "2C SRIC(2)", "any TRAPP"),
file_root = file.path(output_dir, "TRIC2_SRIC_TRAPP"),
fill = cbbPalette[c(6,7,3)])
......@@ -677,7 +646,7 @@ RA$save_venn(selection_ids = c(TRIC_2, sTRIC_2, TRAPP_id),
### combined total
```{r}
RA$save_venn(selection_ids = c(anyTRIC_id, sTRIC_2, TRAPP_id),
RA$save_venn(selection_ids = c(anyTRIC_id, SRIC_2, TRAPP_id),
names = c("2C TRIC(1/2)", "2C SRIC(2)", "any TRAPP"),
file_root = file.path(output_dir, "TRIC12_SRIC_TRAPP_venn"),
fill = cbbPalette[c(6,7,3)])
......@@ -685,7 +654,7 @@ RA$save_venn(selection_ids = c(anyTRIC_id, sTRIC_2, TRAPP_id),
```{r}
RA$save_euler(selection_ids = c(anyTRIC_id, sTRIC_2, TRAPP_id),
RA$save_euler(selection_ids = c(anyTRIC_id, SRIC_2, TRAPP_id),
names = c("2C TRIC(1/2)", "2C SRIC(2)", "any TRAPP"),
file_root = file.path(output_dir, "TRIC12_SRIC_TRAPP_euler"),
fill = cbbPalette[c(6,7,3)])
......@@ -701,7 +670,7 @@ RA$save_venn(selection_ids = c(TRIC, anySc_id, RA$get_hasRBD_id()),
```
```{r}
RA$save_venn(selection_ids = c(anyTRIC_id, sTRIC_2, RA$get_hasRBD_id()),
RA$save_venn(selection_ids = c(anyTRIC_id, SRIC_2, RA$get_hasRBD_id()),
names = c("2C-TRIC(1/2)", "2C-STRIC(2)", "RB domain"),
file_root = file.path(output_dir, "2CRIC_RBD_Venn"),
fill = cbbPalette[c(6,7,3)])
......@@ -822,7 +791,7 @@ TRIC_SHORT_LONG_Background
Helpfer function to retrieve IDs
```{r}
get_ids = function(x, colfilter) {
get_ids = function(x, colfilter, type = "Ensembl") {
id = "ID"
if(type == "Entrez") {
......@@ -847,49 +816,80 @@ background_run1
```{r}
#source("../RBPbaseAnalysisMmCelllines/TermEnrichment.R")
background_run1_run2 <- unique(
sort(
c(
get_ids(RA$get_main_table(),
background_run1),
get_ids(RA$get_main_table(),
background_run2)
)
)
)
EHE <- EnrichmentHandler$new()
EHE$add_comparison_manually("SRIC",
get_ids(RA$get_main_table(), sTRIC_2),
get_ids(RA$get_main_table(), SRIC_2),
get_ids(RA$get_main_table(), background_run2))
EHE$add_comparison_manually("TRIC2",
get_ids(RA$get_main_table(), TRIC_2),
get_ids(RA$get_main_table(), background_run2))
background_run1_run2)
EHE$add_comparison_manually("TRIC",
get_ids(RA$get_main_table(), TRIC),
get_ids(RA$get_main_table(), background_run1))
background_run1_run2)
EHE$add_comparison_manually("onlyTRIC",
get_ids(RA$get_main_table(), onlyTRIC2),
get_ids(RA$get_main_table(), background_run2))
EHE$add_comparison_manually("onlySRIC",
get_ids(RA$get_main_table(), onlySRIC),
get_ids(RA$get_main_table(), background_run2))
EHE$write_comparisons(path = output_dir)
```
```{r}
background_run1_run2_entrez <- unique(
sort(
c(
get_ids(RA$get_main_table(),
background_run1,
type = "Entrez"),
get_ids(RA$get_main_table(),
background_run2,
type = "Entrez")
)
)
)
EHN <- EnrichmentHandler$new()
EHN$add_comparison_manually("SRIC",
get_ids(RA$get_main_table(), sTRIC_2, type="Entrez"),
get_ids(RA$get_main_table(), background_run2, type="Entrez"))
get_ids(RA$get_main_table(),
SRIC_2,
type = "Entrez"),
get_ids(RA$get_main_table(),
background_run2,
type = "Entrez"))
EHN$add_comparison_manually("TRIC2",
get_ids(RA$get_main_table(), TRIC_2, type="Entrez"),
get_ids(RA$get_main_table(), background_run2, type="Entrez"))
get_ids(RA$get_main_table(),
TRIC_2,
type = "Entrez"),
background_run1_run2_entrez)
EHN$add_comparison_manually("TRIC",
get_ids(RA$get_main_table(), TRIC, type="Entrez"),
get_ids(RA$get_main_table(), background_run1, type="Entrez"))
get_ids(RA$get_main_table(),
TRIC,
type = "Entrez"),
background_run1_run2_entrez)
EHN$add_comparison_manually("onlyTRIC",
get_ids(RA$get_main_table(), onlyTRIC2, type="Entrez"),
get_ids(RA$get_main_table(), background_run2, type="Entrez"))
get_ids(RA$get_main_table(),
onlyTRIC2,
type = "Entrez"),
get_ids(RA$get_main_table(),
background_run2,
type = "Entrez"))
EHN$add_comparison_manually("onlySRIC",
get_ids(RA$get_main_table(), onlySRIC, type="Entrez"),
get_ids(RA$get_main_table(), background_run2, type="Entrez"))
EHN$write_comparisons(path = output_dir)
```
......@@ -1007,7 +1007,7 @@ for (gotype in c("BP", "CC", "MF")) {
```{r}
for(i in c("BP", "CC", "MF")) {
GO_cluster <- compareCluster(geneCluster = list(
onlySRIC = EHE$get_comparison("onlySRIC")$get_foreground(),
SRIC = EHE$get_comparison("SRIC")$get_foreground(),
onlyTRIC = EHE$get_comparison("onlyTRIC")$get_foreground()),
#universe = c(EHE$get_comparison("brain")$get_universe() ,
# EHE$get_comparison("kidney")$get_universe(),
......@@ -1023,7 +1023,62 @@ for(i in c("BP", "CC", "MF")) {
}
```
## Save Lists
```{r}
RA$get_main_table()
```
```{r}
get_ids(RA$get_main_table(), SRIC_2) %>% length
```
### only 2C TRIC run2 compared to 2C SRIC 2 run 2
```{r}
get_ids(RA$get_main_table(), onlyTRIC2) %>%
write(file = file.path(output_dir, "list_onlyTotal.txt"), sep = "\n")
get_ids(RA$get_main_table(), onlyTRIC2, type = "Entrez") %>%
write(file = file.path(output_dir, "list_onlyTotal_entrez.txt"), sep = "\n")
```
```{r}
get_ids(RA$get_main_table(), SRIC_2) %>%
write(file = file.path(output_dir, "list_Short.txt"), sep = "\n")
get_ids(RA$get_main_table(), SRIC_2, type = "Entrez") %>%
write(file = file.path(output_dir, "list_Short_entrez.txt"), sep = "\n")
```
```{r}
get_ids(RA$get_main_table(), TRIC_2) %>%
write(file = file.path(output_dir, "list_Total.txt"), sep = "\n")
get_ids(RA$get_main_table(), TRIC_2, type = "Entrez") %>%
write(file = file.path(output_dir, "list_Total_entrez.txt"), sep = "\n")
```
## KEGG Pathway annotation
```{r}
gly <- read_csv(file = file.path(input_dir, "kegg_glycolysis_glyconeogenesis.csv")) %>%
dplyr::select(EntrezIDs, Entry_id) # , GraphicsName, `shared name`)
gly %>% separate_rows(EntrezIDs, sep = ",") %>%
dplyr::filter(EntrezIDs != "") %>%
mutate(short = EntrezIDs %in% get_ids(RA$get_main_table(), SRIC_2),
total2 = EntrezIDs %in% get_ids(RA$get_main_table(), TRIC_2),
total1 = EntrezIDs %in% get_ids(RA$get_main_table(), TRIC),
totalany = EntrezIDs %in% c(get_ids(RA$get_main_table(), TRIC),
get_ids(RA$get_main_table(), TRIC_2))) %>%
group_by(Entry_id) %>% summarize(
short = any(short),
total2 = any(total2),
total1 = any(total1),
totalany = any(totalany)) %>% write_tsv(file = file.path(output_dir,
"cyto_glycolysis.tsv"))
```
# Session
......
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