Commit 94fd351b authored by David Trudgian's avatar David Trudgian

Initial template workflow

This diff is collapsed.
Initial Version.
Copyright © 2016. The University of Texas Southwestern Medical Center
5323 Harry Hines Boulevard Dallas, Texas, 75390 Telephone 214-648-3111
\ No newline at end of file
This diff is collapsed.
# metadata for the example astrocyte ChipSeq workflow package
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# A unique identifier for the workflow package, text/underscores only
name: 'astrocyte_example'
# Who wrote this?
author: 'David Trudgian'
# A contact email address for questions
email: ''
# A more informative title for the workflow package
title: 'Astrocyte Example ChIPSeq Workflow'
# A summary of the workflow package in plain text
description: |
This is an example workflow package for the BioHPC astrocyte workflow system.
It implements a simple ChIPSeq analysis workflow using BWA and MACS, plus a
simple R Shiny visualization application.
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# A list of documentation file in .md format that should be viewable from the
# web interface. These files are in the 'docs' subdirectory. The first file
# listed will be used as a documentation index and is by convention
- ''
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Remember - The workflow file is always named 'workflow/main.f'
# The workflow must publish all final output into $baseDir
# A list of clueter environment modules that this workflow requires to run.
# Specify versioned module names to ensure reproducability.
- 'BWA/0.7.5'
- 'picard/1.127'
- 'macs/1.4.2'
# A list of parameters used by the workflow, defining how to present them,
# options etc in the web interface. For each parameter:
# id: The name of the parameter in the NEXTFLOW workflow
# type: The type of the parameter, one of:
# string - A free-format string
# integer - An integer
# real - A real number
# file - A single file from user data
# files - One or more files from user data
# select - A selection from a list of values
# required: true/false, must the parameter be entered/chosen?
# description: A user friendly description of the meaning of the parameter
# default: A default value for the parameter (optional)
# min: Minium value/characters/files for number/string/files types
# max: Maxumum value/characters/files for number/string/files types
# regex: A regular expression that describes valid entries / filenames
# choices: A set of choices presented to the user for the parameter.
# Each choice is a pair of value and description, e.g.
# choices:
# - [ 'myval', 'The first option']
# - [ 'myval', 'The second option']
# NOTE - All parameters are passed to NEXTFLOW as strings... but they
# are validated by astrocyte using the information provided above
- id: fastq
type: files
required: true
description: |
One or more input FASTQ files from a ChIPSeq experiment
regex: ".*(fastq|fq)"
min: 1
- id: index
type: select
- [ '/project/apps_database/iGenomes/Homo_sapiens/UCSC/hg19/Sequence/BWAIndex/genome.fa', 'UCSC hg19']
- [ '/project/apps_database/iGenomes/Homo_sapiens/UCSC/hg18/Sequence/BWAIndex/genome.fa', 'UCSC hg18']
required: true
description: |
Reference genome for BWA alignment
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Remember - The vizapp is always 'vizapp/server.R' 'vizapp/ui.R'
# The workflow must publish all final output into $baseDir
# Name of the R module that the vizapp will run against
vizapp_r_module: 'R/3.2.1-Intel'
# List of any CRAN packages, not provided by the modules, that must be made
# available to the vizapp
- shiny
- shinyFiles
# # List of any Bioconductor packages, not provided by the modules, that must be made
# available to the vizapp
- chipseq
\ No newline at end of file
# Astrocyte ChIPSeq Example
This workflow carries out a simple ChIPSeq alignment and peak calling using
*BWA* and *MACS 1.4*. One or more FASTQ files containing reads from a ChIPSeq
experiment can be selected as input. For each file this workflow:
1. Aligns the reads to a selected genomic reference using BWA aln.
2. Converts BWA's native output into SAM format.
3. Sorts and indexes the SAM file, and converts into binary BAM format using
4. Performs ChIPSeq peak calling using MACS 1.4, with simple `--no-model` and
`--single-profile` options. Wig files are produced as well as standard
spreadsheet output.
## Workflow Parameters
* **fastq** - Choose one or more ChIPSeq read files to process. All should be
ChIP files - i.e. there is no control. Each file will be processed as an
independent sample.
* **index** - Choose a genomic index to use as a reference for alignment of
ChIPSeq reads. A variety of options are available for human and murine
## Visualization App
The example visualization app demonstrates integration of Shiny into astrocyte
by implementing a simple file chooser that access the output of the workflow.
## Test Data
The test data directory of this workflow package includes a subset of reads from
Chr19 for a CTCF ChIP in a G1E cell line.
Originally made available as example data for the Galaxy ChIP-Seq exercises
at []
## Credits
This example worklow is derived from original scripts kindly contributed by the
Xu lab, Children's Research Instiute at UT Southwestern.
# This example implements a simple file browser for accessing results.
# Results are available in the directory specified by the outputDir environment
# variable, red by Sys.getenv
rootdir <- Sys.getenv('outputDir')
shinyServer(function(input, output, session) {
# The backend for a simple file chooser, restricted to the
# rootdir we obtained above.
# See
shinyFileChoose(input, 'files', roots=c('workflow'=rootdir), filetypes=c('', 'bed', 'xls','wig'), session=session)
# Application title
titlePanel("Astrocyte Example"),
helpText("This is a minimal example, demonstrating how
a Shiny visualization application can access the output of a workflow.
Here we provide a file browser using the shinyFiles package. Real
Astrocyte vizapps would provide custom methods to access and visualize
helpText("The workflow output is in the directory set in the
outputDir environment variable. this can be retrieved in R with the
command Sys.getenv('outputDir')"),
# A simple file browser within the workflow output directory
# See
shinyFilesButton('files', label='Browse workflow output', title='Please select a file', multiple=FALSE)
\ No newline at end of file
* Copyright (c) 2016. The University of Texas Southwestern Medical Center
* This file is part of the BioHPC Workflow Platform
* Example ChIP-Seq analysis script, demonstrating the BioHPC Workflow Platform
* @authors
* David Trudgian <>
// Path to an input file, or a pattern for multiple inputs
// Note - $baseDir is the location of this workflow file
params.fastq = "$baseDir/../test_data/*.fastq"
// Path to the BWA Index (.fa file) that we are using for the analysis
params.index = "/project/apps_database/iGenomes/Homo_sapiens/UCSC/hg19/Sequence/BWAIndex/genome.fa"
// First, get the list of fastqs, might be using a pattern matching multiple
fastqs = Channel.fromPath(params.fastq)
// Now find the path to the BWA index directory
index_path = file(params.index).parent
// And get the name of the actual index inside that directory
index_name = file(params.index).name
// bwa_aln
// Run BWA aln on a fastq file, to produce sai output
// Input - fastq_file is taken from the fastq channel
// - BWA index at $index_path/$index_name
// Output - pair of fastq & generated sai file into the alignments channel
process bwa_aln {
// Tell Nextflow we will use 32 cpus here for BWA
cpus 32
file fastq_file from fastqs
set file(fastq_file), file("${}.sai") into alignments
module load BWA/0.7.5
bwa aln $index_path/$index_name -t 32 $fastq_file > "${}.sai"
// bwa_aln
// Run bwa samse to produce sam.gz from an sai alignment
// Input - pair of fastq file and corresponding sai file, from alignments channel
// Output - .sam.gz into the samfiles channel, and baseDir/output
process bwa_samse {
// bwa samse will use a single cpu core
cpu 1
// Publish the outputs we create here into the workflow output directory
publishDir "$baseDir/output", mode: 'copy'
set file(fastq_file), file(sai_file) from alignments
file "${}.sam.gz" into samfiles
module load BWA/0.7.5
bwa samse -r "@RG\tID:${}\tLB:${}\tSM:${}\tPL:ILLUMINA" $index_path/$index_name\
$sai_file $fastq_file | gzip > "${}.sam.gz"
// sam2bam
// Convert SAM file to BAM file, sorting by co-ordinate and indexing
// Input - a sam file, (possibly gzipped) from the samfile channel
// Output - .sam.gz into the samfiles channel, and baseDir/output
process sam2bam {
// Tell Nextflow picard will only use one cpu.
// We are allocating 32GB to java though, so tell
// Nextflow so it can assign the task appropriately.
cpus 1
memory '32GB'
// Publish the outputs we create here into the workflow output directory
publishDir "$baseDir/output", mode: 'copy'
file sam_file from samfiles
file "${}.bam" into bamfiles
module add picard/1.127
java -Xmx32G -jar \$PICARD/picard.jar SortSam \
INPUT="${sam_file}" \
OUTPUT="${}.bam" \
SORT_ORDER=coordinate \
// macs
// Peak calling on a bam using MACS 1.4
// Input - a bam file, from the bamfiles channel
// Output - various wig and bed into baseDir/output
process macs14 {
// Publish the outputs we create here into the workflow output directory
publishDir "$baseDir/output", mode: 'copy'
file bam_file from bamfiles
file "${bam_file}_bwa_nomodel_MACS_wiggle"
file "${bam_file}_bwa_nomodel_peaks.bed"
file "${bam_file}_bwa_nomodel_peaks.xls"
file "${bam_file}_bwa_nomodel_summits.bed"
module add macs/1.4.2
macs14 -t ${bam_file} \
--name ${bam_file}_bwa_nomodel \
--nomodel \
--wig \
--single-profile \
-f BAM
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment