--- title: "Matching Footprint-based analysis results to Covid-19 Disease Maps content" author: "Alberto Valdeolivas: alvadeolivas@gmail.com; Date:" date: "03/04/2022" always_allow_html: true 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) library(stringr) ``` # 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.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.tsv") ``` 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} matching_genes <- character() matching_pathways <- character() for (i in 1:nrow(disease_map)){ if (!(is.na(disease_map$source_hgnc[i]))) { source_nodes <- str_replace(unlist(strsplit(disease_map$source_hgnc[i], split = ";")), "HGNC_SYMBOL:", "") } else { source_nodes <- c() } if (!(is.na(disease_map$target_hgnc[i]))) { target_nodes <- str_replace(unlist(strsplit(disease_map$target_hgnc[i], split = ";")), "HGNC_SYMBOL:", "") } else { target_nodes <- c() } all_nodes <- unique(c(source_nodes, target_nodes)) if (length(all_nodes)!= 0){ current_matching_genes <- intersect(carnival_nodes_hgnc, all_nodes) if (length(current_matching_genes) != 0){ current_matching_pathways <- rep(disease_map$source_diagram[i], length(current_matching_genes)) matching_genes <- c(matching_genes, current_matching_genes) matching_pathways <- c(matching_pathways, current_matching_pathways) } } } disease_map_hgnc_carnival_detected <- data.frame(source_diagram = matching_pathways, hgnc_carnival=matching_genes) %>% dplyr::distinct() ``` and We visualize the results. ```{r} disease_map_hgnc_carnival_detected %>% kbl(col.names = c("Covid19 DM Diagram", "Carnival nodes")) %>% kable_styling() ``` ```{r, warning=FALSE, message=FALSE} write.table(x=disease_map_hgnc_carnival_detected, file = "MatchingGenes/carnival_diagrams.tsv", sep = "\t", row.names = FALSE, quote = FALSE) ``` # Session Info Details ```{r, echo=FALSE, eval=TRUE} sessionInfo() ```