conda config --add envs_dirs /zfs/omics/projects/bioinformatics/software/miniconda3/envs/COMEBin
Introduction
COMEBin is a binning tool that uses contrastive multiple-view representation learning (combining sequence composition and coverage/abundance information from mapping reads back to the assembly) to group contigs from a metagenome assembly into genome bins (Wang et al. 2024).
For metagenomic binning pipelines, it is recommended to use COMEbin alongside other binners (i.e. MetaBAT2, SemiBin, VAMB, …), and then consolidate the results using either DAS Tool or Binette to get the best results.
Installation
Installed on Crunchomics: Yes, COMEBin v.1.0.4 is installed on Crunchomics.
If you have access to Crunchomics and have not yet access to the bioinformatics share you can send an email with your UvA netID to Nina Dombrowski. Afterwards, you can add the bioinformatics share as follows (if you have already done this in the past, you don’t need to run this command):
If you want to install it yourself, the command below installs the version verified on Crunchomics. Before running it, check the COMEBin releases page for a newer version and swap the version number if one is available — just be aware that a newer version may not have the scikit-learn fix below yet, so you may need to work out a similar patch yourself if you hit the same error.
mamba create -n comebin_1.0.4 -c bioconda -c conda-forge comebin=1.0.4Important: COMEBin installs a version of scikit-learn that is too new for one of its own scripts: the script calls a scikit-learn function with an option (n_jobs) that scikit-learn has since removed, so a binning run fails partway through with a TypeError: __init__() got an unexpected keyword argument 'n_jobs'. COMEBin has not been updated since March 2024, so this is unlikely to be fixed upstream soon. Until it is, apply this one-time patch to the installed copy of the script (adjust the environment name if you used a different one):
Last verified working: 2026-08-04 (COMEBin v1.0.4). If you hit a different error after a fresh install, this patch may be outdated — check the COMEBin GitHub for updates before re-patching.
conda activate comebin_1.0.4
ENVBIN="$CONDA_PREFIX/bin/COMEBin"
cp "$ENVBIN/cluster.py" "$ENVBIN/cluster.py.orig"
sed -i 's/n_jobs=-1, //' "$ENVBIN/cluster.py"Because the removed option was the one COMEBin used to control how many CPUs it uses for this step, you need to set the number of threads via an environment variable inside your SLURM script by adding this line on top of your job script:
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASKUsage
Input file format:
- Contigs [-a]: The metagenomic assembly file in fasta format.
- Bam files [-p]: Path to the directory containing sorted, indexed BAM file(s) from mapping reads back to the assembly (one BAM per sample if you have multiple samples for differential coverage binning).
conda activate comebin_env_1.0.3
run_comebin.sh -a assembly.fasta \
-o comebin_output \
-p bam_files/ \
-t 10Usage information:
bash run_comebin.sh [options] -a contig_file -o output_dir -p bam_file_path
Options:
-a STR metagenomic assembly file
-o STR output directory
-p STR path to access to the bam files
-n INT number of views for contrastive multiple-view learning (default=6)
-t INT number of threads (default=5)
-l FLOAT temperature in loss function (default=0.07 for assemblies with an N50 > 10000, default=0.15 for others)
-e INT embedding size for comebin network (default=2048)
-c INT embedding size for coverage network (default=2048)
-b INT batch size for training process (default=1024)