- Overview
- Quick Start
- Prerequisites
- GCP Set-up
- Software / Dockerfiles
- Configuration Files
- Run the Pipeline
- Pipeline Outputs
- Monitoring and Job Management
- WDL Workflow Structure
- Local Development and Testing
- Troubleshooting
- Citations and References
- Contributing and Support
- Version Information
- License
This repo contains the rna-seq data processing pipeline implemented in Workflow Description Language (WDL) based on harmonized RNA-SEQ MOP. This pipeline uses caper, a wrapper python package for the workflow management system Cromwell. All the data was processed on the Google Cloud Platform (GCP).
The pipeline supports the following organisms and genome versions:
- Rat: rn6 (Rnor_6.0, Ensembl 96), rn7 (mRatBN7.2, Ensembl 108), rn8 (GRCr8, Ensembl 115)
- Human: gencode_v39 (GRCh38)
The pipeline uses:
- STAR aligner for read alignment
- RSEM for transcript quantification (TPM, FPKM, counts)
- featureCounts for gene-level read quantification
- Quality control tools including FastQC, MultiQC, Picard, and Bowtie2 (for contamination assessment)
The pipeline generates:
- Gene expression quantification (counts, TPM, FPKM) from RSEM
- Gene counts from featureCounts
- Comprehensive QC metrics for outlier detection and covariate adjustment
- MultiQC reports for both pre- and post-alignment QC
For experienced users, here's the essential workflow:
# 1. Clone the repository
git clone https://github.com/MoTrPAC/motrpac-rna-seq-pipeline
# 2. Install Python dependencies
pip3 install -r scripts/requirements.txt
# 3. Generate input JSON configuration
python3 scripts/make_json_rnaseq.py \
-g gs://your-bucket/fastq_raw \
-o ./input_json \
-r batch1_qc_metrics \
-a human \
-v gencode_v39 \
-n 1 \
-p your-gcp-project \
-d us-docker.pkg.dev/motrpac-portal/rnaseq
# 4. Submit the pipeline
caper submit wdl/rnaseq_pipeline_scatter.wdl -i input_json/set1_rnaseq.json
# 5. Monitor pipeline status
caper list- Google Cloud Platform (GCP) account with billing enabled
- GCP service account with appropriate permissions
- GCP Storage bucket for pipeline inputs and outputs
- Google Cloud SDK
- Python >= 3.6.9
- Git
Install required Python packages:
pip3 install -r scripts/requirements.txtThe main dependencies include:
gcsfs- for accessing Google Cloud Storagenumpy- for data processing
Ensure the following APIs are enabled in your GCP project:
- Compute Engine API
- Cloud Storage API
- Google Cloud Batch API (for workflow execution)
The WDL/Cromwell framework is optimized to run pipelines in high-performance computing environments. The MoTrPAC Bioinformatics Center runs pipelines on Google Cloud Platform (GCP). We used a number of fantastic tools developed by our colleagues from the ENCODE project to run pipelines on GCP (and other HPC platforms).
A brief summary of the steps to set-up a VM to run the Motrpac pipelines on GCP (for details, please, check the caper repo):
- Create a GCP account.
- Enable cloud APIs.
- Install the Google Cloud SDK (Software Development Kit) on your local machine.
- Create a service account and download the key file to your local computer (e.g.
service-account-191919.json) - Create a bucket for pipeline inputs and outputs (e.g. gs://pipelines/). Note: a GCP bucket is similar to a folder on your computer or a storage unit, but it is stored on Google's servers in the cloud instead of on your local computer.
- Set up a VM on GCP: create a Virtual Machine (VM) instance from where the pipelines will be run. We recommend the script available in the caper repo. For that, clone the repo on your local machine and run the following command:
$ bash create_instance.sh [INSTANCE_NAME] [PROJECT_ID] [GCP_SERVICE_ACCOUNT_KEY_JSON_FILE] [GCP_OUT_DIR]
# Example for the pipeline:
./create_instance.sh pipeline-instance your-gcp-project-name service-account-191919.json gs://pipelines/results/- Finally, clone the repo on your VM instance
git clone https://github.com/MoTrPAC/motrpac-rna-seq-pipelineSeveral tools are required to run the rna-seq pipeline. All of them are pre-installed in docker containers, which are publicly available in the Artifact Registry.
The pipeline uses the following containerized tools (all available at us-docker.pkg.dev/motrpac-portal/rnaseq):
fastqc:latest- FastQC for quality controlumi_attach:latest- UMI attachment utilitycutadapt:latest- Adapter trimmingmultiqc:latest- Aggregate QC reportingstar:latest- STAR alignerfeature_counts:latest- featureCounts from Subreadrsem:latest- RSEM quantificationbowtie:latest- Bowtie2 aligner (for contamination screening)picard:latest- Picard tools (MarkDuplicates, CollectRnaSeqMetrics)umi_dup:latest- UMI-based duplication assessmentsamtools:latest- SAMtools utilitiescollect_qc:latest- Custom QC metrics collectionmerge_results:latest- Result merging across samples
To find out more about the specific versions of tools used to run the pipeline, check the dockerfiles/*.Dockerfile.
To build and push updated containers:
# Build all dockerfiles
bash scripts/build_dockerfiles.sh
# Push to Artifact Registry (requires appropriate permissions)
bash scripts/push_dockerfiles.shAn input configuration file (in JSON format) is required to process the data through the pipeline. This configuration file contains several key-value pairs that specify the inputs and outputs of the workflow, the location of the input files, default pipeline parameters, docker containers, the execution environment, and other parameters needed for execution.
The optimal way to generate the configuration files is to run the make_json_rnaseq.py script.
Usage:
python3 scripts/make_json_rnaseq.py \
-g GCP_PATH \ # GCS path to directory containing FASTQ files
-o OUTPUT_PATH \ # Local path where JSON files will be written
-r OUTPUT_REPORT_NAME \ # Name for the output QC metrics report
-a {rat,human} \ # Organism
-v {rn6,rn7,rn8,gencode_v39} \ # Genome build version
-n NUM_CHUNKS \ # Number of batches to split samples into
-p PROJECT \ # GCP project name
-d DOCKER_REPO \ # Docker repository prefix (optional)
-i \ # Include index files (for UMI processing)
-u # Include undetermined reads (optional)Complete Example:
python3 scripts/make_json_rnaseq.py \
-g gs://motrpac-bucket/rna-seq/human/batch7_20220316/fastq_raw \
-o ./input_json \
-r batch7_qc_metrics.csv \
-a human \
-v gencode_v39 \
-n 1 \
-p motrpac-portal \
-d us-docker.pkg.dev/motrpac-portal/rnaseq \
-iThis will create JSON configuration file(s) (e.g., set1_rnaseq.json, set2_rnaseq.json, etc.) in the specified output directory.
The make_json_rnaseq.py script automatically selects the appropriate reference files based on the organism and version:
Rat (rn6):
- STAR index:
gs://omicspipelines-public-resources/rnaseq/references/rat/Rnor6_v96_star_index.tar.gz - GTF:
gs://omicspipelines-public-resources/rnaseq/references/rat/Rattus_norvegicus.Rnor_6.0.96.gtf - RSEM reference:
gs://omicspipelines-public-resources/rnaseq/references/rat/rn6_rsem_reference.tar.gz
Rat (rn7):
- STAR index:
gs://omicspipelines-public-resources/rnaseq/references/rat/rn7/rn7_v108_star_index.tar.gz - GTF:
gs://omicspipelines-public-resources/rnaseq/references/rat/rn7/Rattus_norvegicus.mRatBN7.2.108.gtf - RSEM reference:
gs://omicspipelines-public-resources/rnaseq/references/rat/rn7/rn7_rsem_reference.tar.gz
Rat (rn8):
- STAR index:
gs://omicspipelines-public-resources/rnaseq/references/rat/rn8/rn8_v115_star_index.tar.gz - GTF:
gs://omicspipelines-public-resources/rnaseq/references/rat/rn8/Rattus_norvegicus.GRCr8.115.gtf - RSEM reference:
gs://omicspipelines-public-resources/rnaseq/references/rat/rn8/rn8_rsem_reference.tar.gz
Human (gencode_v39):
- STAR index:
gs://omicspipelines-public-resources/rnaseq/references/human/hg38_v39_star_index.tar.gz - GTF:
gs://omicspipelines-public-resources/rnaseq/references/human/GRCh38.v39.primary_assembly.annotation.gtf - RSEM reference:
gs://omicspipelines-public-resources/rnaseq/references/human/hg38_rsem_reference.tar.gz
For more details, see the scripts documentation.
Connect to the VM and submit the job using the below command:
caper submit wdl/rnaseq_pipeline_scatter.wdl -i input_json/set1_rnaseq.jsonCheck the status of workflows and make sure they have succeeded by typing caper list on the VM instance that's running the job and look for Succeeded.
The pipeline generates the following main output files:
-
RSEM Gene Expression Quantification
*_rsem_genes_count.txt- Raw gene-level counts*_rsem_genes_tpm.txt- Transcripts Per Million (TPM) normalized expression*_rsem_genes_fpkm.txt- Fragments Per Kilobase Million (FPKM) normalized expression
-
featureCounts Gene Quantification
*_feature_counts.txt- Gene-level raw counts from featureCounts
- QC Metrics Report
*_qc_report.csv- Comprehensive QC metrics per sample including:- Read alignment statistics
- rRNA, globin, and PhiX contamination rates
- PCR duplication rates
- Strand specificity
- 5' to 3' coverage bias
- Percentage of reads mapping to coding/intronic/intergenic regions
- Chromosome mapping percentages
The pipeline also generates intermediate outputs for each sample (stored in Cromwell execution directories):
- FastQC reports (pre- and post-trimming)
- MultiQC consolidated reports
- STAR alignment BAM files
- Trimmed FASTQ files
- Picard metrics files
Final merged outputs are written to the GCS bucket specified during pipeline submission. Individual sample outputs are organized in the Cromwell execution directory structure.
# List all workflows
caper list
# Check detailed status of a specific workflow
caper metadata [WORKFLOW_ID]# View workflows currently running
caper list | grep Running
# Check logs for a specific workflow
caper debug [WORKFLOW_ID]# Abort a running workflow
caper abort [WORKFLOW_ID]
# Check troubleshooting information
caper troubleshoot [WORKFLOW_ID]Successful pipeline runs will write outputs to your specified GCS bucket. Intermediate files and execution logs are stored in:
cromwell-executions/- Contains all task execution outputs and logscromwell-workflow-logs/- Contains workflow-level logs
To copy results from GCS to your local machine:
gsutil -m cp -r gs://your-bucket/results/workflow_id/* ./local_results/The pipeline is organized as a modular WDL workflow with the following structure:
wdl/rnaseq_pipeline_scatter.wdl- Main workflow that orchestrates all tasks using a scatter-gather pattern to process multiple samples in parallel
The pipeline consists of the following task modules (in wdl/ directory):
Pre-alignment QC and Processing:
fastqc/- Quality control with FastQC (pre- and post-trimming)attach_umi/- Attach UMI indices to read namescutadapt/- Adapter trimmingmultiqc/- Aggregate QC reporting
Alignment and Quantification:
star_align/- Alignment with STARrsem_exp/- RSEM quantificationfeature_counts/- featureCounts quantification
Contamination Screening:
bowtie2_align/- Bowtie2 alignment to globin, rRNA, and PhiX references
Post-alignment QC:
mark_duplicates/- PCR duplicate marking with Picardcollect_rnaseq_metrics/- RNA-seq QC metrics with Picardumi_dup/- UMI-based duplication assessmentcompute_mapped/- Chromosome mapping statisticscollect_qc_metrics/- Consolidated QC metrics collection
Results Aggregation:
merge_results/- Merge quantification and QC data across all samples
The repository also includes workflows for building reference files:
wdl/star_ref/- Build STAR genome indiceswdl/rsem_index/- Build RSEM reference indiceswdl/bowtie2_index/- Build Bowtie2 indices
For detailed instructions on how to prepare all required reference files for a new organism or genome build (index building, refFlat generation, etc.), see README-DATA-REF.md.
Use the provided setup scripts to configure your development environment:
# Set up VM for pipeline execution
bash scripts/setup/setup_vm.sh
# Set up local development environment
bash scripts/setup/setup_develop.shBefore submitting workflows, validate your JSON configuration files:
python3 scripts/validate_jsons.py input_json/set1_rnaseq.jsonThe prototype/ directory contains example configuration files and submission scripts:
# Example submission script for generic use
bash prototype/submit_rnaseq_generic.sh
# Example JSON configurations in prototype/input_json/The examples/ directory contains additional JSON examples for individual tasks and different organism configurations.
# Build all docker images
bash scripts/build_dockerfiles.sh
# Push to your container registry (configure registry URL first)
bash scripts/push_dockerfiles.sh1. Pipeline Fails During Submission
- Verify JSON configuration is valid using
scripts/validate_jsons.py - Ensure all required input files exist in the specified GCS paths
- Check that service account has permissions to access GCS buckets
2. Tasks Fail with "Out of Memory" Errors
- Increase
*_ramGBparameters in your JSON configuration - Default memory allocations are in
scripts/make_json_rnaseq.py
3. Tasks Fail with "Out of Disk Space" Errors
- Increase
*_diskparameters in your JSON configuration - Ensure your GCS bucket has sufficient quota
4. Cannot Find Output Files
- Check workflow succeeded:
caper list - Outputs are in the GCS bucket specified in your configuration
- Check Cromwell execution logs in
cromwell-executions/
5. Docker Image Pull Failures
- Verify you have access to the Artifact Registry
- Check that docker image names/tags are correct in JSON
- Ensure Compute Engine service account has Artifact Registry Reader role
Workflow-level logs:
# View workflow metadata
caper metadata [WORKFLOW_ID]
# Check troubleshooting info
caper troubleshoot [WORKFLOW_ID]Task-level logs: Navigate to the Cromwell execution directory:
cd cromwell-executions/rnaseq_pipeline/[WORKFLOW_ID]/
# Find specific task directories and check stderr/stdout logsGCP Console:
- Navigate to Life Sciences API in GCP Console
- View operation logs and details for each task execution
If issues persist:
- Check the Cromwell documentation: https://cromwell.readthedocs.io/
- Review the Caper documentation: https://github.com/MoTrPAC/caper/
- Open an issue on the GitHub repository with:
- Workflow ID
- Error messages from logs
- JSON configuration (with sensitive data removed)
- RNA-SEQ MOP - MoTrPAC RNA-seq Method of Procedure
- Cromwell - Workflow management system
- Caper - Cromwell wrapper for easy workflow execution
- WDL - Workflow Description Language specification
- STAR - Dobin A, et al. STAR: ultrafast universal RNA-seq aligner. Bioinformatics. 2013.
- RSEM - Li B and Dewey CN. RSEM: accurate transcript quantification from RNA-Seq data with or without a reference genome. BMC Bioinformatics. 2011.
- featureCounts - Liao Y, et al. featureCounts: an efficient general purpose program for assigning sequence reads to genomic features. Bioinformatics. 2014.
- FastQC - Quality control for high throughput sequence data
- MultiQC - Ewels P, et al. MultiQC: summarize analysis results for multiple tools and samples in a single report. Bioinformatics. 2016.
- Cutadapt - Martin M. Cutadapt removes adapter sequences from high-throughput sequencing reads. EMBnet.journal. 2011.
- Bowtie2 - Langmead B and Salzberg SL. Fast gapped-read alignment with Bowtie 2. Nature Methods. 2012.
- Picard Tools - Broad Institute toolkit for SAM/BAM file manipulation
- ENCODE-DCC - Tools and pipelines from the ENCODE Project Consortium
- Rat rn6: Ensembl Rnor_6.0 release 96
- Rat rn7: Ensembl mRatBN7.2 release 108
- Rat rn8: Ensembl GRCr8 release 115
- Human: GENCODE v39 (GRCh38)
If you encounter bugs or have feature requests, please open an issue on the GitHub repository.
When reporting issues, please include:
- Description of the problem
- Steps to reproduce
- Expected vs. actual behavior
- Workflow ID (if applicable)
- Relevant error messages or logs
- JSON configuration (remove sensitive information)
For questions or support related to the MoTrPAC RNA-seq pipeline:
- Open an issue on GitHub: https://github.com/MoTrPAC/motrpac-rna-seq-pipeline/issues
- Contact the MoTrPAC Bioinformatics Center
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request with a clear description of the changes
- MoTrPAC Data Hub - Access to MoTrPAC datasets
- MoTrPAC GitHub Organization - Other MoTrPAC analysis pipelines and tools
This pipeline is actively maintained and updated. Check the releases page for version history and changelogs.
If you use this pipeline in your research, please cite:
- WDL Version: 1.0
- Cromwell Version: Compatible with Cromwell 50+
- Python Version: Requires Python >= 3.6.9
- GCP: Designed for Google Cloud Platform (adaptable to other backends with Cromwell configuration)
Major updates and changes are documented in the repository's commit history. For significant changes:
- Reference genome updates (rn6 → rn7, GENCODE versions)
- Tool version updates (see dockerfiles for current versions)
- Workflow optimizations and bug fixes
Check the commit history for detailed changes.
This project is licensed under the MIT License. Copyright (c) 2025 MoTrPAC.
See the LICENSE.md file for the full license text.