anvi-rename-bins

Rename all bins in a given collection (so they have pretty names).

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

Authors

Requires

collection bin profile-db

Can use

contigs-db

Provides

collection bin

Usage

This program creates a new collection from the bins in another collection with specific guidelines. This is especially helpful when you wish to standardize your bin names, add project specific prefixes, and/or exclude those that do not match your criteria of completion, redundancy, and/or size estimates.

Renaming all bins in a collection

Let’s say you have a collection called MY_COLLECTION, which has four bins that are named poorly (which can happen due to decisions made by automatic binning tools, or after a few steps of manual refinement): Bin_1_2_1, Bin_2, Bin_3_1_1, and Bin_4. In an instance like this, running the program anvi-rename-bins the following way will standardize these bin names with a prefix specific to your project:

anvi-rename-bins -c contigs-db \ -p profile-db \ --prefix SURFACE_OCEAN \ --collection-to-read MY_COLLECTION \ --collection-to-write SURFACE_OCEAN_SAMPLES \ --report-file rename.txt

Now your profile-db will have a new collection named SURFACE_OCEAN_SAMPLES that will contains your four bins witht their new names SURFACE_OCEAN_Bin_00001, SURFACE_OCEAN_Bin_00002, SURFACE_OCEAN_Bin_00003, and SURFACE_OCEAN_Bin_00004. The new naming will order your bins based on their substantive completion (i.e., completion minus redunancy).

The file rename.txt is a TAB-delimited file that contains a summary of your renaming process. The first column has the original name of the bins that you renamed, the second has their new names, and the remaining columns contain information about those bins (like their completion, redundency, and size).

Separating out the MAGs

You can also label your MAGs separately from your bins via the flag --call-MAGs:

anvi-rename-bins -c contigs-db \ -p profile-db \ --prefix SURFACE_OCEAN \ --collection-to-read MY_COLLECTION \ --collection-to-write SURFACE_OCEAN_MAGS \ --report-file rename.txt \ --call-MAGs \ --min-completion-for-MAG 70

Now, the collection SURFACE_OCEAN_MAGS will include SURFACE_OCEAN_MAG_00001, SURFACE_OCEAN_MAG_00002, SURFACE_OCEAN_MAG_00003, and SURFACE_OCEAN_Bin_00004. These are exactly the same bins that the collection contained before, but now the names differenciate the wheat from the chaff.

In addition to minimum completion estimate, you can also adjust the maximum redundancy value, minimum size to call MAGs. Please see the help menu for all parameters and their descriptions.

Exclude bins that are not MAGs

When you use the flag --call-MAGs, anvi’o identifies those bins that could be considered ‘MAGs’ based on your specific criteria. But regardles of whether an original bin remains a bin, or tagged as a MAG, everything in your original collection will end up in your new collection. The flag --exclude-bins enable you to filter out those that end up not being tagged as MAGs:

anvi-rename-bins -c contigs-db \ -p profile-db \ --prefix SURFACE_OCEAN \ --collection-to-read MY_COLLECTION \ --collection-to-write SURFACE_OCEAN_MAGS \ --report-file rename.txt \ --min-completion-for-MAG 70 \ --call-MAGs \ --exclude-bins

With the addition of the flag --exclude-bins to the same command, the collection SURFACE_OCEAN_MAGS will no longer include bins SURFACE_OCEAN_Bin_00003 and SURFACE_OCEAN_Bin_00004.

See also the program anvi-delete-collection.

The report file

Following is an example reporting output file anvi’o will generate at the file path declared with the parameter --report-file:

old_bin_name new_bin_name SCG_domain completion redundancy size_in_Mbp
Bin_2 p800_MAG_00001 eukarya 61.45 7.23 26.924911
Bin_1 p800_MAG_00002 bacteria 98.59 8.45 1.612349
Bin_3 p800_Bin_00003 blank 0.00 0.00 0.103694
Bin_5 p800_Bin_00004 blank 0.00 0.00 0.128382
Bin_4 p800_Bin_00005 bacteria 1.41 0.00 0.378418

The column SCG_domain will explain which collection of single-copy core genes were used to generate these completion/redundancy estimates. The absence of any domain prediction for any given bin will be marked with the keyrowd blank.

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-rename-bins.

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-rename-bins [-h] -c CONTIGS_DB -p PROFILE_DB [--collection-to-read COLLECTION_TO_READ] [--collection-to-write COLLECTION_TO_WRITE] [--prefix PREFIX] [--report-file REPORT_FILE_PATH] [--list-collections] [--dry-run] [--call-MAGs] [--min-completion-for-MAG MIN_COMPLETION_FOR_MAG] [--max-redundancy-for-MAG MAX_REDUNDANCY_FOR_MAG] [--size-for-MAG MEGABASEPAIRS] [--exclude-bins]

Parameters and their descriptions

DEFAULT INPUTS Standard stuff
-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
--collection-to-read COLLECTION_TO_READ
Collection name to read from. Anvi'o will not overwrite an existing collection, instead, it will create a copy of your collection with new bin names.
--collection-to-write COLLECTION_TO_WRITE
The new collection name. Give it a nice, fancy name.
OUTPUT AND TESTING a.k.a, sweet parameters of convenience
--prefix PREFIX
Prefix for the bin names. Must be a single word, composed of digits and numbers. The use of the underscore character is OK, but that's about it (fine, the use of the dash character is OK, too but no more!). If the prefix is 'PREFIX', each bin will be renamed as 'PREFIX_XXX_00001, PREFIX_XXX_00002', and so on, in the order of percent completion minus percent redundancy (what we call, 'substantive completion'). The 'XXX' part will either be 'Bin', or 'MAG depending on other parameters you use. Keep reading.
--report-file REPORT_FILE_PATH
This file will report each name change event, so you can trace back the original names of renamed bins later.
--list-collections
Show available collections and exit.
--dry-run
When used does NOT update the profile database, just creates the report file so you can view how things will be renamed.
MAG OPTIONS If you want to call some bins 'MAGs' because you are so cool
--call-MAGs
This program by default rename your bins as 'PREFIX_Bin_00001', 'PREFIX_Bin_00002' and so on. If you use this flag, it will name the ones that meet the criteria described by MAG-related flags as 'PREFIX_MAG_00001', 'PREFIX_MAG_00002', and so on. The ones that do not get to be named as MAGs will remain as bins.
--min-completion-for-MAG MIN_COMPLETION_FOR_MAG
If --call-MAGs flag is used, call any bin a 'MAG' if their completion estimate is above this (the default is 70), and the redundancy estimate is less than --max-redundancy-for-MAG. Default: 70
--max-redundancy-for-MAG MAX_REDUNDANCY_FOR_MAG
If --call-MAGs flag is used, call any bin a 'MAG' if their redundancy estimate is below this (the default is 10) and the completion estimate is above --min-completion-for-MAG. Default: 10
--size-for-MAG MEGABASEPAIRS
If --call-MAGs flag is used, call any bin a 'MAG' if their redundancy estimate is less than --max-redundancy-for-MAG, AND THEIR SIZE IS LARGER THAN THIS VALUE REGARDLESS OF THE COMPLETION ESTIMATE. The default behavior is to not care about this at all. Default: 0.0
--exclude-bins
Exclude bins that don't match any of your criteria to call MAGs. By default, your new collection will include every single item in your original collection. But if you are calling MAGs with the `--call-MAGs` flag AND would like to keep only those that are determined to be a MAG, you can use this flag and all the 'bins' would then be excluded from your new collection, leaving you with only the 'good' stuff.

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.