bioc
bioc - Processing BioC, Brat, and PubTator with Python.
What it is and what it does
bioc is a Python library for serializing and deserializing three biomedical text annotation formats: BioC (XML and JSON), Brat standoff, and PubTator. It exposes a familiar API modeled on Python's standard library marshal and pickle modules, making it straightforward to load annotation files into Python objects and dump them back to disk.
The package is designed for biomedical NLP workflows where text documents and their annotations need to be exchanged or processed. It depends on lxml for XML parsing, jsonlines for JSON line handling, intervaltree for interval operations, tqdm for progress bars, and docopt for command-line argument parsing. The library has been stable since its 2016 release but is no longer actively maintained.
Use it for:
- Load BioC XML annotation files from biomedical corpora for downstream NLP processing or analysis
- Convert between Brat standoff format and BioC format for annotation tool interoperability
- Parse PubTator Central output to extract biomedical entity and relation annotations from literature
- Serialize processed annotation objects back to BioC or Brat format for sharing with collaborators
- Build reproducible biomedical text mining pipelines that depend on standardized annotation formats
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Reads and writes biomedical text annotation formats—BioC XML/JSON, Brat standoff, and PubTator—with a marshal/pickle-like API.
Yes, if you work with BioC, Brat, or PubTator formats in a stable biomedical NLP pipeline. The package is mature and has no known vulnerabilities, but it is abandoned and will not receive updates. Install only if you are confident the format specifications and your dependencies will remain compatible, or if you plan to maintain a fork yourself.
Install
bioc on PyPI
pip
pip install biocuv
uv add biocpoetry
poetry add biocInstalling bioc
Before you install
Low install friction with five lightweight runtime dependencies. Package is abandoned as of 2023-08-21 with no commits since; last release was 2023-08-15, over 1095 days ago. Suitable for stable use cases but expect no maintenance or bug fixes.
License in practice
MIT license (permissive); you may use, modify, and distribute bioc freely in commercial and private projects with minimal restrictions.
Quickstart
pip install bioc
from bioc import biocxml
with open('file.xml', 'r') as fp:
collection = biocxml.load(fp)
Verify before relying
- Whether the package works correctly with current versions of lxml, jsonlines, intervaltree, tqdm, and docopt
- Whether PubTator and Brat format specifications have changed since the last release in 2023
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — lxml, jsonlines, intervaltree, tqdm, docopt |
| Maintenance | abandoned — 1,095 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 165,686/month — #10,520 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: bioc-2.1-py3-none-any.whl
Keywords: bioc, brat, pubtator
Tags
More Application Frameworks packages
FastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
textualTextual is a Python framework for building…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
mcpBuild and connect to Model Context Protocol…
permissive · top 1,000 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
wfdbRead, write, process, and plot physiologic…
permissive · top 15,000 on PyPI
isa-rwvalProvides Python classes and utilities to read,…
unclear · top 15,000 on PyPI
edfioedfio reads and writes EDF, EDF+C, BDF, and…
permissive · top 15,000 on PyPI
prontoPronto parses, browses, creates, and exports…
permissive · top 15,000 on PyPI
dirtyjsonParses JSON-like data from files containing…
permissive · top 5,000 on PyPI
fastoboParses, loads, edits, and serializes OBO (Open…
permissive · top 15,000 on PyPI
javapropertiesReads and writes Java .properties files in both…
permissive · top 5,000 on PyPI
docspecDocspec provides a library and CLI to…
unclear · top 15,000 on PyPI
pyaxmlparserParses Android APK files to extract metadata…
permissive · top 15,000 on PyPI
python-libsbmlProvides Python bindings to read, write, and…
copyleft · top 15,000 on PyPI