samntrek

Locally deployable search tool to explore local Salmonella epidemiology in a global context

https://github.com/jimmyliu1326/samntrek

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 7 DOI reference(s) in README
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.0%) to scientific vocabulary

Keywords

bioinformatics nextflow
Last synced: 6 months ago · JSON representation ·

Repository

Locally deployable search tool to explore local Salmonella epidemiology in a global context

Basic Info
  • Host: GitHub
  • Owner: jimmyliu1326
  • License: mit
  • Language: Nextflow
  • Default Branch: main
  • Homepage:
  • Size: 694 KB
Statistics
  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 2
Topics
bioinformatics nextflow
Created over 1 year ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog Contributing License Citation

README.md

Nextflow run with docker run with singularity

SamnTrek: Locally deployable search tool to explore local Salmonella epidemiology in a global context

SamnTrek enables rapid integration of NCBI Pathogen Detection (NPD) data to place local Salmonella strains in a global context. Specifically, given any Salmonella genomes, SamnTrek identifies closely matching strains in NPD and constructs a phylogeny to contextualize the (local) query sequences with close matching (global) hits. The sequence similarity search algorithm has been optimized extensively, rendering it possible to search through >400,000 Salmonella genomes in minutes using minimal resources.

workflow

Quick start

This section is dedicated to those who cannot be bothered with the fine details and are simply seeking to get the pipeline up and running asap.

Minimal prerequisites

  • One of the supported containerization platforms installed: Singularity or Docker
  • Nextflow >= v23.0.0
  • Git
  • Internet connection

Once all the prerequisites have been installed, run the following command in the terminal to verify all dependencies have been set up correctly:

bash nextflow run jimmyliu1326/SamnTrek -r [version] --help

[!NOTE] Replace [version] with the latest release tag, which can be found here

If successful, the complete pipeline help message will be printed to screen.

Configuring the input samplesheet

The input sequence data must be formatted as a .csv file containing two columns: sample and genome

  • The sample column contains unique identifiers to each query genome i.e. sample ID
  • The genome column contains the path to each query genome
  • The sample sheet must contain column headers sample and genome

Example samplesheet:

sample,genome Sample_A,/path/to/Sample_A.fasta Sample_B,/path/to/Sample_B.fasta

Downloading the database

Precomputed NPD database can be downloaded by running the following command:

nextflow run jimmyliu1326/SamnTrek \ -r [version] \ -profile <docker/singularity> \ --wf download_db \ --download_path /path/to/SamnTrek_db

  • -profile indicates which containerization platform to use for process execution i.e. Docker or Singularity
  • --wf download_db signals the pipeline to only download the database
  • --download_path specifies where to save the downloaded database files

With all of the above steps completed, the full pipeline can be executed by specifying --wf all

nextflow run jimmyliu1326/SamnTrek \ -r [version] \ -profile <docker/singularity> \ --wf all \ --input samplesheet.csv \ --outdir ./results --db /path/to/SamnTrek_db

  • --input specifies the path to input samplesheet
  • --outdir specifies the path to save the output results
  • --db specifies the path to the directory containing predownloaded database files

Modular Pipeline Design

SamnTrek orchestrates the logic flow between four primary modules that collectively enable rapid integration of NPD Salmonella data. The modular design allows flexible points of entry. Users can resume from any steps in the pipeline without restarting the pipeline from scratch, which can expedite parameter tuning, testing and optimization.

The key modules of SamnTrek include (listed in chronological order of operation): 1. Sort (sort) - Placement of query in precomputed genomic clusters 2. Search (search) - Search against NPD sequences belonging to the same cluster and identify the subset of closest matching hits using unsupervised clustering 3. Fetch (fetch_hits) - Downloaded the full genomes of the close matches from NCBI 4. Contextualize (contextualize) - Construct a phylogeny integrating both the query and close matching hits

For example, users can quickly produce close matching hits based on different search parameters without reperforming the prior sort step.

[!NOTE] While Nextflow does have a built-in resume function, it relies on the integrity of the temporary files stored in working directory. However, in some institutions, these working directories are routinely cleansed to free up storage space. Hence, we have implemented a custom method to reuse cached results directly from the output directory (--outdir)

Results in a previous output directory can be reused by supplying the directory path using the --results_dir option

```bash

Initial run using top_hits = 100

nextflow run jimmyliu1326/SamnTrek \ --wf all \ --input samplesheet.csv \ --outdir ./results \ --db ./SamnTrekdb \ --tophits 100

Second run using top_hits = 200 and

reusing previous results

nextflow run jimmyliu1326/SamnTrek \ --wf search,fetchhits,contextualize \ --input samplesheet.csv \ --resultsdir ./results \ --outdir ./newresults \ --db ./SamnTrekdb \ --top_hits 200 ```

Output files legend

The following table describes the content stored in each subdirectory within the output directory (--outdir).

| File | Description | | :-- | :-- | | SORTRESULTS/ | Cluster placement results organized by sample ID. | SORTRESULTS/.tsv | Describes the predicted cluster assignments made by three different methods (best hit search, KNN, phylogenetic placement) and the final assignment based on majority voting. | SEARCHRESULTS/ | Sequence similarity search results organized by sample ID. | SEARCHRESULTS/.hits | Contains the NCBI accession IDs of the close matching strains. | SEARCHRESULTS/*.tsv | Contains the estimated core and accessory distance to all the database sequences belonging to the same cluster as the query. | SEARCHRESULTS/searchstats.tsv | Summarizes the subject to (top) hits ratio | | SEARCHRESULTS/coreaccessoryplot.png | Scatterplot displaying the distribution of relative distances of subject sequences to the query | | SEARCHRESULTS/hdbscanclusterscore.png | Results of HDBSCAN hyperparameter tuning evaluating cluster quality score (silhouette index) and total cluster count | | PDGENOMES/ | Archives all close matching genomes downloaded from NCBI | | SUMMARY/ | Summary files compiling results across all samples supplied in the input sample sheet | | SUMMARY/sortresults.tsv | Aggregated cluster placement predictions | | SUMMARY/searchresults.tsv | Aggregated sequence search results | | SUMMARY/SamnTreksummary.tsv | Complete summary file aggregating cluster placement and sequence search results | | TREE/ | Data related to phylogenetic analysis | | TREE/.nwk | Raw phylogenetic tree file | | TREE/.distancematrix.tsv | Pairwise distance matrix used in phylogenetic construction |

Future plans

  • Real-time synchronization with NPD
  • Support core genome SNV phylogenetics
  • Streamline tree visualizations by facilitating the compilation of available metadata of the close matching hits from NPD

Credits

SamnTrek was originally written by Jimmy Liu.

Citations

This pipeline uses code and infrastructure developed and maintained by the nf-core community, reused here under the MIT license.

SamnTrek manuscript is currently in progress. It will be updated here when available.

The nf-core framework for community-curated bioinformatics pipelines.

Philip Ewels, Alexander Peltzer, Sven Fillinger, Harshil Patel, Johannes Alneberg, Andreas Wilm, Maxime Ulysse Garcia, Paolo Di Tommaso & Sven Nahnsen.

Nat Biotechnol. 2020 Feb 13. doi: 10.1038/s41587-020-0439-x.

Owner

  • Name: Jimmy Liu
  • Login: jimmyliu1326
  • Kind: user
  • Location: Vancouver

Citation (CITATIONS.md)

# nf/samntrek: Citations

## [nf-core](https://pubmed.ncbi.nlm.nih.gov/32055031/)

> Ewels PA, Peltzer A, Fillinger S, Patel H, Alneberg J, Wilm A, Garcia MU, Di Tommaso P, Nahnsen S. The nf-core framework for community-curated bioinformatics pipelines. Nat Biotechnol. 2020 Mar;38(3):276-278. doi: 10.1038/s41587-020-0439-x. PubMed PMID: 32055031.

## [Nextflow](https://pubmed.ncbi.nlm.nih.gov/28398311/)

> Di Tommaso P, Chatzou M, Floden EW, Barja PP, Palumbo E, Notredame C. Nextflow enables reproducible computational workflows. Nat Biotechnol. 2017 Apr 11;35(4):316-319. doi: 10.1038/nbt.3820. PubMed PMID: 28398311.

## Pipeline tools

- [FastQC](https://www.bioinformatics.babraham.ac.uk/projects/fastqc/)

  > Andrews, S. (2010). FastQC: A Quality Control Tool for High Throughput Sequence Data [Online].

- [MultiQC](https://pubmed.ncbi.nlm.nih.gov/27312411/)

  > Ewels P, Magnusson M, Lundin S, Käller M. MultiQC: summarize analysis results for multiple tools and samples in a single report. Bioinformatics. 2016 Oct 1;32(19):3047-8. doi: 10.1093/bioinformatics/btw354. Epub 2016 Jun 16. PubMed PMID: 27312411; PubMed Central PMCID: PMC5039924.

## Software packaging/containerisation tools

- [Anaconda](https://anaconda.com)

  > Anaconda Software Distribution. Computer software. Vers. 2-2.4.0. Anaconda, Nov. 2016. Web.

- [Bioconda](https://pubmed.ncbi.nlm.nih.gov/29967506/)

  > Grüning B, Dale R, Sjödin A, Chapman BA, Rowe J, Tomkins-Tinch CH, Valieris R, Köster J; Bioconda Team. Bioconda: sustainable and comprehensive software distribution for the life sciences. Nat Methods. 2018 Jul;15(7):475-476. doi: 10.1038/s41592-018-0046-7. PubMed PMID: 29967506.

- [BioContainers](https://pubmed.ncbi.nlm.nih.gov/28379341/)

  > da Veiga Leprevost F, Grüning B, Aflitos SA, Röst HL, Uszkoreit J, Barsnes H, Vaudel M, Moreno P, Gatto L, Weber J, Bai M, Jimenez RC, Sachsenberg T, Pfeuffer J, Alvarez RV, Griss J, Nesvizhskii AI, Perez-Riverol Y. BioContainers: an open-source and community-driven framework for software standardization. Bioinformatics. 2017 Aug 15;33(16):2580-2582. doi: 10.1093/bioinformatics/btx192. PubMed PMID: 28379341; PubMed Central PMCID: PMC5870671.

- [Docker](https://dl.acm.org/doi/10.5555/2600239.2600241)

  > Merkel, D. (2014). Docker: lightweight linux containers for consistent development and deployment. Linux Journal, 2014(239), 2. doi: 10.5555/2600239.2600241.

- [Singularity](https://pubmed.ncbi.nlm.nih.gov/28494014/)

  > Kurtzer GM, Sochat V, Bauer MW. Singularity: Scientific containers for mobility of compute. PLoS One. 2017 May 11;12(5):e0177459. doi: 10.1371/journal.pone.0177459. eCollection 2017. PubMed PMID: 28494014; PubMed Central PMCID: PMC5426675.

GitHub Events

Total
  • Release event: 2
  • Watch event: 4
  • Push event: 4
  • Create event: 2
Last Year
  • Release event: 2
  • Watch event: 4
  • Push event: 4
  • Create event: 2

Dependencies

.github/workflows/branch.yml actions
  • mshick/add-pr-comment b8f338c590a895d50bcbfa6c5859251edc8952fc composite
.github/workflows/ci.yml actions
  • actions/checkout 0ad4b8fadaa221de15dcec353f45205ec38ea70b composite
  • jlumbroso/free-disk-space 54081f138730dfa15788a46383842cd2f914a1be composite
  • nf-core/setup-nextflow v2 composite
.github/workflows/clean-up.yml actions
  • actions/stale 28ca1036281a5e5922ead5184a1bbf96e5fc984e composite
.github/workflows/download_pipeline.yml actions
  • actions/setup-python 82c7e631bb3cdc910f68e0081d67478d79c6982d composite
  • eWaterCycle/setup-singularity 931d4e31109e875b13309ae1d07c70ca8fbc8537 composite
  • jlumbroso/free-disk-space 54081f138730dfa15788a46383842cd2f914a1be composite
  • nf-core/setup-nextflow v2 composite
.github/workflows/fix-linting.yml actions
  • actions/checkout 0ad4b8fadaa221de15dcec353f45205ec38ea70b composite
  • actions/setup-python 82c7e631bb3cdc910f68e0081d67478d79c6982d composite
  • peter-evans/create-or-update-comment 71345be0265236311c031f5c7866368bd1eff043 composite
.github/workflows/linting.yml actions
  • actions/checkout 0ad4b8fadaa221de15dcec353f45205ec38ea70b composite
  • actions/setup-python 82c7e631bb3cdc910f68e0081d67478d79c6982d composite
  • actions/upload-artifact 65462800fd760344b1a7b4382951275a0abb4808 composite
  • nf-core/setup-nextflow v2 composite
.github/workflows/linting_comment.yml actions
  • dawidd6/action-download-artifact 09f2f74827fd3a8607589e5ad7f9398816f540fe composite
  • marocchino/sticky-pull-request-comment 331f8f5b4215f0445d3c07b4967662a32a2d3e31 composite
.github/workflows/release-announcements.yml actions
  • actions/setup-python 82c7e631bb3cdc910f68e0081d67478d79c6982d composite
  • rzr/fediverse-action master composite
  • zentered/bluesky-post-action 80dbe0a7697de18c15ad22f4619919ceb5ccf597 composite
modules/nf-core/fastqc/meta.yml cpan
modules/nf-core/multiqc/meta.yml cpan
subworkflows/nf-core/utils_nextflow_pipeline/meta.yml cpan
subworkflows/nf-core/utils_nfcore_pipeline/meta.yml cpan
subworkflows/nf-core/utils_nfvalidation_plugin/meta.yml cpan
modules/nf-core/fastqc/environment.yml pypi
modules/nf-core/multiqc/environment.yml pypi