anvi-gen-function-matrix

A program to generate reports for the distribution of functions across genomes.

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

Authors

Requires

functions external-genomes

Can use

internal-genomes genomes-storage-db groups-txt

Provides

functions-across-genomes-txt

Can provide

functional-enrichment-txt

Usage

Generates TAB-delmited output files for functions from a single function annotation source across genomes.

For a simlar program that reports HMM hits across genomes, see anvi-gen-hmm-hits-matrix.

The input genomes 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. Unlike, anvi-display-functions, this program will report TAB-delmited output files for you to further analyze.

You can run the program on a set of genomes for a given annotation source:

anvi-gen-function-matrix -e external-genomes \ --annotation-source COG20_FUNCTION \ --output-file-prefix MY-GENOMES

The command above will result in two files in your work directory, both of which will be of type functions-across-genomes-txt:

  • MY-GENOMES-FREQUENCY.txt
  • MY-GENOMES-PRESENCE-ABSENCE.txt

In each of these files, the first columns describe each function (a unique key, the function name, and optionally the function accession ids), and the remaining columns hold one value per genome.

You can always learn about which functions are in a given contigs-db using the program anvi-db-info.

Per-population copy number normalization for metagenomic assemblies

If we want to get an idea of differences in functional capacity across different metagenomic assemblies (or long-read sequence metagenomes) but, for some good reasons, we do not have MAGs from these assemblies, or we want to make sure that we make use of all the sequence data we have and not only those reads that are used to reconstruct genomes, we can’t just look at the distribution of functions across genomes, because all functions and metabolic pathways will most likely occur nearly everywhere, at least in one population, and population numbers may differ dramatically across samples, and just counting the occurrence of a given function would not provide ecologically meaningful insights. To overcome this, Iva Veseli introduced the per-population copy number normalization. Based on the same principle, adding the flag --add-per-population-copy-number allows you to normalize individual functional annotations within a metagenomic assembly using the SCG-based estimate of population numbers within the sample.

anvi-gen-function-matrix -e external-genomes \ --annotation-source COG20_FUNCTION \ --output-file-prefix MY-METAGENOMES \ --add-per-population-copy-number

Adding the flag generates an additional output file of type functions-across-genomes-txt:

  • MY-METAGENOMES-PER-POPULATION-COPY-NUMBER.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 COG20_FUNCTION \ --output-file-prefix MY-GENOMES \ --groups-txt groups.txt

which would generate an additional file in your work directory of type functional-enrichment-txt:

  • MY-GENOMES-FUNCTIONAL-ENRICHMENT.txt

Edit this file to update this information.

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.