Git Product home page Git Product logo

rna-seek's Introduction

RNA-seek

DOI GitHub releases Docker Pulls Build GitHub issues GitHub license

An open-source, reproducible, and scalable solution for analyzing RNA-seq data.

Table of Contents

  1. Introduction
  2. Overview
    2.1 RNA-seek Pipeline
    2.2 Reference Genomes
    2.3 Dependencies
    2.4 Installation
  3. Run RNA-seek pipeline
    3.1 Using Singularity
    3.2 Using Docker
    3.3 Biowulf
  4. Contribute
  5. References

1. Introduction

RNA-sequencing (RNA-seq) has a wide variety of applications. This popular transcriptome profiling technique can be used to quantify gene and isoform expression, detect alternative splicing events, predict gene-fusions, call variants and much more.

RNA-seek is a comprehensive, open-source RNA-seq pipeline that relies on technologies like Docker20 and Singularity21 to maintain the highest-level of reproducibility. The pipeline consists of a series of data processing and quality-control steps orchestrated by Snakemake19, a flexible and scalable workflow management system, to submit jobs to a cluster or cloud provider.

RNA-seek_overview_diagram
Fig 1. Run locally on a compute instance, on-premise using a cluster, or on the cloud using AWS. A user can define the method or mode of execution. The pipeline can submit jobs to a cluster using a job scheduler like SLURM, or run on AWS using Tibanna (feature coming soon!). A hybrid approach ensures the pipeline is accessible to all users. As an optional step, relevelant output files and metadata can be stored in object storage using HPC DME (NIH users) or Amazon S3 for archival purposes (coming soon!).

2. Overview

2.1 RNA-seek Pipeline

A bioinformatics pipeline is more than the sum of its data processing steps. A pipeline without quality-control steps provides a myopic view of the potential sources of variation within your data (i.e., biological verses technical sources of variation). RNA-seek pipeline is composed of a series of quality-control and data processing steps.

The accuracy of the downstream interpretations made from transcriptomic data are highly dependent on initial sample library. Unwanted sources of technical variation, which if not accounted for properly, can influence the results. RNA-seek's comprehensive quality-control helps ensure your results are reliable and reproducible across experiments. In the data processing steps, RNA-seek quantifies gene and isoform expression and predicts gene fusions. Please note that the detection of alternative splicing events and variant calling will be incorporated in a later release.

RNA-seq quantification pipeline Fig 2. An Overview of RNA-seek Pipeline. Gene and isoform counts are quantified and a series of QC-checks are performed to assess the quality of the data. This pipeline stops at the generation of a raw counts matrix and gene-fusion calling. To run the pipeline, a user must select their raw data, a reference genome, and output directory (i.e., the location where the pipeline performs the analysis). Quality-control information is summarized across all samples in a MultiQC report.

Quality Control
FastQC2 is used to assess the sequencing quality. FastQC is run twice, before and after adapter trimming. It generates a set of basic statistics to identify problems that can arise during sequencing or library preparation. FastQC will summarize per base and per read QC metrics such as quality scores and GC content. It will also summarize the distribution of sequence lengths and will report the presence of adapter sequences.

Kraken214 and FastQ Screen17 are used to screen for various sources of contamination. During the process of sample collection to library preparation, there is a risk for introducing wanted sources of DNA. FastQ Screen compares your sequencing data to a set of different reference genomes to determine if there is contamination. It allows a user to see if the composition of your library matches what you expect. Also, if there are high levels of microbial contamination, Kraken can provide an estimation of the taxonomic composition. Kraken can be used in conjunction with Krona15 to produce interactive reports.

Preseq1 is used to estimate the complexity of a library for each samples. If the duplication rate is very high, the overall library complexity will be low. Low library complexity could signal an issue with library preparation where very little input RNA was over-amplified or the sample may be degraded.

Picard10 can be used to estimate the duplication rate, and it has another particularly useful sub-command called CollectRNAseqMetrics which reports the number and percentage of reads that align to various regions: such as coding, intronic, UTR, intergenic and ribosomal regions. This is particularly useful as you would expect a library constructed with ploy(A)-selection to have a high percentage of reads that map to coding regions. Picard CollectRNAseqMetrics will also report the uniformity of coverage across all genes, which is useful for determining whether a sample has a 3' bias (observed in ploy(A)-selection libraries containing degraded RNA).

RSeQC9 is another particularity useful package that is tailored for RNA-seq data. It is used to calculate the inner distance between paired-end reads and calculate TIN values for a set of canonical protein-coding transcripts. A median TIN value is calucated for each sample, which analogous to a computationally derived RIN.

MultiQC11 is used to aggreate the results of each tool into a single interactive report.

Quantification
Cutadapt3 is used to remove adapter sequences, perform quality trimming, and remove very short sequences that would otherwise multi-map all over the genome prior to alignment.

STAR4 is used to align reads to the reference genome. The RNA-seek pipeline runs STAR in a two-passes where splice-junctions are collected and aggregated across all samples and provided to the second-pass of STAR. In the second pass of STAR, the splice-junctions detected in the first pass are inserted into the genome indices prior to alignment.

RSEM5 is used to quantify gene and isoform expression. The expected counts from RSEM are merged across samples to create a two counts matrices for gene counts and isoform counts.

Arriba22 is used to predict gene-fusion events. The pre-built human and mouse reference genomes use Arriba blacklists to reduce the false-positive rate.

2.2 Reference Genomes

Reference files are pulled from an S3 bucket to the compute instance or local filesystem prior to execution.
RNA-seek comes bundled with pre-built reference files for the following genomes:

Name Species Genome Annotation
hg38_30 Homo sapiens (human) GRCh38 Gencode6 Release 30
mm10_M21 Mus musculus (mouse) GRCm38 Gencode Release M21

Warning: This section contains FTP links for downloading each reference file. Open the link in a new tab to start a download.

2.3 Dependencies

Requires: singularity>=3.5 snakemake>=6.0

Snakemake and singularity must be installed on the target system. Snakemake orchestrates the execution of each step in the pipeline. To guarantee reproducibility, each step relies on pre-built images from DockerHub. Snakemake uses singaularity to pull these images onto the local filesystem prior to job execution, and as so, snakemake and singularity are the only two dependencies.

2.4 Installation

Please clone this repository to your local filesystem using the following command:

# Clone Repository from Github
git clone https://github.com/skchronicles/RNA-seek.git
# Change your working directory to the RNA-seek repo
cd RNA-seek/

3. Run RNA-seek pipeline

3.1 Using Singularity

# Coming Soon!

3.2 Using Docker

# Coming Soon!

3.3 Biowulf

# rna-seek is configured to use different execution backends: local or slurm
# view the help page for more information
./rna-seek run --help

# @local: uses local singularity execution method
# The local MODE will run serially on compute
# instance. This is useful for testing, debugging,
# or when a users does not have access to a high
# performance computing environment.
# Please note that you can dry-run the command below
# by providing the --dry-run flag
# Do not run this on the head node!
# Grab an interactive node
sinteractive --mem=110g --cpus-per-task=12 --gres=lscratch:200
module purge
module load singularity snakemake
./rna-seek run --input .tests/*.R?.fastq.gz --output /data/$USER/RNA_hg38 --genome hg38_30 --mode local

# @slurm: uses slurm and singularity execution method
# The slurm MODE will submit jobs to the cluster.
# It is recommended running rna-seek in this mode.
module purge
module load singularity snakemake
./rna-seek run --input .tests/*.R?.fastq.gz --output /data/$USER/RNA_hg38 --genome hg38_30 --mode slurm

4. Contribute

This section is for new developers working with the RNA-seek pipeline. If you have added new features or adding new changes, please consider contributing them back to the original repository:

  1. Fork the original repo to a personal or org account.
  2. Clone the fork to your local filesystem.
  3. Copy the modified files to the cloned fork.
  4. Commit and push your changes to your fork.
  5. Create a pull request to this repository.

5. References

1. Daley, T. and A.D. Smith, Predicting the molecular complexity of sequencing libraries. Nat Methods, 2013. 10(4): p. 325-7.
2. Andrews, S. (2010). FastQC: a quality control tool for high throughput sequence data.
3. Martin, M. (2011). "Cutadapt removes adapter sequences from high-throughput sequencing reads." EMBnet 17(1): 10-12.
4. Dobin, A., et al., STAR: ultrafast universal RNA-seq aligner. Bioinformatics, 2013. 29(1): p. 15-21.
5. Li, B. and C.N. Dewey, RSEM: accurate transcript quantification from RNA-Seq data with or without a reference genome. BMC Bioinformatics, 2011. 12: p. 323.
6. Harrow, J., et al., GENCODE: the reference human genome annotation for The ENCODE Project. Genome Res, 2012. 22(9): p. 1760-74.
7. Law, C.W., et al., voom: Precision weights unlock linear model analysis tools for RNA-seq read counts. Genome Biol, 2014. 15(2): p. R29.
8. Smyth, G.K., Linear models and empirical bayes methods for assessing differential expression in microarray experiments. Stat Appl Genet Mol Biol, 2004. 3: p. Article3.
9. Wang, L., et al. (2012). "RSeQC: quality control of RNA-seq experiments." Bioinformatics 28(16): 2184-2185.
10. The Picard toolkit. https://broadinstitute.github.io/picard/.
11. Ewels, P., et al. (2016). "MultiQC: summarize analysis results for multiple tools and samples in a single report." Bioinformatics 32(19): 3047-3048.
12. R Core Team (2018). R: A Language and Environment for Statistical Computing. Vienna, Austria, R Foundation for Statistical Computing.
13. Li, H., et al. (2009). "The Sequence Alignment/Map format and SAMtools." Bioinformatics 25(16): 2078-2079.
14. Wood, D. E. and S. L. Salzberg (2014). "Kraken: ultrafast metagenomic sequence classification using exact alignments." Genome Biol 15(3): R46.
15. Ondov, B. D., et al. (2011). "Interactive metagenomic visualization in a Web browser." BMC Bioinformatics 12(1): 385.
16. Okonechnikov, K., et al. (2015). "Qualimap 2: advanced multi-sample quality control for high-throughput sequencing data." Bioinformatics 32(2): 292-294.
17. Wingett, S. and S. Andrews (2018). "FastQ Screen: A tool for multi-genome mapping and quality control." F1000Research 7(2): 1338.
18. Robinson, M. D., et al. (2009). "edgeR: a Bioconductor package for differential expression analysis of digital gene expression data." Bioinformatics 26(1): 139-140.
19. Koster, J. and S. Rahmann (2018). "Snakemake-a scalable bioinformatics workflow engine." Bioinformatics 34(20): 3600.
20. Merkel, D. (2014). Docker: lightweight linux containers for consistent development and deployment. Linux Journal, 2014(239), 2.
21. Kurtzer GM, Sochat V, Bauer MW (2017). Singularity: Scientific containers for mobility of compute. PLoS ONE 12(5): e0177459.
22. Haas, B. J., et al. (2019). "Accuracy assessment of fusion transcript detection via read-mapping and de novo fusion transcript assembly-based methods." Genome Biology 20(1): 213.


Back to Top

rna-seek's People

Contributors

mtandon09 avatar skchronicles avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rna-seek's Issues

2pass STAR mode

Provide an option to run either:

  • all-sample junction aggregation after 1st pass and then 2nd pass OR
  • with per-sample --twopassMode Basic

rNA QC report integration

  • lite version to work without group information
  • grab flowcellid or instrument SN from fastq header

Update star alignment rules in single-end.smk

Background

After running the pipeline on a Havard Medical School cluster, we ran into an issue where STAR's internal method for sorting caused the pipeline to fail due to ulimit restrictions. The issue only occurs during the alignment steps of the single-end pipeline.

With that being said, it should not effect the PE alignment rules, as we are using samtool to sort the bam file. We have confirmed this by running the pipeline with paired-end data, and we did not run into any problems. A while ago we switched from STAR's internal sorting mechanism to samtools due to memory issues. At that time, we did not also update the SE rules.

To avoid this problem in the future, we should not rely on STAR to internally sort the bam file. Let's move to samtools like in the PE ruleset.

Here is an overview of what needs to be changed in the SE alignment rules:
image

Small curated input dataset for continuous integration github actions workflow

@skchronicles said

@kopardev
Yes, I will look into it.

I was also thinking we should create a custom set of references for the ci workflow.

Here is what I am thinking:

  1. Find a dataset with a differentially expressed gene
    DE gene should be comprised of uniquely mapped reads (reads only mapping to one location). This is so we can spike-in this gene later on into a pre-computed counts matrix.
    Optional: Differential expression is validated through a secondary method
  2. Extract these uniquely mapped reads for said DE gene to create the following:
    Sub-sampled fastq files for testing purposes
    Custom reference files (with a custom ref.fa and genes.gtf)
    The ref.fa should only contain the sequence for the gene of intereset (you can pad it with +/- 10KB), and the GTF files will have to be modified to accommodate the new ref.fa, and it should only contain our gene of interest.

Do you have some time to do look into this more?

Singularity cache

  • option to save pulled singularity images to a cached folder
  • command line option to specify cache folder for reuse during subsequent runs

Adding fastqvalidator

I think we talked about this a while ago. It is a good tool to ensure that the fastq files are not corrupted or incomplete. Check it out. FastQValidator

SRA support

  • --input can accept comma-separated SRR numbers OR
  • sradownload subcommand to download files before running pipeline

Running STAR with GTF provided on the fly

I have some scripts doing this here /scratch/kopardevn/fasta_GTF_testing/scripts:

  • make_star_index.sh creates the STAR index with just the fasta file. This is all you need going forward
  • star1p_pipeliner_version.sh and star2p_pipeliner_version.sh have code to calculate the mean read length and use mean read length minus 1 as the overhang
  • GTF file is directly provided to star1p_pipeliner_version.sh and star2p_pipeliner_version.sh at runtime. The whole idea is that when Gencode roles out a new GTF, we can switch to the new GTF seamlessly
  • --outTmpDir uses /lscratch to make things faster... you can also try with /dev/shm

Build all references files on the fly

Dynamically Build References

Add a command-line option to provide a genomic reference file and a GTF file.

All required reference files will be built during runtime. This option can be used to by-pass the pre-built reference files we have on S3 (i.e., hg38_30 and mm10_M21).

Adding gene fusion caller Arriba

Arriba(v2.0.0)

Add the latest version of Arriba (v2.0.0) to the pipeline which includes a blacklist for mm10.

  • Create new indices for STAR (2.7.6a). STAR's 2.7.0f indices are not compatibile with the latest version of STAR.

image

  • Create a new docker image for Arriba. The author's current version of Arriba does not have python installed, and it does not have arriba in $PATH. STAR is in $PATH though (not sure why Suhrig did that). I will open a pull request with the new Dockerfile.

image

  • Add Arriba to cluster profile, right now it is set to the defaults

Download Inputs from SRA

Download from SRA

Add a command-line option to pull FastQ files from SRA using fastq-dump.

It is worth stating that fastq-dump may be depreciated in the near future so it may be worth using fasterq-dump (actively being developed NCBI) instead. fasterq-dump does not have all the same functionality as fastq-dump but I expect in the near future it will.

Screenshot from sra-tools Github repo
image

Here is more information about using fasterq-dump.

Using s3 bucket for resources

Can the resources be hosted in s3 buckets? For eg. for hg38 and gencode version 38 can we use:

s3://nciccbr/Resources/hg38/gencode_release30/hg38.rRNA_interval_list.gz
s3://nciccbr/Resources/hg38/gencode_release30/qualimap_info.txt.gz
s3://nciccbr/Resources/hg38/gencode_release30/annotate.genes.txt.gz
s3://nciccbr/Resources/hg38/gencode_release30/karyoplot_gene_coordinates.txt.gz
s3://nciccbr/Resources/hg38/gencode_release30/genes.ref.bed.gz
s3://nciccbr/Resources/hg38/gencode_release30/karyobeds.tar.gz
s3://nciccbr/Resources/hg38/gencode_release30/geneinfo.bed.gz
s3://nciccbr/Resources/hg38/gencode_release30/annotate.isoforms.txt.gz
s3://nciccbr/Resources/hg38/gencode_release30/refFlat.txt.gz
s3://nciccbr/Resources/hg38/gencode_release30/gencode.v30.annotation.gtf.gz
s3://nciccbr/Resources/hg38/gencode_release30/rsemref.tar.gz
s3://nciccbr/Resources/hg38/hg38.fa.gz
s3://nciccbr/Resources/common/TruSeq_and_nextera_adapters.ngsqc.dat.gz
s3://nciccbr/Resources/common/fastq_screen.conf.gz
s3://nciccbr/Resources/common/fastqc.adapters.gz
s3://nciccbr/Resources/common/TruSeq_and_nextera_adapters_new.fa.gz
s3://nciccbr/Resources/common/adapters2.fa.gz

I have already uploaded all resources for hg38 (gencode release 30), except the STAR indices. We only need the noGTF version of the STAR index if we are providing GTF on the fly and will be independent of the release version. All files are gzipped on the s3 bucket and folders are tar.gz (eg. rsemref.tar.gz)

rMATS

Add rMATS turbo v4.1.0

It looks like the latest version of rMATS (4.1.0) supports reads with variable read lengths.
image

If this is true, it may be worth adding to the pipeline as an optional step (i.e. group information is provided). Reach out to the development team to confirm.

  • Create a docker image for the latest version of rMATS (4.1.0) and the STAR/2.7.6a
  • Create a new rule to run rMATS, if group information is provided

https://github.com/Xinglab/rmats-turbo

GTF independence

  • GTF file provided at STAR alignment. No pre-build transcript index.
  • Genomic STAR indices created by build
  • no more genes-<rl> type folders created by build

s3 location for common genome+annotation combinations

  • prebuild reference files for common genome+annotations and store in s3
  • json file will have s3 URIs
  • json file itself will be s3 URI ... make --genome CL argument work with custom json which are themselves located in s3

Possible Race Condition with s3 Remote files

About:
Temporarily moving to keep remote files option until this Snakemake issue has been resolved

  --keep-remote    Keep local copies of remote input files. (default: False)

Again, this is a temporary fix until this issue has been resolved or addressed in a newer release of Snakemake.

TLDR:
It looks like the remote files were removed locally before dependent rules completed. It is worth noting that I have not experienced this issue when running Snakemake locally (i.e. jobs are not submitted to the cluster). It only seems to occur when multiple concurrent jobs are running on a network shared filesystem. This behavior could be partly explained by file-system latency (remote files do not use --latency-wait information); however, it is hard to say.

build to accept gz files

  • Gencode serves files in gzipped format. If folks download references from there to use for build-ing then they will have to ungzip the files
  • make build accept gz files and do the ungzip for the user if needed

MultiQC bug

Hello,

I got an issue when running rnaseq_multiqc for a new project:


multiqc : Oops! The 'kraken' MultiQC module broke...
Please copy the following traceback and report it at https://github.com/ewels/MultiQC/issues
If possible, please include a log file that triggers the error - the last file found was:
......trim.kraken_bacteria.taxa.txt

Module kraken raised an exception: Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/multiqc/multiqc.py", line 569, in run
output = mod()
File "/usr/local/lib/python3.6/dist-packages/multiqc/modules/kraken/kraken.py", line 60, in init
self.sum_sample_counts()
File "/usr/local/lib/python3.6/dist-packages/multiqc/modules/kraken/kraken.py", line 134, in sum_sample_counts
self.kraken_sample_total_readcounts[s_name] = round(float(row['counts_rooted']) / (row['percent'] / 100.0))
ZeroDivisionError: float division by zero
<<------

Running the new version of multiqc (1.12) fixed the problem. The rnaseq pipeline should use the 1.12 version or the latest.

@felloumi

Kraken database

The current kraken database being used does not appear to include mouse.

RNA-seek Documentation

  • create a new json (or yaml) file in the workdir listing all tools used by the pipeline along with their version numbers

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.