Skip to content

Commit

Permalink
Merge pull request #83 from bcbio/feature_RNAseq_DE_nonhuman_ESP
Browse files Browse the repository at this point in the history
Add support for mouse to RNAseq DE template
  • Loading branch information
lpantano authored Jan 31, 2025
2 parents 64a6234 + 898de3d commit 7e048a9
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions inst/templates/rnaseq/02_differential_expression/DEG.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,15 @@ source(params$project_file)
map(list.files(params$functions_file,pattern = "*.R$",full.names = T), source) %>% invisible()
# IMPORTANT set these values if you are not using the parameters in the header (lines 22-31)
genome=params$genome
library(org.Hs.eg.db)
ann.org=org.Hs.eg.db
if(grepl(genome, "hg|human", ignore.case = TRUE)) {
library(org.Hs.eg.db)
ann.org=org.Hs.eg.db
} else if(grepl(genome, "mm|mouse", ignore.case = TRUE)) {
library(org.Mm.eg.db)
ann.org=org.Mm.eg.db
} else {
warning("If you are working on an organism other than human or mouse: Bioconductor packages are also available for a number of other organisms. This code should work for any of the organisms with an eg.db package listed at https://bioconductor.org/packages/release/BiocViews.html#___Organism -- please search for your organism and assign ann.org manually.")
}
column=params$column
# use contrast to set up multiple comparisons
Expand Down Expand Up @@ -554,7 +561,16 @@ for (contrast in names(de_list)){
From the set of differentially expressed genes and using publicly available information about gene sets involved in biological processes and functions, we can calculate which biological processes and functions are significantly perturbed as a result of the treatment.

```{r}
all_in_life=get_databases_v2(sps="human")
if(grepl(genome, "hg|human", ignore.case = TRUE)) {
all_in_life=get_databases_v2(sps="human")
run_FA=TRUE
} else if(grepl(genome, "mm|mouse", ignore.case = TRUE)) {
all_in_life=get_databases_v2(sps="mouse")
run_FA=TRUE
} else {
warning("If you are working on an organism other than human or mouse: This pathway enrichment is based on annotations from MSigDB https://www.gsea-msigdb.org/gsea/msigdb which only has human and mouse collections. For non-model organism pathway analysis, please see the template rnaseq/03_functional/Nonmodel_Organism_Pathway_Analysis.Rmd")
run_FA=FALSE
}
```

# Pathway Analysis- GSEA
Expand All @@ -565,7 +581,7 @@ Gene Set Enrichment Analysis (GSEA) is a computational method used to determine
- Incorporation of Prior Knowledge: Utilizes predefined gene sets, allowing integration of existing biological knowledge.
- Contextual Relevance: Can reveal subtle but coordinated changes in biologically meaningful gene sets that might not be apparent when looking at individual genes.

```{r, warning=F, message=F}
```{r, warning=F, message=F, eval=run_FA}
fa_gsea_list=lapply(de_list,function(contrast){
res=contrast[["all"]]
Expand All @@ -581,7 +597,7 @@ fa_gsea_list=lapply(de_list,function(contrast){
})
```

```{r, results='asis'}
```{r, results='asis', eval=run_FA}
# NOTE DT::datatables doesn't work with tabset and for loops
# You can use the following code to print dynamically or call manually sanitize_datatable()
# multiple times
Expand All @@ -603,7 +619,7 @@ Over-Representation Analysis (ORA) is a statistical method used to determine whe
- Biological Insight: Helps to identify pathways and processes that are significantly affected in the condition studied.
- Prior Knowledge Integration: Utilizes existing biological knowledge through predefined gene sets.

```{r, warning=F, message=F}
```{r, warning=F, message=F, eval=run_FA}
fa_list=lapply(de_list,function(contrast){
res=contrast[["all"]]
Expand Down Expand Up @@ -632,7 +648,7 @@ fa_list=lapply(de_list,function(contrast){

## All significant genes {.tabset}

```{r, results='asis'}
```{r, results='asis', eval=run_FA}
# NOTE DT::datatables doesn't work with tabset and for loops
# You can use the following code to print dynamically or call manually sanitize_datatable()
# multiple times
Expand All @@ -649,7 +665,7 @@ tagList(dt_list)

## Down-regulated genes {.tabset}

```{r, results='asis'}
```{r, results='asis', eval=run_FA}
dt_list=list()
for (contrast in names(de_list)){
res_sig=fa_list[[contrast]][["down"]] %>% filter(padj < 0.05)
Expand All @@ -663,7 +679,7 @@ tagList(dt_list)

## Up-regulated genes {.tabset}

```{r, results='asis'}
```{r, results='asis', eval=run_FA}
dt_list=list()
for (contrast in names(de_list)){
res_sig=fa_list[[contrast]][["up"]] %>% filter(padj < 0.05)
Expand Down

0 comments on commit 7e048a9

Please sign in to comment.