Giter Site home page Giter Site logo

amarinderthind / rna-seq-tutorial-for-gene-differential-expression-analysis Goto Github PK

View Code? Open in Web Editor NEW
27.0 2.0 14.0 2.61 MB

This tutorial is created for educational purpose

R 100.00%
rnaseq-pipeline rnaseq rnaseq-workshop deseq2 edger enrichment-analysis bioconductor-packages reactome-pathway pca-analysis rna-seq-dge

rna-seq-tutorial-for-gene-differential-expression-analysis's Introduction

RNASeq tutorial for gene differential expression analysis and Functional enrichment analysis

This tutorial was created for educational purposes and was presented at a Workshop organised by Dollar Education.

Interested in exploring more applications of the RNASeq, Read here https://ro.uow.edu.au/test2021/3578/

Want to adjust for tumour purity Check https://www.nature.com/articles/s41587-022-01440-w

About the RNA-Seq analysis

The R script performs several steps in RNAseq gene differential expression analysis, including filtering, preprocessing, visualization, clustering, and Enrichment. For the analysis, several R Bioconductor packages are required to be installed (Installation commands are provided in the script. However, users can also refer to the Bioconductor website for detailed instructions).

Main Bioconductor packages to be installed

DESeq2, edgeR, biomaRt (Very useful for gene filtering and annotations), PCAtools (PCA detailed analysis), ReactomePA (enrichment analysis)

RNA-Seq-DGE.R is the R script.

RNA-Seq-DGE.rmd used to create an output of the script shown in the PDF file here.

No significant enrichment was found from the demo example, so enrichment plots are empty or commented.

Note:

If data is obtained by different batch processing please consider ~batch (batch effect in the design matrix) or use CombatSeq as defined in the new script.

Required data files

You should have a raw count and annotation/metadata file for running this analysis. Raw count files are usually obtained from tools such as featureCount, Rsem etc.

setwd("/Users/Path") #Path_to_working_directory

rawcount<-read.table ("RawCount_input.csv",header=TRUE,  sep=",",  row.names=1)

## Replace NAs by zero and change the input to the required format
rawcount <- round(rawcount) 
rawcount[is.na(rawcount)] <- 0

Loading and filtering Data annotation file

anno <-read.table ("Annotation_of_samples_12_Samples_ALL.csv",header=TRUE,  sep=",", row.names = 1) ##, In this case, we have 3 columns (a) sample (b) Condition (c) batch
#rownames(anno) <- anno$sample  ##add row names as sample name (if not already), because PCA function check row names of anno == col of the data matrix

table(anno$Condition)

library(tidyverse)
library('dplyr') ##HAS COUNT FUNCTION

### In case you want to consider the subset of samples based on some condition (when multiple e.g. >3 )
#anno <- anno %>% 
#  as.data.frame %>%
#  filter(anno$Condition =='Condition_A' |anno$Condition =='Condition_B' | anno$Condition == 'Condition_C' )  %>%
#  arrange(Condition)  	#Arrange rows by padj values 

sort anno based on condition ## sorted conditional sample representation in heatmap

anno <- anno %>% 
  as.data.frame %>%
  arrange(Condition) 

PCA plot for pre-DE investigation

library(PCAtools)

anno <- anno[match(colnames(rawcount), anno$Sample),] ## reordering anno rows with colnames of rawcount
lograwcount <- as.matrix(log2(rawcount +1))  ## log transformation of rawcount for PCA plot 

 top1000.order <- head(order(matrixStats::rowVars(lograwcount), decreasing = TRUE), 1000) ## taking top 1000 genes having the highest variance selected from all the genes in the input
  p <- PCAtools::pca(mat = lograwcount[top1000.order,], metadata = anno, removeVar = 0.01) ## performing PCA

  biplot(p,                                                       #visualization of PCA plot
       lab = paste0(p$metadata$Sample),
        colby = 'Batch',  #Sample #Batch #Condition #sex
        hline = 0, vline = 0,
        legendPosition = 'right',
         encircle = T )
  
  screeplot(p, axisLabSize = 18, titleLabSize = 22) ## This plot shows how much variation in the data is explained by which PC component.
  pairsplot(p) ## draw various combinations of the PCA plot

Plots

PCA plots for initial QC

       

Dot plot and HeatMap

       

       

### Over enrichment analysis (ORA) and Gene set enrichment analysis (GSEA)

Reading material or relevant articles

Explore about different normalization methods here

Other emerging bulk RNASeq applications

EdgeR

Deseq2

PCAtools

Reactome Pathway Analysis

Contact

In case you have any queries please feel free to contact [email protected] for any other queries.

rna-seq-tutorial-for-gene-differential-expression-analysis's People

Contributors

amarinderthind avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

rna-seq-tutorial-for-gene-differential-expression-analysis's Issues

File RawGeneCounts

Hey,
Nice tutorial..!! But it would be great if you provide RawGeneCounts.tsv file. That will help newbie to get update with the kind of input data look like.
Thanks
Regards
Devender Arora

typo in RNA-Seq-DGE.R

Line 177 has a typo where "Case1" should be "case1"

current code is:

contrasts.edgeR <- makeContrasts(Case1 - Control, levels=design.mat) ##FirstC-SecondC ##Define

and should be

contrasts.edgeR <- makeContrasts(case1 - Control, levels=design.mat) ##FirstC-SecondC ##Define

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.