R Bioconductor RNA-seq and ChIP-seq analysis
General Software questions
In this exercise, we are going to download two packages and explore some of their functionality.
- How do you download any package from Bioconductor ?
- How do you access the vignettes for a given package ?
- What is the current version of ChIPseeker?
- How should you cite edgeR?
- How do you find help for a function (say annotatePeak)?
ChIP-seq analysis using ChIPseeker
In this exercise, we are going to explore annotating, comparing and visualizing ChIP-seq data and working with GRanges objects. Open the vignette for ChIPSeeker to load test data.
- How many peaks are in the ARmo_100nM experiment?
- What is the average length of peaks in ARmo_1nM?
- Extract peaks only from chromosome 3 in ARmo_1nM?
- Extract the first five peaks from the ARmo_1nM?
- Extract the peak name and score column of CBX6_BF?
- What is the most represented annotation of peaks in CBX7_BF?
- Make a vendiagram of overlapping peaks for ARmo experiments?
- Get the Average profile around promoters for CBX7_BF?
RNA-seq analysis using edgeR
In this exercise, we are going to use edgeR to normalize data, do differential expressed genes, draw heatmaps. Open the manual and vignette for edgeR for help.
Install Packages For pheatmap package, click "package"->"install" Type 'a' if program asks you if you want to update packages. Install from:CRAN Packages: pheatmap Check "Install dependencies" Click "Install" Click "Yes" if prompt window asks you if you want to use a personal library.
#Set working directory #Session-> Set working directory -> choose directory #Read data matrix and sample file cfile = read.table("RNAseq_count_table.txt",header=T,row.names=1,sep="\t") coldata = read.table("RNAseq_design_pe.txt",header=T,sep="\t") head(cfile) head(coldata) #Reorder the counts columns to match the order of sample file cfile = cfile[coldata$SampleID] #It is good to set your control group label as the baseline. Especially you are going to use intercept group = relevel(factor(coldata$SampleGroup),ref="monocytes") cds = DGEList(cfile,group=group)
Pre-filtering the low-expressed genes.
- Filter for keeping a gene if cpm (counts per million) exceeds 1 in at least 4 samples.
Explortory analysis and some visulization
Use cpm() function to get log2 transformed normalized counts
rld <- cpm(cds, log=TRUE)
Calculate the distance between sample pairs and do hierarchical clustering
sampleDists = dist(t(rld)) sampleDists plot(hclust(sampleDists))
Use a heatmap to show sample correlation
- Use MDS plot to check the relationship of replicates.
- Make a design matrix for samplegroups
- Normalize data and estimate dispersion. What is the norm.factors per sample?
- Use glmFit() and glmLRT() to test for differential expression. What are the top 10 differential genes sorted by logFC.
Make a dataframe with column for genes
res_filt = cbind(gene_name = rownames(res), data.frame(res))
- Filter for genes that are logFC>=1 & FDR<=0.01
- Draw a heatmap of differential expressed genes meeting filter criteria.