Package: taxmyphage
taxmyPHAGEDeveloped byAndrew Millard,Thomas Sicheritz-PontenandRemi DeniseScript to assign taxonomy to a bacteriophage at the genus and species level. It will identify the most similar genomes in the set of currently classified ICTV genomes that are present in the VMR.
Read about the VMRhere. It will compare the query genome against these genomes and run aVIRIDIC-like analysison the closest relatives. Interpret the output of VIRIDIC-like analysis to determine if the phage falls within a current genus and or species. It does not run VIRIDIC, but utilises the same formula for comparison of genomes.  The input is a single genome sequence. The remainder of the analysis is automatedDesigned for:Individual complete phage genomesWhat it will do:Classify a dsDNA phage genomes at the Genus and or species level against ICTV genomesTell you if your genome represents a new genusUse current ICTV cutoffs for Genera and Speciesaccept multiple inputs at the same timeWhat it wont do:Metagenomic samplesEukaryotic virusesRNA phages - it will give a result - not necessarily the correct onessDNA phages - again a result but likely not accurateClassify a phage into a new familyCompare against every single phage genome in Genbank. It is designed for classification , so compares against currently classified phages.A web version will be available soon.QUICK start and testmamba create -n taxmyphage -c conda-forge -c bioconda taxmyphage
mamba activate taxmyphage

# If databases not installed, install them
taxmyphage install

# Run taxmyphage
taxmyphage run -i test.fna -t 4if you are on macosx with a M1/M2 chip, you will need to install the following packages firstCONDA_SUBDIR=osx-64 mamba create -n taxmyphage -c conda-forge -c bioconda taxmyphage
mamba activate taxmyphage

# If databases not installed, install them
taxmyphage install

# Run taxmyphage
taxmyphage run -i test.fna -t 4This should check the required software is installed and give a warning if not. It will also download the required fasta database and MASH file for comparison. These will be installed in the cloned tax_myPHAGE directory. If you download manually then please move them into tax_myPHAGE  directory.Output of the test should have the following lines at the bottomRequirementsIt can be run on a standard laptop in a reasonable time.Input FilesDescriptionDownload InstructionsICTV.msh(MASH index)Prebuilt MASH index of ICTV genomes. DownloadhereDownload:wget https://millardlab-inphared.s3.climb.ac.uk/ICTV_2023.mshBacteriophage_genomes.fasta.gzDatabase of ICTV-classified genomes. Downloadhere.- Download:wget https://millardlab-inphared.s3.climb.ac.uk/Bacteriophage_genomes.fasta.gz- Unzip:gunzip Bacteriophage_genomes.fasta.gz- Create blast db:makeblastdb -in Bacteriophage_genomes.fasta -parse_seqids -dbtype nuclVMR.xlsxVirus Metadata Resource (VMR). Downloadhere.- Download:wget https://ictv.global/vmr/currentInstall[!IMPORTANT]tax_myPHAGE requiresMASH>=2.3 andBLAST>=2.14.0.You need to install mash and NCBI BLAST by yourself (except if you install macsyfinder viaconda/mamba).The other dependencies are managed by the python package managerpip.Condamamba install -c conda-forge -c bioconda taxmyphageif you are on macosx with a M1/M2 chip, you will need to install the following packages firstCONDA_SUBDIR=osx-64 mamba install -c conda-forge -c bioconda taxmyphageBioconda doesn't support osx-arm64 yet.Pypipip install taxmyphageIf you installing by pip, don't forget to install a working version ofMASHandBLASTSourceAlternatively, a development version oftaxmyphagecan be install from github.git clone https://github.com/amillard/tax_myPHAGEeither you can install the taxmyphage and its dependencies via pipcd tax_myPHAGE
pip install -e .
taxmyphage -hor you install following dependencies yourselfbiopython >= 1.81
pandas >= 2.1.1
seaborn >= 0.13
wget >= 3.2
scipy >= 1.11.3
tqdm >= 4.66.1
openpyxl >= 3.1.2
networkx >= 3.1
icecream >= 2.1.3and run it viapip install -e --no-dependencies .
taxmyphage -hortax_myPHAGE/taxmyphage/bin/taxmyphage.py -hModulesInstallAllows to install the databases before running theRunmodule.taxmyphage installOptionsusage: taxmyphage install [-h] [-v] [-V] [-db FOLDER_PATH] [--makeblastdb MAKEBLASTDB]

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         Show verbose output. (For debugging purposes)
  -V, --version         Show the version number and exit.

Databases options:
  -db FOLDER_PATH, --db_folder FOLDER_PATH
                        Path to the database directory where the databases are stored. (Default is /Users/rdenise/Documents/Scripts/tax_myPHAGE/taxmyphage/database)

Install options:
  --makeblastdb MAKEBLASTDB
                        Path to the blastn executable (default: makeblastdb)Runtaxmyphage run -i input.fastaOptionsusage: taxmyphage run [-h] -i [FASTA_FILE ...] [[FASTA_FILE ...] ...] [-o OUTPUT] [-p PREFIX] [-t THREADS] [-d DIST] [--mash MASH] [--blastdbcmd BLASTDBCMD] [--blastn BLASTN] [--makeblastdb MAKEBLASTDB]
                      [--no-figures] [-v] [-V] [-db FOLDER_PATH]

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         Show verbose output. (For debugging purposes)
  -V, --version         Show the version number and exit.

General options:
  -i [FASTA_FILE ...] [[FASTA_FILE ...] ...], --input [FASTA_FILE ...] [[FASTA_FILE ...] ...]
                        Path to an input fasta file(s), or directory containing fasta files. The fasta file(s) could contain multiple phage genomes. They can be compressed (gzip). If a directory is given the
                        expected fasta extentions are ['fasta', 'fna', 'fsa', 'fa'] but can be gzipped. (Required)
  -o OUTPUT, --output OUTPUT
                        Path to the output directory. (Default is current directory)
  -p PREFIX, --prefix PREFIX
                        Will add the prefix to results and summary files that will store results of MASH and comparision to the VMR Data produced by ICTV combines both sets of this data into a single csv file.
                        Use this flag if you want to run multiple times and keep the results files without manual renaming of files. (Default no prefix)
  -t THREADS, --threads THREADS
                        Maximum number of threads that will be used by BLASTn. (Default is 1)

MASH options:
  -d DIST, --distance DIST
                        Will change the mash distance for the intial seraching for close relatives. We suggesting keeping at 0.2 If this results in the phage not being classified, then increasing to 0.3 might
                        result in an output that shows the phage is a new genus. We have found increasing above 0.2 does not place the query in any current genus, only provides the output files to demonstrate it
                        falls outside of current genera. (Default is 0.2)
  --mash MASH           Path to the MASH executable (default: mash)
  --blastdbcmd BLASTDBCMD
                        Path to the blastn executable (default: blastdbcmd)

Similarity options:
  --blastn BLASTN       Path to the blastn executable (default: blastn)
  --makeblastdb MAKEBLASTDB
                        Path to the blastn executable (default: makeblastdb)
  --no-figures          Use this option if you don't want to generate Figures. This will speed up the time it takes to run the script - but you get no Figures. (By default, Figures are generated)

Databases options:
  -db FOLDER_PATH, --db_folder FOLDER_PATH
                        Path to the database directory where the databases are stored. (Default is /Users/rdenise/Documents/Scripts/tax_myPHAGE/taxmyphage/database)Indicative run timeThe time to classify a phage will depend on the number of hits and number of phages currently classified within a particular genus. The more species within a genus, the longer the time for classification. The numbers below are from running on a 16 core server. We have been running the process on a MAC book and Windows laptop in reasonable time periods.GenusNumber of genomes in GeneraTime(H:M:S)Cheoctovirus9600:07:44Tequatrovirus8300:26:19Peduovirus2700:00:23Warwickvirus1800:00:18Pseudotevenvirus90:01:15Changmaivirus20:00:17Stompvirus10:00:16Output files for theRunmodule[output_folder]                                          <- General output folder
├── Summary_taxonomy.tsv                                 <- Summary of the analysis for all the genomes (summarises what was printed to screen)
└── Results_per_genome                                   <- Folder containing the results for each genome
  └── [genome query_id]                                  <- Results output for the genome query_id
      ├── Output_of_taxonomy.csv                         <- Output of the taxonomy classification
      ├── Summary_file.txt                               <- Summary of the analysis (summarises what was printed to screen)
      ├── heatmap.pdf                                    <- Heatmap of the similarity to the closest relatives (pdf)
      ├── heatmap.png                                    <- Heatmap of the similarity to the closest relatives    (png)
      ├── heatmap.svg                                    <- Heatmap of the similarity to the closest relatives (svg)
      ├── known_taxa.fa                                  <- Fasta file of the closest relatives
      ├── mash.txt                                       <- Output of the MASH analysis
      ├── query.fasta                                    <- Input fasta file
      ├── similarities.tsv                               <- Similarities to the closest relatives
      ├── top_right_matrix.tsv                           <- Top right matrix of similarity to closest relatives (same as heatmap)
      └── pmv                                            <- VIRIDIC-like analysis
          ├── pmv_in.fa                                  <- Input fasta file
          ├── pmv_in.fa.blastn_vs2_self.tab.gz           <- Blastn output of the input fasta file against itself
          ├── pmv_in.fa.genus_species_clusters.tsv       <- Clusters of the closest relatives
          ├── pmv_in.fa.ndb                              <- Blastn database of the closest relatives
          ├── pmv_in.fa.nhr
          ├── pmv_in.fa.nin
          ├── pmv_in.fa.njs
          ├── pmv_in.fa.not
          ├── pmv_in.fa.nsq
          ├── pmv_in.fa.ntf
          └── pmv_in.fa.ntoOutput files explainedSummary_taxonomy.tsv- Summarises what was printed to screen for all the genomesQuery sequence headerRealmKingdomPhylumClassOrderFamilySubfamilyGenusSpeciesFull classificationMessageMZ130489DuplodnaviriaHeunggongviraeUroviricotaCaudoviricetesCrassviralesCrevaviridaeCoarsevirinaeJunduvirusJunduvirus communisr__Duplodnaviria;k__Heunggongvirae;p__Uroviricota;c__Caudoviricetes;o__Crassvirales;f__Crevaviridae;sf__Coarsevirinae;g__Junduvirus;s__Junduvirus communisCurrent ICTV taxonomy and VIRIDIC-algorithm output appear to be consistent at the genus levelnewGenus_phageUnknownUnknownUnknownUnknownUnknownUnknownUnknownNew_genusNew_genus new_speciesr__Unknown;k__Unknown;p__Unknown;c__Unknown;o__Unknown;f__Unknown;sf_Unknown;g__New_genus;s__New_genus new_speciesQuery is a new genus and species. You could try running again with if you larger distancetest1DuplodnaviriaHeunggongviraeUroviricotaCaudoviricetesNot Defined YetNot Defined YetVequintavirinaeCertrevirusCertrevirus name_your_speciesr__Duplodnaviria;k__Heunggongvirae;p__Uroviricota;c__Caudoviricetes;o__;f__;g__Certrevirus;s__Certrevirus name_your_speciesThe number of expected genera is different from the predicted number of genus clusters. It will require more manual curationSummary_file.txt- Summarises what was printed to screenQuery sequence header was:test1 
    
    
Query sequence can be classified within a current genus and represents a new species, it is in:
    
Class:Caudoviricetes    Family: Not Defined Yet    Subfamily:Vequintavirinae    Genus:Certrevirus    Species:name_your_speciesOutput_of_taxonomy.csv- Provides Cluster and Species numbers for you query phage, merged with data from the VMR for the closest relatives to you query***.pdf,.svg,.png- image files of top right matrix of similarity to closest currently classified phagesSimilaritytaxmyphage similarity -i input.fastaOptionsusage: taxmyphage similarity [-h] -i [FASTA_FILE ...] [[FASTA_FILE ...] ...] [-o OUTPUT] [-p PREFIX] [-t THREADS] [--reference REFERENCE] [--blastn BLASTN] [--makeblastdb MAKEBLASTDB] [--no-figures] [-v] [-V]
                          [-db FOLDER_PATH]

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         Show verbose output. (For debugging purposes)
  -V, --version         Show the version number and exit.

General options:
  -i [FASTA_FILE ...] [[FASTA_FILE ...] ...], --input [FASTA_FILE ...] [[FASTA_FILE ...] ...]
                        Path to an input fasta file(s), or directory containing fasta files. The fasta file(s) could contain multiple phage genomes. They can be compressed (gzip). If a directory is given the
                        expected fasta extentions are ['fasta', 'fna', 'fsa', 'fa'] but can be gzipped. (Required)
  -o OUTPUT, --output OUTPUT
                        Path to the output directory. (Default is current directory)
  -p PREFIX, --prefix PREFIX
                        Will add the prefix to results and summary files that will store results of MASH and comparision to the VMR Data produced by ICTV combines both sets of this data into a single csv file.
                        Use this flag if you want to run multiple times and keep the results files without manual renaming of files. (Default no prefix)
  -t THREADS, --threads THREADS
                        Maximum number of threads that will be used by BLASTn. (Default is 1)

Comparison options:
  --reference REFERENCE
                        Path to the reference database file. Input file will be used as query against it. If not provided, input will be compare against itself. If you use reference no figure is generated.
                        (Default is '')

Similarity options:
  --blastn BLASTN       Path to the blastn executable (default: blastn)
  --makeblastdb MAKEBLASTDB
                        Path to the blastn executable (default: makeblastdb)
  --no-figures          Use this option if you don't want to generate Figures. This will speed up the time it takes to run the script - but you get no Figures. (By default, Figures are generated)

Databases options:
  -db FOLDER_PATH, --db_folder FOLDER_PATH
                        Path to the database directory where the databases are stored. (Default is /Users/rdenise/Documents/Scripts/tax_myPHAGE/taxmyphage/database)Output files for thesimilaritymodule[output_folder]                          <- General output folder
├── heatmap.pdf                          <- Heatmap of the similarity to the closest relatives (pdf)
├── heatmap.png                          <- Heatmap of the similarity to the closest relatives    (png)
├── heatmap.svg                          <- Heatmap of the similarity to the closest relatives (svg)
├── pmv.fasta                            <- Input fasta file
├── pmv.fasta.blastn_vs2_self.tab.gz     <- Blastn output of the input fasta file against itself
├── pmv.fasta.genus_species_clusters.tsv <- Clusters of the closest relatives
├── pmv.fasta.ndb                        <-  Blastn database of the closest relatives
├── pmv.fasta.nhr
├── pmv.fasta.nin
├── pmv.fasta.njs
├── pmv.fasta.not
├── pmv.fasta.nsq
├── pmv.fasta.ntf
├── pmv.fasta.nto
├── similarities.tsv                     <- Similarities to the closest relatives
└── top_right_matrix.tsv                 <- Top right matrix of similarity to closest relatives (same as heatmap)Output files explained***.pdf,.svg,.png- image files of top right matrix of similarity to closest currently classified phages