Skip to content

CDCgov/polkapox

Repository files navigation

PolkaPox 🦠 🧬 🪗

Nextflow run with conda run with docker run with singularity

Introduction

PolkaPox is a workflow for filtering, trimming, QC, reference-based analysis, and de novo assembly of Illumina sequencing reads from orthopoxviruses.

The pipeline is built using Nextflow, a workflow tool to run tasks across multiple compute infrastructures in a very portable manner. It uses Docker/Singularity containers making installation trivial and results highly reproducible. The Nextflow DSL2 implementation of this pipeline uses one container per process which makes it much easier to maintain and update software dependencies. Where possible, these processes have been submitted to and installed from nf-core/modules in order to make them available to all nf-core pipelines, and to everyone within the Nextflow community!

Pipeline summary

Read pre-processing

  1. Filter raw reads to capture only Orthopox Virus sequences. (Kraken + SeqTK)
  2. Trim and filter reads for adapter contamination and quality, summarize QC (Fastp)

Reference-based analyses

  1. Align reads to reference genome. (BWA)
  2. Variant calling and target gene mutation summary. (iVar)
  3. Consensus sequence generation. (iVar)

Reference-free analyses

  1. De novo assembly. (Unicycler)
  2. Calculate assembly quality metrics. (QUAST)
  3. Assembly graph resolution. (mpxv-AssemblyGraph_gfaPy.py)
  4. Align reads to assembled genome. (BWA)
  5. Correct assembly errors and ambiguities. (iVar)
  6. Quantify assembly corrections. (MUMmer)

Performance summary

  1. Visualize reads metrics and summary of software versions. (MultiQC)
  2. Compile various QC metrics. (summarize_qc.py)
graph TD
  subgraph filter_reads["Filter Reads"]
    kraken2["Kraken2<br>classify opxv reads"]
    seqtk["Seqtk<br>subsample opxv reads"]
    fastp["Fastp:<br>quality trim + filter"]
    kraken2 -- read_assignments --> seqtk
    seqtk -- subsampled_reads --> fastp
  end

subgraph ref_based["Reference-based assembly"]
  direction LR
  bwa["Bwa mem<br>map to reference"];
  samtools["Samtools<br>calculate mapping stats"];
  ivar_cons["Ivar consensus<br>generate consensus fasta"];
  ivar_var["Ivar variants<br>call variants"]
  var_filt[Filtered variants];
  bwa -- bam --> samtools
  bwa -- bam --> ivar_cons
  bwa -- bam --> ivar_var
  ivar_var-."if filter=true".->var_filt
  ref_fasta([Consensus fasta]);
  vcf([VCF]);

  ivar_cons --> ref_fasta
  ivar_var --> vcf
end

  subgraph denovo[Denovo assembly]
    %% Assign the processes (nodes)
    unicycler["Unicycler<br>Denovo assembly"]
    graph_recon["graph_reconstruct.py<br>Reconstruct assembly path"]
    bwa_denovo["Bwa mem<br>map to assembly"]
    samtools_denovo["Samtools<br>calculate mapping stats"]
    ivar_polish["Ivar consensus<br>generate consensus fasta"]
    summarize_asmb["Mummer and Quast<br>Summarize assembly"]

    %% Assign output files
    assembly_fasta(["Final assembly"])
    assembly_contigs(["Assembly contigs"])

    %% Assign the arrows
    %%fastp -- cleaned_reads --> unicycler
    unicycler -- assembly_graph --> graph_recon
    graph_recon -- fasta assembly --> bwa_denovo
    graph_recon -."if unable to reconstruct graph".->  assembly_contigs
    %%fastp -- cleaned_reads --> bwa_denovo
    bwa_denovo -- bam --> samtools_denovo
    bwa_denovo -- bam --> ivar_polish
    ivar_polish --> assembly_fasta
    graph_recon --> summarize_asmb
    assembly_fasta --> summarize_asmb
    end 

  subgraph summarize[Summarize and QC]
    direction LR
    %% Assign the processes (nodes)
    multiqc["MultiQC<br>Gather and summarize"]
    summarizeqc["Summarize_qc.py<br>Summarize all processes"]

    %% Assign output files
    sample_summary(["sample_summary.tsv<br>Summary table of all processes"])

    %% Assign the arrows
    %%assembly_fasta --> multiqc
    %%ref_fasta --> multiqc
    multiqc --> summarizeqc
    summarizeqc --> sample_summary
  end
  
  %% Connect the subworkflows
  filter_reads -- cleaned reads --> denovo
  filter_reads -- cleaned reads --> ref_based
  denovo --> summarize
  ref_based --> summarize
Loading

Quick Start

  1. Install Nextflow (>=21.10.3)

  2. Install any of Docker, Singularity (you can follow this tutorial), Podman, Shifter or Charliecloud for full pipeline reproducibility (you can use Conda both to install Nextflow itself and also to manage software within pipelines. Please only use it within pipelines as a last resort; see docs).

    • Note: if running this pipeline on CDC infrascructure (aspen, biolinux), use singularity containers.
  3. Clone this repo to your working environment:

    git clone [email protected]:CDCgov/polkapox.git
  4. Prepare your samples. You have two options:

(A) Make a sample sheet which will act as pipeline input. The samplesheet should consist of three columns with sample ID, R1 and R2 specified. If you are using single-end data, only one fastq can be specified and the pipeline will auto detect this. Example:

sample,fastq_1,fastq_2
CONTROL_REP1,AEG588A1_S1_L002_R1_001.fastq.gz,AEG588A1_S1_L002_R2_001.fastq.gz

(B) Pass a directory of FastQ files as your input and the pipeline will auto-create the samplesheet. See Usage for more details.

  1. Start running your own analysis!

    nextflow run polkapox/main.nf --input {SAMPLESHEET.csv OR input_directory} --outdir {OUTDIR} --fasta {REF.fa} -profile sge,singularity --kraken_db {PATH/TO/DB} --gff {ANNOTATION.gff} --workflow {WORKFLOW} --filter {true/false}

    note: If you do not provide --fasta, --gff, or --kraken_db, they will default to the reference and gff in the assets folder of this repo, and a kraken db hosted on the SciComp file system, respectively. If you do not specify --filter then it will default to true. See nextflow.config for details. Add --file_levels {top (default)/nested} if passing a directory as input. See usage for details.

Pipeline configuration

Note that some form of configuration will be needed so that Nextflow knows how to fetch the required software. You can chain multiple config profiles in a comma-separated string.

  • The pipeline comes with config profiles called docker, singularity, podman, shifter, charliecloud and conda which instruct the pipeline to use the named tool for software management. For example, -profile test,docker.
  • If you are using singularity, please use the nf-core download command to download images first, before running the pipeline. Setting the NXF_SINGULARITY_CACHEDIR or singularity.cacheDir Nextflow options enables you to store and re-use the images from a central location for future pipeline runs.
  • If you are using conda, it is highly recommended to use the NXF_CONDA_CACHEDIR or conda.cacheDir settings to store the environments in a central location for future pipeline runs.

Running on CDC cluster

For use on an HPC cluster (rosalind, aspen) the workflow can be run as a job by the following steps:

  1. After logging in, activate the nextflow environment:

    module load nextflow
  2. Point to the cdc.config file, which contains custom profiles for the CDC HPC clusters. Submit individual processes as jobs to the scheduler using a profile defined in cdc.config. For example, to run a job on rosalind:

    nextflow run main.nf --input {SAMPLESHEET.csv} --outdir {OUTDIR} --fasta {REF.fa} -profile rosalind,singularity --kraken_db {PATH/TO/DB} --gff {ANNOTATION.gff} -config /scicomp/reference/nextflow/configs/cdc.config
    

Documentation

Basic usage

The PolkaPox pipeline requires two inputs: [1] a samplesheet (or input directory) --input and [2] a --workflow definition. Additional details are provided in usage.

Output

Pipeline outputs are organized into sub-directories for each step in the selected workflow. All paths are relative to the top-level results directory --outdir and additional details are provided in output.

${outdir}/
  ├── bwa
  ├── fastp
  ├── final_assembly
  ├── graph_recon
  ├── graph_recon_mapping
  ├── ivar
  ├── ivar_variants
  ├── kraken2
  ├── multiqc
  ├── mummer
  ├── pipeline_info
  ├── quast
  ├── sample_summary.tsv
  ├── samtools
  ├── seqtk
  ├── unicycler
  └── variant_summaries

De novo assembly

The PolkaPox pipeline includes de novo assembly optimized for the linear genome architecture of orthopoxviruses. Additional details are provided in de novo.

Credits

Contributors:
Lynsey Kovar | Hunter Seabolt | Shatavia Morrison | Kristen Knipe
Kyle O'Connell | Ethan Hetrick | Michael Weigand | Crystal Gigante
Dhwani Batra | Ankush Gupta | Jessica Rowell | Daisy McGrath
Yesh Kulasekarapandian | Jason Caravas

Contributions and Support

If you would like to contribute to this pipeline, please see the contributing guidelines.

Citations

An extensive list of references for the tools used by the pipeline can be found in the CITATIONS.md file.

You can cite the nf-core publication as follows:

The nf-core framework for community-curated bioinformatics pipelines.

Philip Ewels, Alexander Peltzer, Sven Fillinger, Harshil Patel, Johannes Alneberg, Andreas Wilm, Maxime Ulysse Garcia, Paolo Di Tommaso & Sven Nahnsen.

Nat Biotechnol. 2020 Feb 13. doi: 10.1038/s41587-020-0439-x.


Public Domain Standard Notice

This repository constitutes a work of the United States Government and is not subject to domestic copyright protection under 17 USC § 105. This repository is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the CC0 1.0 Universal public domain dedication. All contributions to this repository will be released under the CC0 dedication. By submitting a pull request you are agreeing to comply with this waiver of copyright interest.

License Standard Notice

The repository utilizes code licensed under the terms of the Apache Software License and therefore is licensed under ASL v2 or later.

This source code in this repository is free: you can redistribute it and/or modify it under the terms of the Apache Software License version 2, or (at your option) any later version.

This source code in this repository is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache Software License for more details.

You should have received a copy of the Apache Software License along with this program. If not, see http://www.apache.org/licenses/LICENSE-2.0.html

The source code forked from other open source projects will inherit its license.

Privacy Standard Notice

This repository contains only non-sensitive, publicly available data and information. All material and community participation is covered by the Disclaimer and Code of Conduct. For more information about CDC's privacy policy, please visit http://www.cdc.gov/other/privacy.html.

Contributing Standard Notice

Anyone is encouraged to contribute to the repository by forking and submitting a pull request. (If you are new to GitHub, you might start with a basic tutorial.) By contributing to this project, you grant a world-wide, royalty-free, perpetual, irrevocable, non-exclusive, transferable license to all users under the terms of the Apache Software License v2 or later.

All comments, messages, pull requests, and other submissions received through CDC including this GitHub page may be subject to applicable federal law, including but not limited to the Federal Records Act, and may be archived. Learn more at http://www.cdc.gov/other/privacy.html.

Records Management Standard Notice

This repository is not a source of government records, but is a copy to increase collaboration and collaborative potential. All government records will be published through the CDC web site.

Additional Standard Notices

Please refer to CDC's Template Repository for more information about contributing to this repository, public domain notices and disclaimers, and code of conduct.