Jetstream Workflow That Creates Gene Expression Matrices (GEMs) from SRA/FASTQ NGS Files

This is the old version of Pegasus-GEM JS workflow. Please use this latest version - Pegasus-GEM Jetstream Workflow Tutorial - 2.2

Rationale and background

Pegasus-GEM is Pegasus Jetstream workflow that utilizes Jetstream resources to produce a Gene Expression Matrix (GEM) from DNA sequence files in FASTQ format. This is adapted from OSG-GEM workflow that currently runs on Open Science Grid (OSG)

William L. Poehlman, Mats Rynge, Chris Branton, D. Balamurugan and Frank A. Feltus. OSG-GEM: Gene Expression Matrix Construction Using the Open Science Grid. Bioinformatics and Biology Insights 2016:10 133–141 doi: 10.4137/BBI.S38193.


This workflow processes both paired or single end FASTQ files to produce a matrix of normalized RNA molecule counts (FPKM). Pegasus-GEM also supports direct input downloads from NCBI SRA for processing. An indexed reference genome along with gene model annotation files must be obtained prior to configuring and running the workflow. The following tasks are directed by the Pegasus workflow manager:

It is suggested that the user become familiar with the documentation associated with the following software packages:

This tutorial will take users through steps of:

  1. Running Pegasus-GEM on Jetstream cloud
  2. Running Pegasus-GEM on an example data


Sounds great, what do I need to get started?

  1. XSEDE account
  2. XSEDE allocation. Users can request a startup XSEDE allocation. The startup XSEDE allocations are relatively easy to apply and get allotted. Please contact for further information.
  3. Getting started with Jetstream
  4. Your data (or you can run example data)

What kind of data do I need?

  1. Mandatory requirements
    1. FASTQ files. Either single end or paired. You can also use SRR id's
    2. Select the type of reads. Single or Paired.
    3. Select the type of mapper (Tophat2 or Hisat2 or STAR)
    4. Select the type of assembler (Cufflinks or Stringtie)

What kind of resources will I need for my project?

  1. Enough SUs (Service Units) to run your computation
  2. One MASTER and several workers needed for running your computation
  3. Enough storage space on the WQ-MAKER Jetstream instance for both input and output files. Since most of the images have limited disk space, it is recommended to mount an external volume to the running Pegasus-GEM MASTER instance. 

Part 1: Connect to an instance of an CentOs Jetstream Image (virtual machine)

Step 1. Go to and log in with your XSEDE credentials.


Step 2. Click on the "Create New Project"  in the Project tab on the top and enter the name of the project and a brief description 

Step 3. Launch an instance from the selected image and name it as MASTER 

After the project has been created and entered inside it, click the "New" button, select "Centos 7 (7.3) Development GUI" image and then click Launch instance. In the next window (Basic Info),

Make sure to check on the Projected Resources Usage to make sure you have enough resources to run the instance. If you need more SUs or CPUs to run instances, contact the Jetstream team at Review the details of the instance you are selecting to launch and click "Launch Instance"

As the instance is launched behind the scenes, you will get an update as it goes through each step.

Status updates of Instance launch (both MASTER and WORKER) include Build-requesting launch, Build-networking, Build-spawning, Active-networking, Active-deploying. Depending on the usage load on Jetstream, it can take anywhere from 2-5 mins for an instance to become active. You can force check updates by using the refresh button in the Instance launch page or the refresh button on your browser. Once the instance becomes active a virtual machine with the ip address provided will become available for you to connect to. This virtual machine will have all the necessary components to run WQ-MAKER and test files to run a MAKER demo. 

Step 4. Launch WORKER instance from  "Centos 7 (7.3) Development GUI" image 

Launch one instance from the  "Centos 7 (7.3) Development GUI" image and name them as W-1. Use the same configuration as the MASTER VM 

Step 5. ssh into the ip address of MASTER VM as root

$ ssh -A root@<ip.address>
# For example
$ ssh -A root@ #Do not use this ip address with your username as it will not work

5.1 Bootstrap and MASTER and worker

[js-17-50] root ~-->
cd /srv/
git clone
cd jetstream-pegasus/
./ # MASTER     
./ # W-1

Step 6. Create and attach the volume to the MASTER instance

Since the m1 medium instance size (60GB disk space) selected for running MASTER instance of Pegasus may not be sufficient for most of the GEM runs, it is recommended to run it on volumes. Following are the three steps for mounting the external volume.

6.1: Create a volume

Click the "New" button in the project and select "Create Volume". Enter the name of the volume, volume size (GB) needed and the provider (TACC or Indiana) and finally click "Create Volume" 

6.2: Attach the created volume to the MASTER instance 

Click the checkbox by the side of Volume (1), then click the attach button (2), next chose the MASTER instance (3) and finally click the ATTACH VOLUME TO INSTANCE button (4)


Part 3: Set up a Pegasus-GEM run using the Terminal window

Step 1. Get oriented. A workflow specific ssh key has to be created. This key is used for some of the data staging steps of the workflow.

# Create a directory .ssh if you don't have that already
$ mkdir -p ~/.ssh 
$ ssh-keygen -t rsa -b 2048 -f ~/.ssh/workflow 
(Just hit enter when asked for passphrase)

Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/upendra/.ssh/workflow.
Your public key has been saved in /home/upendra/.ssh/
The key fingerprint is:
The key's randomart image is:
+--[ RSA 2048]----+
|   .E  .*oo..    |
|  .    o =.o     |
|   .    =.+..    |
|  .   .o.B.      |
|   . o .S o      |
|    . o. o       |
|     .           |
|                 |
|                 |
$ cat ~/.ssh/ >>~/.ssh/authorized_keys

Step 2: Example Workflow Setup. The workflow cloned from github contains an example config file as well as example input files from the 21st chromosome of Gencode Release 24 of the GRCh38 build of the human reference genome. Two small FASTQ files containing 200,000 sequences from NCBI dataset SRR1825962 lie within the Test_data directory of the workflow

$ git clone

$ cd OSG-GEM

# To run the test workflow, the user must copy the osg-gem.confi.template file like this
$ cp osg-gem.conf.example osg-gem.conf

# Take a look at the config file first
$ cat osg-gem.conf
reference_prefix = chr21-GRCh38

# List the inputs to process. Each line can either be a pair
# of forward and reverse files, separated by a space:
#    input1 = forward.fastq.gz reverse.fastq.gz
# or a single SRR number. Example:
#    input2 = DRR046893
# or a single fastq file for single end reads.  Example:
#    input3 = SRR4343300.fastq.gz

input1 = ./Test_data/TEST_1.fastq.gz ./Test_data/TEST_2.fastq.gz
#input1 = ./Test_data/SRR4343300.fastq.gz
#input2 = SRR4343300
#input2 = DRR046893


# Memory available to the jobs. This should be roughly 2X the
# size of the reference genome, rounded up whole GB
memory = 4 GB

# Reads are single end
single = False

# Reads are paired end
paired = True

# process using TopHat2
tophat2 = False

# process using Hisat2
hisat2 = True

# process using STAR
star = False

# process using Cufflinks
cufflinks = False

# process using StringTie
stringtie = True

Run default test data . The workflow, configured to run Hisat2 and StringTie, can then be launched by running:

$ ./submit

# To check the status of your run. For example, run
$ pegasus-status -l /mydata/OSG-GEM/runs/osg-gem-1498085153/workflow/osg-gem-1498085153 
(no matching jobs found in Condor Q)
UNRDY READY   PRE  IN_Q  POST  DONE  FAIL %DONE STATE   DAGNAME                                 
    0     0     0     0     0    26     0 100.0 Success 00/00/level-2/level-2.dag               
    0     0     0     0     0     6     0 100.0 Success *gem-0.dag                              
    0     0     0     0     0    32     0 100.0         TOTALS (32 jobs)                        
Summary: 2 DAGs total (Success:2)

# Final output file is located in
ls -lh runs/osg-gem-1498085153/outputs/ 
-rw-r--r-- 1 upendra upendra 68K Jun 21 17:50 runs/osg-gem-1498085153/outputs/ 

Monitoring Workflow

Pegasus provides a set of commands to monitor workflow progress. The path to the workflow files as well as commands to monitor the workflow will print to screen upon submitting the workflow. For example:

2016.05.26 23:31:03.859 CDT:   Your workflow has been started and is running in
2016.05.26 23:31:03.869 CDT:     /stash2/user/username/workflows/osg-gem-x/workflow/osg-gem-x
2016.05.26 23:31:03.880 CDT:   *** To monitor the workflow you can run ***
2016.05.26 23:31:03.891 CDT:     pegasus-status -l /stash2/user/username/workflows/osg-gem-x/workflow/osg-gem-x
2016.05.26 23:31:03.901 CDT:   *** To remove your workflow run ***
2016.05.26 23:31:03.912 CDT:     pegasus-remove /stash2/user/username/workflows/osg-gem-x/workflow/osg-gem-x

Output will be transferred at the base of this directory upon completion. For example:


From here, the user may follow our documentation to modify the software options as well as point to their own input datasets. Note that there are no test reference genome indices available for STAR, because they are too large to upload to github.

Pre-Workflow User Input

The user must provide indexed reference genome files as well as gene model annotation information prior to submitting the workflow. The user must select a reference prefix($REF_PREFIX) that will be recognized by Pegasus as well as by Hisat2 or Tophat2. In addition, information about splice sites or a reference transcriptome must be provided in order to guide accurate mapping of split input files. Once the user has downloaded a reference genome fasta file and gene annotation in GTF/GFF3 format, the following commands can be used to produce the necessary input files, using GRCh38 as an example $REF_PREFIX for Gencode Release 24 of the human reference genome:


$ cd reference
$ hisat2-build -f GRCh38.fa GRCh38
$ python GRCh38-gencode.v24.annotation.gtf > GRCh38.Splice_Sites.txt


$ cd reference
$ bowtie2-build -f GRCh38.fa GRCh38
$ tophat2 -G GRCh38.gencode.v24.annotation.gff3 --transcriptome-index=transcriptome_data/GRCh38 GRCh38
$ tar czf GRCh38.transcriptome_data.tar.gz transcriptome_data/


$ cd reference/star_index
$ bowtie2-build -f GRCh38.fa GRCh38
$ STAR-2.5.2b/bin/Linux_x86_64_static/STAR --runMode genomeGenerate --runThreadN 4 --genomeDir ./ --genomeFastaFiles ../chr21-GRCh38.fa --sjdbGTFfile ../chr21-gencode.v24.annotation.gff3  
$ python GRCh38-gencode.v24.annotation.gtf > GRCh38.Splice_Sites.txt

Please contact if you need help determining the optimal amount of resources for running pegasus-GEM.