Skip to content

leahkemp/rna_analysis_template

Repository files navigation

RNA analysis template


Analysis template for analysing, visualising and communicating the findings of Illumina RNA sequencing data. This is set up to analyse human data, but can be adapted to other species with some tweaks to the code, namely the pipeline inputs. This template uses the count data and other QC from the rnaseq pipeline, so I'm assuming you've run this pipeline on your data before using this template. See a live example github page here.


Table of contents

What this template can do

This template uses open source tools and includes several scripts for researchers to analyse, explore and communicate findings to other researchers through interactive tables and plots. The results of this template can be served as a github page that renders html files and provides links to RShiny apps hosted on shinyapps.io - this means a single weblink can be given to your collaborators to provide them with all your analysis code and results. Most importantly, this template puts you in good steed to ensure your analysis is reproducible!

What this template can't do

  • Tell you what analysis tools and parameters are appropriate for your data or research question, the assumption is that the tools this template uses are tools you've intentionally chosen to use and that you will actively adapt this template for your use-case
  • Account for different operating systems and compute infrastructures - this means some UNIX experience may be required to run the pipeline/scripts on your operating system or job scheduler. I won't tell you how to do this here, but the pipeline and tools used here are generally portable (ie. able to be run on different operating systems) and I've used renv environments to make the R code more portable

What's this template gonna do?

These counts datasets output by the pipeline are analysed in R to undertake a differential expression analysis of all these RNA species to find differently expressed RNA's. Two methods were employed to undertake a differential expression analysis, namely limma/voom and deseq2.

Beyond a traditional differential expression analysis, the data is prepared and presented in an interactive RShiny app that allows the user to explore RNA expression (both raw counts and counts per million).

Interactive MDS and PCA plots are also created to explore clusters of RNA's/samples in the data.

Lastly, the composition of the RNA species that are identified in each treatment group are compared.

Prerequisite software

python 3, cut, zgrep, GNU software, pandas, PyYAML, R, git

Testing

This template has been validated to work on:

Test data available in the test directory, including fastq data, associated metadata and rnaseq pipeline outputs run on this test fastq data. Raw fastq data from ENCODE), download links:

How to use this template

1. Fork the template repo to a personal or lab account

2. Take this template to the data on your local machine

Clone the forked rna_analysis_template repo to the machine you'd like to analyse the data on

git clone https://github.com/leahkemp/rna_analysis_template.git

3. Format your input files

3.1 Fastq naming convention

sample.fastq.gz
  • one fastq file per sample
  • sample name matching the sample names in the metadata file
  • ".fastq.gz" extension

For example see the test fastq files here

3.2 Metadata file

Required columns:

  • "sample"

    • must be titled "sample"
    • must contain a row with a unique sample name/id for each fastq file present in the directory of fastq files to be analysed
  • "treatment"

    • must be titled "treatment"

Other notes:

  • you can have additional columns
  • you can't have any duplicate column names eg. two columns named "sample" and "Sample"
  • make sure every sample in the fastq directory to be analysed is included in the metadata file and is associated with a treatment group

For example see the test metadata file here

3.3 Configuration file

Set up ./config/config.yaml

4. Run the template

Run/work through the master RMarkdown file, this will do the bulk of the analyses and generate several html file for data visualisation and csv files with processed data

5. Commit and push to your forked version of the github repo

To maintain reproducibility of your analysis, commit and push:

  • All configuration files
  • All run scripts
  • All your documentation/notes

6. Repeat step 5 each time you re-run the analysis with different parameters

7. Create a github page (optional)

Push all the all the html/Rmd/txt files that you'd like to be rendered into a github page to github. Then create a github page. See this example live page and the underlying index.md file that links all the html/Rmd/txt files included in the github page based on the files produced by this template.

8. Contribute back!

Contributions and feedback are always welcome! 😊