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

Initial template workflow

parents
This diff is collapsed.
2016-02-29
----------
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
#
# -----------------------------------------------------------------------------
# BASIC INFORMATION
# -----------------------------------------------------------------------------
# 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: 'biohpc-help@utsouthwestern.edu'
# 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.
# -----------------------------------------------------------------------------
# DOCUMENTATION
# -----------------------------------------------------------------------------
# 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 index.md by convention
documentation_files:
- 'index.md'
# -----------------------------------------------------------------------------
# NEXTFLOW WORKFLOW CONFIGURATION
# -----------------------------------------------------------------------------
# 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.
workflow_modules:
- '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:
#
# REQUIRED INFORMATION
# 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
#
# OPTIONAL INFORMATION
# 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
#
# SELECT TYPE
# 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
workflow_parameters:
- 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
choices:
- [ '/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
# -----------------------------------------------------------------------------
# SHINY APP CONFIGURATION
# -----------------------------------------------------------------------------
# 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
vizapp_cran_packages:
- shiny
- shinyFiles
# # List of any Bioconductor packages, not provided by the modules, that must be made
# available to the vizapp
vizapp_bioc_packages:
- 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
Picard.
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
samples.
## 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 [https://usegalaxy.org/u/james/p/exercise-chip-seq]
## 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.
library(shiny)
library(shinyFiles)
# 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 https://github.com/thomasp85/shinyFiles
shinyFileChoose(input, 'files', roots=c('workflow'=rootdir), filetypes=c('', 'bed', 'xls','wig'), session=session)
})
library(shiny)
library(shinyFiles)
shinyUI(fluidPage(
verticalLayout(
# Application title
titlePanel("Astrocyte Example"),
wellPanel(
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
output."),
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 https://github.com/thomasp85/shinyFiles
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 <David.Trudgian@UTSouthwestern.edu>
*
*/
// Path to an input file, or a pattern for multiple inputs
// Note - $baseDir is the location of this workflow file main.nf
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
input:
file fastq_file from fastqs
output:
set file(fastq_file), file("${fastq_file.name}.sai") into alignments
"""
module load BWA/0.7.5
bwa aln $index_path/$index_name -t 32 $fastq_file > "${fastq_file.name}.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'
input:
set file(fastq_file), file(sai_file) from alignments
output:
file "${fastq_file.name}.sam.gz" into samfiles
"""
module load BWA/0.7.5
bwa samse -r "@RG\tID:${fastq_file.name}\tLB:${fastq_file.name}\tSM:${fastq_file.name}\tPL:ILLUMINA" $index_path/$index_name\
$sai_file $fastq_file | gzip > "${fastq_file.name}.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'
input:
file sam_file from samfiles
output:
file "${sam_file.name}.bam" into bamfiles
"""
module add picard/1.127
java -Xmx32G -jar \$PICARD/picard.jar SortSam \
INPUT="${sam_file}" \
OUTPUT="${sam_file.name}.bam" \
SORT_ORDER=coordinate \
VALIDATION_STRINGENCY=LENIENT \
CREATE_INDEX=true
"""
}
// 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'
input:
file bam_file from bamfiles
output:
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