anvi-get-sequences-for-gene-calls

A script to get back sequences for gene calls.

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

Authors

Requires

contigs-db

Can use

genomes-storage-db

Provides

genes-fasta external-gene-calls

Usage

This program allows you to export the sequences of your gene calls from a contigs-db or genomes-storage-db in the form of a genes-fasta.

If you want other information about your gene calls from a contigs-db, you can run anvi-export-gene-calls (which outputs a gene-calls-txt) or get the coverage and detection information with anvi-export-gene-coverage-and-detection.

Running on a contigs database

You can run this program on a contigs-db like so:

anvi-get-sequences-for-gene-calls -c contigs-db \ -o path/to/output

This is create a genes-fasta that contains every gene in your contigs database. If you only want a specific subset of genes, you can run the following:

anvi-get-sequences-for-gene-calls -c contigs-db \ -o path/to/output \ --gene-caller-ids 897,898,1312 \ --delimiter ,

Now the resulting genes-fasta will contain only those three genes.

Please note that this program allows you to format the deflines of the resulting FASTA file to a great extent. For this, it uses a set of previously-defined variables you can use to define a template of your liking. You can learn about the available variables, you can include the following flag in your command:

anvi-get-sequences-for-gene-calls -c contigs-db \ -o path/to/output \ --list-defline-variables

which will give you an output similar to this:

WARNING
===============================================
Here are the variables you can use to provide a user-defined defline template:

* {gene_caller_id}
* {contig_name}
* {start}
* {stop}
* {direction}
* {length}
* {contigs_db_project_name}

Remember, by default, anvi'o will only use '{gene_caller_id}' to format the
deflines of FASTA files it produces.

Now you can use the --defline-format parameter with any combination of these variables to control the output FASTA file deflines. Here are some examples using the contigs-db file included in the Infant Gut Dataset, and the contents of the resulting FASTA file:

anvi-get-sequences-for-gene-calls -c INFANT-GUT-TUTORIAL/CONTIGS.db \
                                  --gene-caller-ids 77 \
                                  -o 77.fa \
                                  --defline-format "{gene_caller_id}"
>77
ATGAGTAATTTATTGCGAGCAGAAGGCGTGTCTTATCAAGTAAATGGTCGTAGCATTCTTTCTGATATTGATTTGTCATTTGAAACAGGCAGCAATACAACAATTGTTGGTCCTTCAGGT
AGCGGGAAAAGTACATTTTTAAAAATTTTATCTTCATTATTAAGTCCTACAGAAGGCGAAATTTTTTATCAAGAAGCGCCAATTACTACAATGCCAATCGAAACATACCGCCAAAAGGTT
TCTTATTGTTTTCAGCAGCCAACTTTATTTGGTGAAACCGTGTATGATAATTTGTTATTTCCATTTACCGTCAGACAAGAAGCGTTTAATCAGGAAAAAGTCGTGGCATTACTCCAACAA
GTGAAATTGCCCGCTGCTTATCTTGAAAAGAAAATAGCCGAACTCTCTGGTGGTGAGCGACAACGGGTTGCTTTGCTACGAAACATTATTTTTGTACCAGATGTTTTATTATTAGACGAA
GTTACAACGGGATTAGATGAAGAAAGCAAACAGATTGTCAATCAATTGTTAAACCAATTAAACAAAGAGCAAGGAGTCACGCTGGTTCGTGTCACGCATGATACCGAAGAAATTCAGCAA
GCACAGCAAGTGATTCGTATTGTAGCAGGAAAGGTGGCGCCGACAGATGGATTTAGCAGTTAA

The simple option shown above also is the default defline format anvi’o uses. Here is a more sophisticated example:

anvi-get-sequences-for-gene-calls -c INFANT-GUT-TUTORIAL/CONTIGS.db \
                                  --gene-caller-ids 77 \
                                  -o 77.fa \
                                  --defline-format "{contigs_db_project_name}_{contig_name}_{gene_caller_id}"
>Infant_Gut_Contigs_from_Sharon_et_al_Day17a_QCcontig1_77
ATGAGTAATTTATTGCGAGCAGAAGGCGTGTCTTATCAAGTAAATGGTCGTAGCATTCTTTCTGATATTGATTTGTCATTTGAAACAGGCAGCAATACAACAATTGTTGGTCCTTCAGGT
AGCGGGAAAAGTACATTTTTAAAAATTTTATCTTCATTATTAAGTCCTACAGAAGGCGAAATTTTTTATCAAGAAGCGCCAATTACTACAATGCCAATCGAAACATACCGCCAAAAGGTT
TCTTATTGTTTTCAGCAGCCAACTTTATTTGGTGAAACCGTGTATGATAATTTGTTATTTCCATTTACCGTCAGACAAGAAGCGTTTAATCAGGAAAAAGTCGTGGCATTACTCCAACAA
GTGAAATTGCCCGCTGCTTATCTTGAAAAGAAAATAGCCGAACTCTCTGGTGGTGAGCGACAACGGGTTGCTTTGCTACGAAACATTATTTTTGTACCAGATGTTTTATTATTAGACGAA
GTTACAACGGGATTAGATGAAGAAAGCAAACAGATTGTCAATCAATTGTTAAACCAATTAAACAAAGAGCAAGGAGTCACGCTGGTTCGTGTCACGCATGATACCGAAGAAATTCAGCAA
GCACAGCAAGTGATTCGTATTGTAGCAGGAAAGGTGGCGCCGACAGATGGATTTAGCAGTTAA

And finally, here is an example that is quite comprehensive in its request from anvi’o:

anvi-get-sequences-for-gene-calls -c INFANT-GUT-TUTORIAL/CONTIGS.db \
                                  --gene-caller-ids 77 \
                                  -o 77.fa \
                                  --defline-format "{gene_caller_id} contig_name:{contig_name}|gene_start:{start}|gene_stop:{stop}|gene_length:{length}|gene_direction:{direction}"
>77 contig_name:Day17a_QCcontig1|gene_start:67276|gene_stop:67939|gene_length:663|gene_direction:f
ATGAGTAATTTATTGCGAGCAGAAGGCGTGTCTTATCAAGTAAATGGTCGTAGCATTCTTTCTGATATTGATTTGTCATTTGAAACAGGCAGCAATACAACAATTGTTGGTCCTTCAGGT
AGCGGGAAAAGTACATTTTTAAAAATTTTATCTTCATTATTAAGTCCTACAGAAGGCGAAATTTTTTATCAAGAAGCGCCAATTACTACAATGCCAATCGAAACATACCGCCAAAAGGTT
TCTTATTGTTTTCAGCAGCCAACTTTATTTGGTGAAACCGTGTATGATAATTTGTTATTTCCATTTACCGTCAGACAAGAAGCGTTTAATCAGGAAAAAGTCGTGGCATTACTCCAACAA
GTGAAATTGCCCGCTGCTTATCTTGAAAAGAAAATAGCCGAACTCTCTGGTGGTGAGCGACAACGGGTTGCTTTGCTACGAAACATTATTTTTGTACCAGATGTTTTATTATTAGACGAA
GTTACAACGGGATTAGATGAAGAAAGCAAACAGATTGTCAATCAATTGTTAAACCAATTAAACAAAGAGCAAGGAGTCACGCTGGTTCGTGTCACGCATGATACCGAAGAAATTCAGCAA
GCACAGCAAGTGATTCGTATTGTAGCAGGAAAGGTGGCGCCGACAGATGGATTTAGCAGTTAA

You also have the option to report the output in gff3 format, report extended deflines for each gene, or report amino acid sequences instead of nucleotide sequences.

Running on a genomes storage database

You can also get the sequences from gene calls in a genomes-storage-db, like so:

anvi-get-sequences-for-gene-calls -g genomes-storage-db \ -o path/to/output

This will create a genes-fasta that contains every gene in your genomes storage database. To focus on only a subset of the genomes contained in your database, use the flag --genome-names. You can provide a comma-delimited list of genome names or a flat text file that contains one genome per line. Alternatively, you could provide a list of gene-caller-ids as specified above.

You also have the option to report the output in gff3 format, report extended deflines for each gene, or report amino acid sequences instead of nucleotide sequences.

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-gene-calls.

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-gene-calls [-h] [-c CONTIGS_DB] [--gene-caller-ids GENE_CALLER_IDS] [--delimiter CHAR] [--flank-length INT] [--get-aa-sequences] [--external-gene-calls GENE-CALLS] [--export-gff3] [--annotation-source FUNCTION_ANNOTATION_SOURCE] [-l] [--return-all-function-hits-for-each-gene] [-g GENOMES_STORAGE] [-G GENOME_NAMES] [--report-extended-deflines] [--wrap WRAP] [--list-defline-variables] [--defline-format F-STRING] -o FILE_PATH

Parameters and their descriptions

OPTION #1: GET SEQUENCES FROM A CONTIGS DB
-c, --contigs-db CONTIGS_DB
Anvi'o contigs database generated by 'anvi-gen-contigs-database'
--gene-caller-ids GENE_CALLER_IDS
Gene caller ids to focus on. Multiple of them can be declared separated by a delimiter (the default is a comma, and if there is no option to change the delimiter, you must use a comma).In anvi-gen-variability-profile, if you declare nothing you will get all genes matching your other filtering criteria. In other programs, you may get everything, nothing, or an error. It really depends on the situation. Fortunately, mistakes are cheap, so it's worth a try.
--delimiter CHAR
The delimiter to parse multiple input terms. The default is ','. Default: ,
--flank-length INT
Extend sequences for gene calls with additional nucleotides from both ends. If the seqeunce for a target gene is between nucleotide positions START and STOP, using a flank lenght of M will give you a sequence that starts at START - M and ends at STOP + M. Default: 0
--get-aa-sequences
Store amino acid sequences instead.
--external-gene-calls GENE-CALLS
An optional external gene calls file path that precisely describes the set of gene sequences exported. Using this file you can create an anvi'o contigs database from the resulting genes FASTA file without having to do a gene calling from scratch.
OPTION #1.1: STORE SEQEUNCES AS GFF? This only works with OPTION #1 :/
--export-gff3
If this is true, the output file will be in GFF3 format.
--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.
-l, --list-annotation-sources
List available functional annotation sources.
--return-all-function-hits-for-each-gene
Any given function annotation source may provide more than one annotation for a given gene. Using this flag will instruct anvi'o to report all hits, even if the default behavior is to report only the most statistically significant one.
OPTION #2: GET SEQUENCES FROM A GENOMES STORAGE
-g, --genomes-storage GENOMES_STORAGE
Anvi'o genomes storage file
-G, --genome-names GENOME_NAMES
Genome names to 'focus'. You can use this parameter to limit the genomes included in your analysis. You can provide these names as a comma-separated list of names, or you can put them in a file, where you have a single genome name in each line, and provide the file path.
FASTA OUTPUT FORMATTING OPTIONS
--report-extended-deflines
When declared, the deflines in the resulting FASTA file will contain more information.
--wrap WRAP
When to wrap sequences when storing them in a FASTA file. The default is '120'. A value of '0' would be equivalent to 'do not wrap'. Default: 120
--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.
--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.
OPTIONS COMMON TO ALL INPUTS
-o, --output-file FILE_PATH required
File path to store results.

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.