Skip to content

Analysis setup

Move to the rnaseq-course folder and create a directory dedicated to the analyses. From a terminal you would run the following command:

cd rnaseq-course
mkdir analysis

Once you have created this directory, you need to set RStudio server to use it as the working directory. To do this, use the file browser to move into the analysis folder, and click More > Set As Working Directory.

It would also be useful to create a new script, where you can save all the commands needed to run the analysis. To do this, go to File > New File > R Script or by using the keyboard shortcut Ctrl + Shift + N (Cmd + Shift + N on macOS).

Tip

To push commands from an R script to the R console in RStudio, you can select the lines of code you want to run in your script and then press Ctrl + Enter (or Cmd + Enter on macOS) or click the “Run” button in the script editor toolbar, typically represented as a green play button.

Setting the R library path

Packages required for the hands-on have been preinstalled by the instructors and can be used from the current session by running the following command in a R console:

.libPaths("/software/rg/rnaseq/rpackages_2024")

Load required packages

The preinstalled packages include the tidyverse tools. You may use these to process and visualize the data in an easier and more efficient way. The libraries also include the edgeR package for performing the differential gene expression analysis, and the pheatmap package for making heatmap plots. In order to use the tools from these packages, you will need to load them in the current environment. This can be achieved by running the following command in the R console:

library(scales)
library(dplyr)
library(magrittr)
library(tidyr)
library(tibble)
library(ggplot2)
library(vroom)
library(edgeR)
library(pheatmap)