Skip to main content
Labrat logo

Test Package Build codecov PyPI - Version DOI

labrat

Labrat is a Python framework designed to improve reproducibility, simplify laboratory management, and support common biomedical research tasks.

Features

  • Create, list, and track computational biology projects from reusable templates
  • Calculate solution dilutions, molarity, transmittance/absorbance conversions, and more
  • Organize scientific data, images, videos, and archives by file type
  • Archive projects and directories with timestamped backups
  • Count canonical nucleotides, create DNA complements, and translate FASTA sequences
  • Query gene, variant, and biomedical literature resources with provenance
  • Use the same tools from the command line or Python

Install

Install from PyPI:

pip install pylabrat

Or install from source:

git clone https://github.com/sdhutchins/labrat.git
cd labrat
pip install .

For development, install in editable mode:

pip install -e .

Examples

Command-Line Interface

Create a new project:

labrat project new --type computational-biology --name "KARG Analysis" \
  --path ./karg_analysis --description "Analyze the KARG data"

List all projects:

labrat project list

Archive files or directories:

labrat archive --source ./my_project --destination ~/Archive --name "project_backup"

Organize scientific data files:

labrat organize --science

Query genes through MyGene, variants through MyVariant, and literature through PubTator 3:

labrat query gene BMPR2
labrat query gene BMPR2 --all-matches
labrat query variant rs429358
labrat query literature "BMPR2 pulmonary arterial hypertension"
labrat query literature --gene BMPR2 \
  --disease "pulmonary arterial hypertension"

Add --format json to retain the complete provider response and query provenance for downstream analysis. The default output uses terminal-aware Rich tables and panels that remain readable when output is redirected.

Python API

Calculate solution dilutions:

from labrat.math import dilute_stock

# Calculate final concentration
final_conc = dilute_stock(100, 2, vF=4)  # Returns 50.0

Manage projects programmatically:

from labrat.project import ProjectManager

# Create a new project
manager = ProjectManager('Dr. Jane Doe')
manager.new_project(
    project_type='computational-biology',
    project_name='KARG Analysis',
    project_path='./karg_analysis',
    description="Analyze the KARG data."
)

# List all projects
projects = manager.list_projects()

Documentation

The complete documentation is available at www.shauritahutchins.com/labrat.

Great Docs requires Python 3.11 or later and Quarto. Build the documentation locally with:

pip install -e ".[docs]"
great-docs build

The generated site is written to great-docs/_site/ and is not committed.

Tests

Before running tests, ensure all dependencies are installed:

pip install -r requirements.txt

Or if installing the package:

pip install .

Run all tests using unittest:

python -m unittest discover -s tests

Or run tests with pytest (if installed):

pytest tests/

To run a specific test file:

python -m unittest tests.test_archiver
python -m unittest tests.test_file_organizer
python -m unittest tests.test_project_manager

Roadmap

  • Add a lab inventory app
  • Add project report template
  • Integrate exmemo

Author

Shaurita Hutchins · @sdhutchins · :email:

Contributing

If you would like to contribute to this package, install the package in development mode, and check out our contributing guidelines.

License

MIT

Metadata

Release files for pylabrat 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pylabrat 0.2.0
File Size Uploaded
pylabrat-0.2.0.tar.gz 92.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pylabrat 0.2.0
File Interpreter ABI Platform
pylabrat-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 193.3 kB

Release files / pylabrat-0.2.0.tar.gz

Download URL pylabrat-0.2.0.tar.gz
Size 92.3 kB
Tags Source
SHA-256 checksum
How to use checksums
56346a20a471248de18ec55d0b822a8bb52a18c6f28de735d1b97313d49138ea
BLAKE2b-256 checksum
How to use checksums
9f1a2ca5113da1ae490debe1625625b20cc09914d5d170acc82e75f00cf80192
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / pylabrat-0.2.0-py3-none-any.whl

Download URL pylabrat-0.2.0-py3-none-any.whl
Size 100.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c31fa687bcf9a25fcb1784e26894e9ae6f387144413c22107a554d1d078ed143
BLAKE2b-256 checksum
How to use checksums
e4fd42a4abe9fceae78283907f2ba563a69a0397f5ffb833a89b5f9b1f2476c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page