This repository that contains the core logic for processing mycobacterial sequencing data. It outputs JSON files containing data on species, lineage, and AMR.
The workflow consist of multiple steps:
| Step | Main Software | Notes | Repository(ies) |
|---|---|---|---|
| Gatekeeper | kraken2 | Quality checking and read filtering | gatekeeper_pipeline |
| Speciation | minimap2, samtools, mykrobe | Competitive Mapping and Lineage Calling (mykrobe) | lineagecalling_pipeline competitivemapping_pipeline |
| Assembly | clockwork, minos, rundial | Variant calling | clockwork_pipeline rundial |
| Resistance Prediction | gnomonicus | Variants, mutations and effects of a specified (minos) VCF file | tb-predict-pipeline |
| Relatedness | Find Neighbour 5 | SNP distance calculation | fn5_pipeline |
| Summary | None | Summarises outputs into a JSON file | summary_pipeline |
A machine readable list of the repositories required to run the full pipeline is included in this repository. Useful technical details, e.g. thresholds, may be found in the supplementary information to this paper Characterizing the performance of an antibiotic resistance prediction tool, gnomonicus, using a diverse test set of 2,663 Mycobacterium tuberculosis samples.
Pipeline development and maintenance is conducted by an internal team. We can't accept Pull Requests at the moment. If you find a bug or have a feature suggestion, or have difficulty running the code please raise an Issue. Try and provide as much detail as possible, and be nice!
- Linux or WSL2 (we use Ubuntu)
- make (usually included with Linux)
- jq
- AWS CLI to make it easier to download reference data
- Docker
- Nextflow
- Reference data
- Mycobacterial read data
Doing this is going to require some knowledge of the command line and Nextflow. The code is intended to run on a Kubernetes cluster, and this complicates local running somewhat. We don't recommend trying to run this code on a non-local Executor.
You will first need to clone this repository https://github.com/softwaremmm/gpas-tb-workflow.git and cd gpas-tb-workflow.
We recommand running git checkout 2.6.1 to fix the version being run to an official release. 2.5.4 is the earliest version that will install neatly.
make is used to simplify installation. It will:
- Clone all of the repositories needed for the full pipeline
- Create a directory structure to hold reference data
- Download the necessary reference data. There's over 1GB of this, plus the kraken2 index.
Use make install-small-kraken to install with an 8GB kraken2 index or make install-big-kraken to install with the full kraken2 index used in production. The computer used to run the software needs RAM in excess of the kraken2 index size.
The pipeline has two Nextflow profiles, associated with running on a laptop or VM (local) or on Kubernetes (kubernetes).
There are two ways of specifying input data - one is a conventional Nextflow
approach, the other mimics the way in which input data is presented to the pipeline on Kubernetes.
For development the conventional approach is usually more useful.
This pipeline is known to run with Nextflow 26.10.5.
A specific version can be used for running by prefixing the command with NXF_VER=26.10.5 nextflow run ....
If you don't have the known compatible version, you will see a warning.
Input and output directories are specified as shown below, which supports running batches of samples. When running locally -profile local should be used.
nextflow run . -profile local --sample_input_dir <path/to/input_dir> --seq_platform <illumina/ont> -output-dir </abs/path/to/output_dir>By default it will look for files in the input directory based on the following params:
params.input_paired_suffix = "*_{1,2}.fastq.gz"params.input_single_suffix = "*.fastq.gz"but these can be overriden. Note that file ending must be.fastq.gzor.fq.gz.
nextflow run ... --input_paired_suffix "tb_sample*_{1,2}.fq.gz"You can also use --publish_dir <directory> to save all process outputs to provided directory. This is rarely needed.
You may need to reduce memory requirements for kraken2 if using smaller index e.g.
--kraken2_mem 9GBIf you're looking for data to try it out with, you could use make get-example-inputs to download some files from the ENA.
A concrete example of a command to run the pipeline with this data would then be:
NXF_VER=26.10.5 nextflow run . -profile local --sample_input_dir data/inputs/illumina --seq_platform illumina --kraken2_mem 9GB -output-dir output/(The `pwd`/output is a trick to get round the need for an absolute path)
To specify a clair3 model for ONT variant calling, set the param basecalling_model to a value from this list https://github.com/softwaremmm/rundial/blob/develop/src/dorado_to_clair3_model.rs (left side).
If this parameter is not specified, bcftools, the default, is used for variant calling.
By default when running locally, relatedness will be carried out on all sample in your batch. There is a further cache at data/relatedness/tuberculosis which will enable incremental relatedness results. For example, processing samples in batch 1 populates distances.txt with all distances within batch 1, then processing samples in batch 2 will populate distances.txt with all distances in batch 2, as well as all distances between batch 1 and 2. To keep the relatedness to just within batch, please remove existing data from data/relatedness/tuberculosis between each run.
If you have existing fastas you would like to add for comparison to your batches, please follow the instructions to reference compress your samples here then copy each .fn6 file to data/relatedness/tuberculosis.
The pipeline as of version 2.6.0 is capable of reference-based assembly for a small range of NTMs, where enough reads are found. This is not routinely tested and is mainly intended for internal development use. To turn on, use -profile local,ntms instead of -profile local.
The pipeline outputs several large files and FASTQ files by default. To reduce the amount of large files and stop output of FASTQs use -profile local,reduced_outputs.
For permanant setting of Nextflow version for all pipelines on your computer, which avoids having to run Nextflow with the
NXF_VER=24.10.4 prefix, you can add a line to your .bashrc or .zshrc something like:
echo 'export NXF_VER=24.10.4' >> ~/.bashrc
or
echo 'export NXF_VER=24.10.4' >> ~/.zshrc
If compatibility with more recent versions of nextflow is important to you, please raise an issue.