wf-tb-amr documentation

By EPI2ME Labs
3 min read

Mycobacterium tuberculosis workflow

Mycobacterium tuberculosis workflow for multiplexed Nanopore sequencing data.

Introduction

wf-tb-amr is a workflow for determining the antibiotic resistance of Mycobacterium tuberculosis targeted sequencing samples. The workflow handles multiplexed sequencing runs and provides clear and simple reports summarising the predicted resistance profile of each sample according to genetic variants discovered.

Compute requirements

Recommended requirements:

  • CPUs = 16
  • Memory = 32GB

Minimum requirements:

  • CPUs = 8
  • Memory = 16GB

Approximate run time: 5 minutes per sample

ARM processor support: True

Install and run

These are instructions to install and run the workflow on command line. You can also access the workflow via the EPI2ME Desktop application.

The workflow uses Nextflow to manage compute and software resources, therefore Nextflow will need to be installed before attempting to run the workflow.

The workflow can currently be run using either Docker or Singularity to provide isolation of the required software. Both methods are automated out-of-the-box provided either Docker or Singularity is installed. This is controlled by the -profile parameter as exemplified below.

It is not required to clone or download the git repository in order to run the workflow. More information on running EPI2ME workflows can be found on our website.

The following command can be used to obtain the workflow. This will pull the repository in to the assets folder of Nextflow and provide a list of all parameters available for the workflow as well as an example command:

nextflow run epi2me-labs/wf-tb-amr --help

To update a workflow to the latest version on the command line use the following command:

nextflow pull epi2me-labs/wf-tb-amr

A demo dataset is provided for testing of the workflow. It can be downloaded and unpacked using the following commands:

wget https://ont-exd-int-s3-euwst1-epi2me-labs.s3.amazonaws.com/wf-tb-amr/wf-tb-amr-demo.tar.gz
tar -xzvf wf-tb-amr-demo.tar.gz

The workflow can then be run with the downloaded demo data using:

nextflow run epi2me-labs/wf-tb-amr \
--fastq 'wf-tb-amr-demo/fastq' \
--sample_sheet 'wf-tb-amr-demo/sample_sheet.csv' \
-profile standard

For further information about running a workflow on the command line see https://labs.epi2me.io/wfquickstart/

This workflow is designed to take input sequences that have been produced from Oxford Nanopore Technologies devices.

Find related protocols in the Nanopore community.

Input example

This workflow accepts FASTQ files as input.

The FASTQ input parameter for this workflow accepts the path to a directory containing one level of sub-directories which in turn contain FASTQ files. The data is assumed to be multiplexed with the names of the sub-directories as barcodes. A sample sheet can be provided with --sample_sheet.

input_directory
├── barcode01
│ ├── reads0.fastq
│ └── reads1.fastq
├── barcode02
│ ├── reads0.fastq
│ ├── reads1.fastq
│ └── reads2.fastq
└── barcode03
└── reads0.fastq

Input parameters

Input Options

Nextflow parameter nameTypeDescriptionHelpDefault
fastqstringFASTQ files to use in the analysis.This accepts one of three cases: (i) the path to a single FASTQ file; (ii) the path to a top-level directory containing FASTQ files; (iii) the path to a directory containing one level of sub-directories which in turn contain FASTQ files. In the first and second case, a sample name can be supplied with --sample. In the last case, the data is assumed to be multiplexed with the names of the sub-directories as barcodes. In this case, a sample sheet can be provided with --sample_sheet.
analyse_unclassifiedbooleanAnalyse unclassified reads from input directory. By default the workflow will not process reads in the unclassified directory.If selected and if the input is a multiplex directory the workflow will also process the unclassified directory.False

Sample Options

Nextflow parameter nameTypeDescriptionHelpDefault
sample_sheetstringA CSV file used to map barcodes to sample aliases. The sample sheet can be provided when the input data is a directory containing sub-directories with FASTQ files.The sample sheet is a CSV file with, minimally, columns named barcode and alias. Extra columns are allowed. A type column is required for this workflow and should have one of the following values; test_sample, positive_control, no_template_control.
samplestringA single sample name for non-multiplexed data. Permissible if passing a single .fastq(.gz) file or directory of .fastq(.gz) files.

Output Options

Nextflow parameter nameTypeDescriptionHelpDefault
out_dirstringDirectory for output of all workflow results.output

Reference Options

Nextflow parameter nameTypeDescriptionHelpDefault
referencestringNCBI accession for reference genome.By default the workflow uses NC_000962.3. WARNING: If you change this parameter but don’t alter the variant database, Genbank file, and the amplicon BED (all generated for NC_000962.3) to match, then the behaviour of the workflow is unlikely to be as expected.
amplicons_bedstringThe location of the amplicons for the assay.A BED file describing the location of the amplicons used to generate the data to be processed by this workflow. Based on NC_000962.3.
variant_dbstringVariant database in VCF format.A list of variants, in VCF format, that this assay will genotype. SNPs only.
genbankstringGenbank file for organism of interest.Genbank file used for variant annotation, defaults to NC000962.3 annotations.

Advanced Options

Nextflow parameter nameTypeDescriptionHelpDefault
align_threadsnumberNumber of CPU threads to use per alignment task.The total CPU resource used by the workflow is constrained by the executor configuration.4
mpileup_threadsnumberNumber of CPU threads to use per mpileup task.The total CPU resource used by the workflow is constrained by the executor configuration.4
mafnumberMinimum mutant allele frequency to consider.By default the workflow will filter any variant which is present at less than 10% allele frequency (0.1). Change this parameter to alter this filtering behaviour. Minimum is set at 1%.0.1
downsampleintegerNumber of reads to downsample to in each direction, leave empty for no downsampling.Downsampling can help with run times without significantly impacting the result of your analysis. By default no downsampling is performed, but you can specify the coverage to downsample to in each direction here, to a minimum of 100.
minimum_read_supportintegerThe minimum number of reads to consider for a variant call on each strand.By default the workflow expects a minimum of 5 reads on each strand supporting a variant. This is to ensure that when using the maf, very low coverage regions do not contribute to potentially false positive variant calls.5
ntc_thresholdstringComma separated string of x,y - where x is the read count threshold and y is the number of amplicons i.e. 20,3 - fail is more than 20 reads in more than 3 amplicons.20,3
sample_thresholdstringComma separated string of x,y - where x is the read count threshold and y is the number of amplicons. For example 20,8 means a sample will pass only if at least 20 reads were detected in each of at least 8 amplicons.-20,8
positive_thresholdstringComma separated string of x,y - where x is the read count threshold and y is the number of amplicons i.e. 20,2 - fail is less than 20 reads in less than 2 amplicons.-20,2
strand_biasintegerSet a threshold for strand bias filtering.Strand bias is represented as a Phred scaled p-value from a Fisher’s exact test, with a value close to 0 being preferable.1000
report_configstringReport configuration file.The report can be configured to help with translation. See report_config.eng.json in the primer scheme directory. Here you can provide a path to your own report configuration file.

Outputs

Output files may be aggregated including information for all samples or provided per sample. Per-sample files will be prefixed with respective aliases and represented below as {{ alias }}.

TitleFile pathDescriptionPer sample or aggregated
Workflow report./wf-tb-amr-report.htmlThe report for all samples in the workflow runaggregated
Workflow CSV results summary./wf-tb-amr-report.csvThe CSV summary of the results of the workflowaggregated
Alignment./{{ alias }}.bamAligned reads for the sample in BAM formatper-sample
Alignment index./{{ alias }}.bam.baiAn index file for the alignment in BAI formatper-sample
Variants./{{ alias }}.final.vcfCalled, annotated variants for the sample.per-sample
Per sample report./{{ alias }}_report.htmlThe report for a single sampleper-sample

Pipeline overview

1. Concatenates input files and generate per read stats.

The fastcat/bamstats tool is used to concatenate multifile samples to be processed by the workflow. It will also output per read stats including average read lengths and qualities.

2. Align reads to NC_000962.3 reference genome

minimap2 is used to align reads from the samples to the Mycobacterium tuberculosis reference genome FASTA (NC_000962.3). This step also discards unmapped reads and generates statistics from the resulting BAM file.

3. Downsample reads

Downsampling is off by default. This optional step downsamples the data to a specified number of reads.

4. Call variants using mpileup

The bcftools mpileup tool is used to determine base composition of pre-defined variants.

5. Phase variants

The whatshap tool is used to phase variants. Codon numbers are then added using vcf-annotator, and the results processed to ensure that phased variants are correctly annotated.

6. Report results

The workflow outputs an HTML report with overall results for all samples in the run, indivdual sample HTML reports, and a summary CSV file.

Troubleshooting

  • If the workflow fails please run it with the demo dataset to ensure the workflow itself is working. This will help us determine if the issue is related to the environment, input parameters or a bug.
  • See how to interpret some common nextflow exit codes here.

FAQ’s

If your question is not answered here, please report any issues or suggestions on the github issues page or start a discussion on the community.

See the EPI2ME website for lots of other resources and blog posts.


Share

EPI2ME Labs

EPI2ME Labs

Senior Button Pusher

Quick Links

TutorialsWorkflowsOpen DataContact

Social Media

© 2020 - 2024 Oxford Nanopore Technologies plc. All rights reserved. Registered Office: Gosling Building, Edmund Halley Road, Oxford Science Park, OX4 4DQ, UK | Registered No. 05386273 | VAT No 336942382. Oxford Nanopore Technologies, the Wheel icon, EPI2ME, Flongle, GridION, Metrichor, MinION, MinIT, MinKNOW, Plongle, PromethION, SmidgION, Ubik and VolTRAX are registered trademarks of Oxford Nanopore Technologies plc in various countries. Oxford Nanopore Technologies products are not intended for use for health assessment or to diagnose, treat, mitigate, cure, or prevent any disease or condition.