anvi-export-pan-subgraph

Export genomic loci that is in between two nodes in a given pangenome graph..

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

Authors

Requires

pan-graph-db

Can use

external-genomes

Provides

contigs-db

Usage

This program exports the genomic loci that fall between two nodes of an anvi’o pan-graph-db as individual contigs-db files (one per genome).

You will typically identify the two nodes of interest by visualizing the pangenome graph with anvi-display-pan-graph, and then ask this program to extract, for each genome in the graph, the stretch of DNA that lies between the genes that correspond to those two nodes.

Required Parameters

You will need to provide a pan-graph-db, an external-genomes file that describes the genomes that went into the graph (so anvi’o knows where to find each source contigs-db), an output directory, and a way to describe the loci to export. The loci can be described either by two graph nodes (--graph-nodes) or by a single region ID (--region-id). You must provide one of these two, but not both.

Describing loci with two graph nodes

Provide the two graph nodes that flank the loci you wish to export with --graph-nodes:

anvi-export-pan-subgraph -p PAN-GRAPH.db \ -e external-genomes \ --graph-nodes NODE_1,NODE_2 \ -o OUTPUT_DIRECTORY

Describing loci with a region ID

Alternatively, you can provide a single region ID with --region-id, and anvi’o will resolve the two boundary nodes of that region automatically:

anvi-export-pan-subgraph -p PAN-GRAPH.db \ -e external-genomes \ --region-id 234 \ -o OUTPUT_DIRECTORY

Please note that the way by which boundary nodes are resolved depends on the type of the region:

  • For a backbone region, anvi’o uses the leftmost and rightmost nodes of the region (by position) as the boundaries.
  • For a variable region, the first and the last nodes in the region will not necessarily present in all genomes, so anvi’o instead uses the closest eligible (non-RNA, coding) backbone nodes flanking the region on each side. As a result, the exported loci will include the variable region content plus at least two extra genes from the flanking backbone regions (one on each side), and anvi’o will print a warning describing exactly what was used. Keep this in mind if you intend to analyze the conservancy of genes in variable regions, to avoid misinterpretations.

You will typically learn which nodes or region IDs you are interested in by visualizing the pangenome graph in anvi’o using the program anvi-display-pan-graph. Region IDs will appear as you zoom in to certain parts of the pangenome graph like shown below:

Region IDs in pangenome graphs

Output

Regardless of how you describe the loci, the output directory will contain a separate contigs-db (along with a FASTA file and a blank profile-db) for the locus extracted from each genome.

Gene caller IDs

By default, the gene caller IDs in each exported contigs-db match those in the source contigs-db that the locus was extracted from. This way you can trace every gene in an exported locus back to the gene it originated from in the original database.

If you would rather have the gene caller IDs reset so that they start from 0 in each output database (which was the historical behavior of this program), use the --reset-gene-caller-ids flag:

anvi-export-pan-subgraph -p PAN-GRAPH.db \ -e external-genomes \ --graph-nodes NODE_1,NODE_2 \ -o OUTPUT_DIRECTORY \ --reset-gene-caller-ids

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-export-pan-subgraph.

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-export-pan-subgraph [-h] -p PAN_GRAPH_DB -e FILE_PATH [--graph-nodes NODE_1,NODE_2] [--component-id COMPONENT_ID] [--region-id REGION_ID] -o DIR_PATH [--reset-gene-caller-ids]

Parameters and their descriptions

INPUT FILES
-p, --pan-graph-db PAN_GRAPH_DB required
Anvi'o pangenome graph database.
-e, --external-genomes FILE_PATH required
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.
SUBGRAPH COORDINATES This is where you describe the loci that you wish anvi'o to export. Users will typically learn which nodes or region IDs they are interested in by visualizing the pangenome graph in anvi'o using the program `anvi-display-pan-graph`. Provide either --graph-nodes, or --component-id together with --region-id (not both approaches at once).
--graph-nodes NODE_1,NODE_2
Nodes in an anvi'o pangenome graph database..
--component-id COMPONENT_ID
The number of a component in an anvi'o pangenome graph database (e.g. '1' for the first/largest component). Used together with `--region-id` to identify a region.
--region-id REGION_ID
The number of a region within a component of an anvi'o pangenome graph database (e.g. '5' for the fifth region). Must be used together with `--component-id`. The program will resolve the two boundary nodes (by position) of the region and export the loci between them.
OUTPUT Provide a directory path, and anvi'o will generate all your contigs databases for exported loci in it.
-o, --output-dir DIR_PATH required
Directory path for output files
--reset-gene-caller-ids
By default, the gene caller ids in the resulting contigs databases will match those in the source contigs databases, so you can trace each gene back to where it came from. If you use this flag, anvi'o will instead reset the gene caller ids so they start from 0 in each output database (which was the historical default behavior).

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.