anvi-get-sequences-for-function-hits

Get sequences for genes with hits in a single functional annotation source, optionally only for those that match to specific accession ids, from one or more contigs-dbs, bins, or genomes. Similar to anvi-get-sequences-for-hmm-hits, but without any gene concatenation / phylogenomics functionality..

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

Authors

Requires

contigs-db functions

Can use

profile-db collection bin external-genomes internal-genomes

Provides

genes-fasta

Usage

This program writes a genes-fasta with one entry per gene that has at least one hit in a single functions source. You can limit the output to genes with hits to specific accession ids in that source.

It works with a contigs-db, bins in a collection, or many genomes described in external-genomes and/or internal-genomes files.

anvi-get-sequences-for-function-hits is very similar to anvi-get-sequences-for-hmm-hits, but unlike the latter, this program does not have any functionality to concatenate genes for downstream phylogenetic or phylogenomic analyses. While this was not difficult to implement, it was a mindful omission on our part. This is primarily due to the fact that genes that share a functional annotation can have extremely low sequence identity depending on the breadth of their representation in databases, so their sequences may not a reliable basis for phylogenetic or phylogenomic inferences even though it may not be immediately obvious for all functions. HMMs can also return not-so-ideal hits, but since they are built from aligned sequences by design, they are generally more appropriate to work with for such goals.

The primary purpose of this program is to give you all matching sequences annotated with a particular function, or all functions listed in a particular source.

Learn available annotation sources

anvi-get-sequences-for-function-hits -c contigs-db \ --list-annotation-sources

Get sequences for all genes with hits in a source

anvi-get-sequences-for-function-hits -c contigs-db \ --annotation-source Pfam \ -o genes-fasta

Get sequences only for genes with hits to specific accession ids

anvi-get-sequences-for-function-hits -c contigs-db \ --annotation-source Pfam \ --accession-ids PF00117,PF02786 \ -o genes-fasta

Instead of a comma-separated list, --accession-ids also accepts a file with one accession id per line. A gene is reported if any of its hits in the source matches any of the accession ids. If an accession id matches nothing in any of your inputs, anvi’o will stop with an error rather than ignore it.

Get sequences from bins or genomes

For every bin in a collection (use --bin-id or --bin-ids-file to focus on specific bins):

anvi-get-sequences-for-function-hits -c contigs-db \ -p profile-db \ -C collection \ --annotation-source COG20_FUNCTION \ -o genes-fasta

For many genomes:

anvi-get-sequences-for-function-hits -e external-genomes \ -i internal-genomes \ --annotation-source KOfam \ --accession-ids K00001 \ -o genes-fasta

The annotation source must be present in every input contigs-db.

Amino acid sequences

Sequences are reported in DNA alphabet by default. Add --get-aa-sequences to get amino acid sequences instead.

Deflines

The default defline looks like this:

{genome_name}_{gene_callers_id} source:{source}|accession:{accession}|function:{function}

Here {genome_name} is the genome name, the bin name, or the project name of the contigs-db depending on the input. If a gene has multiple hits in the source, its accessions and functions are joined with !!!.

You can define your own defline with --defline-format, and see all available variables with --list-defline-variables. Your format must produce a unique defline for each sequence (e.g., by including {genome_name} and {gene_callers_id}), otherwise anvi’o will complain.

anvi-get-sequences-for-function-hits -c contigs-db \ --annotation-source Pfam \ --defline-format “{gene_callers_id}_{accession}” \ -o genes-fasta

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-get-sequences-for-function-hits.

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-get-sequences-for-function-hits [-h] [-c CONTIGS_DB] [-p PROFILE_DB] [-C COLLECTION_NAME] [-b BIN_NAME] [-B FILE_PATH] [-e FILE_PATH] [-i FILE_PATH] [--annotation-source FUNCTION_ANNOTATION_SOURCE] [--accession-ids ACCESSION_IDS] [-l] [-o FILE_PATH] [--get-aa-sequences] [--defline-format F-STRING] [--list-defline-variables] [--no-wrap]

Parameters and their descriptions

INPUT OPTION #1: CONTIGS DB Get sequences for all genes with hits in a single contigs-db.
-c, --contigs-db CONTIGS_DB
Anvi'o contigs database generated by 'anvi-gen-contigs-database'
INPUT OPTION #2: CONTIGS DB + PROFILE DB Get sequences for genes in bins of a collection. Without a bin id or a bin ids file, every bin in the collection will be used.
-p, --profile-db PROFILE_DB
Anvi'o profile database
-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).
INPUT OPTION #3: EXTERNAL / INTERNAL GENOMES Get sequences for genes in many genomes. You can use an external genomes file, an internal genomes file, or both.
-e, --external-genomes FILE_PATH
A two-column TAB-delimited flat text file that lists anvi'o contigs databases. The first item in the header line should read 'name', and the second should read 'contigs_db_path'. Each line in the file should describe a single entry, where the first column is the name of the genome (or MAG), and the second column is the anvi'o contigs database generated for this genome.
-i, --internal-genomes FILE_PATH
A five-column TAB-delimited flat text file. The header line must contain these columns: 'name', 'bin_id', 'collection_id', 'profile_db_path', 'contigs_db_path'. Each line should list a single entry, where 'name' can be any name to describe the anvi'o bin identified as 'bin_id' that is stored in a collection.
FUNCTIONS Declare exactly one annotation source, and optionally limit the output to genes with hits to specific accession ids in it. If you are recovering sequences from multiple genomes you better have the same annotation source in all of them.
--annotation-source FUNCTION_ANNOTATION_SOURCE
Get functional annotations for a specific annotation source. You can use the flag '--list-annotation-sources' to learn about what sources are available.
--accession-ids ACCESSION_IDS
One or more accession ids from a functional annotation source to focus on. You can provide them as a comma-separated list (e.g., 'PF00117,PF02786'), or as a path to a file with one accession id per line. Accession ids are matched exactly and they are case-sensitive for science.
-l, --list-annotation-sources
List available functional annotation sources.
OUTPUT A FASTA file with one entry per gene.
-o, --output-file FILE_PATH
File path to store results.
--get-aa-sequences
Store amino acid sequences instead.
--defline-format F-STRING
Proivide a defline template for anvi'o to use when generating the FASTA output. The way this works is actually quite simple: first you learn about all the options that exist using the `--list-defline-variables`, and then use them to create your template. Available variables should be listed within curly brackets, which will be evaluated in contex. Anything outside of curly brackets will be kept as is. For instance, if you would like your defline to have the gene caller ID after the contig name in which it occurs, you can use this template: '{contig_name}_{gene_callers_id}', and your defline will look like '>XXX_182'. In most cases '{gene_callers_id}' will serve as the default defline format if this parameters is not used. See more examples in online help.
--list-defline-variables
When declared, anvi'o will list the variable names that can be used to construct deflines in FASTA outputs from the user-defined `--defline-format` strings.
--no-wrap
Do not be wrap sequences nicely in the output file.

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.