bioutils

raw JSON →
0.6.1 verified Fri May 01 auth: no python

A library of miscellaneous simple bioinformatics utilities and lookup tables, including codon translation, sequence manipulation, and assembly mapping. Current version 0.6.1, requires Python >=3.10, maintained by biocommons.

pip install bioutils
error AttributeError: module 'bioutils' has no attribute 'codons'
cause Trying to access bioutils.codons after import bioutils, but submodules need explicit import.
fix
Use 'from bioutils import codons' instead of 'import bioutils' then 'bioutils.codons'.
error ImportError: cannot import name 'translate' from 'bioutils'
cause The correct import is from bioutils.codons, not from bioutils directly.
fix
Use 'from bioutils.codons import translate'.
breaking Version 0.6.0 dropped support for Python <3.10 and migrated configuration from setup.cfg to pyproject.toml. If you are on an older Python version, stay on 0.5.x.
fix Upgrade to Python >=3.10 or pin bioutils to <0.6.0.
gotcha Functions like codons.translate() and sequences.reverse_complement() expect plain string input, not Bio.Seq objects. Passing a Seq object will cause a TypeError.
fix Convert Seq objects to string using str(seq) before passing to bioutils functions.

Demonstrates basic codon translation and sequence manipulation.

from bioutils import codons, sequences

# Translate a DNA sequence to protein
dna = "ATGGCCATTGTAATGGGCCGCTGAAAGGGTGCCCGATAG"
protein = codons.translate(dna)
print(protein)

# Get reverse complement
rev_comp = sequences.reverse_complement(dna)
print(rev_comp)