Consensus sequence construction from ONT long amplicons using USEARCH and medaka - Snakemake workflow
A mini snakemake pipeline for batch constructing consensus sequences from long nanopore amplicons with medaka for a set of samples.
The pipeline includes the following steps:
usearch -cluster_fast
for clustering read sequences to find centroid with the largest cluster size (i.e. draft sequence)mini_align
for aligning the reads to a draft/intermediate sequencemedaka consensus
for running consensus algorithm across assembly regionsmedaka stitch
for collating results from step 3 to create consensus sequence
Steps 2-4 (wrapped up in medaka_polish.sh
) are the medaka polishing steps, and will be iterated for four rounds as advised by medaka documentation. This snakemake script will automatically install medaka package (defined in envs/medaka.yaml
) in your working directory without requiring admin priviledges. The final consensus from the 4th polishing round will be renamed as *.final_consensus.fa.
At the end of pipeline, the final consensus sequences of all samples will be merged into a single FASTA file (all_samples.final_consensus.fa
) in the output directory.
git clone https://github.com/ritatam/snakemake_ont_consensus_build.git
cd snakemake_ont_consensus_build
Paths and parameters can be edited in config.yaml
.
input_reads_dir
: Input directory containing all the *.fastq amplicon read files (e.g. s_cerevisiae.fastq, a_flavus.fastq, ...) to be processed simultaneously (via snakemake)output_dir
: Output directory to store draft and polished consensus sequences per sample (as subdirectories). All the intermediate files will be stored in the output sample/polish/intermediate_files directory.usearch_path
: Path to the USEARCH binary. Note: This has been already configured to use the USEARCH binary in the repo's external_program folder, so user will not need to download it independently.usearch_id
: Minimum sequence identity for USEARCH read clustering, ranging between 0.0 and 1.0.medaka_model
: Medaka model for consensus polishing, based on the basecaller used. See medaka documentation for details.threads
: Number of threads to use in medaka polishing.
Install the required conda environemnt without running the pipeline. Subsequent runs with flag --use-conda
will utilise the local environment stored in your working directory (/.snakemake/conda
) without requiring internet connection.
snakemake --use-conda --conda-create-envs-only -c1
Dry-run the pipeline to print the commands and the corresponding i/o files, without running the pipeline.
snakemake --use-conda -np
Run the pipeline and specify number of cores to use (e.g. 8 cores)
snakemake --use-conda -c8