Skip to content
Snippets Groups Projects
grep_disease_maps.Rmd 3.76 KiB
Newer Older
Alberto Valdeolivas's avatar
Alberto Valdeolivas committed
---
title: "Matching Footprint-based analysis results to Covid-19 Disease Maps content"
author: "Alberto Valdeolivas: alvadeolivas@gmail.com; Date:"
date: "03/04/2022"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

### License Info

This program is free software: you can redistribute it and/or modify it under 
the terms of the GNU General Public License as published by the Free Software 
Foundation, either version 3 of the License, or (at your option) any later 
version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY 
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Please check http://www.gnu.org/licenses/.

The code included in the present notebook is based on this [script][https://git-r3lab.uni.lu/computational-modelling-and-simulation/generegulationanalysis/-/blob/master/5_SBMLSearch/SourceCode/grep_disease_map.R] developed by Yusuke Hiki

# Introduction

The present script takes the output of our Footprint-based analysis and matches
the results againts the content of [the Covid-19 Disease Maps][https://covid.pages.uni.lu/map_contents] 

```{r, warning=FALSE, message=FALSE}
library(kableExtra)
```

# Results

## Reading Input files

We first read the content ofthe Covid-19 Disease Maps which can be found in this [file][https://gitlab.lcsb.uni.lu/covid/models/-/blob/master/Resources/Expand%20the%20diagrams/COVID19_Disease_Map_bipartite_crosslinked_additional_HGNCs.tsv]: 

```{r, warning=FALSE, message=FALSE}
disease_map <- read.delim("https://gitlab.lcsb.uni.lu/covid/models/-/raw/master/Resources/Expand%20the%20diagrams/COVID19_Disease_Map_bipartite_crosslinked_additional_HGNCs.tsv")

# Extract row with HGNC symbol
disease_map_hgnc <- disease_map[ !is.na( disease_map$source_hgnc ), ]

# Get HGNC symbol list for each row
disease_map_gene_list <- strsplit( x=gsub( pattern="HGNC_SYMBOL:", replacement="", x=disease_map_hgnc$source_hgnc ), split=";" )
```

We then read the output of our Footprint-based analyisis, namely CARNIVAL's output network. 
This file can be found [here][https://gitlab.lcsb.uni.lu/computational-modelling-and-simulation/footprint-based-analysis-and-causal-network-contextualisation-in-sars-cov-2-infected-a549-cell-line/-/tree/master/Carnival_Results]. 

```{r, warning=FALSE, message=FALSE}
carnival_results <- readRDS("InputFiles/carnival_results_withprogeny.rds")
carnival_nodes_hgnc <- unique(c(carnival_results$weightedSIF[,"Node1"], carnival_results$weightedSIF[,"Node2"]))
```

## Matching the results

We finally match all our genes from the carnival network with all the genes from the different pathways
included in the COVID19 Disease maps.

```{r, warning=FALSE, message=FALSE}
disease_map_hgnc_carnival_detected <- data.frame()


for( current_gene in  carnival_nodes_hgnc){
  
  # Get row index of disease map matched with target gene
  index_matched <- which( unlist( lapply( X=disease_map_gene_list, FUN=function(x){ return( any(current_gene==x) ) } ) ) )
  
  # Extract the row
  if( length( index_matched ) != 0 ){
    disease_map_hgnc_carnival_detected_i <- cbind( disease_map_hgnc[ index_matched, ], hgnc_carnival=current_gene )
    disease_map_hgnc_carnival_detected <- rbind( disease_map_hgnc_carnival_detected, disease_map_hgnc_carnival_detected_i )
  }
}

disease_map_hgnc_carnival_detected <- unique( disease_map_hgnc_carnival_detected[ ,c("source_diagram", "hgnc_carnival") ] )
rownames(disease_map_hgnc_carnival_detected) <- NULL
```

and We visualize the results. 

```{r}
disease_map_hgnc_carnival_detected %>% 
  kbl(col.names = c("Covid19 DM Diagram", "Carnival nodes")) %>% 
  kable_styling()
```


# Session Info Details

```{r, echo=FALSE, eval=TRUE}
sessionInfo()
```