SPACEc 0.0.7__tar.gz → 0.0.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {spacec-0.0.7 → spacec-0.0.9}/.github/workflows/ci.yml +24 -14
- {spacec-0.0.7 → spacec-0.0.9}/.pre-commit-config.yaml +2 -2
- spacec-0.0.9/Docker/SPACEc_cpu +65 -0
- spacec-0.0.9/Docker/SPACEc_gpu +75 -0
- spacec-0.0.9/LICENSE.txt +25 -0
- spacec-0.0.9/PKG-INFO +251 -0
- spacec-0.0.9/README.md +200 -0
- spacec-0.0.9/docs/overview.png +0 -0
- spacec-0.0.9/install_spacec.sh +77 -0
- {spacec-0.0.7 → spacec-0.0.9}/notebooks/0_tissue_extractor.ipynb +5 -18
- {spacec-0.0.7 → spacec-0.0.9}/notebooks/1_cell_segmentation.ipynb +55 -29
- {spacec-0.0.7 → spacec-0.0.9}/notebooks/2_preprocessing.ipynb +1 -10
- spacec-0.0.9/notebooks/3_GUI_assisted_clustering.ipynb +663 -0
- {spacec-0.0.7 → spacec-0.0.9}/notebooks/3_cell_annotation_STELLAR.ipynb +5 -11
- {spacec-0.0.7 → spacec-0.0.9}/notebooks/3_cell_annotation_ml.ipynb +4 -10
- {spacec-0.0.7 → spacec-0.0.9}/notebooks/3_clustering.ipynb +6 -12
- {spacec-0.0.7 → spacec-0.0.9}/notebooks/4_cell_neighborhood_analysis.ipynb +5 -11
- spacec-0.0.9/notebooks/5_distance_permutation_analysis.ipynb +937 -0
- {spacec-0.0.7 → spacec-0.0.9}/notebooks/6_patch_proximity_analysis.ipynb +8 -13
- {spacec-0.0.7 → spacec-0.0.9}/notebooks/7_TissUUmaps.ipynb +49 -4
- spacec-0.0.9/notebooks/CellSeg_compensation.ipynb +1521 -0
- spacec-0.0.9/notebooks/Interactive_clustering_demo.ipynb +689 -0
- spacec-0.0.9/requirements/README.md +11 -0
- spacec-0.0.9/requirements/requirements-deepcell-mac-arm64_tf210-metal.txt +22 -0
- spacec-0.0.9/requirements/requirements-deepcell-mac-arm64_tf210.txt +22 -0
- spacec-0.0.9/requirements/requirements-deepcell-mac-arm64_tf28-metal.txt +22 -0
- {spacec-0.0.7 → spacec-0.0.9}/setup.cfg +13 -9
- spacec-0.0.9/src/SPACEc.egg-info/PKG-INFO +251 -0
- {spacec-0.0.7 → spacec-0.0.9}/src/SPACEc.egg-info/SOURCES.txt +14 -3
- {spacec-0.0.7 → spacec-0.0.9}/src/SPACEc.egg-info/requires.txt +13 -7
- {spacec-0.0.7 → spacec-0.0.9}/src/spacec/__init__.py +3 -2
- spacec-0.0.9/src/spacec/archive/tools_archive.py +837 -0
- {spacec-0.0.7 → spacec-0.0.9}/src/spacec/plotting/_general.py +316 -7
- spacec-0.0.9/src/spacec/preprocessing/__init__.py +15 -0
- {spacec-0.0.7 → spacec-0.0.9}/src/spacec/preprocessing/_general.py +282 -44
- {spacec-0.0.7 → spacec-0.0.9}/src/spacec/tools/__init__.py +6 -0
- {spacec-0.0.7 → spacec-0.0.9}/src/spacec/tools/_general.py +1591 -1672
- {spacec-0.0.7 → spacec-0.0.9}/src/spacec/tools/_segmentation.py +6 -4
- spacec-0.0.9/tests/data/CP_test.zip +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/tests/test_0_qptiff_converter.py +1 -1
- {spacec-0.0.7 → spacec-0.0.9}/tests/test_1_cell_segmentation.py +25 -1
- spacec-0.0.9/tests/test_2_preprocessing_compensation.py +13 -0
- {spacec-0.0.7 → spacec-0.0.9}/tests/test_3_clustering.py +3 -0
- {spacec-0.0.7 → spacec-0.0.9}/tests/test_5_distance_permutation_analysis.py +9 -2
- {spacec-0.0.7 → spacec-0.0.9}/tests/test_6_patch_proximity_analysis.py +11 -2
- {spacec-0.0.7 → spacec-0.0.9}/tests/test_7_TissUUmaps.py +11 -0
- {spacec-0.0.7 → spacec-0.0.9}/tox.ini +67 -1
- spacec-0.0.7/LICENSE.txt +0 -21
- spacec-0.0.7/PKG-INFO +0 -140
- spacec-0.0.7/README.md +0 -93
- spacec-0.0.7/TODO.md +0 -20
- spacec-0.0.7/docs/overview.png +0 -0
- spacec-0.0.7/environment.yml +0 -7
- spacec-0.0.7/notebooks/5_distance_permutation_analysis.ipynb +0 -833
- spacec-0.0.7/src/SPACEc.egg-info/PKG-INFO +0 -140
- spacec-0.0.7/src/spacec/preprocessing/__init__.py +0 -8
- {spacec-0.0.7 → spacec-0.0.9}/.coveragerc +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/.gitignore +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/.isort.cfg +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/.readthedocs.yml +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/AUTHORS.md +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/CHANGELOG.md +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/CONTRIBUTING.md +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/Docker/old/Dockerfile +0 -0
- {spacec-0.0.7/Docker → spacec-0.0.9/Docker/old}/SPACEc_cpu +0 -0
- {spacec-0.0.7/Docker → spacec-0.0.9/Docker/old}/SPACEc_gpu +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/Docker/old/tutorial.Dockerfile +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/Docker/old/tutorial_init.sh +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/docs/Makefile +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/docs/_static/.gitignore +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/docs/authors.md +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/docs/changelog.md +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/docs/conf.py +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/docs/contributing.md +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/docs/index.md +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/docs/license.md +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/docs/readme.md +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/docs/requirements.txt +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/docs/tutorials.md +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/pyproject.toml +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/setup.py +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/src/SPACEc.egg-info/dependency_links.txt +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/src/SPACEc.egg-info/not-zip-safe +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/src/SPACEc.egg-info/top_level.txt +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/src/spacec/_shared/segmentation.py +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/src/spacec/_shared/segmentation_unused.py +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/src/spacec/helperfunctions/__init__.py +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/src/spacec/helperfunctions/_general.py +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/src/spacec/helperfunctions/_qptiff_converter.py +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/src/spacec/plotting/__init__.py +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/src/spacec/plotting/_qptiff_converter.py +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/src/spacec/plotting/_segmentation.py +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/src/spacec/tools/_qptiff_converter.py +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/tests/__init__.py +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/tests/conftest.py +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/tests/data/processed/cellseg/reg001_X01_Y01_Z01_compensated.csv +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/tests/data/processed/cellseg/reg010_X01_Y01_Z01_compensated.csv +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/tests/data/processed/tonsil/1/adata_nn_2000.h5ad +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/tests/data/processed/tonsil/1/adata_nn_demo.h5ad +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/tests/data/processed/tonsil/1/adata_nn_demo_annotated.h5ad +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/tests/data/processed/tonsil/1/adata_nn_demo_annotated_cn.h5ad +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/tests/data/processed/tonsil/1/overlay_tonsil1.pickle +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/tests/data/processed/tonsil/1/seg_output_tonsil1.pickle +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/tests/data/raw/S1121_Scan1_small.qptiff +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/tests/data/raw/tonsil/1/reg010_X01_Y01_Z01.tif +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/tests/data/raw/tonsil/celltype_markers +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/tests/data/raw/tonsil/channelnames.txt +0 -0
- /spacec-0.0.7/tests/test_2_preprocessing.py → /spacec-0.0.9/tests/test_2_preprocessing_base.py +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/tests/test_3_cell_annotation_STELLAR.py +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/tests/test_3_cell_annotation_ml.py +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/tests/test_3_clustering_gpu.py +0 -0
- {spacec-0.0.7 → spacec-0.0.9}/tests/test_4_cellular_neighborhood_analysis.py +0 -0
|
@@ -62,10 +62,10 @@ jobs:
|
|
|
62
62
|
python:
|
|
63
63
|
# - "3.8" # oldest Python supported
|
|
64
64
|
- "3.9"
|
|
65
|
-
|
|
65
|
+
- "3.10" # newest Python that is stable
|
|
66
66
|
platform:
|
|
67
67
|
- ubuntu-latest
|
|
68
|
-
|
|
68
|
+
- macos-latest
|
|
69
69
|
# - windows-latest
|
|
70
70
|
# exclude:
|
|
71
71
|
# - platform: windows-latest
|
|
@@ -83,25 +83,35 @@ jobs:
|
|
|
83
83
|
# libvips
|
|
84
84
|
- name: Install libvips on Ubuntu
|
|
85
85
|
if: startsWith(matrix.platform, 'ubuntu')
|
|
86
|
-
run: sudo apt-get install -y libvips
|
|
87
|
-
# TODO: Can't get this to run
|
|
88
|
-
# - name: Install libvips on Windows
|
|
89
|
-
# if: startsWith(matrix.platform, 'windows')
|
|
90
|
-
# run: choco install nip2
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
run: sudo apt-get install -y libvips graphviz
|
|
87
|
+
# # TODO: Can't get this to run
|
|
88
|
+
# # - name: Install libvips on Windows
|
|
89
|
+
# # if: startsWith(matrix.platform, 'windows')
|
|
90
|
+
# # run: choco install nip2
|
|
91
|
+
# - name: Install libvips on Mac
|
|
92
|
+
# if: startsWith(matrix.platform, 'macos')
|
|
93
|
+
# run: brew install vips
|
|
94
|
+
|
|
95
|
+
# - name: Setup Graphviz
|
|
96
|
+
# uses: tlylt/install-graphviz@v1
|
|
94
97
|
|
|
95
|
-
- name: Setup Graphviz
|
|
96
|
-
uses: tlylt/install-graphviz@v1
|
|
97
98
|
- name: Retrieve pre-built distribution files
|
|
98
99
|
uses: actions/download-artifact@v4
|
|
99
100
|
with: {name: python-distribution-files, path: dist/}
|
|
100
|
-
|
|
101
|
+
|
|
102
|
+
- name: Run tests (ubuntu)
|
|
103
|
+
if: startsWith(matrix.platform, 'ubuntu')
|
|
101
104
|
run: >-
|
|
102
105
|
pipx run --python '${{ steps.setup-python.outputs.python-path }}'
|
|
103
|
-
tox --installpkg '${{ needs.prepare.outputs.wheel-distribution }}'
|
|
106
|
+
tox -e platform-ubuntu --installpkg '${{ needs.prepare.outputs.wheel-distribution }}'
|
|
104
107
|
-- -rFEx --durations 10 --color yes # pytest args
|
|
108
|
+
- name: Run tests (macos)
|
|
109
|
+
if: startsWith(matrix.platform, 'macos')
|
|
110
|
+
run: >-
|
|
111
|
+
pipx run --python '${{ steps.setup-python.outputs.python-path }}'
|
|
112
|
+
tox -e platform-macos --installpkg '${{ needs.prepare.outputs.wheel-distribution }}'
|
|
113
|
+
-- -rFEx --durations 10 --color yes # pytest args
|
|
114
|
+
|
|
105
115
|
- name: Generate coverage report
|
|
106
116
|
run: pipx run coverage lcov -o coverage.lcov
|
|
107
117
|
# - name: Upload partial coverage report
|
|
@@ -2,7 +2,7 @@ exclude: '^docs/conf.py'
|
|
|
2
2
|
|
|
3
3
|
repos:
|
|
4
4
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
5
|
-
rev:
|
|
5
|
+
rev: v5.0.0
|
|
6
6
|
hooks:
|
|
7
7
|
- id: trailing-whitespace
|
|
8
8
|
- id: check-added-large-files
|
|
@@ -41,7 +41,7 @@ repos:
|
|
|
41
41
|
- id: isort
|
|
42
42
|
|
|
43
43
|
- repo: https://github.com/psf/black
|
|
44
|
-
rev: 24.
|
|
44
|
+
rev: 24.10.0
|
|
45
45
|
hooks:
|
|
46
46
|
- id: black
|
|
47
47
|
language_version: python3
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
FROM debian:bullseye-slim
|
|
2
|
+
|
|
3
|
+
# Fix (tzdata)
|
|
4
|
+
ARG DEBIAN_FRONTEND=noninteractive
|
|
5
|
+
|
|
6
|
+
# Update the package list and install dependencies
|
|
7
|
+
RUN apt-get update && \
|
|
8
|
+
apt-get install -y \
|
|
9
|
+
fontconfig \
|
|
10
|
+
fonts-dejavu-core \
|
|
11
|
+
fonts-droid-fallback \
|
|
12
|
+
fonts-liberation \
|
|
13
|
+
fonts-noto-mono \
|
|
14
|
+
ttf-bitstream-vera \
|
|
15
|
+
git \
|
|
16
|
+
wget && \
|
|
17
|
+
rm -rf /var/lib/apt/lists/*
|
|
18
|
+
|
|
19
|
+
# Install Miniforge
|
|
20
|
+
RUN apt-get update && \
|
|
21
|
+
apt-get install -y wget && \
|
|
22
|
+
wget "https://github.com/conda-forge/miniforge/releases/download/23.11.0-0/Miniforge3-23.11.0-0-Linux-x86_64.sh" && \
|
|
23
|
+
bash Miniforge3-*.sh -b -p /miniforge && \
|
|
24
|
+
rm Miniforge3-*.sh
|
|
25
|
+
|
|
26
|
+
# Add Miniforge to PATH
|
|
27
|
+
ENV PATH="/miniforge/bin:${PATH}"
|
|
28
|
+
|
|
29
|
+
# Create a new conda environment with Python 3.10
|
|
30
|
+
RUN conda create -n spacec python=3.10 -y
|
|
31
|
+
|
|
32
|
+
# Install mamba
|
|
33
|
+
RUN conda install -n spacec -c conda-forge mamba -y
|
|
34
|
+
|
|
35
|
+
# Install libxml2
|
|
36
|
+
RUN mamba install -n spacec -c conda-forge libxml2=2.13.5 -y
|
|
37
|
+
|
|
38
|
+
# Install other dependencies
|
|
39
|
+
RUN mamba install -n spacec -c conda-forge graphviz libvips pyvips openslide-python -y
|
|
40
|
+
|
|
41
|
+
# Install gcc
|
|
42
|
+
RUN apt-get update && \
|
|
43
|
+
apt-get install -y build-essential gcc && \
|
|
44
|
+
rm -rf /var/lib/apt/lists/*
|
|
45
|
+
|
|
46
|
+
# Install SPACEc
|
|
47
|
+
RUN mamba run -n spacec pip install spacec
|
|
48
|
+
|
|
49
|
+
# Install additional Python packages
|
|
50
|
+
RUN mamba run -n spacec pip install networkx==3.2.* protobuf==3.20.0 numpy==1.24.*
|
|
51
|
+
|
|
52
|
+
# Clean up
|
|
53
|
+
RUN mamba clean --all -f -y && \
|
|
54
|
+
rm -rf /root/.cache/pip
|
|
55
|
+
|
|
56
|
+
# Copy notebooks into the image
|
|
57
|
+
COPY notebooks /notebooks
|
|
58
|
+
WORKDIR /notebooks
|
|
59
|
+
|
|
60
|
+
# Expose relevant ports
|
|
61
|
+
EXPOSE 8888
|
|
62
|
+
EXPOSE 5100
|
|
63
|
+
|
|
64
|
+
# Default command
|
|
65
|
+
CMD ["conda", "run", "-n", "spacec", "jupyter", "lab", "--ip='0.0.0.0'", "--port=8888", "--no-browser", "--allow-root", "--NotebookApp.token=''"]
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
FROM nvidia/cuda:11.2.2-cudnn8-runtime
|
|
2
|
+
|
|
3
|
+
# Add the NVIDIA package repositories GPG key
|
|
4
|
+
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub
|
|
5
|
+
|
|
6
|
+
# Fix (tzdata)
|
|
7
|
+
ARG DEBIAN_FRONTEND=noninteractive
|
|
8
|
+
|
|
9
|
+
# Update the package list and install dependencies
|
|
10
|
+
RUN apt-get update && \
|
|
11
|
+
apt-get install -y \
|
|
12
|
+
fontconfig \
|
|
13
|
+
fonts-dejavu-core \
|
|
14
|
+
fonts-droid-fallback \
|
|
15
|
+
fonts-liberation \
|
|
16
|
+
fonts-noto-mono \
|
|
17
|
+
ttf-bitstream-vera \
|
|
18
|
+
git \
|
|
19
|
+
wget && \
|
|
20
|
+
rm -rf /var/lib/apt/lists/*
|
|
21
|
+
|
|
22
|
+
# Install Miniforge
|
|
23
|
+
RUN apt-get update && \
|
|
24
|
+
apt-get install -y wget && \
|
|
25
|
+
wget "https://github.com/conda-forge/miniforge/releases/download/23.11.0-0/Miniforge3-23.11.0-0-Linux-x86_64.sh" && \
|
|
26
|
+
bash Miniforge3-*.sh -b -p /miniforge && \
|
|
27
|
+
rm Miniforge3-*.sh
|
|
28
|
+
|
|
29
|
+
# Add Miniforge to PATH
|
|
30
|
+
ENV PATH="/miniforge/bin:${PATH}"
|
|
31
|
+
|
|
32
|
+
# Create a new conda environment with Python 3.10
|
|
33
|
+
RUN conda create -n spacec python=3.10 -y
|
|
34
|
+
|
|
35
|
+
# Install mamba
|
|
36
|
+
RUN conda install -n spacec -c conda-forge mamba -y
|
|
37
|
+
|
|
38
|
+
# Install libxml2
|
|
39
|
+
RUN mamba install -n spacec -c conda-forge libxml2=2.13.5 -y
|
|
40
|
+
|
|
41
|
+
# Install other dependencies
|
|
42
|
+
RUN mamba install -n spacec -c conda-forge graphviz libvips pyvips openslide-python -y
|
|
43
|
+
|
|
44
|
+
# Install gcc
|
|
45
|
+
RUN apt-get update && \
|
|
46
|
+
apt-get install -y build-essential gcc && \
|
|
47
|
+
rm -rf /var/lib/apt/lists/*
|
|
48
|
+
|
|
49
|
+
# Install SPACEc
|
|
50
|
+
RUN mamba run -n spacec pip install spacec
|
|
51
|
+
|
|
52
|
+
# Install additional Python packages
|
|
53
|
+
RUN mamba run -n spacec pip install networkx==3.2.* protobuf==3.20.0 numpy==1.24.*
|
|
54
|
+
|
|
55
|
+
# Install PyTorch
|
|
56
|
+
RUN mamba run -n spacec pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113
|
|
57
|
+
|
|
58
|
+
# Install RAPIDS and related packages
|
|
59
|
+
RUN mamba install -n spacec -c rapidsai -c conda-forge -c nvidia rapids=24.02 -y && \
|
|
60
|
+
mamba run -n spacec pip install rapids-singlecell==0.9.5 pandas==1.5.3
|
|
61
|
+
|
|
62
|
+
# Clean up
|
|
63
|
+
RUN mamba clean --all -f -y && \
|
|
64
|
+
rm -rf /root/.cache/pip
|
|
65
|
+
|
|
66
|
+
# Copy notebooks into the image
|
|
67
|
+
COPY notebooks /notebooks
|
|
68
|
+
WORKDIR /notebooks
|
|
69
|
+
|
|
70
|
+
# Expose relevant ports
|
|
71
|
+
EXPOSE 8888
|
|
72
|
+
EXPOSE 5100
|
|
73
|
+
|
|
74
|
+
# Default command
|
|
75
|
+
CMD ["conda", "run", "-n", "spacec", "jupyter", "lab", "--ip='0.0.0.0'", "--port=8888", "--no-browser", "--allow-root", "--NotebookApp.token=''"]
|
spacec-0.0.9/LICENSE.txt
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Academic Software License Agreement (2024/07/10)
|
|
2
|
+
|
|
3
|
+
STANFORD ACADEMIC SOFTWARE LICENSE AGREEMENT FOR "SPACEc: A Streamlined, Interactive Python Workflow for Multiplexed Image Processing and Analysis"
|
|
4
|
+
|
|
5
|
+
1. This is a legal agreement (“Agreement”) between ______________________ (“RECIPIENT” or “you”), and THE BOARD OF TRUSTEES OF THE LELAND STANFORD JUNIOR UNIVERSITY (“STANFORD”). Stanfordhave assignments to “Integrative Matching and Analysis of Cells across single-cell multi-omics datasets with overlapping and non-overlapping features” (“Software”) which was developed in the laboratory of Professor Garry Nolan at Stanford.
|
|
6
|
+
2. By accepting, receiving, and using Software, including any accompanying information, materials or manuals you are agreeing to be bound by the terms of this Agreement. If you do not agree to the terms of this Agreement, promptly return the Software to STANFORD.
|
|
7
|
+
3. STANFORD grant to RECIPIENT a royalty-free, nonexclusive, and nontransferable license to use the Software furnished hereunder, upon the terms and conditions set out below.
|
|
8
|
+
4. RECIPIENT acknowledges that the Software is a research tool still in the development stage and that it is being supplied as is, without any accompanying services, support or improvements from STANFORD. STANFORD MAKE NO REPRESENTATIONS AND EXTENDS NO WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED OTHER THAN SET OUT IN THIS AGREEMENT.
|
|
9
|
+
5. STANFORD do not grant any licenses under any STANFORD patent or patent application by this Agreement.
|
|
10
|
+
6. RECIPIENT agrees to use the Software solely for internal academic non-commercial purposes and shall not distribute or transfer it to another location or to any other person without prior written permission from STANFORD. In particular, no article in this license grants commercial use rights to RECIPIENT.
|
|
11
|
+
7. RECIPIENT agrees not to reverse engineer, reverse assemble, reverse compile decompile, disassemble, or otherwise attempt to re-create the source code for the Software. RECIPIENT acknowledges that any programs created based on the Software will be considered a derivative of Software and owned by STANFORD.
|
|
12
|
+
8. RECIPIENT may NOT make modifications to the Software or integrate Software into RECIPIENT’s own software.
|
|
13
|
+
9. RECIPIENT may not further distribute Software without express written permission of STANFORD. If permission to transfer the Software is given, RECIPIENT warrants that RECIPIENT will not remove or export any part of the Software from the United States except in full compliance with all United States export regulations and other applicable laws.
|
|
14
|
+
10. RECIPIENT will use the Software in compliance with all applicable laws, policies and regulations including, but not limited to, any approvals, informed consent and patient confidentiality principles.
|
|
15
|
+
11. RECIPIENT will indemnify, hold harmless, and defend STANFORD against any claim of any kind arising out of or related to the exercise of any rights granted under this Agreement or the breach of this Agreement by RECIPIENT.
|
|
16
|
+
12. Title and copyright to the Software and any derivatives and any associated documentation shall at all times remain with STANFORD, and RECIPIENT agrees to preserve same.
|
|
17
|
+
13. If RECIPIENT plans to publish any peer reviewed papers, abstracts, or similar publications, RECIPIENT agrees to acknowledge Software and its creators in a manner consistent with academic (industry) practice.
|
|
18
|
+
14. This agreement may be terminated by either party upon thirty (30) days written notice to the other party. In the event of termination, RECIPIENT shall destroy or return immediately all Software and all copies thereof to STANFORDupon STANFORD’request.
|
|
19
|
+
15. The parties to this document agree that a copy of the original signature (including an electronic copy) may be used for any and all purposes for which the original signature may have been used. The parties further waive any right to challenge the admissibility or authenticity of this document in a court of law based solely on the absence of an original signature.
|
|
20
|
+
|
|
21
|
+
RECIPIENT
|
|
22
|
+
Signature ___________________________________________________
|
|
23
|
+
Name ________________________________________________________
|
|
24
|
+
Title _______________________________________________________
|
|
25
|
+
Date ________________________________________________________
|
spacec-0.0.9/PKG-INFO
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: SPACEc
|
|
3
|
+
Version: 0.0.9
|
|
4
|
+
Summary: SPatial Analysis for CodEX data (SPACEc)
|
|
5
|
+
Home-page: https://github.com/yuqiyuqitan/SPACEc
|
|
6
|
+
Author: yuqiyuqitan
|
|
7
|
+
Author-email: tanyuqi527@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Documentation, https://spacec.readthedocs.io/
|
|
10
|
+
Project-URL: Source, https://github.com/yuqiyuqitan/SPACEc
|
|
11
|
+
Project-URL: Tracker, https://github.com/yuqiyuqitan/SPACEc/issues
|
|
12
|
+
Platform: any
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Programming Language :: Python
|
|
15
|
+
Requires-Python: <3.11,>=3.9
|
|
16
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
17
|
+
License-File: LICENSE.txt
|
|
18
|
+
Requires-Dist: importlib-metadata; python_version < "3.8"
|
|
19
|
+
Requires-Dist: tqdm
|
|
20
|
+
Requires-Dist: joblib
|
|
21
|
+
Requires-Dist: pandas
|
|
22
|
+
Requires-Dist: yellowbrick
|
|
23
|
+
Requires-Dist: statsmodels
|
|
24
|
+
Requires-Dist: scikit-learn
|
|
25
|
+
Requires-Dist: scikit-image
|
|
26
|
+
Requires-Dist: scanpy
|
|
27
|
+
Requires-Dist: networkx
|
|
28
|
+
Requires-Dist: tensorly
|
|
29
|
+
Requires-Dist: cellpose==3.0.8
|
|
30
|
+
Requires-Dist: concave_hull
|
|
31
|
+
Requires-Dist: pyFlowSOM
|
|
32
|
+
Requires-Dist: TissUUmaps==3.1.1.6
|
|
33
|
+
Requires-Dist: Flask==2.0.0
|
|
34
|
+
Requires-Dist: Werkzeug==2.3.8
|
|
35
|
+
Requires-Dist: GitPython
|
|
36
|
+
Requires-Dist: igraph
|
|
37
|
+
Requires-Dist: leidenalg; sys_platform != "darwin" or platform_machine != "arm64"
|
|
38
|
+
Requires-Dist: louvain; sys_platform != "darwin" or platform_machine != "arm64"
|
|
39
|
+
Requires-Dist: python-louvain==0.1
|
|
40
|
+
Requires-Dist: matplotlib==3.9
|
|
41
|
+
Requires-Dist: panel
|
|
42
|
+
Requires-Dist: watchfiles
|
|
43
|
+
Requires-Dist: networkx<3.4
|
|
44
|
+
Requires-Dist: pyvips
|
|
45
|
+
Requires-Dist: openslide-python
|
|
46
|
+
Requires-Dist: deepcell; sys_platform != "darwin" or platform_machine != "arm64"
|
|
47
|
+
Provides-Extra: testing
|
|
48
|
+
Requires-Dist: setuptools; extra == "testing"
|
|
49
|
+
Requires-Dist: pytest; extra == "testing"
|
|
50
|
+
Requires-Dist: pytest-cov; extra == "testing"
|
|
51
|
+
|
|
52
|
+
# SPatial Analysis for CodEX data (SPACEc)
|
|
53
|
+
|
|
54
|
+
[](https://github.com/yuqiyuqitan/SPACEc/stargazers)
|
|
55
|
+
[](https://pepy.tech/project/spacec)
|
|
56
|
+
[](https://pypi.org/project/spacec/)
|
|
57
|
+
[](https://spacec.readthedocs.io/en/latest/?badge=latest)
|
|
58
|
+
[](https://github.com/yuqiyuqitan/SPACEc/actions/workflows/ci.yml)
|
|
59
|
+
[](https://doi.org/10.1101/2024.06.29.601349)
|
|
60
|
+
|
|
61
|
+
**Multiplexed imaging** technologies offer valuable insights into intricate tissue structures, yet they pose significant computational hurdles. These include cumbersome data handoffs, inefficiencies in processing large images (often ranging from 8 to 40 gigabytes per image), and limited spatial analysis capabilities. We created **SPACEc, an all-in-one, scalable Python platform that advances both analytical capabilities and computational efficiency.** Through careful engineering optimization, it streamlines the entire process from image extraction and cell segmentation to data preprocessing, while introducing novel approaches such as Patch Proximity Analysis for mapping cellular microenvironments to fill in the current analytic gaps. The platform significantly improves the performance of existing tools through parallelization and GPU acceleration, including enhanced cell-cell interaction analysis and simplified deep-learning annotation workflows, while its intuitive user-friendly design makes these advanced spatial analyses accessible to a wider scientific audience.
|
|
62
|
+
|
|
63
|
+
## General outline of SPACEc analysis
|
|
64
|
+
|
|
65
|
+

|
|
66
|
+
|
|
67
|
+
## Installation notes
|
|
68
|
+
|
|
69
|
+
**Note**: We currently support Python==`3.9` and `3.10`.
|
|
70
|
+
* The **example tonsil data** is available on [dryad](https://datadryad.org/stash/share/OXTHu8fAybiINGD1S3tIVUIcUiG4nOsjjeWmrvJV-dQ)
|
|
71
|
+
|
|
72
|
+
### Install
|
|
73
|
+
|
|
74
|
+
<details><summary>Linux</summary>
|
|
75
|
+
|
|
76
|
+
SPACEc CPU
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Create conda environment
|
|
80
|
+
conda create -n spacec python==3.10
|
|
81
|
+
conda activate spacec
|
|
82
|
+
|
|
83
|
+
# Install dependencies via conda.
|
|
84
|
+
conda install -c conda-forge graphviz libvips openslide
|
|
85
|
+
|
|
86
|
+
# Install spacec
|
|
87
|
+
pip install spacec
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
#### Continue the following steps only if you have GPU(s)
|
|
91
|
+
|
|
92
|
+
SPACEc GPU
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Set environment variables
|
|
96
|
+
conda install conda-forge::cudatoolkit=11.2.2 cudnn=8.1.0.77 -y
|
|
97
|
+
# Set environment variables for the conda environment
|
|
98
|
+
mkdir -p $CONDA_PREFIX/etc/conda/activate.d && \
|
|
99
|
+
echo -e 'export PATH=$CONDA_PREFIX/bin:$PATH\nexport LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$LD_LIBRARY_PATH' > $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh && \
|
|
100
|
+
chmod +x $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
|
|
101
|
+
|
|
102
|
+
# Ensure package compatibility
|
|
103
|
+
# Note: Ignore dependency issues for now (seaborn)!
|
|
104
|
+
pip install protobuf==3.19.6 tensorflow-gpu==2.8.0 # numpy==1.24
|
|
105
|
+
|
|
106
|
+
# If Pytorch does not find the GPU try:
|
|
107
|
+
# pip install torch==1.12.0+cu113 torchvision==0.13.0+cu113 torchaudio==0.12.0 --extra-index-url https://download.pytorch.org/whl/cu113
|
|
108
|
+
|
|
109
|
+
# restart the environment to reload PATH variable
|
|
110
|
+
conda deactivate
|
|
111
|
+
conda activate spacec
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
1. For GPU-accelerated clustering via RAPIDS, note that only RTX20XX or better GPUs are supported (optional).
|
|
115
|
+
```bash
|
|
116
|
+
conda install -c rapidsai -c conda-forge -c nvidia rapids=24.02
|
|
117
|
+
pip install rapids-singlecell==0.9.5 pandas==1.5
|
|
118
|
+
pip install --ignore-installed networkx==3.2
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
2. To run STELLAR (optional).
|
|
122
|
+
```bash
|
|
123
|
+
# more information please refer to https://pytorch-geometric.readthedocs.io/en/2.1.0/notes/installation.html
|
|
124
|
+
pip install torch==1.12.0+cu113 torchvision==0.13.0+cu113 torchaudio==0.12.0 --extra-index-url https://download.pytorch.org/whl/cu113
|
|
125
|
+
pip install torch-scatter==2.1.0 torch-sparse==0.6.16 torch-cluster==1.6.0 torch-spline-conv==1.2.1 torch-geometric==2.2.0 -f https://data.pyg.org/whl/torch-1.12.0+cu113.html
|
|
126
|
+
# conda install pyvips # if you get the error "OSError: cannot load library 'libvips.so.42'"
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
<!-- Martin: I don't think this is required. -->
|
|
130
|
+
3. Reinstall SPACEc to be compatible with the GPU setting
|
|
131
|
+
```bash
|
|
132
|
+
# Install spacec
|
|
133
|
+
pip install spacec
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
4. Test if SPACEc loads and if your GPU is visible if you installed the GPU version. In Python:
|
|
137
|
+
```python
|
|
138
|
+
import spacec as sp
|
|
139
|
+
sp.hf.check_for_gpu()
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
* ⚠️ **IMPORTANT**: always import `spacec` first before importing any other packages
|
|
143
|
+
|
|
144
|
+
</details>
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
<details><summary>Apple M1/M2/M3/M4</summary>
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
SPACEc CPU:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
conda create -n spacec
|
|
154
|
+
conda activate spacec
|
|
155
|
+
|
|
156
|
+
# Install Python via conda
|
|
157
|
+
conda install python==3.10
|
|
158
|
+
|
|
159
|
+
# Install dependencies via conda.
|
|
160
|
+
conda install -c conda-forge graphviz libvips openslide
|
|
161
|
+
# conda install -c conda-forge pyvips # only required for Python 3.9
|
|
162
|
+
|
|
163
|
+
# Install spacec
|
|
164
|
+
pip install spacec
|
|
165
|
+
|
|
166
|
+
# Install remaining requirements for deepcell
|
|
167
|
+
# NOTE: Ignore the error about pip's dependency resolver
|
|
168
|
+
pip install -r https://raw.githubusercontent.com/nolanlab/SPACEc/master/requirements-deepcell-mac-arm64_tf210-metal.txt
|
|
169
|
+
pip install deepcell --no-deps
|
|
170
|
+
```
|
|
171
|
+
SPACEc GPU: Mac GPU support is currently only supported for Tensorflow based methods not PyTorch, we recommend you use Linux system for full GPU acceleration.
|
|
172
|
+
|
|
173
|
+
* ⚠️ **IMPORTANT**: always import `spacec` first before importing any other packages
|
|
174
|
+
</details>
|
|
175
|
+
|
|
176
|
+
<details><summary>Windows</summary>
|
|
177
|
+
|
|
178
|
+
Although SPACEc can run directly on Windows systems, we highly recommend running it in WSL. If you are unfamiliar with WSL, you can find more information on how to use and install it here: https://learn.microsoft.com/en-us/windows/wsl/install If you decide to use WSL, follow the Linux instructions.
|
|
179
|
+
|
|
180
|
+
If you plan to continue with the native Windows environment
|
|
181
|
+
1. One of the segmentation tools within SPACEc neeeds a C++ compiler. If your environment doesn't have it already, the easiest way is to:
|
|
182
|
+
1. Download the community version of Visual Studio from the official Microsoft website: [https://visualstudio.microsoft.com](https://visualstudio.microsoft.com/). After installing the software on your system, select the following options to install the components needed for C++ development (see screenshots)
|
|
183
|
+
|
|
184
|
+

|
|
185
|
+
|
|
186
|
+

|
|
187
|
+
|
|
188
|
+
2. In the meantime, you can already install libvips ([https://www.libvips.org/](https://www.libvips.org/)) by downloading the pre-compiled Windows binaries from this repository: https://github.com/libvips/build-win64-mxe/releases/tag/v8.16.0 and adding them to your PATH. If you are unsure about which version to choose, [vips-dev-w64-all-8.16.0.zip](https://github.com/libvips/build-win64-mxe/releases/download/v8.16.0/vips-dev-w64-all-8.16.0.zip) should work for you.
|
|
189
|
+
3. Unpack the zip file and add the directory to your PATH environment. If you don’t know how to do that, consider watching this tutorial video that explains the process: [https://www.youtube.com/watch?v=O5iBsdAd1_w](https://www.youtube.com/watch?v=O5iBsdAd1_w)
|
|
190
|
+
|
|
191
|
+
SPACEc CPU:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
# Create conda environment
|
|
195
|
+
conda create -n spacec python==3.10
|
|
196
|
+
conda activate spacec
|
|
197
|
+
|
|
198
|
+
# Install dependencies via conda.
|
|
199
|
+
conda install -c conda-forge graphviz
|
|
200
|
+
|
|
201
|
+
# Install spacec
|
|
202
|
+
pip install spacec
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
SPACEc GPU:
|
|
206
|
+
```bash
|
|
207
|
+
conda install conda-forge::cudatoolkit=11.2.2 cudnn=8.1.0.77 -y
|
|
208
|
+
|
|
209
|
+
mkdir %CONDA_PREFIX%\etc\conda\activate.d && (
|
|
210
|
+
echo @echo off > %CONDA_PREFIX%\etc\conda\activate.d\env_vars.bat
|
|
211
|
+
echo set PATH=%CONDA_PREFIX%\bin;%PATH% >> %CONDA_PREFIX%\etc\conda\activate.d\env_vars.bat
|
|
212
|
+
echo set LD_LIBRARY_PATH=%CONDA_PREFIX%\lib;%LD_LIBRARY_PATH% >> %CONDA_PREFIX%\etc\conda\activate.d\env_vars.bat
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
# If Pytorch does not find the GPU try:
|
|
216
|
+
# pip install torch==1.12.0+cu113 torchvision==0.13.0+cu113 torchaudio==0.12.0 --extra-index-url https://download.pytorch.org/whl/cu113
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Reinstall SPACEc to be compatible with the GPU setting
|
|
220
|
+
```bash
|
|
221
|
+
# Install spacec
|
|
222
|
+
pip install spacec
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Test if SPACEc loads and if your GPU is visible if you installed the GPU version.
|
|
226
|
+
```python
|
|
227
|
+
import spacec as sp
|
|
228
|
+
sp.hf.check_for_gpu()
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
* ⚠️ **IMPORTANT**: always import `spacec` first before importing any other packages
|
|
232
|
+
</details>
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
<details><summary>Docker</summary>
|
|
236
|
+
If you encounter installation issues or prefer a containerized setup, use the SPACEc Docker image: https://hub.docker.com/r/tkempchen/spacec. You can also build or modify it using the repository's Dockerfiles.
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
# Run CPU version:
|
|
240
|
+
docker pull tkempchen/spacec:cpu
|
|
241
|
+
docker run -p 8888:8888 -p 5100:5100 tkempchen/spacec:cpu
|
|
242
|
+
|
|
243
|
+
# Run CPU version on Mac with M chip:
|
|
244
|
+
docker pull tkempchen/spacec:cpu
|
|
245
|
+
docker run --platform linux/amd64 -p 8888:8888 -p 5100:5100 tkempchen/spacec:cpu
|
|
246
|
+
|
|
247
|
+
# Or run GPU version:
|
|
248
|
+
docker pull tkempchen/spacec:gpu
|
|
249
|
+
docker run --gpus all -p 8888:8888 -p 5100:5100 tkempchen/spacec:gpu
|
|
250
|
+
```
|
|
251
|
+
</details>
|