From 73bfcef04cccb0286b688b7f1da8d38108bd2751 Mon Sep 17 00:00:00 2001 From: Alexander Pico Date: Mon, 9 Nov 2020 15:08:38 -0800 Subject: [PATCH] updated use case 1 --- single-cell-analysis/Session_4/use_case_1.Rmd | 50 ++- .../Session_4/use_case_1.html | 314 ++++++++++++++++-- 2 files changed, 314 insertions(+), 50 deletions(-) diff --git a/single-cell-analysis/Session_4/use_case_1.Rmd b/single-cell-analysis/Session_4/use_case_1.Rmd index 5d1d5f9..0f5536a 100644 --- a/single-cell-analysis/Session_4/use_case_1.Rmd +++ b/single-cell-analysis/Session_4/use_case_1.Rmd @@ -8,11 +8,39 @@ output: html_document knitr::opts_chunk$set(echo = TRUE) ``` +This use case will demonstrate analyzing and visualizing single cell datasets from within Cytoscape to generate network views of clusters of differentiated genes per cell population. In order to control Cytoscape from R, we'll need to install the RCy3 pacakge: +# Installation +```{r} +if(!"RCy3" %in% installed.packages()){ + install.packages("BiocManager") + BiocManager::install("RCy3") +} +library(RCy3) +``` + +The whole point of RCy3 is to connect with Cytoscape, so you will need to install and launch Cytoscape: + +* Download the latest Cytoscape from http://www.cytoscape.org/download.php +* Complete installation wizard +* Launch Cytoscape + +```{r} +cytoscapePing() +``` + +For this use case, you'll also need two Cytoscape apps: + * [scNetViz app](http://apps.cytoscape.org/apps/scnetviz) to work with single cell datasets in Cytoscape + * [stringApp](https://apps.cytoscape.org/apps/stringapp) to perform enrichment analysis using the STRING webservice + +```{r} +installApp('scNetViz') +installApp('STRINGapp') +``` In this example, we will browse a single cell expression atlas, explore a particular dataset, perform differential expression analysis based on provided categories, generate networks from the top genes from each category, and functionally characterize and visualize the networks. -##Steps 1-2: Load data +# Load single cell dataset Use the accession number of single-cell experiment to pull data from the [Single-Cell Experiment Atlas](https://www.ebi.ac.uk/gxa/sc/experiments) of EMBL-EBI. @@ -23,37 +51,31 @@ RCy3::commandsRun('scnetviz load gxa experiment accession=E-GEOD-81383') This loads the data and opens an experiment table with three tabs, named _TPM_, _Categories_, and _DiffExp_. -##Step 3a - +# Perform differential expression analysis Run differential expression analysis for the row with `true` value of `sel.K` (default). ```{r} RCy3::commandsRun('scnetviz calculate diffexp accession=E-GEOD-81383') ``` -##Step 3b - +# Generate networks Fetch protein-protein interaction networks from the [STRING](https://string-db.org/) database. ```{r} RCy3::commandsRun('scnetviz create network accession=E-GEOD-81383') ``` -The following command runs Steps 3a-3b simultaneously. -```{r} -RCy3::commandsRun('scnetviz create all experiment=E-GEOD-81383') -``` - -##Step 4 - +# Check resulting networks Check the networks available in the current Cytoscape session. ```{r} RCy3::commandsRun('network list') ``` -Perform functional enrichment analysis for the network selected in the current session. This uses the [_stringApp_](https://www.cgl.ucsf.edu/cytoscape/stringApp/index.shtml). To view the results in the Cytoscape application, you may have to activate the _Show enrichment panel_ option under __STRING Enrichment__ sub-menu from __Apps__ from the menu bar. +# Perform functional enrichment analysis +Perform functional enrichment analysis for the network selected in the current session using the _stringApp_. ```{r} -RCy3::commandsRun('string retrieve enrichment allNetSpecies=Homo sapiens') +net.enr <- RCy3::commandsRun('string retrieve enrichment allNetSpecies=Homo sapiens') +RCy3::commandsRun('string show enrichment') ``` Visit the [scNetViz website](https://www.cgl.ucsf.edu/cytoscape/scNetViz/#networks) for more information. diff --git a/single-cell-analysis/Session_4/use_case_1.html b/single-cell-analysis/Session_4/use_case_1.html index ff0f8bb..2119878 100644 --- a/single-cell-analysis/Session_4/use_case_1.html +++ b/single-cell-analysis/Session_4/use_case_1.html @@ -14,15 +14,239 @@ scNetViz: Use case #1 - + - - - - - - - + + + + + + + + + +