Skip to content

Commit

Permalink
Merge branch 'CW-1258-params-help' into 'dev'
Browse files Browse the repository at this point in the history
CW-1258 - Extra help for wf params

See merge request epi2melabs/workflows/wf-mpx!17
  • Loading branch information
mattdmem committed Nov 30, 2022
2 parents 7c42282 + 270ccea commit 9770882
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 90 deletions.
14 changes: 8 additions & 6 deletions README.md
@@ -1,25 +1,27 @@
# wf-mpx | Monkeypox Virus Metagenomic Assembly
# wf-mpx | Mpox Virus Metagenomic Assembly

This repository contains a [nextflow](https://www.nextflow.io/) workflow for the
assembly of reads originating from the Monkeypox virus obtained through
assembly of reads originating from the mpox virus obtained through
Oxford Nanopore metagenomic sequencing.
## Introduction

This workflow provides a simple way to analyse Monkeypox sequencing data; taking
This workflow provides a simple way to analyse mpox sequencing data; taking
raw Oxford Nanopore Technologies reads and creating a draft consensus and assembly.

We expect data to be generated from a mixed population sample hence the use of the term "metagenomics".

> No trimming of sequences is carried out so be vigilant when using targeted data.
Using community develped tools this workflow:
Using community-develped tools, this workflow:
* Maps reads to a reference genome (`minimap2`)
* Assesses coverage
* Discards reads not mapping to the chosen reference
* Calls variants with resepect to reference (`medaka`)
* Calls variants with resepect to the reference (`medaka`)
* Filters variants with <20x coverage
* Creates a draft consensus (`bcftools`)
* Creats a de-novo assembly (`flye` & `medaka`)

More information can be found in this [blog post](https://labs.epi2me.io/basic-monkeypox-workflow).
More information can be found in this [blog post](https://labs.epi2me.io/basic-mpox-workflow).
## Quickstart

The workflow uses [nextflow](https://www.nextflow.io/) to manage compute and
Expand Down
4 changes: 2 additions & 2 deletions docs/header.md
@@ -1,5 +1,5 @@
# wf-mpx | Monkeypox Virus Metagenomic Assembly
# wf-mpx | Mpox Virus Metagenomic Assembly

This repository contains a [nextflow](https://www.nextflow.io/) workflow for the
assembly of reads originating from the Monkeypox virus obtained through
assembly of reads originating from the mpox virus obtained through
Oxford Nanopore metagenomic sequencing.
10 changes: 6 additions & 4 deletions docs/intro.md
@@ -1,17 +1,19 @@
## Introduction

This workflow provides a simple way to analyse Monkeypox sequencing data; taking
This workflow provides a simple way to analyse mpox sequencing data; taking
raw Oxford Nanopore Technologies reads and creating a draft consensus and assembly.

We expect data to be generated from a mixed population sample hence the use of the term "metagenomics".

> No trimming of sequences is carried out so be vigilant when using targeted data.
Using community develped tools this workflow:
Using community-develped tools, this workflow:
* Maps reads to a reference genome (`minimap2`)
* Assesses coverage
* Discards reads not mapping to the chosen reference
* Calls variants with resepect to reference (`medaka`)
* Calls variants with resepect to the reference (`medaka`)
* Filters variants with <20x coverage
* Creates a draft consensus (`bcftools`)
* Creats a de-novo assembly (`flye` & `medaka`)

More information can be found in this [blog post](https://labs.epi2me.io/basic-monkeypox-workflow).
More information can be found in this [blog post](https://labs.epi2me.io/basic-mpox-workflow).
26 changes: 12 additions & 14 deletions main.nf
Expand Up @@ -32,33 +32,31 @@ process summariseReads {

process alignReads {
label "wfmpx"
cpus params.threads
cpus params.align_threads
input:
tuple val(sample_id), val(type), path(sample_fastq), path(sample_stats)
path reference
output:
tuple val(sample_id), val(type), path("${sample_id}.bam"), path("${sample_id}.bam.bai"), emit: alignment
tuple path("${sample_id}.bamstats"), path("${sample_id}.bam.summary"), emit: bamstats
"""
mini_align -i ${sample_fastq} -r ${reference} -p ${sample_id} -t $task.cpus -m
stats_from_bam -o ${sample_id}.bamstats -s ${sample_id}.bam.summary -t $task.cpus ${sample_id}.bam
mini_align -i ${sample_fastq} -r ${reference} -p ${sample_id} -t ${params.align_threads} -m
stats_from_bam -o ${sample_id}.bamstats -s ${sample_id}.bam.summary -t ${params.align_threads} ${sample_id}.bam
#Keep only mapped reads going forward
#samtools view -b -F 4 ${sample_id}_all.bam > ${sample_id}.bam
"""
}

process coverageCalc {
depth_threads = {params.threads >= 4 ? 4 : params.threads}
label "wfmpx"
cpus depth_threads
cpus 1
input:
tuple val(sample_id), val(type), path("${sample_id}.bam"), path("${sample_id}.bam.bai")
path reference
output:
tuple path("${sample_id}.depth.txt")
path "${sample_id}.depth.txt"
"""
#mosdepth --fast-mode --by 10 -t $task.cpus ${sample_id} ${sample_id}.bam
coverage_from_bam -s 1 -p ${sample_id} ${sample_id}.bam
mv ${sample_id}*.depth.txt ${sample_id}.depth.txt
"""
Expand All @@ -68,7 +66,7 @@ process coverageCalc {

process medakaVariants {
label "wfmpx"
cpus params.threads
cpus 2
input:
tuple val(sample_id), val(type), path("${sample_id}.bam"), path("${sample_id}.bam.bai")
path reference
Expand All @@ -89,7 +87,7 @@ process medakaVariants {

process makeConsensus {
label "wfmpx"
cpus params.threads
cpus 1
input:
tuple val(sample_id), val(type), path("${sample_id}.annotate.filtered.vcf")
path reference
Expand All @@ -107,7 +105,7 @@ process makeConsensus {

process flyeAssembly {
label "wfmpx"
cpus params.threads
cpus params.assembly_threads
input:
tuple val(sample_id), val(type), path("${sample_id}.bam"), path("${sample_id}.bam.bai")
path reference
Expand All @@ -116,11 +114,11 @@ process flyeAssembly {
script:
"""
samtools bam2fq ${sample_id}.bam > ${sample_id}_restricted.fastq
flye --nano-raw ${sample_id}_restricted.fastq -g 197k -t ${params.threads} --meta -o flye
flye --nano-raw ${sample_id}_restricted.fastq -g 197k -t ${params.assembly_threads} --meta -o flye
# polish assembly with medaka
medaka_consensus -i ${sample_id}_restricted.fastq -t ${params.threads} -d flye/assembly.fasta ${params.medaka_options}
medaka_consensus -i ${sample_id}_restricted.fastq -t ${params.assembly_threads} -d flye/assembly.fasta ${params.medaka_options}
minimap2 -ax map-ont ${reference} medaka/consensus.fasta | samtools view -bh - | samtools sort - > ${sample_id}_assembly_mapped.bam
Expand Down Expand Up @@ -173,7 +171,7 @@ process makeReport {
output:
path "wf-mpx-*.html"
script:
report_name = "wf-mpx-" + params.report_name + '.html'
report_name = "wf-mpx-report.html"
"""
report.py $report_name \
Expand Down Expand Up @@ -273,7 +271,7 @@ workflow {
samples = fastq_ingress([
"input":params.fastq,
"sample":params.sample,
"sample_sheet":params.sample_sheet])
"sample_sheet":null])

pipeline(samples, params._reference, params._genbank)
output(pipeline.out.results)
Expand Down
8 changes: 4 additions & 4 deletions nextflow.config
Expand Up @@ -16,16 +16,16 @@ params {
fastq = null
out_dir = "output"
sample = null
sample_sheet = null
wfversion = "v0.0.5"
threads = 4
align_threads = 4
assembly_threads = 4
assembly = true
medaka_options = null
min_coverage = 20
aws_image_prefix = null
aws_queue = null
report_name = "report"
disable_ping = false
analyse_unclassified = false

reference = null

Expand All @@ -48,7 +48,7 @@ manifest {
name = 'epi2me-labs/wf-mpx'
author = 'Oxford Nanopore Technologies'
homePage = 'https://github.com/epi2me-labs/wf-mpx'
description = 'Monkeypox metagenomics assembly workflow.'
description = 'Mpox metagenomics assembly workflow.'
mainScript = 'main.nf'
nextflowVersion = '>=20.10.0'
version = 'v0.0.5'
Expand Down

0 comments on commit 9770882

Please sign in to comment.