--- title: "Customize intercellular networks" author: "Marton Olbei" date: "10/12/2020" output: pdf_document: default html_document: default --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = FALSE) ``` In this tutorial we show you how to query interactions from the intercellular interactions in OmniPath, and go over the various attributes accompanying them. We'll start by importing libraries, first `OmnipathR`, and `dplyr` for data wrangling. ```{r echo=TRUE, message=FALSE, warning=FALSE} library(OmnipathR) library(dplyr) ``` The intercellular interactions in OmniPath are collated from a number of sources. When putting together a query, you can select all of these, or just a preferred subset of them. The `get_intercell_resources` function returns the list of datasets included in the database. ```{r echo=TRUE, message=FALSE} get_intercell_resources() ``` These resources contain a large variety of actors we can use to build intercellular interactions. Take a peek at a generalized list of these categories by using the `get_intercell_generic_categories` function. This list is also accessible from the browser, at https://omnipathdb.org/intercell_summary. Using the `get_intercell_categories` command returns the complete list. ```{r echo=TRUE, message=FALSE} get_intercell_generic_categories() ``` Now that we have seen the resources and categories, we have to go over a few definitions related to them to make sure everything is clear going forward. ![definitions](OP_workflow_6.png) To import an intercellular network we call the `import_intercell_network` function. The function has three main steps: * first, we have to define the datasets to import from under `interactions_param` * following that, we can specify the qualities of the transmitting proteins, such as which categories they should belong to, what should be their scope, source, aspect and so on under `transmitter_param` * once we are done with that, we should specify the same for the receiving molecules under `receiver_param` In this example below we generate a large intercellular network, where we are attempting to connect ligands to receptors. These steps can be individually traced back through URLs: 1. interaction parameters: https://omnipathdb.org/interactions?genesymbols=yes&datasets=omnipath,pathwayextra,ligrecextra&organisms=9606&fields=sources,references,curation_effort&license=academic 2. transmitter parameters: https://omnipathdb.org/intercell?scope=generic&categories=ligand&causality=trans&license=academic 3. receiver parameters: https://omnipathdb.org/intercell?scope=generic&categories=receptor&causality=rec&license=academic ```{r echo=TRUE, message=FALSE} interactions <- import_intercell_network( interactions_param = list( datasets = c('omnipath', 'pathwayextra', 'ligrecextra') ), transmitter_param = list( categories = c('ligand') ), receiver_param = list( categories =c('receptor') ) ) ``` ```{r echo=TRUE, message=FALSE} interactions ``` This results in 7604 interactions. Let's narrow it down by restricting it with some of the categorical data outlined above. ```{r echo=TRUE, message=FALSE} interactions_small <- import_intercell_network( interactions_param = list( datasets = c('omnipath', 'pathwayextra', 'ligrecextra') ), transmitter_param = list( categories = c('ligand'), scope = c('specific') # let's restrict the scope to be specific ), receiver_param = list( categories =c('receptor') ) ) ``` ```{r echo=TRUE, message=FALSE} interactions_small ``` *In this tutorial we learned:* * the data sources used to generate intercellular interactions * the qualities of intercellular interactors * the functions to generate and specify intercellular interactions