Repository files navigation

CircleCI

AMBER: Assessment of Metagenome BinnERs

AMBER is an evaluation package for the comparative assessment of genome reconstructions and taxonomic assignments from metagenome benchmark datasets. It provides performance metrics, results rankings, and comparative visualizations for assessing multiple programs or parameter effects. The provided metrics were used in the first community benchmarking challenge of the initiative for the Critical Assessment of Metagenomic Interpretation.

Metrics computed per bin

  • Predicted bin size in bps and sequences
  • True positives
  • (Average) Purity
  • (Average) Completeness

Metrics computed per sample

  • Accuracy
  • Misclassification rate (contamination)
  • Purity
  • Completeness
  • (Adjusted) Rand index
  • Percentage of binned base pairs and sequences
  • Number of genomes recovered within levels of completeness and contamination
  • UniFrac (for taxonomic binning)

Example pages produced by AMBER

Installation

Requirements

AMBER 2.0.7 has been tested with Python 3.11.

See requirements.txt for all dependencies.

Installation options

There are several options to install AMBER:

Bioconda

Install and configure Bioconda if not already installed. Then use the following command to create a Conda environment and install AMBER:

conda create --name amber cami-amber

Activate the Conda environment with:

conda activate amber

Python pip

Install pip if not already installed (tested on Linux Ubuntu 22.04):

sudo apt install python3-pip

Should you receive the message Unable to locate package python3-pip, enter the following commands and repeat the previous step.

sudo add-apt-repository universe
sudo apt update

Then run:

pip install cami-amber 

Make sure to add AMBER to your PATH:

echo'PATH=$PATH:${HOME}/.local/bin'>>~/.bashrc
source~/.bashrc

Alternatively, download or git-clone AMBER from GitHub. In AMBER's directory, install all requirements with the command:

pip install -r requirements.txt 

Docker

You can pull a pre-built AMBER Docker BioContainer as follows:

docker pull quay.io/biocontainers/cami-amber:<tag>

See valid values for <tag>.

Alternatively, download or git-clone AMBER from GitHub. In AMBER's directory, build the Docker image with the command:

docker build -t amber .

See bellow an example of how to run AMBER using Docker.

User guide

Input

As input, AMBER uses three files and an additional file for assessing taxonomic binning:

  1. A gold standard mapping of contigs or read IDs to genomes and/or taxon IDs in the CAMI binning Bioboxes format. Columns are tab separated. Example:
@Version:0.9.1
@SampleID:gsa
@@SEQUENCEID BINID TAXID LENGTH
RH|P|C37126 Sample6_89 45202 25096
RH|P|C3274 Sample9_91 32644 10009
RH|P|C26099 1053046 765201 689201
RH|P|C35075 1053046 765201 173282
RH|P|C20873 1053046 765201 339258

See here another example. Observations:

  • The value of the SampleID header tag must uniquely identify a sample and be the same in the gold standard and the predictions (input 2 below).
  • Column BINID (TAXID) is required to assess genome (taxonomic) binning.
  • Column LENGTH can be added to a mapping file using tool src/utils/add_length_column.py.
  1. One or more files, each containing the bin assignments from a binning program, also in the CAMI binning Bioboxes format. Column LENGTH is not required (LENGTH is only required in the gold standard).

Note: a tool for converting FASTA files, such that each file represents a bin, is available (see src/utils/convert_fasta_bins_to_biobox_format.py).

  1. For assessing taxonomic binning, AMBER also requires the file nodes.dmp from NCBI. Download taxdump.tar.gz from ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz, extract nodes.tmp, and provide it to AMBER with option --ncbi_dir.

Input format for multiple samples

Binnings of datasets with multiple samples are supported by AMBER. For each binning program, simply concatenate the binnings of the different samples into a single file to obtain one binning file per program. The gold standard must also consist in one file for all samples. Remember: binnings for the same sample must have the same SampleID.

Running amber.py

usage: AMBER [-h] -g GOLD_STANDARD_FILE [-l LABELS] [-p FILTER] [-n MIN_LENGTH] -o OUTPUT_DIR [--stdout] [-d DESC] [--colors COLORS] [--silent] [--skip_gs] [-v] [-x MIN_COMPLETENESS]
[-y MAX_CONTAMINATION] [-r REMOVE_GENOMES] [-k KEYWORD] [--genome_coverage GENOME_COVERAGE] [--ncbi_dir NCBI_DIR]
bin_files [bin_files ...]
AMBER: Assessment of Metagenome BinnERs
positional arguments:
bin_files Binning files
options:
-h, --help show this help message and exit
-g GOLD_STANDARD_FILE, --gold_standard_file GOLD_STANDARD_FILE
Gold standard - ground truth - file
-l LABELS, --labels LABELS
Comma-separated binning names
-p FILTER, --filter FILTER
Filter out [FILTER]% smallest genome bins (default: 0)
-n MIN_LENGTH, --min_length MIN_LENGTH
Minimum length of sequences
-o OUTPUT_DIR, --output_dir OUTPUT_DIR
Directory to write the results to
--stdout Print summary to stdout
-d DESC, --desc DESC Description for HTML page
--silent Silent mode
--skip_gs Skip gold standard evaluation vs itself
-v, --version show program's version number and exitgenome binning-specific arguments: -x MIN_COMPLETENESS, --min_completeness MIN_COMPLETENESS Comma-separated list of min. completeness thresholds (default %: 50,70,90) -y MAX_CONTAMINATION, --max_contamination MAX_CONTAMINATION Comma-separated list of max. contamination thresholds (default %: 10,5) -r REMOVE_GENOMES, --remove_genomes REMOVE_GENOMES File with list of genomes to be removed -k KEYWORD, --keyword KEYWORD Keyword in the second column of file with list of genomes to be removed (no keyword=remove all genomes in list) --genome_coverage GENOME_COVERAGE genome coveragestaxonomic binning-specific arguments: --ncbi_dir NCBI_DIR Directory containing the NCBI taxonomy database dump files nodes.dmp, merged.dmp, and names.dmp

Example:

amber.py -g test/gsa_mapping.binning \
-l "MaxBin 2.0, CONCOCT, MetaBAT" \
-p 1 \
-r test/unique_common.tsv \
-k "circular element" \
test/naughty_carson_2 \
test/goofy_hypatia_2 \
test/elated_franklin_0 \
-o output_dir/

Running amber.py using Docker

amber.py can be run with the docker run command. Example:

docker run -v $(pwd):/host amber \
amber.py \
-l "CONCOCT (CAMI), MaxBin 2.0.2 (CAMI)" \
-p 1 \
-r /host/test/unique_common.tsv \
-k "circular element" \
-g /host/test/gsa_mapping.binning \
/host/test/goofy_hypatia_2 \
/host/test/naughty_carson_2 \
-o /host/output_dir

Utilities

src/utils/add_length_column.py

Adds column _LENGTH to the gold standard mapping file, eliminating the need to provide a FASTA or FASTQ file to amber.py.

usage: add_length_column.py [-h] -g GOLD_STANDARD_FILE -f FASTA_FILE
Add length column _LENGTH to gold standard mapping and print mapping on the
standard output
optional arguments:
-h, --help show this help message and exit
-g GOLD_STANDARD_FILE, --gold_standard_file GOLD_STANDARD_FILE
Gold standard - ground truth - file
-f FASTA_FILE, --fasta_file FASTA_FILE
FASTA or FASTQ file with sequences of gold standard

Example: File CAMI_low_RL_S001__insert_270_GoldStandardAssembly.fasta.gz used in the example can be downloaded here.

python3 src/utils/add_length_column.py -g test/gsa_mapping.binning \
-f test/CAMI_low_RL_S001__insert_270_GoldStandardAssembly.fasta.gz

Output:

@Version:0.9.1
@SampleID:gsa
@@SEQUENCEID BINID LENGTH
RL|S1|C10817 Sample18_57 20518
RL|S1|C11497 Sample22_57 37672
RL|S1|C6571 evo_1286_AP.033 69914
RL|S1|C10560 evo_1286_AP.033 995657
...

src/utils/convert_fasta_bins_to_biobox_format.py

usage: convert_fasta_bins_to_biobox_format.py [-h] [-o OUTPUT_FILE]
paths [paths ...]
Convert bins in FASTA files to CAMI tsv format
positional arguments:
paths FASTA files including full paths
optional arguments:
-h, --help show this help message and exit
-o OUTPUT_FILE, --output_file OUTPUT_FILE
Output file

Example:

python3 src/utils/convert_fasta_bins_to_cami.py \
/path/to/file/maxbin.out.001.fasta \
/path/to/file/maxbin.out.002.fasta \
/path/to/file/maxbin.out.003.fasta \
/path/to/file/maxbin.out.004.fasta \
/path/to/file/maxbin.out.005.fasta \
-o bins.tsv

Alternatively:

python3 src/utils/convert_fasta_bins_to_cami.py /path/to/file/maxbin.out.0* -o bins.tsv

Output: File bins.tsv is created in the working directory.

Developer guide

We are using tox for project automation.

Tests

If you want to run tests, just type tox in the project's root directory:

tox

You can use all libraries that AMBER depends on by activating tox's virtual environment with the command:

source<project_directory>/.tox/py311/bin/activate

Update GitHub page

In order to update https://cami-challenge.github.io/AMBER, modify file index.html.

Make a release

If the dev branch is merged into the master branch:

  1. Update version.py according to semantic versioning on the dev branch.

  2. Merge the dev branch into the master branch.

  3. Make a release on GitHub with the same version number provided in version.py .

  4. Create package and upload it to PyPI:

python3 setup.py sdist bdist_wheel
twine upload dist/*

Citation

Please cite AMBER as:

The metrics implemented in AMBER were used and described in the CAMI manuscript, thus you may also cite:

  • Sczyrba, A., Hofmann, P., Belmann, P. et al. Critical Assessment of Metagenome Interpretation—a benchmark of metagenomics software. Nat Methods 14, 1063–1071 (2017). https://doi.org/10.1038/nmeth.4458

or

License

AMBER 2 is licensed under GPL v3.

About

AMBER: Assessment of Metagenome BinnERs

Topics

Resources

Stars

33 stars

Watchers

7 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Repository files navigation

CircleCI

AMBER: Assessment of Metagenome BinnERs

AMBER is an evaluation package for the comparative assessment of genome reconstructions and taxonomic assignments from metagenome benchmark datasets. It provides performance metrics, results rankings, and comparative visualizations for assessing multiple programs or parameter effects. The provided metrics were used in the first community benchmarking challenge of the initiative for the Critical Assessment of Metagenomic Interpretation.

Metrics computed per bin

  • Predicted bin size in bps and sequences
  • True positives
  • (Average) Purity
  • (Average) Completeness

Metrics computed per sample

  • Accuracy
  • Misclassification rate (contamination)
  • Purity
  • Completeness
  • (Adjusted) Rand index
  • Percentage of binned base pairs and sequences
  • Number of genomes recovered within levels of completeness and contamination
  • UniFrac (for taxonomic binning)

Example pages produced by AMBER

Installation

Requirements

AMBER 2.0.7 has been tested with Python 3.11.

See requirements.txt for all dependencies.

Installation options

There are several options to install AMBER:

Bioconda

Install and configure Bioconda if not already installed. Then use the following command to create a Conda environment and install AMBER:

conda create --name amber cami-amber

Activate the Conda environment with:

conda activate amber

Python pip

Install pip if not already installed (tested on Linux Ubuntu 22.04):

sudo apt install python3-pip

Should you receive the message Unable to locate package python3-pip, enter the following commands and repeat the previous step.

sudo add-apt-repository universe
sudo apt update

Then run:

pip install cami-amber 

Make sure to add AMBER to your PATH:

echo'PATH=$PATH:${HOME}/.local/bin'>>~/.bashrc
source~/.bashrc

Alternatively, download or git-clone AMBER from GitHub. In AMBER's directory, install all requirements with the command:

pip install -r requirements.txt 

Docker

You can pull a pre-built AMBER Docker BioContainer as follows:

docker pull quay.io/biocontainers/cami-amber:<tag>

See valid values for <tag>.

Alternatively, download or git-clone AMBER from GitHub. In AMBER's directory, build the Docker image with the command:

docker build -t amber .

See bellow an example of how to run AMBER using Docker.

User guide

Input

As input, AMBER uses three files and an additional file for assessing taxonomic binning:

  1. A gold standard mapping of contigs or read IDs to genomes and/or taxon IDs in the CAMI binning Bioboxes format. Columns are tab separated. Example:
@Version:0.9.1
@SampleID:gsa
@@SEQUENCEID BINID TAXID LENGTH
RH|P|C37126 Sample6_89 45202 25096
RH|P|C3274 Sample9_91 32644 10009
RH|P|C26099 1053046 765201 689201
RH|P|C35075 1053046 765201 173282
RH|P|C20873 1053046 765201 339258

See here another example. Observations:

  • The value of the SampleID header tag must uniquely identify a sample and be the same in the gold standard and the predictions (input 2 below).
  • Column BINID (TAXID) is required to assess genome (taxonomic) binning.
  • Column LENGTH can be added to a mapping file using tool src/utils/add_length_column.py.
  1. One or more files, each containing the bin assignments from a binning program, also in the CAMI binning Bioboxes format. Column LENGTH is not required (LENGTH is only required in the gold standard).

Note: a tool for converting FASTA files, such that each file represents a bin, is available (see src/utils/convert_fasta_bins_to_biobox_format.py).

  1. For assessing taxonomic binning, AMBER also requires the file nodes.dmp from NCBI. Download taxdump.tar.gz from ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz, extract nodes.tmp, and provide it to AMBER with option --ncbi_dir.

Input format for multiple samples

Binnings of datasets with multiple samples are supported by AMBER. For each binning program, simply concatenate the binnings of the different samples into a single file to obtain one binning file per program. The gold standard must also consist in one file for all samples. Remember: binnings for the same sample must have the same SampleID.

Running amber.py

usage: AMBER [-h] -g GOLD_STANDARD_FILE [-l LABELS] [-p FILTER] [-n MIN_LENGTH] -o OUTPUT_DIR [--stdout] [-d DESC] [--colors COLORS] [--silent] [--skip_gs] [-v] [-x MIN_COMPLETENESS]
[-y MAX_CONTAMINATION] [-r REMOVE_GENOMES] [-k KEYWORD] [--genome_coverage GENOME_COVERAGE] [--ncbi_dir NCBI_DIR]
bin_files [bin_files ...]
AMBER: Assessment of Metagenome BinnERs
positional arguments:
bin_files Binning files
options:
-h, --help show this help message and exit
-g GOLD_STANDARD_FILE, --gold_standard_file GOLD_STANDARD_FILE
Gold standard - ground truth - file
-l LABELS, --labels LABELS
Comma-separated binning names
-p FILTER, --filter FILTER
Filter out [FILTER]% smallest genome bins (default: 0)
-n MIN_LENGTH, --min_length MIN_LENGTH
Minimum length of sequences
-o OUTPUT_DIR, --output_dir OUTPUT_DIR
Directory to write the results to
--stdout Print summary to stdout
-d DESC, --desc DESC Description for HTML page
--silent Silent mode
--skip_gs Skip gold standard evaluation vs itself
-v, --version show program's version number and exitgenome binning-specific arguments: -x MIN_COMPLETENESS, --min_completeness MIN_COMPLETENESS Comma-separated list of min. completeness thresholds (default %: 50,70,90) -y MAX_CONTAMINATION, --max_contamination MAX_CONTAMINATION Comma-separated list of max. contamination thresholds (default %: 10,5) -r REMOVE_GENOMES, --remove_genomes REMOVE_GENOMES File with list of genomes to be removed -k KEYWORD, --keyword KEYWORD Keyword in the second column of file with list of genomes to be removed (no keyword=remove all genomes in list) --genome_coverage GENOME_COVERAGE genome coveragestaxonomic binning-specific arguments: --ncbi_dir NCBI_DIR Directory containing the NCBI taxonomy database dump files nodes.dmp, merged.dmp, and names.dmp

Example:

amber.py -g test/gsa_mapping.binning \
-l "MaxBin 2.0, CONCOCT, MetaBAT" \
-p 1 \
-r test/unique_common.tsv \
-k "circular element" \
test/naughty_carson_2 \
test/goofy_hypatia_2 \
test/elated_franklin_0 \
-o output_dir/

Running amber.py using Docker

amber.py can be run with the docker run command. Example:

docker run -v $(pwd):/host amber \
amber.py \
-l "CONCOCT (CAMI), MaxBin 2.0.2 (CAMI)" \
-p 1 \
-r /host/test/unique_common.tsv \
-k "circular element" \
-g /host/test/gsa_mapping.binning \
/host/test/goofy_hypatia_2 \
/host/test/naughty_carson_2 \
-o /host/output_dir

Utilities

src/utils/add_length_column.py

Adds column _LENGTH to the gold standard mapping file, eliminating the need to provide a FASTA or FASTQ file to amber.py.

usage: add_length_column.py [-h] -g GOLD_STANDARD_FILE -f FASTA_FILE
Add length column _LENGTH to gold standard mapping and print mapping on the
standard output
optional arguments:
-h, --help show this help message and exit
-g GOLD_STANDARD_FILE, --gold_standard_file GOLD_STANDARD_FILE
Gold standard - ground truth - file
-f FASTA_FILE, --fasta_file FASTA_FILE
FASTA or FASTQ file with sequences of gold standard

Example: File CAMI_low_RL_S001__insert_270_GoldStandardAssembly.fasta.gz used in the example can be downloaded here.

python3 src/utils/add_length_column.py -g test/gsa_mapping.binning \
-f test/CAMI_low_RL_S001__insert_270_GoldStandardAssembly.fasta.gz

Output:

@Version:0.9.1
@SampleID:gsa
@@SEQUENCEID BINID LENGTH
RL|S1|C10817 Sample18_57 20518
RL|S1|C11497 Sample22_57 37672
RL|S1|C6571 evo_1286_AP.033 69914
RL|S1|C10560 evo_1286_AP.033 995657
...

src/utils/convert_fasta_bins_to_biobox_format.py

usage: convert_fasta_bins_to_biobox_format.py [-h] [-o OUTPUT_FILE]
paths [paths ...]
Convert bins in FASTA files to CAMI tsv format
positional arguments:
paths FASTA files including full paths
optional arguments:
-h, --help show this help message and exit
-o OUTPUT_FILE, --output_file OUTPUT_FILE
Output file

Example:

python3 src/utils/convert_fasta_bins_to_cami.py \
/path/to/file/maxbin.out.001.fasta \
/path/to/file/maxbin.out.002.fasta \
/path/to/file/maxbin.out.003.fasta \
/path/to/file/maxbin.out.004.fasta \
/path/to/file/maxbin.out.005.fasta \
-o bins.tsv

Alternatively:

python3 src/utils/convert_fasta_bins_to_cami.py /path/to/file/maxbin.out.0* -o bins.tsv

Output: File bins.tsv is created in the working directory.

Developer guide

We are using tox for project automation.

Tests

If you want to run tests, just type tox in the project's root directory:

tox

You can use all libraries that AMBER depends on by activating tox's virtual environment with the command:

source<project_directory>/.tox/py311/bin/activate

Update GitHub page

In order to update https://cami-challenge.github.io/AMBER, modify file index.html.

Make a release

If the dev branch is merged into the master branch:

  1. Update version.py according to semantic versioning on the dev branch.

  2. Merge the dev branch into the master branch.

  3. Make a release on GitHub with the same version number provided in version.py .

  4. Create package and upload it to PyPI:

python3 setup.py sdist bdist_wheel
twine upload dist/*

Citation

Please cite AMBER as:

The metrics implemented in AMBER were used and described in the CAMI manuscript, thus you may also cite:

  • Sczyrba, A., Hofmann, P., Belmann, P. et al. Critical Assessment of Metagenome Interpretation—a benchmark of metagenomics software. Nat Methods 14, 1063–1071 (2017). https://doi.org/10.1038/nmeth.4458

or

License

AMBER 2 is licensed under GPL v3.

About

AMBER: Assessment of Metagenome BinnERs

Topics

Resources

Stars

33 stars

Watchers

7 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

CircleCI

AMBER: Assessment of Metagenome BinnERs

AMBER is an evaluation package for the comparative assessment of genome reconstructions and taxonomic assignments from metagenome benchmark datasets. It provides performance metrics, results rankings, and comparative visualizations for assessing multiple programs or parameter effects. The provided metrics were used in the first community benchmarking challenge of the initiative for the Critical Assessment of Metagenomic Interpretation.

Metrics computed per bin

  • Predicted bin size in bps and sequences
  • True positives
  • (Average) Purity
  • (Average) Completeness

Metrics computed per sample

  • Accuracy
  • Misclassification rate (contamination)
  • Purity
  • Completeness
  • (Adjusted) Rand index
  • Percentage of binned base pairs and sequences
  • Number of genomes recovered within levels of completeness and contamination
  • UniFrac (for taxonomic binning)

Example pages produced by AMBER

Installation

Requirements

AMBER 2.0.7 has been tested with Python 3.11.

See requirements.txt for all dependencies.

Installation options

There are several options to install AMBER:

Bioconda

Install and configure Bioconda if not already installed. Then use the following command to create a Conda environment and install AMBER:

conda create --name amber cami-amber

Activate the Conda environment with:

conda activate amber

Python pip

Install pip if not already installed (tested on Linux Ubuntu 22.04):

sudo apt install python3-pip

Should you receive the message Unable to locate package python3-pip, enter the following commands and repeat the previous step.

sudo add-apt-repository universe
sudo apt update

Then run:

pip install cami-amber 

Make sure to add AMBER to your PATH:

echo'PATH=$PATH:${HOME}/.local/bin'>>~/.bashrc
source~/.bashrc

Alternatively, download or git-clone AMBER from GitHub. In AMBER's directory, install all requirements with the command:

pip install -r requirements.txt 

Docker

You can pull a pre-built AMBER Docker BioContainer as follows:

docker pull quay.io/biocontainers/cami-amber:<tag>

See valid values for <tag>.

Alternatively, download or git-clone AMBER from GitHub. In AMBER's directory, build the Docker image with the command:

docker build -t amber .

See bellow an example of how to run AMBER using Docker.

User guide

Input

As input, AMBER uses three files and an additional file for assessing taxonomic binning:

  1. A gold standard mapping of contigs or read IDs to genomes and/or taxon IDs in the CAMI binning Bioboxes format. Columns are tab separated. Example:
@Version:0.9.1
@SampleID:gsa
@@SEQUENCEID BINID TAXID LENGTH
RH|P|C37126 Sample6_89 45202 25096
RH|P|C3274 Sample9_91 32644 10009
RH|P|C26099 1053046 765201 689201
RH|P|C35075 1053046 765201 173282
RH|P|C20873 1053046 765201 339258

See here another example. Observations:

  • The value of the SampleID header tag must uniquely identify a sample and be the same in the gold standard and the predictions (input 2 below).
  • Column BINID (TAXID) is required to assess genome (taxonomic) binning.
  • Column LENGTH can be added to a mapping file using tool src/utils/add_length_column.py.
  1. One or more files, each containing the bin assignments from a binning program, also in the CAMI binning Bioboxes format. Column LENGTH is not required (LENGTH is only required in the gold standard).

Note: a tool for converting FASTA files, such that each file represents a bin, is available (see src/utils/convert_fasta_bins_to_biobox_format.py).

  1. For assessing taxonomic binning, AMBER also requires the file nodes.dmp from NCBI. Download taxdump.tar.gz from ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz, extract nodes.tmp, and provide it to AMBER with option --ncbi_dir.

Input format for multiple samples

Binnings of datasets with multiple samples are supported by AMBER. For each binning program, simply concatenate the binnings of the different samples into a single file to obtain one binning file per program. The gold standard must also consist in one file for all samples. Remember: binnings for the same sample must have the same SampleID.

Running amber.py

usage: AMBER [-h] -g GOLD_STANDARD_FILE [-l LABELS] [-p FILTER] [-n MIN_LENGTH] -o OUTPUT_DIR [--stdout] [-d DESC] [--colors COLORS] [--silent] [--skip_gs] [-v] [-x MIN_COMPLETENESS]
[-y MAX_CONTAMINATION] [-r REMOVE_GENOMES] [-k KEYWORD] [--genome_coverage GENOME_COVERAGE] [--ncbi_dir NCBI_DIR]
bin_files [bin_files ...]
AMBER: Assessment of Metagenome BinnERs
positional arguments:
bin_files Binning files
options:
-h, --help show this help message and exit
-g GOLD_STANDARD_FILE, --gold_standard_file GOLD_STANDARD_FILE
Gold standard - ground truth - file
-l LABELS, --labels LABELS
Comma-separated binning names
-p FILTER, --filter FILTER
Filter out [FILTER]% smallest genome bins (default: 0)
-n MIN_LENGTH, --min_length MIN_LENGTH
Minimum length of sequences
-o OUTPUT_DIR, --output_dir OUTPUT_DIR
Directory to write the results to
--stdout Print summary to stdout
-d DESC, --desc DESC Description for HTML page
--silent Silent mode
--skip_gs Skip gold standard evaluation vs itself
-v, --version show program's version number and exitgenome binning-specific arguments: -x MIN_COMPLETENESS, --min_completeness MIN_COMPLETENESS Comma-separated list of min. completeness thresholds (default %: 50,70,90) -y MAX_CONTAMINATION, --max_contamination MAX_CONTAMINATION Comma-separated list of max. contamination thresholds (default %: 10,5) -r REMOVE_GENOMES, --remove_genomes REMOVE_GENOMES File with list of genomes to be removed -k KEYWORD, --keyword KEYWORD Keyword in the second column of file with list of genomes to be removed (no keyword=remove all genomes in list) --genome_coverage GENOME_COVERAGE genome coveragestaxonomic binning-specific arguments: --ncbi_dir NCBI_DIR Directory containing the NCBI taxonomy database dump files nodes.dmp, merged.dmp, and names.dmp

Example:

amber.py -g test/gsa_mapping.binning \
-l "MaxBin 2.0, CONCOCT, MetaBAT" \
-p 1 \
-r test/unique_common.tsv \
-k "circular element" \
test/naughty_carson_2 \
test/goofy_hypatia_2 \
test/elated_franklin_0 \
-o output_dir/

Running amber.py using Docker

amber.py can be run with the docker run command. Example:

docker run -v $(pwd):/host amber \
amber.py \
-l "CONCOCT (CAMI), MaxBin 2.0.2 (CAMI)" \
-p 1 \
-r /host/test/unique_common.tsv \
-k "circular element" \
-g /host/test/gsa_mapping.binning \
/host/test/goofy_hypatia_2 \
/host/test/naughty_carson_2 \
-o /host/output_dir

Utilities

src/utils/add_length_column.py

Adds column _LENGTH to the gold standard mapping file, eliminating the need to provide a FASTA or FASTQ file to amber.py.

usage: add_length_column.py [-h] -g GOLD_STANDARD_FILE -f FASTA_FILE
Add length column _LENGTH to gold standard mapping and print mapping on the
standard output
optional arguments:
-h, --help show this help message and exit
-g GOLD_STANDARD_FILE, --gold_standard_file GOLD_STANDARD_FILE
Gold standard - ground truth - file
-f FASTA_FILE, --fasta_file FASTA_FILE
FASTA or FASTQ file with sequences of gold standard

Example: File CAMI_low_RL_S001__insert_270_GoldStandardAssembly.fasta.gz used in the example can be downloaded here.

python3 src/utils/add_length_column.py -g test/gsa_mapping.binning \
-f test/CAMI_low_RL_S001__insert_270_GoldStandardAssembly.fasta.gz

Output:

@Version:0.9.1
@SampleID:gsa
@@SEQUENCEID BINID LENGTH
RL|S1|C10817 Sample18_57 20518
RL|S1|C11497 Sample22_57 37672
RL|S1|C6571 evo_1286_AP.033 69914
RL|S1|C10560 evo_1286_AP.033 995657
...

src/utils/convert_fasta_bins_to_biobox_format.py

usage: convert_fasta_bins_to_biobox_format.py [-h] [-o OUTPUT_FILE]
paths [paths ...]
Convert bins in FASTA files to CAMI tsv format
positional arguments:
paths FASTA files including full paths
optional arguments:
-h, --help show this help message and exit
-o OUTPUT_FILE, --output_file OUTPUT_FILE
Output file

Example:

python3 src/utils/convert_fasta_bins_to_cami.py \
/path/to/file/maxbin.out.001.fasta \
/path/to/file/maxbin.out.002.fasta \
/path/to/file/maxbin.out.003.fasta \
/path/to/file/maxbin.out.004.fasta \
/path/to/file/maxbin.out.005.fasta \
-o bins.tsv

Alternatively:

python3 src/utils/convert_fasta_bins_to_cami.py /path/to/file/maxbin.out.0* -o bins.tsv

Output: File bins.tsv is created in the working directory.

Developer guide

We are using tox for project automation.

Tests

If you want to run tests, just type tox in the project's root directory:

tox

You can use all libraries that AMBER depends on by activating tox's virtual environment with the command:

source<project_directory>/.tox/py311/bin/activate

Update GitHub page

In order to update https://cami-challenge.github.io/AMBER, modify file index.html.

Make a release

If the dev branch is merged into the master branch:

  1. Update version.py according to semantic versioning on the dev branch.

  2. Merge the dev branch into the master branch.

  3. Make a release on GitHub with the same version number provided in version.py .

  4. Create package and upload it to PyPI:

python3 setup.py sdist bdist_wheel
twine upload dist/*

Citation

Please cite AMBER as:

The metrics implemented in AMBER were used and described in the CAMI manuscript, thus you may also cite:

  • Sczyrba, A., Hofmann, P., Belmann, P. et al. Critical Assessment of Metagenome Interpretation—a benchmark of metagenomics software. Nat Methods 14, 1063–1071 (2017). https://doi.org/10.1038/nmeth.4458

or

License

AMBER 2 is licensed under GPL v3.

About

AMBER: Assessment of Metagenome BinnERs

Topics

Resources

Stars

33 stars

Watchers

7 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

CircleCI

AMBER: Assessment of Metagenome BinnERs

AMBER is an evaluation package for the comparative assessment of genome reconstructions and taxonomic assignments from metagenome benchmark datasets. It provides performance metrics, results rankings, and comparative visualizations for assessing multiple programs or parameter effects. The provided metrics were used in the first community benchmarking challenge of the initiative for the Critical Assessment of Metagenomic Interpretation.

Metrics computed per bin

  • Predicted bin size in bps and sequences
  • True positives
  • (Average) Purity
  • (Average) Completeness

Metrics computed per sample

  • Accuracy
  • Misclassification rate (contamination)
  • Purity
  • Completeness
  • (Adjusted) Rand index
  • Percentage of binned base pairs and sequences
  • Number of genomes recovered within levels of completeness and contamination
  • UniFrac (for taxonomic binning)

Example pages produced by AMBER

Installation

Requirements

AMBER 2.0.7 has been tested with Python 3.11.

See requirements.txt for all dependencies.

Installation options

There are several options to install AMBER:

Bioconda

Install and configure Bioconda if not already installed. Then use the following command to create a Conda environment and install AMBER:

conda create --name amber cami-amber

Activate the Conda environment with:

conda activate amber

Python pip

Install pip if not already installed (tested on Linux Ubuntu 22.04):

sudo apt install python3-pip

Should you receive the message Unable to locate package python3-pip, enter the following commands and repeat the previous step.

sudo add-apt-repository universe
sudo apt update

Then run:

pip install cami-amber 

Make sure to add AMBER to your PATH:

echo'PATH=$PATH:${HOME}/.local/bin'>>~/.bashrc
source~/.bashrc

Alternatively, download or git-clone AMBER from GitHub. In AMBER's directory, install all requirements with the command:

pip install -r requirements.txt 

Docker

You can pull a pre-built AMBER Docker BioContainer as follows:

docker pull quay.io/biocontainers/cami-amber:<tag>

See valid values for <tag>.

Alternatively, download or git-clone AMBER from GitHub. In AMBER's directory, build the Docker image with the command:

docker build -t amber .

See bellow an example of how to run AMBER using Docker.

User guide

Input

As input, AMBER uses three files and an additional file for assessing taxonomic binning:

  1. A gold standard mapping of contigs or read IDs to genomes and/or taxon IDs in the CAMI binning Bioboxes format. Columns are tab separated. Example:
@Version:0.9.1
@SampleID:gsa
@@SEQUENCEID BINID TAXID LENGTH
RH|P|C37126 Sample6_89 45202 25096
RH|P|C3274 Sample9_91 32644 10009
RH|P|C26099 1053046 765201 689201
RH|P|C35075 1053046 765201 173282
RH|P|C20873 1053046 765201 339258

See here another example. Observations:

  • The value of the SampleID header tag must uniquely identify a sample and be the same in the gold standard and the predictions (input 2 below).
  • Column BINID (TAXID) is required to assess genome (taxonomic) binning.
  • Column LENGTH can be added to a mapping file using tool src/utils/add_length_column.py.
  1. One or more files, each containing the bin assignments from a binning program, also in the CAMI binning Bioboxes format. Column LENGTH is not required (LENGTH is only required in the gold standard).

Note: a tool for converting FASTA files, such that each file represents a bin, is available (see src/utils/convert_fasta_bins_to_biobox_format.py).

  1. For assessing taxonomic binning, AMBER also requires the file nodes.dmp from NCBI. Download taxdump.tar.gz from ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz, extract nodes.tmp, and provide it to AMBER with option --ncbi_dir.

Input format for multiple samples

Binnings of datasets with multiple samples are supported by AMBER. For each binning program, simply concatenate the binnings of the different samples into a single file to obtain one binning file per program. The gold standard must also consist in one file for all samples. Remember: binnings for the same sample must have the same SampleID.

Running amber.py

usage: AMBER [-h] -g GOLD_STANDARD_FILE [-l LABELS] [-p FILTER] [-n MIN_LENGTH] -o OUTPUT_DIR [--stdout] [-d DESC] [--colors COLORS] [--silent] [--skip_gs] [-v] [-x MIN_COMPLETENESS]
[-y MAX_CONTAMINATION] [-r REMOVE_GENOMES] [-k KEYWORD] [--genome_coverage GENOME_COVERAGE] [--ncbi_dir NCBI_DIR]
bin_files [bin_files ...]
AMBER: Assessment of Metagenome BinnERs
positional arguments:
bin_files Binning files
options:
-h, --help show this help message and exit
-g GOLD_STANDARD_FILE, --gold_standard_file GOLD_STANDARD_FILE
Gold standard - ground truth - file
-l LABELS, --labels LABELS
Comma-separated binning names
-p FILTER, --filter FILTER
Filter out [FILTER]% smallest genome bins (default: 0)
-n MIN_LENGTH, --min_length MIN_LENGTH
Minimum length of sequences
-o OUTPUT_DIR, --output_dir OUTPUT_DIR
Directory to write the results to
--stdout Print summary to stdout
-d DESC, --desc DESC Description for HTML page
--silent Silent mode
--skip_gs Skip gold standard evaluation vs itself
-v, --version show program's version number and exitgenome binning-specific arguments: -x MIN_COMPLETENESS, --min_completeness MIN_COMPLETENESS Comma-separated list of min. completeness thresholds (default %: 50,70,90) -y MAX_CONTAMINATION, --max_contamination MAX_CONTAMINATION Comma-separated list of max. contamination thresholds (default %: 10,5) -r REMOVE_GENOMES, --remove_genomes REMOVE_GENOMES File with list of genomes to be removed -k KEYWORD, --keyword KEYWORD Keyword in the second column of file with list of genomes to be removed (no keyword=remove all genomes in list) --genome_coverage GENOME_COVERAGE genome coveragestaxonomic binning-specific arguments: --ncbi_dir NCBI_DIR Directory containing the NCBI taxonomy database dump files nodes.dmp, merged.dmp, and names.dmp

Example:

amber.py -g test/gsa_mapping.binning \
-l "MaxBin 2.0, CONCOCT, MetaBAT" \
-p 1 \
-r test/unique_common.tsv \
-k "circular element" \
test/naughty_carson_2 \
test/goofy_hypatia_2 \
test/elated_franklin_0 \
-o output_dir/

Running amber.py using Docker

amber.py can be run with the docker run command. Example:

docker run -v $(pwd):/host amber \
amber.py \
-l "CONCOCT (CAMI), MaxBin 2.0.2 (CAMI)" \
-p 1 \
-r /host/test/unique_common.tsv \
-k "circular element" \
-g /host/test/gsa_mapping.binning \
/host/test/goofy_hypatia_2 \
/host/test/naughty_carson_2 \
-o /host/output_dir

Utilities

src/utils/add_length_column.py

Adds column _LENGTH to the gold standard mapping file, eliminating the need to provide a FASTA or FASTQ file to amber.py.

usage: add_length_column.py [-h] -g GOLD_STANDARD_FILE -f FASTA_FILE
Add length column _LENGTH to gold standard mapping and print mapping on the
standard output
optional arguments:
-h, --help show this help message and exit
-g GOLD_STANDARD_FILE, --gold_standard_file GOLD_STANDARD_FILE
Gold standard - ground truth - file
-f FASTA_FILE, --fasta_file FASTA_FILE
FASTA or FASTQ file with sequences of gold standard

Example: File CAMI_low_RL_S001__insert_270_GoldStandardAssembly.fasta.gz used in the example can be downloaded here.

python3 src/utils/add_length_column.py -g test/gsa_mapping.binning \
-f test/CAMI_low_RL_S001__insert_270_GoldStandardAssembly.fasta.gz

Output:

@Version:0.9.1
@SampleID:gsa
@@SEQUENCEID BINID LENGTH
RL|S1|C10817 Sample18_57 20518
RL|S1|C11497 Sample22_57 37672
RL|S1|C6571 evo_1286_AP.033 69914
RL|S1|C10560 evo_1286_AP.033 995657
...

src/utils/convert_fasta_bins_to_biobox_format.py

usage: convert_fasta_bins_to_biobox_format.py [-h] [-o OUTPUT_FILE]
paths [paths ...]
Convert bins in FASTA files to CAMI tsv format
positional arguments:
paths FASTA files including full paths
optional arguments:
-h, --help show this help message and exit
-o OUTPUT_FILE, --output_file OUTPUT_FILE
Output file

Example:

python3 src/utils/convert_fasta_bins_to_cami.py \
/path/to/file/maxbin.out.001.fasta \
/path/to/file/maxbin.out.002.fasta \
/path/to/file/maxbin.out.003.fasta \
/path/to/file/maxbin.out.004.fasta \
/path/to/file/maxbin.out.005.fasta \
-o bins.tsv

Alternatively:

python3 src/utils/convert_fasta_bins_to_cami.py /path/to/file/maxbin.out.0* -o bins.tsv

Output: File bins.tsv is created in the working directory.

Developer guide

We are using tox for project automation.

Tests

If you want to run tests, just type tox in the project's root directory:

tox

You can use all libraries that AMBER depends on by activating tox's virtual environment with the command:

source<project_directory>/.tox/py311/bin/activate

Update GitHub page

In order to update https://cami-challenge.github.io/AMBER, modify file index.html.

Make a release

If the dev branch is merged into the master branch:

  1. Update version.py according to semantic versioning on the dev branch.

  2. Merge the dev branch into the master branch.

  3. Make a release on GitHub with the same version number provided in version.py .

  4. Create package and upload it to PyPI:

python3 setup.py sdist bdist_wheel
twine upload dist/*

Citation

Please cite AMBER as:

The metrics implemented in AMBER were used and described in the CAMI manuscript, thus you may also cite:

  • Sczyrba, A., Hofmann, P., Belmann, P. et al. Critical Assessment of Metagenome Interpretation—a benchmark of metagenomics software. Nat Methods 14, 1063–1071 (2017). https://doi.org/10.1038/nmeth.4458

or

License

AMBER 2 is licensed under GPL v3.

About

AMBER: Assessment of Metagenome BinnERs

Topics

Resources

Stars

33 stars

Watchers

7 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Repository files navigation

CircleCI

AMBER: Assessment of Metagenome BinnERs

AMBER is an evaluation package for the comparative assessment of genome reconstructions and taxonomic assignments from metagenome benchmark datasets. It provides performance metrics, results rankings, and comparative visualizations for assessing multiple programs or parameter effects. The provided metrics were used in the first community benchmarking challenge of the initiative for the Critical Assessment of Metagenomic Interpretation.

Metrics computed per bin

  • Predicted bin size in bps and sequences
  • True positives
  • (Average) Purity
  • (Average) Completeness

Metrics computed per sample

  • Accuracy
  • Misclassification rate (contamination)
  • Purity
  • Completeness
  • (Adjusted) Rand index
  • Percentage of binned base pairs and sequences
  • Number of genomes recovered within levels of completeness and contamination
  • UniFrac (for taxonomic binning)

Example pages produced by AMBER

Installation

Requirements

AMBER 2.0.7 has been tested with Python 3.11.

See requirements.txt for all dependencies.

Installation options

There are several options to install AMBER:

Bioconda

Install and configure Bioconda if not already installed. Then use the following command to create a Conda environment and install AMBER:

conda create --name amber cami-amber

Activate the Conda environment with:

conda activate amber

Python pip

Install pip if not already installed (tested on Linux Ubuntu 22.04):

sudo apt install python3-pip

Should you receive the message Unable to locate package python3-pip, enter the following commands and repeat the previous step.

sudo add-apt-repository universe
sudo apt update

Then run:

pip install cami-amber 

Make sure to add AMBER to your PATH:

echo'PATH=$PATH:${HOME}/.local/bin'>>~/.bashrc
source~/.bashrc

Alternatively, download or git-clone AMBER from GitHub. In AMBER's directory, install all requirements with the command:

pip install -r requirements.txt 

Docker

You can pull a pre-built AMBER Docker BioContainer as follows:

docker pull quay.io/biocontainers/cami-amber:<tag>

See valid values for <tag>.

Alternatively, download or git-clone AMBER from GitHub. In AMBER's directory, build the Docker image with the command:

docker build -t amber .

See bellow an example of how to run AMBER using Docker.

User guide

Input

As input, AMBER uses three files and an additional file for assessing taxonomic binning:

  1. A gold standard mapping of contigs or read IDs to genomes and/or taxon IDs in the CAMI binning Bioboxes format. Columns are tab separated. Example:
@Version:0.9.1
@SampleID:gsa
@@SEQUENCEID BINID TAXID LENGTH
RH|P|C37126 Sample6_89 45202 25096
RH|P|C3274 Sample9_91 32644 10009
RH|P|C26099 1053046 765201 689201
RH|P|C35075 1053046 765201 173282
RH|P|C20873 1053046 765201 339258

See here another example. Observations:

  • The value of the SampleID header tag must uniquely identify a sample and be the same in the gold standard and the predictions (input 2 below).
  • Column BINID (TAXID) is required to assess genome (taxonomic) binning.
  • Column LENGTH can be added to a mapping file using tool src/utils/add_length_column.py.
  1. One or more files, each containing the bin assignments from a binning program, also in the CAMI binning Bioboxes format. Column LENGTH is not required (LENGTH is only required in the gold standard).

Note: a tool for converting FASTA files, such that each file represents a bin, is available (see src/utils/convert_fasta_bins_to_biobox_format.py).

  1. For assessing taxonomic binning, AMBER also requires the file nodes.dmp from NCBI. Download taxdump.tar.gz from ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz, extract nodes.tmp, and provide it to AMBER with option --ncbi_dir.

Input format for multiple samples

Binnings of datasets with multiple samples are supported by AMBER. For each binning program, simply concatenate the binnings of the different samples into a single file to obtain one binning file per program. The gold standard must also consist in one file for all samples. Remember: binnings for the same sample must have the same SampleID.

Running amber.py

usage: AMBER [-h] -g GOLD_STANDARD_FILE [-l LABELS] [-p FILTER] [-n MIN_LENGTH] -o OUTPUT_DIR [--stdout] [-d DESC] [--colors COLORS] [--silent] [--skip_gs] [-v] [-x MIN_COMPLETENESS]
[-y MAX_CONTAMINATION] [-r REMOVE_GENOMES] [-k KEYWORD] [--genome_coverage GENOME_COVERAGE] [--ncbi_dir NCBI_DIR]
bin_files [bin_files ...]
AMBER: Assessment of Metagenome BinnERs
positional arguments:
bin_files Binning files
options:
-h, --help show this help message and exit
-g GOLD_STANDARD_FILE, --gold_standard_file GOLD_STANDARD_FILE
Gold standard - ground truth - file
-l LABELS, --labels LABELS
Comma-separated binning names
-p FILTER, --filter FILTER
Filter out [FILTER]% smallest genome bins (default: 0)
-n MIN_LENGTH, --min_length MIN_LENGTH
Minimum length of sequences
-o OUTPUT_DIR, --output_dir OUTPUT_DIR
Directory to write the results to
--stdout Print summary to stdout
-d DESC, --desc DESC Description for HTML page
--silent Silent mode
--skip_gs Skip gold standard evaluation vs itself
-v, --version show program's version number and exitgenome binning-specific arguments: -x MIN_COMPLETENESS, --min_completeness MIN_COMPLETENESS Comma-separated list of min. completeness thresholds (default %: 50,70,90) -y MAX_CONTAMINATION, --max_contamination MAX_CONTAMINATION Comma-separated list of max. contamination thresholds (default %: 10,5) -r REMOVE_GENOMES, --remove_genomes REMOVE_GENOMES File with list of genomes to be removed -k KEYWORD, --keyword KEYWORD Keyword in the second column of file with list of genomes to be removed (no keyword=remove all genomes in list) --genome_coverage GENOME_COVERAGE genome coveragestaxonomic binning-specific arguments: --ncbi_dir NCBI_DIR Directory containing the NCBI taxonomy database dump files nodes.dmp, merged.dmp, and names.dmp

Example:

amber.py -g test/gsa_mapping.binning \
-l "MaxBin 2.0, CONCOCT, MetaBAT" \
-p 1 \
-r test/unique_common.tsv \
-k "circular element" \
test/naughty_carson_2 \
test/goofy_hypatia_2 \
test/elated_franklin_0 \
-o output_dir/

Running amber.py using Docker

amber.py can be run with the docker run command. Example:

docker run -v $(pwd):/host amber \
amber.py \
-l "CONCOCT (CAMI), MaxBin 2.0.2 (CAMI)" \
-p 1 \
-r /host/test/unique_common.tsv \
-k "circular element" \
-g /host/test/gsa_mapping.binning \
/host/test/goofy_hypatia_2 \
/host/test/naughty_carson_2 \
-o /host/output_dir

Utilities

src/utils/add_length_column.py

Adds column _LENGTH to the gold standard mapping file, eliminating the need to provide a FASTA or FASTQ file to amber.py.

usage: add_length_column.py [-h] -g GOLD_STANDARD_FILE -f FASTA_FILE
Add length column _LENGTH to gold standard mapping and print mapping on the
standard output
optional arguments:
-h, --help show this help message and exit
-g GOLD_STANDARD_FILE, --gold_standard_file GOLD_STANDARD_FILE
Gold standard - ground truth - file
-f FASTA_FILE, --fasta_file FASTA_FILE
FASTA or FASTQ file with sequences of gold standard

Example: File CAMI_low_RL_S001__insert_270_GoldStandardAssembly.fasta.gz used in the example can be downloaded here.

python3 src/utils/add_length_column.py -g test/gsa_mapping.binning \
-f test/CAMI_low_RL_S001__insert_270_GoldStandardAssembly.fasta.gz

Output:

@Version:0.9.1
@SampleID:gsa
@@SEQUENCEID BINID LENGTH
RL|S1|C10817 Sample18_57 20518
RL|S1|C11497 Sample22_57 37672
RL|S1|C6571 evo_1286_AP.033 69914
RL|S1|C10560 evo_1286_AP.033 995657
...

src/utils/convert_fasta_bins_to_biobox_format.py

usage: convert_fasta_bins_to_biobox_format.py [-h] [-o OUTPUT_FILE]
paths [paths ...]
Convert bins in FASTA files to CAMI tsv format
positional arguments:
paths FASTA files including full paths
optional arguments:
-h, --help show this help message and exit
-o OUTPUT_FILE, --output_file OUTPUT_FILE
Output file

Example:

python3 src/utils/convert_fasta_bins_to_cami.py \
/path/to/file/maxbin.out.001.fasta \
/path/to/file/maxbin.out.002.fasta \
/path/to/file/maxbin.out.003.fasta \
/path/to/file/maxbin.out.004.fasta \
/path/to/file/maxbin.out.005.fasta \
-o bins.tsv

Alternatively:

python3 src/utils/convert_fasta_bins_to_cami.py /path/to/file/maxbin.out.0* -o bins.tsv

Output: File bins.tsv is created in the working directory.

Developer guide

We are using tox for project automation.

Tests

If you want to run tests, just type tox in the project's root directory:

tox

You can use all libraries that AMBER depends on by activating tox's virtual environment with the command:

source<project_directory>/.tox/py311/bin/activate

Update GitHub page

In order to update https://cami-challenge.github.io/AMBER, modify file index.html.

Make a release

If the dev branch is merged into the master branch:

  1. Update version.py according to semantic versioning on the dev branch.

  2. Merge the dev branch into the master branch.

  3. Make a release on GitHub with the same version number provided in version.py .

  4. Create package and upload it to PyPI:

python3 setup.py sdist bdist_wheel
twine upload dist/*

Citation

Please cite AMBER as:

The metrics implemented in AMBER were used and described in the CAMI manuscript, thus you may also cite:

  • Sczyrba, A., Hofmann, P., Belmann, P. et al. Critical Assessment of Metagenome Interpretation—a benchmark of metagenomics software. Nat Methods 14, 1063–1071 (2017). https://doi.org/10.1038/nmeth.4458

or

License

AMBER 2 is licensed under GPL v3.

About

AMBER: Assessment of Metagenome BinnERs

Topics

Resources

Stars

33 stars

Watchers

7 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

CircleCI

AMBER: Assessment of Metagenome BinnERs

AMBER is an evaluation package for the comparative assessment of genome reconstructions and taxonomic assignments from metagenome benchmark datasets. It provides performance metrics, results rankings, and comparative visualizations for assessing multiple programs or parameter effects. The provided metrics were used in the first community benchmarking challenge of the initiative for the Critical Assessment of Metagenomic Interpretation.

Metrics computed per bin

  • Predicted bin size in bps and sequences
  • True positives
  • (Average) Purity
  • (Average) Completeness

Metrics computed per sample

  • Accuracy
  • Misclassification rate (contamination)
  • Purity
  • Completeness
  • (Adjusted) Rand index
  • Percentage of binned base pairs and sequences
  • Number of genomes recovered within levels of completeness and contamination
  • UniFrac (for taxonomic binning)

Example pages produced by AMBER

Installation

Requirements

AMBER 2.0.7 has been tested with Python 3.11.

See requirements.txt for all dependencies.

Installation options

There are several options to install AMBER:

Bioconda

Install and configure Bioconda if not already installed. Then use the following command to create a Conda environment and install AMBER:

conda create --name amber cami-amber

Activate the Conda environment with:

conda activate amber

Python pip

Install pip if not already installed (tested on Linux Ubuntu 22.04):

sudo apt install python3-pip

Should you receive the message Unable to locate package python3-pip, enter the following commands and repeat the previous step.

sudo add-apt-repository universe
sudo apt update

Then run:

pip install cami-amber 

Make sure to add AMBER to your PATH:

echo'PATH=$PATH:${HOME}/.local/bin'>>~/.bashrc
source~/.bashrc

Alternatively, download or git-clone AMBER from GitHub. In AMBER's directory, install all requirements with the command:

pip install -r requirements.txt 

Docker

You can pull a pre-built AMBER Docker BioContainer as follows:

docker pull quay.io/biocontainers/cami-amber:<tag>

See valid values for <tag>.

Alternatively, download or git-clone AMBER from GitHub. In AMBER's directory, build the Docker image with the command:

docker build -t amber .

See bellow an example of how to run AMBER using Docker.

User guide

Input

As input, AMBER uses three files and an additional file for assessing taxonomic binning:

  1. A gold standard mapping of contigs or read IDs to genomes and/or taxon IDs in the CAMI binning Bioboxes format. Columns are tab separated. Example:
@Version:0.9.1
@SampleID:gsa
@@SEQUENCEID BINID TAXID LENGTH
RH|P|C37126 Sample6_89 45202 25096
RH|P|C3274 Sample9_91 32644 10009
RH|P|C26099 1053046 765201 689201
RH|P|C35075 1053046 765201 173282
RH|P|C20873 1053046 765201 339258

See here another example. Observations:

  • The value of the SampleID header tag must uniquely identify a sample and be the same in the gold standard and the predictions (input 2 below).
  • Column BINID (TAXID) is required to assess genome (taxonomic) binning.
  • Column LENGTH can be added to a mapping file using tool src/utils/add_length_column.py.
  1. One or more files, each containing the bin assignments from a binning program, also in the CAMI binning Bioboxes format. Column LENGTH is not required (LENGTH is only required in the gold standard).

Note: a tool for converting FASTA files, such that each file represents a bin, is available (see src/utils/convert_fasta_bins_to_biobox_format.py).

  1. For assessing taxonomic binning, AMBER also requires the file nodes.dmp from NCBI. Download taxdump.tar.gz from ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz, extract nodes.tmp, and provide it to AMBER with option --ncbi_dir.

Input format for multiple samples

Binnings of datasets with multiple samples are supported by AMBER. For each binning program, simply concatenate the binnings of the different samples into a single file to obtain one binning file per program. The gold standard must also consist in one file for all samples. Remember: binnings for the same sample must have the same SampleID.

Running amber.py

usage: AMBER [-h] -g GOLD_STANDARD_FILE [-l LABELS] [-p FILTER] [-n MIN_LENGTH] -o OUTPUT_DIR [--stdout] [-d DESC] [--colors COLORS] [--silent] [--skip_gs] [-v] [-x MIN_COMPLETENESS]
[-y MAX_CONTAMINATION] [-r REMOVE_GENOMES] [-k KEYWORD] [--genome_coverage GENOME_COVERAGE] [--ncbi_dir NCBI_DIR]
bin_files [bin_files ...]
AMBER: Assessment of Metagenome BinnERs
positional arguments:
bin_files Binning files
options:
-h, --help show this help message and exit
-g GOLD_STANDARD_FILE, --gold_standard_file GOLD_STANDARD_FILE
Gold standard - ground truth - file
-l LABELS, --labels LABELS
Comma-separated binning names
-p FILTER, --filter FILTER
Filter out [FILTER]% smallest genome bins (default: 0)
-n MIN_LENGTH, --min_length MIN_LENGTH
Minimum length of sequences
-o OUTPUT_DIR, --output_dir OUTPUT_DIR
Directory to write the results to
--stdout Print summary to stdout
-d DESC, --desc DESC Description for HTML page
--silent Silent mode
--skip_gs Skip gold standard evaluation vs itself
-v, --version show program's version number and exitgenome binning-specific arguments: -x MIN_COMPLETENESS, --min_completeness MIN_COMPLETENESS Comma-separated list of min. completeness thresholds (default %: 50,70,90) -y MAX_CONTAMINATION, --max_contamination MAX_CONTAMINATION Comma-separated list of max. contamination thresholds (default %: 10,5) -r REMOVE_GENOMES, --remove_genomes REMOVE_GENOMES File with list of genomes to be removed -k KEYWORD, --keyword KEYWORD Keyword in the second column of file with list of genomes to be removed (no keyword=remove all genomes in list) --genome_coverage GENOME_COVERAGE genome coveragestaxonomic binning-specific arguments: --ncbi_dir NCBI_DIR Directory containing the NCBI taxonomy database dump files nodes.dmp, merged.dmp, and names.dmp

Example:

amber.py -g test/gsa_mapping.binning \
-l "MaxBin 2.0, CONCOCT, MetaBAT" \
-p 1 \
-r test/unique_common.tsv \
-k "circular element" \
test/naughty_carson_2 \
test/goofy_hypatia_2 \
test/elated_franklin_0 \
-o output_dir/

Running amber.py using Docker

amber.py can be run with the docker run command. Example:

docker run -v $(pwd):/host amber \
amber.py \
-l "CONCOCT (CAMI), MaxBin 2.0.2 (CAMI)" \
-p 1 \
-r /host/test/unique_common.tsv \
-k "circular element" \
-g /host/test/gsa_mapping.binning \
/host/test/goofy_hypatia_2 \
/host/test/naughty_carson_2 \
-o /host/output_dir

Utilities

src/utils/add_length_column.py

Adds column _LENGTH to the gold standard mapping file, eliminating the need to provide a FASTA or FASTQ file to amber.py.

usage: add_length_column.py [-h] -g GOLD_STANDARD_FILE -f FASTA_FILE
Add length column _LENGTH to gold standard mapping and print mapping on the
standard output
optional arguments:
-h, --help show this help message and exit
-g GOLD_STANDARD_FILE, --gold_standard_file GOLD_STANDARD_FILE
Gold standard - ground truth - file
-f FASTA_FILE, --fasta_file FASTA_FILE
FASTA or FASTQ file with sequences of gold standard

Example: File CAMI_low_RL_S001__insert_270_GoldStandardAssembly.fasta.gz used in the example can be downloaded here.

python3 src/utils/add_length_column.py -g test/gsa_mapping.binning \
-f test/CAMI_low_RL_S001__insert_270_GoldStandardAssembly.fasta.gz

Output:

@Version:0.9.1
@SampleID:gsa
@@SEQUENCEID BINID LENGTH
RL|S1|C10817 Sample18_57 20518
RL|S1|C11497 Sample22_57 37672
RL|S1|C6571 evo_1286_AP.033 69914
RL|S1|C10560 evo_1286_AP.033 995657
...

src/utils/convert_fasta_bins_to_biobox_format.py

usage: convert_fasta_bins_to_biobox_format.py [-h] [-o OUTPUT_FILE]
paths [paths ...]
Convert bins in FASTA files to CAMI tsv format
positional arguments:
paths FASTA files including full paths
optional arguments:
-h, --help show this help message and exit
-o OUTPUT_FILE, --output_file OUTPUT_FILE
Output file

Example:

python3 src/utils/convert_fasta_bins_to_cami.py \
/path/to/file/maxbin.out.001.fasta \
/path/to/file/maxbin.out.002.fasta \
/path/to/file/maxbin.out.003.fasta \
/path/to/file/maxbin.out.004.fasta \
/path/to/file/maxbin.out.005.fasta \
-o bins.tsv

Alternatively:

python3 src/utils/convert_fasta_bins_to_cami.py /path/to/file/maxbin.out.0* -o bins.tsv

Output: File bins.tsv is created in the working directory.

Developer guide

We are using tox for project automation.

Tests

If you want to run tests, just type tox in the project's root directory:

tox

You can use all libraries that AMBER depends on by activating tox's virtual environment with the command:

source<project_directory>/.tox/py311/bin/activate

Update GitHub page

In order to update https://cami-challenge.github.io/AMBER, modify file index.html.

Make a release

If the dev branch is merged into the master branch:

  1. Update version.py according to semantic versioning on the dev branch.

  2. Merge the dev branch into the master branch.

  3. Make a release on GitHub with the same version number provided in version.py .

  4. Create package and upload it to PyPI:

python3 setup.py sdist bdist_wheel
twine upload dist/*

Citation

Please cite AMBER as:

The metrics implemented in AMBER were used and described in the CAMI manuscript, thus you may also cite:

  • Sczyrba, A., Hofmann, P., Belmann, P. et al. Critical Assessment of Metagenome Interpretation—a benchmark of metagenomics software. Nat Methods 14, 1063–1071 (2017). https://doi.org/10.1038/nmeth.4458

or

License

AMBER 2 is licensed under GPL v3.

About

AMBER: Assessment of Metagenome BinnERs

Topics

Resources

Stars

33 stars

Watchers

7 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

CircleCI

AMBER: Assessment of Metagenome BinnERs

AMBER is an evaluation package for the comparative assessment of genome reconstructions and taxonomic assignments from metagenome benchmark datasets. It provides performance metrics, results rankings, and comparative visualizations for assessing multiple programs or parameter effects. The provided metrics were used in the first community benchmarking challenge of the initiative for the Critical Assessment of Metagenomic Interpretation.

Metrics computed per bin

  • Predicted bin size in bps and sequences
  • True positives
  • (Average) Purity
  • (Average) Completeness

Metrics computed per sample

  • Accuracy
  • Misclassification rate (contamination)
  • Purity
  • Completeness
  • (Adjusted) Rand index
  • Percentage of binned base pairs and sequences
  • Number of genomes recovered within levels of completeness and contamination
  • UniFrac (for taxonomic binning)

Example pages produced by AMBER

Installation

Requirements

AMBER 2.0.7 has been tested with Python 3.11.

See requirements.txt for all dependencies.

Installation options

There are several options to install AMBER:

Bioconda

Install and configure Bioconda if not already installed. Then use the following command to create a Conda environment and install AMBER:

conda create --name amber cami-amber

Activate the Conda environment with:

conda activate amber

Python pip

Install pip if not already installed (tested on Linux Ubuntu 22.04):

sudo apt install python3-pip

Should you receive the message Unable to locate package python3-pip, enter the following commands and repeat the previous step.

sudo add-apt-repository universe
sudo apt update

Then run:

pip install cami-amber 

Make sure to add AMBER to your PATH:

echo'PATH=$PATH:${HOME}/.local/bin'>>~/.bashrc
source~/.bashrc

Alternatively, download or git-clone AMBER from GitHub. In AMBER's directory, install all requirements with the command:

pip install -r requirements.txt 

Docker

You can pull a pre-built AMBER Docker BioContainer as follows:

docker pull quay.io/biocontainers/cami-amber:<tag>

See valid values for <tag>.

Alternatively, download or git-clone AMBER from GitHub. In AMBER's directory, build the Docker image with the command:

docker build -t amber .

See bellow an example of how to run AMBER using Docker.

User guide

Input

As input, AMBER uses three files and an additional file for assessing taxonomic binning:

  1. A gold standard mapping of contigs or read IDs to genomes and/or taxon IDs in the CAMI binning Bioboxes format. Columns are tab separated. Example:
@Version:0.9.1
@SampleID:gsa
@@SEQUENCEID BINID TAXID LENGTH
RH|P|C37126 Sample6_89 45202 25096
RH|P|C3274 Sample9_91 32644 10009
RH|P|C26099 1053046 765201 689201
RH|P|C35075 1053046 765201 173282
RH|P|C20873 1053046 765201 339258

See here another example. Observations:

  • The value of the SampleID header tag must uniquely identify a sample and be the same in the gold standard and the predictions (input 2 below).
  • Column BINID (TAXID) is required to assess genome (taxonomic) binning.
  • Column LENGTH can be added to a mapping file using tool src/utils/add_length_column.py.
  1. One or more files, each containing the bin assignments from a binning program, also in the CAMI binning Bioboxes format. Column LENGTH is not required (LENGTH is only required in the gold standard).

Note: a tool for converting FASTA files, such that each file represents a bin, is available (see src/utils/convert_fasta_bins_to_biobox_format.py).

  1. For assessing taxonomic binning, AMBER also requires the file nodes.dmp from NCBI. Download taxdump.tar.gz from ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz, extract nodes.tmp, and provide it to AMBER with option --ncbi_dir.

Input format for multiple samples

Binnings of datasets with multiple samples are supported by AMBER. For each binning program, simply concatenate the binnings of the different samples into a single file to obtain one binning file per program. The gold standard must also consist in one file for all samples. Remember: binnings for the same sample must have the same SampleID.

Running amber.py

usage: AMBER [-h] -g GOLD_STANDARD_FILE [-l LABELS] [-p FILTER] [-n MIN_LENGTH] -o OUTPUT_DIR [--stdout] [-d DESC] [--colors COLORS] [--silent] [--skip_gs] [-v] [-x MIN_COMPLETENESS]
[-y MAX_CONTAMINATION] [-r REMOVE_GENOMES] [-k KEYWORD] [--genome_coverage GENOME_COVERAGE] [--ncbi_dir NCBI_DIR]
bin_files [bin_files ...]
AMBER: Assessment of Metagenome BinnERs
positional arguments:
bin_files Binning files
options:
-h, --help show this help message and exit
-g GOLD_STANDARD_FILE, --gold_standard_file GOLD_STANDARD_FILE
Gold standard - ground truth - file
-l LABELS, --labels LABELS
Comma-separated binning names
-p FILTER, --filter FILTER
Filter out [FILTER]% smallest genome bins (default: 0)
-n MIN_LENGTH, --min_length MIN_LENGTH
Minimum length of sequences
-o OUTPUT_DIR, --output_dir OUTPUT_DIR
Directory to write the results to
--stdout Print summary to stdout
-d DESC, --desc DESC Description for HTML page
--silent Silent mode
--skip_gs Skip gold standard evaluation vs itself
-v, --version show program's version number and exitgenome binning-specific arguments: -x MIN_COMPLETENESS, --min_completeness MIN_COMPLETENESS Comma-separated list of min. completeness thresholds (default %: 50,70,90) -y MAX_CONTAMINATION, --max_contamination MAX_CONTAMINATION Comma-separated list of max. contamination thresholds (default %: 10,5) -r REMOVE_GENOMES, --remove_genomes REMOVE_GENOMES File with list of genomes to be removed -k KEYWORD, --keyword KEYWORD Keyword in the second column of file with list of genomes to be removed (no keyword=remove all genomes in list) --genome_coverage GENOME_COVERAGE genome coveragestaxonomic binning-specific arguments: --ncbi_dir NCBI_DIR Directory containing the NCBI taxonomy database dump files nodes.dmp, merged.dmp, and names.dmp

Example:

amber.py -g test/gsa_mapping.binning \
-l "MaxBin 2.0, CONCOCT, MetaBAT" \
-p 1 \
-r test/unique_common.tsv \
-k "circular element" \
test/naughty_carson_2 \
test/goofy_hypatia_2 \
test/elated_franklin_0 \
-o output_dir/

Running amber.py using Docker

amber.py can be run with the docker run command. Example:

docker run -v $(pwd):/host amber \
amber.py \
-l "CONCOCT (CAMI), MaxBin 2.0.2 (CAMI)" \
-p 1 \
-r /host/test/unique_common.tsv \
-k "circular element" \
-g /host/test/gsa_mapping.binning \
/host/test/goofy_hypatia_2 \
/host/test/naughty_carson_2 \
-o /host/output_dir

Utilities

src/utils/add_length_column.py

Adds column _LENGTH to the gold standard mapping file, eliminating the need to provide a FASTA or FASTQ file to amber.py.

usage: add_length_column.py [-h] -g GOLD_STANDARD_FILE -f FASTA_FILE
Add length column _LENGTH to gold standard mapping and print mapping on the
standard output
optional arguments:
-h, --help show this help message and exit
-g GOLD_STANDARD_FILE, --gold_standard_file GOLD_STANDARD_FILE
Gold standard - ground truth - file
-f FASTA_FILE, --fasta_file FASTA_FILE
FASTA or FASTQ file with sequences of gold standard

Example: File CAMI_low_RL_S001__insert_270_GoldStandardAssembly.fasta.gz used in the example can be downloaded here.

python3 src/utils/add_length_column.py -g test/gsa_mapping.binning \
-f test/CAMI_low_RL_S001__insert_270_GoldStandardAssembly.fasta.gz

Output:

@Version:0.9.1
@SampleID:gsa
@@SEQUENCEID BINID LENGTH
RL|S1|C10817 Sample18_57 20518
RL|S1|C11497 Sample22_57 37672
RL|S1|C6571 evo_1286_AP.033 69914
RL|S1|C10560 evo_1286_AP.033 995657
...

src/utils/convert_fasta_bins_to_biobox_format.py

usage: convert_fasta_bins_to_biobox_format.py [-h] [-o OUTPUT_FILE]
paths [paths ...]
Convert bins in FASTA files to CAMI tsv format
positional arguments:
paths FASTA files including full paths
optional arguments:
-h, --help show this help message and exit
-o OUTPUT_FILE, --output_file OUTPUT_FILE
Output file

Example:

python3 src/utils/convert_fasta_bins_to_cami.py \
/path/to/file/maxbin.out.001.fasta \
/path/to/file/maxbin.out.002.fasta \
/path/to/file/maxbin.out.003.fasta \
/path/to/file/maxbin.out.004.fasta \
/path/to/file/maxbin.out.005.fasta \
-o bins.tsv

Alternatively:

python3 src/utils/convert_fasta_bins_to_cami.py /path/to/file/maxbin.out.0* -o bins.tsv

Output: File bins.tsv is created in the working directory.

Developer guide

We are using tox for project automation.

Tests

If you want to run tests, just type tox in the project's root directory:

tox

You can use all libraries that AMBER depends on by activating tox's virtual environment with the command:

source<project_directory>/.tox/py311/bin/activate

Update GitHub page

In order to update https://cami-challenge.github.io/AMBER, modify file index.html.

Make a release

If the dev branch is merged into the master branch:

  1. Update version.py according to semantic versioning on the dev branch.

  2. Merge the dev branch into the master branch.

  3. Make a release on GitHub with the same version number provided in version.py .

  4. Create package and upload it to PyPI:

python3 setup.py sdist bdist_wheel
twine upload dist/*

Citation

Please cite AMBER as:

The metrics implemented in AMBER were used and described in the CAMI manuscript, thus you may also cite:

  • Sczyrba, A., Hofmann, P., Belmann, P. et al. Critical Assessment of Metagenome Interpretation—a benchmark of metagenomics software. Nat Methods 14, 1063–1071 (2017). https://doi.org/10.1038/nmeth.4458

or

License

AMBER 2 is licensed under GPL v3.

About

AMBER: Assessment of Metagenome BinnERs

Topics

Resources

Stars

33 stars

Watchers

7 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Repository files navigation

CircleCI

AMBER: Assessment of Metagenome BinnERs

AMBER is an evaluation package for the comparative assessment of genome reconstructions and taxonomic assignments from metagenome benchmark datasets. It provides performance metrics, results rankings, and comparative visualizations for assessing multiple programs or parameter effects. The provided metrics were used in the first community benchmarking challenge of the initiative for the Critical Assessment of Metagenomic Interpretation.

Metrics computed per bin

  • Predicted bin size in bps and sequences
  • True positives
  • (Average) Purity
  • (Average) Completeness

Metrics computed per sample

  • Accuracy
  • Misclassification rate (contamination)
  • Purity
  • Completeness
  • (Adjusted) Rand index
  • Percentage of binned base pairs and sequences
  • Number of genomes recovered within levels of completeness and contamination
  • UniFrac (for taxonomic binning)

Example pages produced by AMBER

Installation

Requirements

AMBER 2.0.7 has been tested with Python 3.11.

See requirements.txt for all dependencies.

Installation options

There are several options to install AMBER:

Bioconda

Install and configure Bioconda if not already installed. Then use the following command to create a Conda environment and install AMBER:

conda create --name amber cami-amber

Activate the Conda environment with:

conda activate amber

Python pip

Install pip if not already installed (tested on Linux Ubuntu 22.04):

sudo apt install python3-pip

Should you receive the message Unable to locate package python3-pip, enter the following commands and repeat the previous step.

sudo add-apt-repository universe
sudo apt update

Then run:

pip install cami-amber 

Make sure to add AMBER to your PATH:

echo'PATH=$PATH:${HOME}/.local/bin'>>~/.bashrc
source~/.bashrc

Alternatively, download or git-clone AMBER from GitHub. In AMBER's directory, install all requirements with the command:

pip install -r requirements.txt 

Docker

You can pull a pre-built AMBER Docker BioContainer as follows:

docker pull quay.io/biocontainers/cami-amber:<tag>

See valid values for <tag>.

Alternatively, download or git-clone AMBER from GitHub. In AMBER's directory, build the Docker image with the command:

docker build -t amber .

See bellow an example of how to run AMBER using Docker.

User guide

Input

As input, AMBER uses three files and an additional file for assessing taxonomic binning:

  1. A gold standard mapping of contigs or read IDs to genomes and/or taxon IDs in the CAMI binning Bioboxes format. Columns are tab separated. Example:
@Version:0.9.1
@SampleID:gsa
@@SEQUENCEID BINID TAXID LENGTH
RH|P|C37126 Sample6_89 45202 25096
RH|P|C3274 Sample9_91 32644 10009
RH|P|C26099 1053046 765201 689201
RH|P|C35075 1053046 765201 173282
RH|P|C20873 1053046 765201 339258

See here another example. Observations:

  • The value of the SampleID header tag must uniquely identify a sample and be the same in the gold standard and the predictions (input 2 below).
  • Column BINID (TAXID) is required to assess genome (taxonomic) binning.
  • Column LENGTH can be added to a mapping file using tool src/utils/add_length_column.py.
  1. One or more files, each containing the bin assignments from a binning program, also in the CAMI binning Bioboxes format. Column LENGTH is not required (LENGTH is only required in the gold standard).

Note: a tool for converting FASTA files, such that each file represents a bin, is available (see src/utils/convert_fasta_bins_to_biobox_format.py).

  1. For assessing taxonomic binning, AMBER also requires the file nodes.dmp from NCBI. Download taxdump.tar.gz from ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz, extract nodes.tmp, and provide it to AMBER with option --ncbi_dir.

Input format for multiple samples

Binnings of datasets with multiple samples are supported by AMBER. For each binning program, simply concatenate the binnings of the different samples into a single file to obtain one binning file per program. The gold standard must also consist in one file for all samples. Remember: binnings for the same sample must have the same SampleID.

Running amber.py

usage: AMBER [-h] -g GOLD_STANDARD_FILE [-l LABELS] [-p FILTER] [-n MIN_LENGTH] -o OUTPUT_DIR [--stdout] [-d DESC] [--colors COLORS] [--silent] [--skip_gs] [-v] [-x MIN_COMPLETENESS]
[-y MAX_CONTAMINATION] [-r REMOVE_GENOMES] [-k KEYWORD] [--genome_coverage GENOME_COVERAGE] [--ncbi_dir NCBI_DIR]
bin_files [bin_files ...]
AMBER: Assessment of Metagenome BinnERs
positional arguments:
bin_files Binning files
options:
-h, --help show this help message and exit
-g GOLD_STANDARD_FILE, --gold_standard_file GOLD_STANDARD_FILE
Gold standard - ground truth - file
-l LABELS, --labels LABELS
Comma-separated binning names
-p FILTER, --filter FILTER
Filter out [FILTER]% smallest genome bins (default: 0)
-n MIN_LENGTH, --min_length MIN_LENGTH
Minimum length of sequences
-o OUTPUT_DIR, --output_dir OUTPUT_DIR
Directory to write the results to
--stdout Print summary to stdout
-d DESC, --desc DESC Description for HTML page
--silent Silent mode
--skip_gs Skip gold standard evaluation vs itself
-v, --version show program's version number and exitgenome binning-specific arguments: -x MIN_COMPLETENESS, --min_completeness MIN_COMPLETENESS Comma-separated list of min. completeness thresholds (default %: 50,70,90) -y MAX_CONTAMINATION, --max_contamination MAX_CONTAMINATION Comma-separated list of max. contamination thresholds (default %: 10,5) -r REMOVE_GENOMES, --remove_genomes REMOVE_GENOMES File with list of genomes to be removed -k KEYWORD, --keyword KEYWORD Keyword in the second column of file with list of genomes to be removed (no keyword=remove all genomes in list) --genome_coverage GENOME_COVERAGE genome coveragestaxonomic binning-specific arguments: --ncbi_dir NCBI_DIR Directory containing the NCBI taxonomy database dump files nodes.dmp, merged.dmp, and names.dmp

Example:

amber.py -g test/gsa_mapping.binning \
-l "MaxBin 2.0, CONCOCT, MetaBAT" \
-p 1 \
-r test/unique_common.tsv \
-k "circular element" \
test/naughty_carson_2 \
test/goofy_hypatia_2 \
test/elated_franklin_0 \
-o output_dir/

Running amber.py using Docker

amber.py can be run with the docker run command. Example:

docker run -v $(pwd):/host amber \
amber.py \
-l "CONCOCT (CAMI), MaxBin 2.0.2 (CAMI)" \
-p 1 \
-r /host/test/unique_common.tsv \
-k "circular element" \
-g /host/test/gsa_mapping.binning \
/host/test/goofy_hypatia_2 \
/host/test/naughty_carson_2 \
-o /host/output_dir

Utilities

src/utils/add_length_column.py

Adds column _LENGTH to the gold standard mapping file, eliminating the need to provide a FASTA or FASTQ file to amber.py.

usage: add_length_column.py [-h] -g GOLD_STANDARD_FILE -f FASTA_FILE
Add length column _LENGTH to gold standard mapping and print mapping on the
standard output
optional arguments:
-h, --help show this help message and exit
-g GOLD_STANDARD_FILE, --gold_standard_file GOLD_STANDARD_FILE
Gold standard - ground truth - file
-f FASTA_FILE, --fasta_file FASTA_FILE
FASTA or FASTQ file with sequences of gold standard

Example: File CAMI_low_RL_S001__insert_270_GoldStandardAssembly.fasta.gz used in the example can be downloaded here.

python3 src/utils/add_length_column.py -g test/gsa_mapping.binning \
-f test/CAMI_low_RL_S001__insert_270_GoldStandardAssembly.fasta.gz

Output:

@Version:0.9.1
@SampleID:gsa
@@SEQUENCEID BINID LENGTH
RL|S1|C10817 Sample18_57 20518
RL|S1|C11497 Sample22_57 37672
RL|S1|C6571 evo_1286_AP.033 69914
RL|S1|C10560 evo_1286_AP.033 995657
...

src/utils/convert_fasta_bins_to_biobox_format.py

usage: convert_fasta_bins_to_biobox_format.py [-h] [-o OUTPUT_FILE]
paths [paths ...]
Convert bins in FASTA files to CAMI tsv format
positional arguments:
paths FASTA files including full paths
optional arguments:
-h, --help show this help message and exit
-o OUTPUT_FILE, --output_file OUTPUT_FILE
Output file

Example:

python3 src/utils/convert_fasta_bins_to_cami.py \
/path/to/file/maxbin.out.001.fasta \
/path/to/file/maxbin.out.002.fasta \
/path/to/file/maxbin.out.003.fasta \
/path/to/file/maxbin.out.004.fasta \
/path/to/file/maxbin.out.005.fasta \
-o bins.tsv

Alternatively:

python3 src/utils/convert_fasta_bins_to_cami.py /path/to/file/maxbin.out.0* -o bins.tsv

Output: File bins.tsv is created in the working directory.

Developer guide

We are using tox for project automation.

Tests

If you want to run tests, just type tox in the project's root directory:

tox

You can use all libraries that AMBER depends on by activating tox's virtual environment with the command:

source<project_directory>/.tox/py311/bin/activate

Update GitHub page

In order to update https://cami-challenge.github.io/AMBER, modify file index.html.

Make a release

If the dev branch is merged into the master branch:

  1. Update version.py according to semantic versioning on the dev branch.

  2. Merge the dev branch into the master branch.

  3. Make a release on GitHub with the same version number provided in version.py .

  4. Create package and upload it to PyPI:

python3 setup.py sdist bdist_wheel
twine upload dist/*

Citation

Please cite AMBER as:

The metrics implemented in AMBER were used and described in the CAMI manuscript, thus you may also cite:

  • Sczyrba, A., Hofmann, P., Belmann, P. et al. Critical Assessment of Metagenome Interpretation—a benchmark of metagenomics software. Nat Methods 14, 1063–1071 (2017). https://doi.org/10.1038/nmeth.4458

or

License

AMBER 2 is licensed under GPL v3.

About

AMBER: Assessment of Metagenome BinnERs

Topics

Resources

Stars

33 stars

Watchers

7 watching

Forks

Releases

Packages

Used by

Contributors

Languages