A Nextflow pipeline for detecting mosquito food sources from metagenomic sequencing data.
This pipeline processes paired-end FASTQ files to identify taxonomic sources of sequences. It supports two modes:
- Assembly Mode: Assembles reads into contigs using MEGAHIT.
- Merge Mode: Merges paired-end reads using VSEARCH/Seqtk.
The processed sequences are then aligned against a nucleotide database using blastn and taxonomically classified.
- Nextflow (>=21.10.6)
- Singularity (≥=3.11.4)
A CSV file containing the sample information with the following headers:
sample,r1,r2
Example:
sample,r1,r2
sample1,/path/to/sample1_R1.fastq.gz,/path/to/sample1_R2.fastq.gz
sample2,/path/to/sample2_R1.fastq.gz,/path/to/sample2_R2.fastq.gzA file mapping accession numbers to TaxIDs (e.g., nucl_gb.accession2taxid.txt).
Warning
The full nucl_gb.accession2taxid file can be very large (>2GB). Ensure you have sufficient disk space.
You can download the latest version from NCBI: https://ftp.ncbi.nlm.nih.gov/pub/taxonomy/accession2taxid/nucl_gb.accession2taxid.gz
Note: The repository includes a nucl_gb.accession2taxid_TEST.txt for testing purposes only.
It's necessary to download sequences from NCBI for using the workflow.
For testing the instalation you can run the following command:
nextflow run main.nfRun the pipeline with the following command:
nextflow run main.nf \
--input_csv samples.csv \
--db /path/to/blast_db \
--taxon_names /path/to/nucl_gb.accession2taxid.txt \
--mode 2 \
--phred_score 30 \
--min_pident 0 \
--cut_evalue 0.001| Parameter | Description | Default |
|---|---|---|
--input_csv |
Path to the samples CSV file. | ${projectDir}/assets/input.csv |
--db |
Path to the BLAST nucleotide database (fasta). | ${projectDir}/assets/db/db_TEST.fasta |
--taxon_names |
Path to the accession to TaxID mapping file. | ${projectDir}/assets/nucl_gb.accession2taxid_TEST.txt |
--mode |
1 for Assembly (MEGAHIT), 2 for Merge (VSEARCH). |
2 |
--phred_score |
Minimum Phred score for quality control. | 30 |
--min_pident |
Minimum percentage identity for BLAST hits. | 0 |
--cut_evalue |
E-value cutoff for BLAST hits. | 0.001 |
--taxonomy_db_path |
Path to directory where taxonomy SQLite DB will be stored | ${projectDir}/assets/taxonomy_db/ |
The pipeline generates results in the results/ directory:
results/fastp/{sample}/: Quality control reports (HTML/JSON) and filtered reads.results/blast/{sample}/: BLASTn alignment results.results/tax/{sample}/: Taxonomic classification CSV files.results/assembly_classification_counts.txt: A file containing assembly and classification counts, located in theresultsdirectory.
An RMarkdown script is provided in reports/taxonomic_analysis_report.Rmd to generate a summary HTML report of the findings.
- R with libraries:
readr,dplyr,purrr,ggplot2,stringr,tidyr,knitr,DT. - Note: The report requires the
assembly_classification_counts.txtfile which is automatically generated by the pipeline in theresults/folder.
You can render the report using RStudio or R command line:
Rscript -e 'rmarkdown::render("reports/taxonomic_analysis_report.Rmd", knit_root_dir = getwd(), params = list(tax_dir = "results/tax", list_unif_file = "results/assembly_classification_counts.txt", output_dir = "results/plots"))'