A program to generate reports for the distribution of functions across genomes.
🔙 To the main page of anvi’o programs and artifacts.
internal-genomes
genomes-storage-db
groups-txt ![]()
Generates TAB-delmited output files for functions from a single function annotation source across all contigs-db files it receives.
For a simlar program that reports HMM hits instead, see anvi-gen-hmm-hits-matrix.
The input genomes, metagenomes, or loci for this program can be provided through an external-genomes, internal-genomes, genomes-storage-db, or any combination of these sources.
This program is very similar to anvi-display-functions, and can also perform a functional enrichment analysis on-the-fly if you provide it with an optional groups-txt file. But unlike, anvi-display-functions, this program will report TAB-delmited output files for you to further analyze.
You can always learn about which functions are in a given contigs-db using the program anvi-db-info.
You can run the program on a set of contigs-db files with a specific source of function annotation:
anvi-gen-function-matrix -e external-genomes \ --annotation-source functions \ --output-file-prefix MY-GENOMES
The command above will result in two files in your work directory (MY-GENOMES-FREQUENCY.txt and MY-GENOMES-PRESENCE-ABSENCE.txt) of type functions-across-genomes-txt.
In each of these files, the first few columns will describe functions (with a unique key, the full function name, and optionally the function accession ID), and the remaining columns will hold one value per genome.
These files will report raw frequency and presence/absence of functions across contigs-db files that you can use for downstream analyses.
If you want to get an idea of differences in functional capacity across different metagenomic assemblies, but if you do not have MAGs from these assemblies or if you wish to make use of a larger fraction of the sequence data and not only only those reads that are used to reconstruct genomes, looking at the raw frequencies or raw presence/absence data becomes less effective for any downstream analysis as almost all functions and metabolic modules known will likely occur in at least in one population in a given metagenome. Although, normalizing the raw frequencies based on the estimated number of populations in a given environment would make such comparisons across metagenomes much more effective.
Anvi’o includes a means to estimate the number of populations observed in a given assembly using single-copy core genes, which is used in anvi-display-contigs-stats, and Veseli et al. has previously demonstrated its utility by predicting per-population copy number of metabolic modules observed across samples.
anvi-gen-function-matrix makes the same principle accessible with for functions via the flag --add-per-population-copy-number, which produces an additional output file with normalized copy numbers of the frequency of functions across samples:
anvi-gen-function-matrix -e external-genomes \ --annotation-source functions \ --output-file-prefix MY-METAGENOMES \ --add-per-population-copy-number
Adding the flag generates an additional output file, MY-METAGENOMES-PER-POPULATION-COPY-NUMBER.txt, of type functions-across-genomes-txt.
By dividing the frequency of each function in a given metagenomic assembly by the number of populations estimated to be present in that same assembly based on counts of single-copy core genes (SCGs) in each contigs-db: for each domain-specific SCG set, anvi’o takes the mode of the number of hits across all SCGs, and sums these per-domain estimates across Bacteria, Archaea, and Eukarya.
The script relies on SCG annotations generated by anvi-run-hmms, and you need an external-genomes file to let it know which assemblies to compare.
A per-population copy number is an average number of copies of a function per population: a value near 1 means the function tends to occur once in every population, a value below 1 means it is present in only a fraction of the populations, and a value above 1 means it tends to occur in multiple copies per population (as is common for, e.g., transposases). If a given metagenome has single-copy core genes that are too sparse to yield a reliable estimate, anvi’o cannot compute its number of populations, and the per-population copy number values for that assembly will be reported as NA.
Alternatively, you can run it with a groups-txt that associates sets of genomes with distinct groups,
anvi-gen-function-matrix -i internal-genomes \ --annotation-source functions \ --output-file-prefix MY-GENOMES \ --groups-txt groups.txt
which would generate an additional file in your work directory, MY-GENOMES-FUNCTIONAL-ENRICHMENT.txt, of type functional-enrichment-txt.
Edit this file to update this information.
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.