You can use this package to parse SigmaBAM files in openBIS. There are two resources used for automating the parsing of such files:
- Using the Python script in  tutorials/parser_tutorial.py. This script uses the parser class defined insrc/sigmabam2openbis/parser.pyand thebam-masterdataparser infrastructure. We recommend using this tutorial. To run it, after setting up your environment (see below), run in the terminalpython tutorials/parser_script.py.
- Using the Jupyter notebook from tutorials/chemical_data_inventory_openbis_mapper_1_0.ipynb. This tutorial uses PyBIS.
If you want to develop locally this package, clone the project and enter in the workspace folder:
git clone https://github.com/BAMresearch/sigmabam2openbis.git
cd sigmabam2openbisCreate a virtual environment (you can use Python>=3.10) in your workspace:
- Using venv:
python3 -m venv .venv source .venv/bin/activate # in Windows (cmd): source .venv\Scripts\activate 
- Using conda:
conda create --name .venv pip conda activate .venv 
Install the package in editable mode (with the flag -e):
pip install --upgrade pip
pip install -e '.[dev]'Note: In order to install faster the package, you can use uv for pip installing Python packages:
pip install --upgrade pip
pip install uv
uv pip install -e '.[dev]'You can locally run the tests by doing:
python -m pytest -sv testswhere the -s and -v options toggle the output verbosity.
You can also generate a local coverage report:
python -m pytest --cov=src testsWe use Ruff for formatting and linting the code following the rules specified in the pyproject.toml. You can run locally:
ruff check .This will produce an output with the specific issues found. In order to auto-fix them, run:
ruff format .If some issues are not possible to fix automatically, you will need to visit the file and fix them by hand.