sphae
Phage annotations and predictions. A spae is a prediction or foretelling. We'll foretell you what your phage is doing!
Science Score: 67.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
Found .zenodo.json file -
✓DOI references
Found 7 DOI reference(s) in README -
✓Academic publication links
Links to: zenodo.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.2%) to scientific vocabulary
Repository
Phage annotations and predictions. A spae is a prediction or foretelling. We'll foretell you what your phage is doing!
Basic Info
Statistics
- Stars: 33
- Watchers: 3
- Forks: 9
- Open Issues: 1
- Releases: 23
Metadata Files
README.md
Sphae
Phage toolkit to detect phage candidates for phage therapy
Overview
The steps that sphae takes are shown here:
This snakemake workflow was built using Snaketool [https://doi.org/10.1371/journal.pcbi.1010705], to assemble and annotate phage sequences. Currently, this tool is being developed for phage genomes. The steps include,
- Quality control that removes adaptor sequences, low-quality reads and host contamination (optional).
- Assembly
- Contig quality checks; read coverage, viral or not, completeness, and assembly graph components.
- Phage genome annotation
Cite Sphae: https://doi.org/10.1093/bioadv/vbaf004
If you are new to bioinformatics or running command line tools, here is a great tutorial to follow: https://github.com/AnitaTarasenko/sphae/wiki/Sphae-tutorial
Install
Pip install
```bash
creating a new envrionment
conda create -y -n sphae python=3.12 conda activate sphae
install sphae
pip install sphae ```
Conda install
Setting up a new conda environment
bash
conda create -n sphae python
conda activate sphae
Container Install There are two versions of the container
- Sphae v1.5.2 Includes databases, so the container is about 32GB
Steps to donwload and run this container
```
TMPDIR=
singularity pull --tmpdir $TMPDIR --dir $IMAGEDIR docker://npbhavya/sphae:latest
singularity exec sphae_latest.sif sphae --help
singularity exec sphae_latest.sif sphae run --help
singularity exec -B <path/to/inputfiles>:/input,<path/to/output>:/output sphae_latest.sif sphae run --input /input --output /output
```
- Sphae v1.5.2-noDB This version, doesnt come with databases
Here are the commands to download sphae container
```
TMPDIR=
singularity pull --tmpdir $TMPDIR --dir $IMAGEDIR docker://npbhavya/sphae:v1.5.2-noDB
singularity exec sphae_v1.5.2-noDB.sif sphae --help
singularity exec sphae_v1.5.2-noDB.sif sphae run --help
# <path/to/databases> set to sphae/workflow/databases if sphae install is run
singularity exec -B <path/to/databases>:/database,<path/to/inputfiles>:/input,<path/to/output>:/output sphae_latest.sif sphae run --input /input --output /output
```
Source install
```bash
clone sphae repository
git clone https://github.com/linsalrob/sphae.git
move to sphae folder
cd sphae
install sphae
pip install -e .
confirm the workflow is installed by running the below command
sphae --help ```
Installing databases
Run the below command,
```bash
Installs the database to default directory, sphae/workflow/databases
sphae install
Install database to specific directory
sphae install --db_dir
Install the databases to a directory, sphae/workflow/databases
This workflow requires the - Pfam35.0 database to run viral_verify for contig classification. - CheckV database to test for phage completeness - Pharokka databases - Phynteny models - Phold databases - Medaka models
This step requires ~23G of storage If these databases are already installed, skip this step and instead set the envrionment variables pointing to the where these databases are installed
```bash
Note to change the file path to the databases.
For instance if sphae was installed using conda, the databases by default will be saved to /home/username/miniforge3/envs/sphae/lib/python3.11/site-packages/sphae/workflow/databases
export VVDB=sphae/workflow/databases/Pfam35.0/Pfam-A.hmm.gz export CHECKVDB=sphae/workflow/databases/checkv-db-v1.5 export PHAROKKADB=sphae/workflow/databases/pharokka_db export PHYNTENYDB=sphae/workflow/databases/models export PHOLDDB=sphae/workflow/databases/phold ```
Running the workflow
Sphae is developed to be modular:
- sphae run will run QC, assembly and annotation
- sphae annotate will run only annotation steps
Commands to run
Only one command needs to be submitted to run all the above steps: QC, assembly and assembly stats
```bash
For illumina reads, place the reads both forward and reverse reads to one directory
Make sure the fastq reads are saved as {samplename}R1.fastq and {samplename}R2.fastq or with extensions {samplename}R1.fastq.gz
sphae run --input tests/data/illumina-subset --output example -k
For nanopore reads, place the reads, one file per sample in a directory
sphae run --input tests/data/nanopore-subset --sequencing longread --output example -k
For newer ONT sequencing data where polishing is not required, run the command
sphae run --input tests/data/nanopore-subset --sequencing longread --output example -k --no_medaka
To run either of the commands on the cluster, add --executor slurm to the command. There is a little bit of setup to do here.
Setup a ~/.config/snakemake/slurm/config.yaml file - https://snakemake.github.io/snakemake-plugin-catalog/plugins/executor/slurm.html#advanced-resource-specifications
I may have set this workflow to run only slurm right now, will make it more generic soon.
sphae run --input tests/data/nanopore-subset --preprocess longread --output example --profile slurm -k --threads 16 ```
Command to run only annotation steps and phylogenetic trees This step reruns - Pharokka, Phold, Phynteny - Phylogenetic tree with terminase large subunit, portal protein
```bash
the genomes directory has the already assembled complete genomes
run the export commands to set the database paths
sphae annotate --genome
Output
Output is saved to example/RESULTS directory. In this directory, there will be four files
- Genome annotations in GenBank format (Phynteny output)
- Genome in fasta format (either the reoriented to terminase output from Pharokka, or assembled viral contigs)
- Circular visualization in png format (Pharokka output)
- Genome summary file
Genome summary file includes the following information to help, - Sample name - Length of the genome - Coding density - If the assembled contig is circular or not (From checkv) - Completeness (calculated from CheckV) - Contamination (calculated from CheckV) - Taxonomy accession ID (Pharokka output, searches the genome against INPHARED database using mash) - Taxa mash includes the number of matching hashes of the assembled genome to the accession ID/Taxa name. Higher the matching hash- more likely the genome is related to the taxa predicted - Gene searches: - Whether integrase is found (search for integrase gene in annotations) - Whether anti-microbial genes were found (Phold and Pharokka search against AMR database) - Whether any virulence factors were found (Pharokka search against virulence gene database) - Whether any CRISPR spacers were found (Pharokka search against MinCED database)
FAQ
"Failed during assembly":
- This message indicates that the assembly process was unsuccessful. It suggests that the assembler could not generate contigs, which are contiguous sequences of DNA, typically representing segments of a genome.
- To confirm this, you can check the logs located at
sphae.out/PROCESSING/assembly/flye/<sample name>/assembly_info.txtorsphae.out/PROCESSING/assembly/megahit/<sample name>/log. These logs should provide details about the error or the step at which the assembly failed. - One possible reason for this failure could be insufficient genome coverage, meaning that there were not enough sequencing reads to accurately assemble the genome.
"Genome includes multiple contigs, fragmented":
- This message indicates that the assembly generated numerous short fragments (contigs) instead of a single, contiguous sequence representing a nearly complete phage genome.
- You can verify this by examining the file
sphae.out/PROCESSING/assembly/flye/<sample name>-assembly-stats_flye.csvorsphae.out/PROCESSING/assembly/megahit/<sample name>-assembly-stats_megahit.csv. - Each row in these tables represents a contig along with its characteristics. If none of the contigs are identified as viral and do not meet a certain completeness threshold (e.g., greater than 70% completeness), it suggests that the assembly consists of fragmented contigs.
- Fragmented contigs make it challenging to accurately identify genes. To address this issue, you may need to resequence the phages for better coverage or try using different assembly algorithms.
"Good genome coverage but still encountering assembly issues":
- If you have adequate genome coverage but still face assembly problems, you may consider adjusting the subsampling step in sphae. This step involves randomly selecting a subset of reads to reduce the computational burden.
- To modify the subsampling parameters, navigate to the
config/config.yamlfile and update the line undersubsamplesection, for example:subsample: --bases 1000M - Increase or decrease the number of bases (e.g.,
1000Mfor 1000 megabases) based on your requirements. - After making the changes, rerun sphae and ensure that the updated subsampling parameters are reflected in the
sphae.out/sphae.config.yamlfile.
"What does 'No integrases found ...but Phynteny predicted a few unknown function genes to have some similarity with integrase genes but with low confidence. Maybe a false positive or a novel integrase gene' mean?" This message indicates that while no integrase genes were explicitly identified, the analysis detected certain genes that exhibited similarities to integrase genes. However, these genes were associated with low confidence scores, suggesting a possibility of being false positives or potentially representing novel integrase genes.
Phynteny, the tool used for this prediction, assigns a confidence score to each gene prediction. If this score falls below a certain threshold (typically 90%), the gene remains classified as having an unknown function. To further investigate these genes, advanced techniques such as folding using tools like ColabFold and Foldseek can be employed. Analyzing the structure of these genes may provide additional insights into their functionality and potential role in biological processes.
- How do I visualize the phages and gene annotations?
To visualize the phages and gene annotations, I recommend using Clinker. First, gather all the sample genbank files from
sphae.out/RESULTSand place them in a new directory. Then, execute the clinker command to generate clinker plots, which compare the genes in each genome to each other.
Additionally, for enhanced visualization, consider running dnaapler on the genomes in fasta format obtained from
sphae.out/RESULTS. This step generates reoriented phages that start with terminase genes. Pharokka -> Phold -> Phynteny has to be rerun, and the resulting genbank files can be used for visualization. To perform the annotation steps, run the command
sphae annotate --input <reoriented genomes from dnaapler in fasta format directory>
Please note that dnaapler may fail if terminase genes are not found, particularly when working with novel phages. The reason these steps haven't been added to sphae. If you encounter any challenges during this process, please feel free to leave an issue, and I'll provide improved documentation to assist you further with the command on how to install and run the command different commands.
Where are the intermediate files being saved? These files are being saved in
sphae.out/PROCESSING. If you need more information on the file structure here, or have ideas of better organization then leave an issue and I will make a note to have more documentation.Just run annotation on already assembled genomes?
sphae annotate --input <input genomes>This command runs only Pharokka, Phold and Phynteny to annotate the assembled genomes. The results are saved to a new directory labeledsphae.out/annotation.Note: Currently, Sphae runs Phold in CPU mode, but efforts are underway to support Phold GPU mode for faster processing of this step.
How to change the number of base pairs to subsample for a sample? Run the command
sphae configThis copies the config file within the workflow to the current directory. Open this file and update the linebases: 10000000to for instancebases: 300000Then run sphae run with the commandsphae run --input tests/data/illumina-subset --output example -k --config <path to the config file with the change>
Citation
To cite sphae, doi: https://doi.org/10.1101/2024.11.18.624194
Issues and Questions
If you come across any issues or errors, report them under Issues.
Owner
- Name: Rob Edwards
- Login: linsalrob
- Kind: user
- Location: Adelaide, Australia
- Company: Flinders University
- Website: http://edwards.flinders.edu.au/
- Twitter: linsalrob
- Repositories: 31
- Profile: https://github.com/linsalrob
Professor of CS and Biology Writing bioinformatics code to study viruses, phages, and metagenomes.
Citation (CITATION.cff)
cff-version: 1.2.0 message: "If you use this software, please cite it as below." authors: - family-names: "Edwards" given-names: "Robert" orcid: "0000-0001-8383-8949" - family-names: "Bouras" given-names: "George" orcid: "0000-0002-5885-4186" - family-names: "Grigson" given-names: "Susanna" orcid: "0000-0003-4738-3451" - family-names: "Papudeshi" given-names: "Bhavya" orcid: "0000-0001-5359-3100" - family-names: "Mallawaarachchi" given-names: "Vijini" orcid: "0000-0002-2651-8719" - family-names: "Grigson" given-names: "Susanna" orcid: "0000-0003-4738-3451" - family-names: "Tarasenko" given-names: "Anita" orcid: "0009-0003-4283-2374" - family-names: "Roach" given-names: "Michael" orcid: "0000-0003-1488-5148" - family-names: "Inglis" given-names: "Laura" orcid: "0000-0001-7919-8563" title: "spae: Phage annotations and predictions" version: 2.0.4 doi: 10.5281/zenodo.8365089 date-released: 2023-09-21 url: "https://github.com/linsalrob/spae"
GitHub Events
Total
- Create event: 7
- Release event: 7
- Issues event: 5
- Watch event: 11
- Issue comment event: 13
- Push event: 28
Last Year
- Create event: 7
- Release event: 7
- Issues event: 5
- Watch event: 11
- Issue comment event: 13
- Push event: 28
Issues and Pull Requests
Last synced: 9 months ago
All Time
- Total issues: 23
- Total pull requests: 34
- Average time to close issues: about 2 months
- Average time to close pull requests: 3 days
- Total issue authors: 6
- Total pull request authors: 7
- Average comments per issue: 2.26
- Average comments per pull request: 0.09
- Merged pull requests: 30
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 14
- Pull requests: 6
- Average time to close issues: 19 days
- Average time to close pull requests: about 8 hours
- Issue authors: 5
- Pull request authors: 2
- Average comments per issue: 2.57
- Average comments per pull request: 0.0
- Merged pull requests: 6
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- gbouras13 (7)
- npbhavya (2)
- mattheww95 (1)
- CCRAM1 (1)
- minhtrung1997 (1)
- qq9236247 (1)
Pull Request Authors
- npbhavya (10)
- gbouras13 (7)
- Vini2 (3)
- AnitaTarasenko (2)
- susiegriggo (2)
- beardymcjohnface (2)
- Laura-RC (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 78 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 16
- Total maintainers: 1
pypi.org: sphae
Phage workflow
- Documentation: https://sphae.readthedocs.io/
- License: MIT
-
Latest release: 1.5.2
published 9 months ago
Rankings
Maintainers (1)
Dependencies
- Click ==8.1.3
- attrmap >=0.0.7
- metasnek >=0.0.4
- pyyaml ==6.0
- snakemake >=7.14.0
- snaketool-utils >=0.0.3