Registry / data / biotite

biotite

JSON →
library1.7.1pypypi✓ verified 25d ago

Biotite is a comprehensive Python library (current version 1.6.0) for computational molecular biology, offering a broad set of tools for sequence analysis, structural bioinformatics, and accessing data from biological databases. It leverages NumPy arrays for efficient, high-performance operations and provides seamless interfaces to integrate with external bioinformatics software, allowing users to streamline their analyses from basic scripting to developing full software packages. The library maintains an active development and release schedule, with significant updates in recent years.

pip install biotite
INSTALL
IMPORT
SIG · BIOTITE
B
biotite
datapythonv1.7.1
Install
10.8s avg
Import
773ms
Disk
392MB
Pass rate
4/ 10
Env Coverage4 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✓ 10.6s
py 3.11
✕ build_error
✓ 10.3s
py 3.12
✕ build_error
✓ 11s
py 3.13
✕ build_error
✓ 11.5s
py 3.9
✕ build_error
✕ build_error
392MB installed
● package 392MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ProteinSequence
from biotite.sequence import ProteinSequence
entrez
from biotite.database import entrez
FastaFile
from biotite.sequence.io.fasta import FastaFile
align_optimal
from biotite.sequence.align import align_optimal

Downloads two protein sequences (avidin and streptavidin) from the NCBI Entrez database, parses them from a FASTA file, and performs a pairwise optimal sequence alignment using the BLOSUM62 matrix with affine gap penalties.

import biotite.sequence.align as align import biotite.sequence.io.fasta as fasta import biotite.database.entrez as entrez import os # Download FASTA file for the sequences of avidin and streptavidin # The 'file_name' should ideally be a path to a temporary file. # For a runnable example, we'll use a simple name and ensure cleanup in a real scenario. file_name = "sequences.fasta" uids = ["CAC34569", "ACL82594"] # Example UIDs for avidin and streptavidin entrez.fetch_single_file( uids=uids, file_name=file_name, db_name="protein", ret_type="fasta" ) # Parse the downloaded FASTA file and create 'ProteinSequence' objects fasta_file = fasta.FastaFile.read(file_name) avidin_seq, streptavidin_seq = fasta.get_sequences(fasta_file).values() # Align sequences using the BLOSUM62 matrix with affine gap penalty matrix = align.SubstitutionMatrix.std_protein_matrix() alignments = align.align_optimal( avidin_seq, streptavidin_seq, matrix, gap_penalty=(-10, -1), terminal_penalty=False ) print(f"Number of alignments: {len(alignments)}") if alignments: print("First optimal alignment:") print(alignments[0]) # Clean up the downloaded file os.remove(file_name)
Debug
Known issues
breakingAs of Biotite v1.6.0, the `biotraj` package is now a mandatory dependency for trajectory file interfaces in `biotite.structure.io`, and `mdtraj` is no longer required for this purpose. Projects relying on `mdtraj` through Biotite's internal interfaces might require adjustment.
fix
Ensure `biotraj` is installed (`pip install biotraj`) and update import paths if directly using `mdtraj` features that were previously proxied by Biotite.
affects: >=1.6.0
gotchaBiotite internally stores most sequence and structure data as NumPy `ndarray` objects. While offering high performance and intuitive NumPy-like indexing, users accustomed to other bioinformatics libraries (e.g., Biopython) might need to adapt to this NumPy-centric data model.
fix
Familiarize yourself with NumPy array operations and indexing. Biotite's documentation provides examples of how to interact with its NumPy-based data structures.
affects: all
gotchaBiotite is organized into several subpackages (e.g., `biotite.sequence`, `biotite.structure`, `biotite.database`). Specific functionalities reside within these submodules, requiring explicit imports from the relevant subpackage rather than a single top-level `import biotite`.
fix
Always refer to the official documentation or example gallery to find the correct import paths for the specific classes or functions you intend to use.
affects: all
deprecatedIn `biotite.sequence.graphics`, the default color scheme for visualizing sequence alignments changed from `rainbow` to `flower` in v1.6.0. The `flower` scheme is considered to represent amino acid similarity more effectively.
fix
Explicitly set `color_scheme='rainbow'` if you wish to retain the old default, or adapt to the new `flower` default. Consider if your visualization interpretations are affected by the color scheme change.
affects: >=1.6.0
Errors
Common errors & fixes
ValueError: numpy.ufunc size changed, may indicate binary incompatibility.
Biotite was built against a NumPy version different from the one currently installed, often happening after NumPy is updated while Biotite is already installed.
fix
Update both NumPy and Biotite to their latest compatible versions: `pip install --upgrade numpy biotite` or `conda update numpy biotite`.
ModuleNotFoundError: No module named 'biotite.structure.io.npz'
This error typically occurs if the `biotite` package is not correctly installed, or if there's a version mismatch where a required submodule is missing or has been moved/renamed in the installed version.
fix
Ensure `biotite` is properly installed and updated: `pip install --upgrade biotite`. If the problem persists, downgrading to a specific working version (e.g., `pip install biotite==0.41.2` as seen in some contexts) might resolve it for certain environments.
ValueError: invalid literal for int() with base 10: '2+'
This error arises when parsing PDB files where the charge information is formatted as '+X' (e.g., '+2') instead of the PDB standard 'X+' (e.g., '2+'), leading to an integer conversion failure in Biotite's PDB parser.
fix
Pre-process the PDB file to ensure charge fields adhere to the 'X+' format, or if possible, update Biotite to a version that might include a more robust parser for such non-standard formats. Manually editing the problematic charge entries in the PDB file is a direct solution.
TypeError: If a trajectory file is loaded without specifying the template parameter.
When using `biotite.structure.io.load_structure()` to load a trajectory file (which contains multiple models or frames), a template `AtomArray` or `AtomArrayStack` must be provided to define the atom annotations.
fix
Provide a `template` parameter to the `load_structure` function, typically by first loading a single frame or a reference structure from the trajectory or a separate PDB file. Example: `template_structure = biotite.structure.io.load_structure('reference.pdb'); trajectory = biotite.structure.io.load_structure('trajectory.xtc', template=template_structure)`.
Upgrade
Version history
1.7.1latest on PyPI · released Jun 22, 2026
Audit
Dependencies
numpyrequiredCore data model for sequences and structures relies on NumPy ndarrays for performance and intuitive operations.
requestsrequiredUsed for accessing biological databases via REST APIs (e.g., NCBI Entrez, UniProt, PDB).
msgpackrequiredUsed for efficient data serialization.
networkxrequiredLikely used for graph-based analyses within structural or interaction modules.
biotrajrequiredMandatory dependency for trajectory file interfaces within `biotite.structure.io` as of v1.6.0, replacing `mdtraj`.
Agent activity
26 hits · last 30 days
node
24
OpenAI (training)
1
Resources
biotite — pip install biotite · libregistry