anvi-gen-gene-level-stats-databases

A program to compute genes databases for a ginen set of bins stored in an anvi'o collection. Genes databases store gene-level coverage and detection statistics, and they are usually computed and generated automatically when they are required (such as running anvi-interactive with --gene-mode flag). This program allows you to pre-compute them if you don't want them to be done all at once.

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

Authors

Requires

profile-db contigs-db

Can use

collection bin

Provides

genes-db

Usage

This program generates a genes-db, which stores the coverage and detection values for all of the genes in your contigs-db.

This information is usually calculated when it’s needed (for example when running anvi-interactive in genes mode), but this program lets you break this process into two steps. This way, you can easily change the parameters of anvi-interactive without having to recalculate the gene-level statistics.

Given a contigs-db and profile-db pair, as well as a collection, this program will calculate the stats for the genes in each of your bins and give each bin its own genes-db that includes this information.

For example, if a collection called GENE_COLLECTION contained the bins bin_0001, bin_0002, and bin_0003 and you ran:

anvi-gen-gene-level-stats-databases -c contigs-db \ -p profile-db \ -C GENE_COLLECTION

Then it will create a directory called GENES next to your profile-db that contains three genes-dbs called GENE_COLLECTION-bin_0001.db, GENE_COLLECTION-bin_0002.db, and GENE_COLLECTION-bin_0003.db. Once these databases are there, running anvi-interactive in gene mode for any of these bins will use them directly, instead of computing gene-level stats from scratch.

You also have the option to provide a list of bin (either as a file or as a string) to analyze instead of every bin in a collection.

If genes databases already exist for some of your bins, anvi’o will ask you to use the flag --just-do-it before it does anything. With that flag, it will keep each existing genes database that was generated with the same parameters and the same splits, and regenerate the ones that weren’t.

Normalized gene coverages

By default, this program also computes five normalizations of the non_outlier_mean_coverage values of each gene in each sample, and stores them in the genes database. They become additional views when you run anvi-interactive in gene mode:

  • log1p: log(x + 1) of coverage values, which reduces their dynamic range.
  • cov_per_million: mean coverage depth per million mapped reads in each sample, which accounts for differences in sequencing depth across samples. Please note that this is not CPM (counts per million), since it is based on coverage depth rather than read counts.
  • zscore_raw, zscore_log1p, and zscore_cov_per_million: per-gene z-scores of raw, log1p, and cov_per_million values across samples, which show how many standard deviations a gene’s coverage in a given sample deviates from that gene’s mean coverage across all samples.

Z-scores are computed for each gene separately, so they are not comparable between genes within the same sample. With transcriptomic data, they reflect each gene’s own expression pattern. With metagenomic data, genes of a single population tend to follow the abundance of that population, so z-scores mostly help spot genes whose coverage patterns deviate from the rest of their genome (such as those that are found in multiple copies, or are absent from some samples). In either case, setting a center value of 0 for z-score views in the interactive interface will display them as diverging values.

If an existing genes database does not have normalized coverages yet (e.g., because it was generated with an earlier version of anvi’o), this program will compute them using the gene-level stats already stored in it.

You can skip this step with the flag --skip-computing-gene-level-normalized-coverages, in which case these data will not be generated, and these views will not be available:

anvi-gen-gene-level-stats-databases -c contigs-db \ -p profile-db \ -C collection \ --skip-computing-gene-level-normalized-coverages

Z-scores are not meaningful when there is only a single sample. So, if your profile-db has only one sample, anvi’o will refuse to create a new genes database until you add --skip-computing-gene-level-normalized-coverages to your command, so it is clear that these values will not be available.

Computing coverage per million mapped reads requires the number of reads mapped to each sample, which some very old profile-dbs may not have. In that case anvi’o will skip computing normalized coverages with a warning.

Other Parameters

You can also change the definition of an outlier nucleotide position (with --outliers-threshold), or whether nucleotide positions with zero coverage should be treated as outliers (with --zeros-are-outliers).

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-gen-gene-level-stats-databases.

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-gen-gene-level-stats-databases [-h] -c CONTIGS_DB -p PROFILE_DB [-C COLLECTION_NAME] [-b BIN_NAME] [-B FILE_PATH] [--zeros-are-outliers] [--outliers-threshold NUM] [--skip-computing-gene-level-normalized-coverages] [--just-do-it]

Parameters and their descriptions

INPUT DATABASES Which anvi'o databases do you wish to work today?
-c, --contigs-db CONTIGS_DB required
Anvi'o contigs database generated by 'anvi-gen-contigs-database'
-p, --profile-db PROFILE_DB required
Anvi'o profile database
BIN(S) AND COLLECTION You can select a bin, multiple bins, or you can simply focus on every bin in a collection by providing only a collection name. Once you are done with your selection, anvi'o will generate an individual genes database for each of the bin it finds.
-C, --collection-name COLLECTION_NAME
Collection name.
-b, --bin-id BIN_NAME
Bin name you are interested in.
-B, --bin-ids-file FILE_PATH
Text file for bins (each line should be a unique bin id).
ADDITIONAL PARAMETERS These parameters are those that are critical to identify outlier nucleotide positions and how to define what should be included in those calculations. In most cases you can leave them as is, and things are going to be alright.
--zeros-are-outliers
If you want all zero coverage positions to be treated like outliers then use this flag. The reason to treat zero coverage as outliers is because when mapping reads to a reference we could get many zero positions due to accessory genes. These positions then skew the average values that we compute.
--outliers-threshold NUM
Threshold to use for the outlier detection. The default value is '1.5'. Absolute deviation around the median is used. To read more about the method please refer to: 'How to Detect and Handle Outliers' by Boris Iglewicz and David Hoaglin (doi:10.1016/j.jesp.2013.03.013). Default: 1.5
--skip-computing-gene-level-normalized-coverages
By default, when anvi'o generates gene-level coverage stats for a genes database, it also computes five normalizations of the non_outlier_mean_coverage values for each gene in each sample, stores them in the genes database, and makes them available as additional views in gene mode: (1) log1p: log(x + 1), which reduces dynamic range; (2) cov_per_million: mean coverage depth per million mapped reads, which accounts for differences in sequencing depth across samples; (3) zscore_raw: per-gene z-score of raw non_outlier_mean_coverage across samples; (4) zscore_log1p: per-gene z-score of log1p-transformed values; (5) zscore_cov_per_million: per-gene z-score of cov_per_million-normalized values. Z-scores show how many standard deviations a gene's coverage in a given sample deviates from that gene's mean coverage across all samples. They are not comparable between genes within the same sample. With transcriptomic data they reflect each gene's own expression pattern; with metagenomic data, genes of a single population tend to follow the population's abundance, so z-scores mostly help spot genes whose coverage deviates from the rest of their genome. Using this flag will prevent anvi'o from generating these data, and these views will not be available. If the genes database already contains them from an earlier run, they will still be shown. Since z-scores are not meaningful with a single sample, anvi'o will force you to include this flag when it creates a new genes database for a profile database that has only one sample (on behalf of anvi'o, we apologize for the inconvenience if/when that happens).
PARAMETERS OF CONVENIENCE They say they save lives.
--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.