Installation¶
Requirements¶
Python ≥ 3.10
numpy, scipy, pandas, anndata, numba, pyyaml (installed automatically)
optional: PyICU, to sort strings the way R does in a UTF-8 locale (recommended for exact parity); matplotlib for your own plots
a C compiler (
cc) on x86-64, for the long-double kernels that make results bit-identical to R (built automatically on first use; see Validation)
The package is not on PyPI. Install it from a clone of the repository.
With conda (recommended)¶
git clone https://github.com/hoseok-lee/ecotyper-py.git
cd ecotyper-py
conda create -n ecotyper-py -c conda-forge python=3.12 numpy scipy pandas anndata numba pyicu pyyaml
conda activate ecotyper-py
pip install -e .
With pip¶
pip install -e ".[icu,plot]" # PyICU needs the ICU C library (e.g. brew install icu4c)
Optional extras: icu (PyICU), plot (matplotlib), test (pytest), docs (this
documentation).
With Docker¶
docker/Dockerfile builds an image with the dependencies at the exact versions used for the
validation. The package itself is mounted and installed at run time (as work/dock.sh does):
docker build -t ecotyper-py:dev -f docker/Dockerfile .
docker run --rm -u "$(id -u):$(id -g)" -e HOME=/tmp -v "$PWD:/work" -w /work ecotyper-py:dev \
bash -c 'pip install -q --no-deps -e . --target /tmp/pkgs && PYTHONPATH=/work/src python -m ecotyper.cli --help'
Check the installation¶
python -c "import ecotyper.workflows; print('ok')"
ecotyper-py --help
pytest -m "not e2e" # unit parity tests against R fixtures (~1 min)
Example data and prebuilt models¶
The tutorials use the example data and the prebuilt Carcinoma and Lymphoma models that ship with the R repository. Clone it next to this package:
git clone https://github.com/digitalcytometry/ecotyper.git
cd ecotyper
tar -xzf example_data/scRNA_CRC_data.txt.tar.gz -C example_data # needed by tutorials 2 and 5
cd ..
The rest of the documentation assumes:
Path |
Contents |
|---|---|
|
input matrices and annotations of the tutorials |
|
prebuilt models: |
Environment variables¶
Variable |
Effect |
|---|---|
|
sort strings by bytes (like R with |
|
force the long-double kernels off/on (default: on where |
|
use |
|
where the long-double kernel library is compiled to (default: a temp folder) |