3  Lab 1: Familiarizing with the Server

Lab server

Notes

The estimated time for this lab is around <1h.

Aims
  • Access the lab RStudio server.
  • Familiarize yourself with the RStudio interface.
  • Learn how to use the terminal within RStudio.
  • Practice basic R and terminal commands.

2.1 Connect to RStudio Server

Most of scRNA-seq analysis takes place either in python or in R. Here, we focus on how to leverage R to investigate scRNAseq data. RStudio is an IDE (Integrated Development Environment, in other words: a nice graphical interface to run R-related commands).

For this workshop, we have installed R and RStudio on Lab computer. We can directly use RStudio (actually, RStudio-server since it is installed on an the lab’s ubuntu server). Simply open a browser and copy-paste the following address:

URL
http://10.35.229.71:8787/

Or click here: http://10.35.229.71:8787/

An RStudio log in page will appear; to log in, use your user ID for both ID and password.

Some useful commands in R:

getwd()                # equivalent of pwd in terminal
dir.create("~/data/")  # equivalent of mkdir ~/data/ in terminal
setwd("~/data/")       # equivalent of cd ~/data/
install.packages("PACKAGE_NAME") # install a package (very common)
library(PACKAGE_NAME)  # load/activate a package

2.2 Check up

Verify if your RStudio environment is set up correctly.

2.2.1 (RStudio env)

In Editor screen

# Load
library(ggplot2)
library(dplyr)

# Example dataset
library(gapminder)
data <- gapminder %>%
  filter(year == 2007) %>%
  dplyr::select(-year)

# Bubble plot
data %>%
  arrange(desc(pop)) %>%
  mutate(country = factor(country, country)) %>%
  ggplot(aes(x = gdpPercap, y = lifeExp, size = pop, color = continent)) +
  geom_point(alpha = 0.5) +
  scale_size(range = c(0.1, 24), name = "Population (M)") +
  theme_classic()
2.2.2 (RStudio env)

What is BiocManager?

BiocManager is an R package used to install and manage packages from Bioconductor.

2.2.3 (RStudio env)

How do I install packages from Bioconductor (using BiocManager)?

# 1st option
if (!require("BiocManager", quietly = TRUE))
  install.packages("BiocManager")

# 2nd option
BiocManager::install(version = "3.18")

# Use
BiocManager::install("PACKAGE_NAME")

2.3 Cell Ranger Workflow

Below is the Cell Ranger workflow diagram showing the pipeline for processing snRNA-seq data:

View PDF in full screen