Install

SemiBin can run on Python 3.11-3.14.

Install with pixi

The current recommended way to install SemiBin is to use pixi. Pixi will use the packages from conda-forge and bioconda to install SemiBin and its dependencies.

CPU-only mode

Create a pixi.toml file with the following content.

[workspace]
authors = ["Luis Pedro Coelho <luis@luispedro.org>"]
channels = ["conda-forge", "bioconda"]
name = "semibin_install"
platforms = ["linux-64", "osx-64"]
version = "0.1.0"

[tasks]

[dependencies]
semibin = ">=2.6.0,<3"

Then, run pixi install in the same directory as the pixi.toml file to download and install SemiBin2.

With GPU support

If you want to use SemiBin with GPU, you need to install Pytorch with GPU support as well. Starting with the example above, you need to add pytorch-gpu to the dependencies section and cuda to the system-requirements section.

[workspace]
authors = ["Luis Pedro Coelho <luis@luispedro.org>"]
channels = ["conda-forge", "bioconda"]
name = "semibin_install"
platforms = ["linux-64"]
version = "0.1.0"

[tasks]

[dependencies]
semibin = ">=2.6.0,<3"
pytorch-gpu = "*"

[system-requirements]
cuda = "12.0"

Install with conda

Pixi is now the recommended way to install SemiBin. However, if you prefer to use conda, you can install SemiBin with it

Simple Mode

conda create -n SemiBin
conda activate SemiBin
conda install -c conda-forge -c bioconda semibin

With GPU support

To get GPU support, install the pytorch-gpu package from conda-forge together with SemiBin:

conda create -n SemiBin
conda activate SemiBin
conda install -c conda-forge -c bioconda semibin "pytorch-gpu>=2.4"

This requires a CUDA-compatible GPU and NVIDIA driver: conda detects the driver to choose a CUDA build of Pytorch, and the installation fails (with an error mentioning __cuda) if no driver is found. Keep the >=2.4 version constraint: without it, conda may silently fall back to a very old build of Pytorch instead of failing. If you are installing on a machine without a GPU (e.g., the login node of a cluster) for use on a GPU node, set CONDA_OVERRIDE_CUDA (e.g., CONDA_OVERRIDE_CUDA=12.0 conda install ...).

You can check that the GPU is visible to Pytorch with python -c "import torch; print(torch.cuda.is_available())". Pixi is—however—the recommended way to install SemiBin with GPU support.

Install from source

You will need the following dependencies: - Bedtools, Hmmer, Samtools

Optional dependencies: - Prodigal (only needed if using --orf-finder prodigal; the default fast-naive ORF finder does not require it)

You can obtain the required dependencies from conda with the following commands

conda install -c bioconda bedtools hmmer samtools

Then, installing should be a simple matter of running:

pip install .

Shell tab completion

SemiBin supports tab completion of subcommands and options via argcomplete. To enable it in bash or zsh, add the following to your shell startup file (e.g., ~/.bashrc):

eval "$(register-python-argcomplete SemiBin2)"

(See the argcomplete documentation for other shells and for enabling global completion.)

Static completion scripts with shtab

Alternatively, you can generate a static completion script with shtab. Unlike argcomplete, the generated script does not call Python each time you press Tab, so completion is faster, and it also supports fish, tcsh, and PowerShell. The downside is that the script needs to be regenerated when you upgrade SemiBin (otherwise, new subcommands and options will not be completed).

shtab is not a dependency of SemiBin, so install it separately (pip install shtab or conda install -c conda-forge shtab). Then, generate the script for your shell with:

shtab --shell=bash --prog=SemiBin2 SemiBin.main.semibin_arg_parser > SemiBin2.bash

If you have pixi installed, you can also generate the script without installing shtab in your current environment. SemiBin itself must be importable in the temporary environment that pixi exec creates, so request it with --with:

pixi exec -c conda-forge -c bioconda --with semibin shtab -u --shell=bash --prog=SemiBin2 SemiBin.main.semibin_arg_parser > SemiBin2.bash

(The -u flag makes shtab report an error if SemiBin.main cannot be imported; without it, shtab silently produces an empty script.) If you are working in a source checkout of SemiBin, running pixi exec shtab -u ... from the top-level directory of the repository also works.

The --prog=SemiBin2 argument is important: it is the name of the command that the script will register completions for. Replace bash with zsh, fish, tcsh, or powershell as appropriate. Then install the script as follows (each generated script also has a header with the same instructions):

  • bash: save it as ~/.local/share/bash_completion/SemiBin2 and add source ~/.local/share/bash_completion/SemiBin2 to ~/.bashrc.
  • zsh: save it as _SemiBin2 in a directory in your fpath (e.g., ~/.local/share/zsh_completion/_SemiBin2) and add fpath=(~/.local/share/zsh_completion $fpath) to ~/.zshrc (before compinit).
  • fish: save it as ~/.config/fish/completions/SemiBin2.fish.

For example, for zsh:

mkdir -p ~/.local/share/zsh_completion
shtab --shell=zsh --prog=SemiBin2 SemiBin.main.semibin_arg_parser > ~/.local/share/zsh_completion/_SemiBin2

SemiBin.main.semibin_arg_parser is a function that builds and returns the argparse.ArgumentParser for the whole SemiBin2 command (including all subcommands), so it can also be used with shtab's Python API (shtab.complete(parser, shell="bash")).

Alternative ways of running SemiBin

If you use one of these pipelines, we ask that you cite both the pipeline author and the SemiBin manuscript (as well as any other pipeline-embedded tools which contribute to your results).