Skip to content

nextflow pipeline for analyzing Mycobacterium bovis genomes

License

Notifications You must be signed in to change notification settings

avantonder/bovisanalyzer

Repository files navigation

bovisanalyzer

avantonder/bovisanalyzer

Nextflow run with conda run with docker run with singularity

Introduction

bovisanalyzer is a bioinformatics best-practice analysis pipeline for nextflow pipeline for analyzing Mycobacterium bovis genomes.

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

  1. Read QC (FastQC)
  2. Calculate summary statistics for raw fastq files (fastq-scan)
  3. Index reference fasta file (BWA index)
  4. Trim reads for quality and adapter sequence (fastp)
  5. Calculate summary statistics for trimmed fastq files (fastq-scan)
  6. Assign taxonomic labels to sequence reads (Kraken 2)
  7. Re-estimate taxonomic abundance of samples analyzed by kraken (Bracken)
  8. Downsample fastq files (Rasusa)
  9. Detect drug resistance and lineage (TB-Profiler)
  10. Detect spoligotype (SpoTyping)
  11. Assign GB WGS clade (APHA-CSU)
  12. Variant calling
    1. Read mapping (BWA mem)
    2. Sort and index alignments (SAMtools)
    3. Duplicate read marking (picard)
    4. Call and filter variants (BCFtools)
    5. Convert filtered vcf to pseudogenome fasta (BCFtools)
    6. Mask each pseudogenome with zero-coverage, low coverage and poorly mapped regions (BCFtools)
    7. Calculate the percentage of the reference mapped in each pseudogenome fasta (seqtk)
  13. Create alignment from pseudogenome by concatenating fasta files having first checked that the sample sequences are high quality(calculate_fraction_of_non_GATC_bases.py)
  14. Extract variant sites from alignment (SNP-sites)
  15. Summarise fastq metrics, species composition, genotyping and mapping statistics
  16. Present QC and visualisation for raw read, alignment, assembly and variant calling results (MultiQC)

Quick Start

  1. Install Nextflow (>=22.04.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).

  3. Download taxonomic databases for Kraken 2 and Bracken (this is a large file and may take a while):

    wget ftp:https://ftp.ccb.jhu.edu/pub/data/kraken2_dbs/old/minikraken2_v1_8GB_201904.tgz
    
    tar xvfz minikraken2_v1_8GB_201904.tgz
  4. Download the pipeline and test it on a minimal dataset with a single command:

    nextflow run avantonder/bovisanalyzer -profile test,YOURPROFILE --outdir <OUTDIR>

    Note that some form of configuration will be needed so that Nextflow knows how to fetch the required software. This is usually done in the form of a config profile (YOURPROFILE in the example command above). 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.
    • Please check nf-core/configs to see if a custom config file to run nf-core pipelines already exists for your Institute. If so, you can simply use -profile <institute> in your command. This will enable either docker or singularity and set the appropriate execution settings for your local compute environment.
    • 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.
  5. An executable Python script called fastq_dir_to_samplesheet.py has been provided to auto-create an input samplesheet based on a directory containing FastQ files before you run the pipeline (requires Python 3 installed locally) e.g.

    wget -L https://raw.githubusercontent.com/avantonder/bovisanalyzer/main/bin/fastq_dir_to_samplesheet.py
    
    python fastq_dir_to_samplesheet.py <FASTQ_DIR> \
       samplesheet.csv \
       -r1 <FWD_FASTQ_SUFFIX> \
       -r2 <REV_FASTQ_SUFFIX>
    

Alternatively the samplesheet.csv file created by nf-core/fetchngs can also be used.

  1. The pipeline has been designed to work with the AF2122/97 reference and it's strongly recommended that you use this this sequence. A copy of the reference file has been provided with the pipeline. Start running your own analysis:

    • Typical command
     nextflow run avantonder/bovisanalyzer \
         -profile <docker/singularity/podman/conda/institute> \
         --input samplesheet.csv \
         --reference <REFERENCE FASTA> \
         --kraken2db minikraken2_v1_8GB \
         --outdir <OUTDIR>

Documentation

The avantonder/bovisanalyzer pipeline comes with documentation about the pipeline usage, parameters and output.

Acknowledgements

avantonder/bovisanalyzer was originally written by Andries van Tonder.

I wouldn't have been able to write this pipeline with out the tools, documentation, pipelines and modules made available by the fantastic nf-core community. In particular bovisanalyzer owes much to the excellent bactmap pipeline.

Feedback

If you have any issues, questions or suggestions for improving bovisanalyzer, please submit them to the Issue Tracker.

Citations

If you use the avantonder/bovisanalyzer pipeline, please cite it using the following doi: ZENODO_DOI

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