anvi-run-hmms

This program deals with populating tables that store HMM hits in an anvi'o contigs database.

🔙 To the main page of anvi’o programs and artifacts.

Authors

Requires

contigs-db

Can use

hmm-source

Provides

hmm-hits

Usage

Stores hmm-hits for a given hmm-source in a contigs-db. In short, this is the program that will do a search for HMMs against a contigs-db and store that information into the contigs-db’s hmm-hits.

This is one of the programs that users commonly run on newly generated contigs-db, along with anvi-scan-trnas, anvi-run-ncbi-cogs, anvi-run-scg-taxonomy, and so on.

HMMs in the context of anvi’o

In a nutshell, hidden Markov models are statistical models typically generated from known genes which enable ‘searching’ for similar genes in other sequence contexts.

The default anvi’o distribution includes numerous curated HMM profiles for single-copy core genes and ribosomal RNAs, and anvi’o can work with custom HMM profiles provided by the user. In anvi’o lingo, each of these HMM profiles, whether they are built-in or user defined, is called an hmm-source.

Default Usage

To run this program with all default settings (against all default anvi’o hmm-source), you only need to provide a contigs-db:

anvi-run-hmms -c contigs-db

Multithreading will dramatically improve the performance of anvi-run-hmms. If you have multiple CPUs or cores, you may parallelize your search:

anvi-run-hmms -c contigs-db \ --num-threads 6

You can also run this program on a specific built-in hmm-source:

anvi-run-hmms -c contigs-db \ -I Bacteria_71

User-defined HMMs

Running anvi-run-hmms with a custom model is easy. All you need to do is to create a directory with necessary files:

anvi-run-hmms -c contigs-db \ -H MY_HMM_PROFILE

See the relevant section in the artifact hmm-source for details.

Adding HMM hits as a functional annotation source

By default, HMM hits are not considered functional annotations and are kept in a distinct table (the ‘hmm_hits’ table) in the contigs database. However, there are certain cases when you may want them to be considered as functions instead. For instance, if you want to run anvi-estimate-metabolism on a set of user-defined metabolic pathways and you have a set of custom HMMs for their enzymes.

To treat the HMM hits as functional annotations and add them to the ‘gene_functions’ table in your database, you must use the --add-to-functions-table flag:

anvi-run-hmms -c contigs-db \ -H MY_HMM_PROFILE \ --add-to-functions-table

If you want to use this flag with custom hmm-sources, then please make sure you include ACC lines specifying the accession number of each model in your .hmm file. If these lines are not included, then the HMMER software won’t know the accession numbers of your models and we won’t be able to add those accessions to your contigs-db, which might cause you some headaches later. We’ve recently added a sanity check for these ACC lines to help you remember to add them in, but if you are working with older versions of anvi’o, this message is here for you instead.

Changing the HMMER program

By default, anvi-run-hmms will use HMMER’s hmmscan for amino acid HMM profiles, but you can use hmmsearch if you are searching a very large number of models against a relatively smaller number of sequences:

anvi-run-hmms -c contigs-db \ --hmmer-program hmmsearch

This flag has no effect when your HMM profile source is for nucleotide sequences (like any of the Ribosomal RNA sources). In those cases anvi’o will use nhmmscan exclusively.

Saving the HMMER output

If you want to see the output from the HMMER program (eg, hmmscan) used to annotate your data, you can request that it be saved in a directory of your choosing. Please note that this only works when you are running on a single HMM source, as in the example below:

anvi-run-hmms -c contigs-db \ -I Bacteria_71 \ --hmmer-output-dir OUTPUT_DIR

If you do this, file(s) with the prefix hmm will appear in that directory, with the file extension indicating the format of the output file. For example, the table output format would be called hmm.table.

These resulting files are not exactly the raw output of HMMER because anvi’o does quite a bit of pre-processing on the raw input and output file(s) while jumping through some hoops to make the HMM searches multi-threaded. If this is causing you a lot of headache, please let us know.

Requesting domain table output

Please also see anvi-script-filter-hmm-hits-table

No matter what, anvi’o will use the regular table output to annotate your contigs database. However, if you are using the --hmmer-output-dir to store the HMMER output, you can also request a domain table output using the flag --domain-hits-table.

anvi-run-hmms -c contigs-db \ -I Bacteria_71 \ --hmmer-output-dir OUTPUT_DIR \ --domain-hits-table

In this case anvi’o will run HMMER using the --domtblout flag to generate this output file.

This flag will only work with HMM profiles made for amino acid sequences. Profiles for nucleotide sequences require the use of the program nhmmscan, which does not have an option to store domain output.

Please note that this output won’t be used to filter hits to be added to the contigs database. But it will give you the necessary output file to investigate the coverage of HMM hits. But you can use the program anvi-script-filter-hmm-hits-table with this file to remove weak hits from your HMM hits table later.

Other things anvi-run-hmms can do

  • Add the tag --also-scan-trnas to basically run anvi-scan-trnas for you at the same time. It’s very convenient. (But it only works if you are not using the -I or -H flags at the same time because reasons.)
  • Discover extra HMMs shipped with anvi’o but not run by default with --list-miscellaneous-models. This prints categories, descriptions, and the full paths to these models so you can copy-paste one into -H when you want to run it.
  • Prefer keywords instead of full paths for those extra models using --miscellaneous-model, or -M, which accepts model name as a parameter:

anvi-run-hmms -c contigs-db \ -M DNA_Polymerase_Type_B

Edit this file to update this information.

Command line interface

The following is the list of parameters and their descriptions in the latest version of anvi-run-hmms.

The code that generates this web page ensures that this information is the latest available in 9-dev (eunice). Which means, in some cases the information in this section (generated automatically) might be more comprehensive or up-to-date compared to the descriptions above (written by humans).


Command line usage

anvi-run-hmms [-h] [-c CONTIGS_DB] [-H HMM PROFILE PATH] [-M CATEGORY:MODEL] [-I HMM PROFILE NAME(S)] [--hmmer-output-dir OUTPUT DIRECTORY PATH] [--domain-hits-table] [--list-miscellaneous-models] [--also-scan-trnas] [-T NUM_THREADS] [--hmmer-program HMMER_PROGRAM] [--add-to-functions-table] [--just-do-it]

Parameters and their descriptions

DB An anvi'o contigs database to populate with HMM hits
-c, --contigs-db CONTIGS_DB
Anvi'o contigs database generated by 'anvi-gen-contigs-database'
HMM OPTIONS If you have your own HMMs, or if you would like to run only a set of default anvi'o HMM profiles rather than running them all, this is your stop.
-H, --hmm-profile-dir HMM PROFILE PATH
You can use this parameter you can specify a directory path that contain an HMM profile. This way you can run HMM profiles that are not included in anvi'o. See the online to find out about the specifics of this directory structure .
-M, --miscellaneous-model CATEGORY:MODEL
Use a miscellaneous HMM model installed with anvi'o by its key. See '--list-miscellaneous-models' for available options.
-I, --installed-hmm-profile HMM PROFILE NAME(S)
When you run this program without any parameter, it will run all 5 HMM profiles installed on your system. Using this parameter, you can instruct anvi'o to run only one or more of the specific profiles of you choose. You can provide a comma-separated list of names for multiple profiles (but in that case don't put a space between each profile name). Here is the list of installed profiles available to you: 'Ribosomal_RNA_18S' (type: Ribosomal_RNA_18S); 'Ribosomal_RNA_16S' (type: Ribosomal_RNA_16S); 'Bacteria_71' (type: singlecopy); 'Archaea_76' (type: singlecopy); 'Protista_83' (type: singlecopy).
--hmmer-output-dir OUTPUT DIRECTORY PATH
If you provide a path with this parameter, then the HMMER output file(s) will be saved in this directory. Please note that this will only work if you are running on only one profile using the -I flag.
--domain-hits-table
Use this flag in conjunction with --hmmer-output-dir to request domain table output from HMMER (i.e., the file specified by the --domtblout flag from hmmsearch or hmmscan). Otherwise, only the regular --tblout file will be stored in the specified directory. Please note that even if you use this flag, the HMM hits stored in the database will be taken from the --tblout file only. Also, this option only works with HMM profiles for amino acid sequences (not nucleotides).
--list-miscellaneous-models
List the miscellaneous HMM profiles that are shipped with anvi'o but not run by default, including their categories, notes, and full paths to use with '-H'.
tRNAs Through this program you can also scan Transfer RNA sequences in your contigs database for free (instead of running `anvi-scan-trnas` later).
--also-scan-trnas
Also scan tRNAs while you're at it.
PERFORMANCE Stuff everyone forgets to set and then get upset with how slow science goes.
-T, --num-threads NUM_THREADS
Maximum number of threads to use for multithreading whenever possible. Very conservatively, the default is 1, unless the environmental variable `ANVIO_THREADS` sets another positive integer. If you use this parameter, it will override `ANVIO_THREADS`. It is a good idea to not exceed the number of CPUs / cores on your system. Plus, please be careful with this option if you are running your commands on a SGE -- if you are clusterizing your runs, and asking for multiple threads to use, you may deplete your resources very fast. Default: 1
--hmmer-program HMMER_PROGRAM
Which of the HMMER programs to use to run HMMs (hmmscan or hmmsearch). By default anvi'o will use hmmscan for typical HMM operations like those in anvi-run-hmms (as these tend to scan a very large number of genes against a relatively small number of HMMs), but if you are using this program to scan a very large number of HMMs, hmmsearch might be a better choice for performance. For this reason, hmmsearch is the default in operations like anvi-run-pfams and anvi-run-kegg-kofams. See this article for a discussion on the performance of these two programs: http://cryptogenomicon.org/hmmscan-vs-hmmsearch-speed-the-numerology.html
AUTHORITY Because you are the boss.
--add-to-functions-table
Use this flag if you want anvi'o to store your HMM hits as gene annotations in the 'gene_functions'table of the database, rather than in the 'hmm_hits' table.
--just-do-it
Don't bother me with questions or warnings, just do it.

Additional Resources

Are you aware of resources that may help users better understand the utility of this program? Please feel free to edit this file on GitHub. If you are not sure how to do that, find the __resources__ tag in this file to see an example.