Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
170 commits
Select commit Hold shift + click to select a range
994bac4
feat(qc-metrics): add common single cell quality control metrics
abombin Jun 20, 2025
59675ca
style(qc-metrics): fix spelling typo in nFeature metric
abombin Jun 20, 2025
7bf4043
Update src/spac/transformations.py
abombin Jun 20, 2025
0cf530b
fix(check_layer): use check_table spac function to evaluate if adata.…
abombin Jun 23, 2025
6727226
Merge pull request #352 from FNLCR-DMAP/add-sc-qc-metrics
georgezakinih Jun 24, 2025
a228e5e
feat(qc_summary_statistics): add summary statistics table for sc/spat…
abombin Jul 3, 2025
5e03dc2
refactor(get_qc_summary_table): adjust code style to adhere to spac g…
abombin Jul 11, 2025
239f981
Update src/spac/utils.py
abombin Jul 11, 2025
df46aca
make sure that compute_summary_qc_stats has a default input for stat_…
abombin Jul 11, 2025
d5061c4
refactor(get_qc_summary_table): refactor quality control summary stat…
abombin Jul 15, 2025
39a3b45
Merge pull request #353 from FNLCR-DMAP/add_sc_qc_summary
fangliu117 Jul 16, 2025
b960684
feat(template_utils): add template_utils and unit tests
fangliu117 Jul 24, 2025
c889259
feat(ripley_l_template): add ripley_l_template and unit tests
fangliu117 Jul 24, 2025
48608e2
feat(visualize_ripley_template): add visualize_ripley_template and un…
fangliu117 Jul 24, 2025
d291385
Merge branch 'refactor/ripley-l-template' into refactor/visualize-rip…
fangliu117 Jul 24, 2025
ff9238c
fix(visualize_ripley): add missing __init__.py for templates module
fangliu117 Jul 24, 2025
0e2747e
fix(visualize_ripley): make plt.show() conditional based on show_plot…
fangliu117 Jul 24, 2025
cf61b8d
Merge pull request #358 from FNLCR-DMAP/refactor/visualize-ripley-tem…
fangliu117 Jul 24, 2025
7b7e6cb
fix: add missing __init__.py in tests/templates
fangliu117 Jul 24, 2025
e9f0883
fix(template_utils): address review comments
fangliu117 Jul 24, 2025
c94b219
fix(template_utils): address review comments again
fangliu117 Jul 24, 2025
bc9c105
Merge pull request #359 from FNLCR-DMAP/refactor/template-utils
fangliu117 Jul 24, 2025
9914716
fix(ripley_template): address review comments - replace debug prints …
fangliu117 Jul 24, 2025
3086ce2
Merge remote-tracking branch 'origin/dev' into refactor/ripley-l-temp…
fangliu117 Jul 25, 2025
415df89
fix(ripley_template): address review comments - merge dev into the br…
fangliu117 Jul 25, 2025
2e83f0c
Merge pull request #360 from FNLCR-DMAP/refactor/ripley-l-template
fangliu117 Jul 25, 2025
5456658
feat(load_csv): Add load_csv template function with configuration sup…
fangliu117 Jul 27, 2025
bbfa2f6
fix(template_utils): Use applymap instead of map for pandas compatibi…
fangliu117 Jul 28, 2025
1cfb39e
feat(setup_analysis_template): add setup_analysis_template function a…
fangliu117 Jul 28, 2025
dddc33a
fix(setup_analysis_template): fix setup_analysis_template function
fangliu117 Jul 28, 2025
10dc7c7
Merge pull request #362 from FNLCR-DMAP/template_setup_analysis
fangliu117 Jul 28, 2025
28dc23f
Merge pull request #361 from FNLCR-DMAP/template_load_csv
fangliu117 Jul 28, 2025
eb810ab
feat(boxplot_template): add boxplot_template function and unit tests
fangliu117 Jul 28, 2025
cd5abd0
fix(boxplot_template): address minor comments from copilot
fangliu117 Jul 29, 2025
f0d5e29
Merge pull request #363 from FNLCR-DMAP/template_boxplot
fangliu117 Jul 29, 2025
3380427
feat(histogram_template): add histogram_template and unit tests
fangliu117 Jul 31, 2025
51ba1c4
fix(histogram_template): fix odd number of cells in test
fangliu117 Jul 31, 2025
a336044
Merge pull request #364 from FNLCR-DMAP/template_histogram
fangliu117 Jul 31, 2025
0f26c08
feat(spatial_plot_temp): add spatial_plot_template.py and unit tests
fangliu117 Aug 2, 2025
028a049
fix(spatial_plot_temp): addrss copilot comments spatial_plot_template.py
fangliu117 Aug 2, 2025
09362ac
Merge pull request #365 from FNLCR-DMAP/template_spatial_plot
fangliu117 Aug 2, 2025
ff6cce4
feat(arcsinh_normalization_template): add arcsinh_normalization_templ…
fangliu117 Aug 2, 2025
afca7ff
fix(test_arcsinh_normalization_template): Handle odd numbers with bet…
fangliu117 Aug 2, 2025
78cc5a9
Merge pull request #366 from FNLCR-DMAP/template_arcsinh_normalization
fangliu117 Aug 2, 2025
b2d68c5
feat(zscore_normalization_template): add zscore_normalization_templat…
fangliu117 Aug 2, 2025
8d134c8
Merge pull request #367 from FNLCR-DMAP/template_zscore_normalization
fangliu117 Aug 2, 2025
06d8feb
feat(summarize_dataframe_template): add summarize_dataframe_template …
fangliu117 Aug 2, 2025
30118f9
fix(summarize_dataframe_template): address comments from copilot
fangliu117 Aug 2, 2025
d542f1a
Merge pull request #368 from FNLCR-DMAP/template_summarize_dataframe
fangliu117 Aug 2, 2025
829a4bd
feat(combine_annotations_template): add combine_annotations_template …
fangliu117 Aug 2, 2025
9d8582a
fix(combine_annotations_template): address comments from copilot CR f…
fangliu117 Aug 2, 2025
709ceed
Merge pull request #369 from FNLCR-DMAP/template_combine_annotations
fangliu117 Aug 2, 2025
941d641
feat(manual_phenotyping_template): add manual_phenotyping_template fu…
fangliu117 Aug 2, 2025
e4d61cf
fix(test_manual_phenotyping_temp): address comments of copilot review…
fangliu117 Aug 2, 2025
6f19ae2
Merge pull request #370 from FNLCR-DMAP/template_manual_phenotyping
fangliu117 Aug 2, 2025
67e5a80
feat(hierarchical_heatmap_template): add hierarchical_heatmap_templat…
fangliu117 Aug 2, 2025
6466e2f
feat(hierarchical_heatmap_template): add hierarchical_heatmap_templat…
fangliu117 Aug 2, 2025
2ad5a86
Merge pull request #371 from FNLCR-DMAP/template_hierarchical_heatmap
fangliu117 Aug 2, 2025
743fb10
feat(utag_clustering_template): add utag_clustering_template and unit…
fangliu117 Aug 2, 2025
6da3985
feat(utag_clustering_template): add utag_clustering_template and unit…
fangliu117 Aug 2, 2025
c616fdb
Merge pull request #372 from FNLCR-DMAP/template_utag_clustering
fangliu117 Aug 2, 2025
e79fd78
feat(umap_transformation_template): add umap_transformation_template …
fangliu117 Aug 2, 2025
9d24638
fix(umap_transformation_template): return adata in place and fix comm…
fangliu117 Aug 2, 2025
6906ec0
Merge pull request #373 from FNLCR-DMAP/template_umap_transformation
fangliu117 Aug 2, 2025
ca29330
feat(phenograph_clustering_template): add phenograph_clustering_templ…
fangliu117 Aug 3, 2025
92d77a5
Merge pull request #374 from FNLCR-DMAP/template_phenograph_clustering
fangliu117 Aug 3, 2025
d67f6c7
feat(umap_tsne_pca_template): add umap_tsne_pca_template function and…
fangliu117 Aug 3, 2025
7fb9b2c
fix(umap_tsne_pca_template): address the comments from copilot
fangliu117 Aug 3, 2025
6d25262
Merge pull request #375 from FNLCR-DMAP/template_umap_tsne_pca
fangliu117 Aug 3, 2025
96446d7
feat(rename_labels_template): add rename_labels_template function and…
fangliu117 Aug 3, 2025
47f028d
Merge pull request #376 from FNLCR-DMAP/template_rename_labels
fangliu117 Aug 3, 2025
c57075d
feat(relational_heatmap_template): add relational_heatmap_template fu…
fangliu117 Aug 3, 2025
5662bdb
fix(relational_heatmap_template): address the issue of insecure tempo…
fangliu117 Aug 3, 2025
369c6ee
Merge pull request #377 from FNLCR-DMAP/template_relational_heatmap
fangliu117 Aug 3, 2025
34b4eee
feat(sankey_plot_template): add sankey_plot_template function and uni…
fangliu117 Aug 3, 2025
07baeb9
fix(sankey_plot_template): address the comments from copilot
fangliu117 Aug 3, 2025
f3e5864
Merge pull request #378 from FNLCR-DMAP/template_sankey_plot
fangliu117 Aug 3, 2025
824d131
feat(neighborhood_profile_template): add neighborhood_profile_templat…
fangliu117 Aug 3, 2025
5e9d65c
Merge pull request #379 from FNLCR-DMAP/template_neighborhood_profile
fangliu117 Aug 3, 2025
448a980
feat(analysis_to_csv_template): add analysis_to_csv_template function…
fangliu117 Aug 3, 2025
d1c33ba
Merge pull request #380 from FNLCR-DMAP/template_analysis_to_csv
fangliu117 Aug 3, 2025
34961bd
feat(summarize_annotation_statistics): add summarize_annotation_stati…
fangliu117 Aug 3, 2025
fdeba79
Merge pull request #381 from FNLCR-DMAP/template_summarize_annotation…
fangliu117 Aug 3, 2025
3f4336b
feat(interactive_spatial_plot_template): add interactive_spatial_plot…
fangliu117 Aug 3, 2025
64ff302
fix(interactive_spatial_plot_template): remove nidap comments
fangliu117 Aug 3, 2025
704700a
Merge pull request #382 from FNLCR-DMAP/template_interactive_spatial_…
fangliu117 Aug 3, 2025
a7b1349
feat(spatial_interaction_template): add spatial_interaction_template …
fangliu117 Aug 4, 2025
1a3d03d
fix(spatial_interaction_template): fix typo
fangliu117 Aug 4, 2025
7354b98
Merge pull request #383 from FNLCR-DMAP/template_spatial_interaction
fangliu117 Aug 4, 2025
19cd477
feat(nearest_neighbor_calculation_template): add nearest_neighbor_cal…
fangliu117 Aug 4, 2025
81393d9
Merge pull request #384 from FNLCR-DMAP/template_nearest_neighbor_cal…
fangliu117 Aug 4, 2025
07ecdfa
feat(visualize_nearest_neighbor_template): add visualize_nearest_neig…
fangliu117 Aug 4, 2025
52a4ee6
fix(visualize_nearest_neighbor_template): fix typo
fangliu117 Aug 4, 2025
f1c7eaf
Merge pull request #385 from FNLCR-DMAP/template_visualize_nearest_ne…
fangliu117 Aug 4, 2025
6ab7a9d
feat(template_utils): add string_list_to_dictionary to template utils
fangliu117 Aug 4, 2025
d70bb9d
Merge pull request #386 from FNLCR-DMAP/template_utils
fangliu117 Aug 4, 2025
2477266
feat(add_pin_color_rule_template): add add_pin_color_rule_template fn…
fangliu117 Aug 4, 2025
1fc839e
Merge pull request #387 from FNLCR-DMAP/template_add_pin_color_rule
fangliu117 Aug 4, 2025
5e68e02
feat(append_annotation_template): add append_annotation_template func…
fangliu117 Aug 4, 2025
19543a7
Merge pull request #388 from FNLCR-DMAP/template_append_annotation
fangliu117 Aug 4, 2025
8e500ec
feat(binary_to_categorical_annotation_template): add binary_to_catego…
fangliu117 Aug 4, 2025
db94a32
Merge pull request #389 from FNLCR-DMAP/template_binary_to_categorica…
fangliu117 Aug 4, 2025
4fea9c3
feat(calculate_centroid_template): add calculate_centroid_template fu…
fangliu117 Aug 4, 2025
13d42ec
Merge pull request #390 from FNLCR-DMAP/template_calculate_centroid
fangliu117 Aug 4, 2025
e59c994
feat(select_values_template): add select_values_template function and…
fangliu117 Aug 4, 2025
74ea36f
Merge pull request #391 from FNLCR-DMAP/template_select_values
fangliu117 Aug 4, 2025
cedb6d1
fix(select_values_template): fix pandas/numpy version compatibility i…
fangliu117 Aug 4, 2025
c11f641
Merge pull request #392 from FNLCR-DMAP/template_select_values
fangliu117 Aug 4, 2025
47adf3e
feat(downsample_cells_template): add downsample_cells_template functi…
fangliu117 Aug 4, 2025
71dc3d6
Merge pull request #393 from FNLCR-DMAP/template_downsample_cells
fangliu117 Aug 4, 2025
3e24237
feat(combine_dataframes_template): add combine_dataframes_template fu…
fangliu117 Aug 4, 2025
85805e1
Merge pull request #394 from FNLCR-DMAP/template_combine_dataframes
fangliu117 Aug 4, 2025
1db00a8
feat(subset_analysis_template): add subset_analysis_template function…
fangliu117 Aug 4, 2025
aefcb29
fix(subset_analysis_template): fix typo and enhance function
fangliu117 Aug 4, 2025
8509999
Merge pull request #395 from FNLCR-DMAP/template_subset_analysis
fangliu117 Aug 4, 2025
542f985
feat(quantile_scaling_template): refactor nidap code, add quantile_sc…
fangliu117 Aug 4, 2025
de6ee91
fix(quantile_scaling_template): fix typo in both function and unit tests
fangliu117 Aug 4, 2025
1a3a563
Merge pull request #396 from FNLCR-DMAP/template_quantile_scaling
fangliu117 Aug 4, 2025
a71e865
feat(normalize_batch_template): add normalize_batch_template function…
fangliu117 Aug 4, 2025
9edf8ce
fix(normalize_batch_template): fix typo and unused import
fangliu117 Aug 4, 2025
525d749
Merge pull request #397 from FNLCR-DMAP/template_normalize_batch
fangliu117 Aug 4, 2025
abda610
feat(tsne_analysis_template): add tsne_analysis_template function and…
fangliu117 Aug 4, 2025
7ae8e57
fix(tsne_analysis_template): fixed typo
fangliu117 Aug 4, 2025
45dbd24
Merge pull request #398 from FNLCR-DMAP/template_tSNE_analysis
fangliu117 Aug 4, 2025
bbb53f7
feat(posit_it_python_template): add posit_it_python_template function…
fangliu117 Aug 4, 2025
e70f547
fix(posit_it_python_template): fixed typo
fangliu117 Aug 4, 2025
06cfc59
Merge pull request #399 from FNLCR-DMAP/template_posit_it_python
fangliu117 Aug 4, 2025
9e3bea0
feat: Add SPAC boxplot Galaxy tool for Docker deployment
fangliu117 Oct 1, 2025
fc641b4
Merge pull request #400 from FNLCR-DMAP/galaxy_tools
fangliu117 Oct 1, 2025
67e3ec4
feat: add spac arcsinh_norm interactive_spatial_plot galaxy tools
fangliu117 Oct 2, 2025
d2526a7
feat: add spac_load_csv_files galaxy tools
fangliu117 Oct 2, 2025
4717bca
Merge pull request #401 from FNLCR-DMAP/galaxy_tools
fangliu117 Oct 2, 2025
bb6834b
feat: add spac_setup_analysis galaxy tools
fangliu117 Oct 2, 2025
c87e782
fix: spac_boxplot outputs in json and validated ha5d
fangliu117 Oct 2, 2025
b4c1856
Merge pull request #402 from FNLCR-DMAP/galaxy_tools
fangliu117 Oct 2, 2025
cbbcd9e
feat: add spac_zscore_normalization galaxy tools
fangliu117 Oct 3, 2025
6e51811
Merge pull request #403 from FNLCR-DMAP/galaxy_tools
fangliu117 Oct 3, 2025
009d010
refactor: streamline galaxy tools implementation
fangliu117 Oct 8, 2025
49a6479
Merge pull request #405 from FNLCR-DMAP/galaxy_tools_v2
fangliu117 Oct 8, 2025
196f511
init benchmark script
Ahmad8864 Oct 16, 2025
4d2e3d7
feat: add refactored galaxy tools
fangliu117 Oct 17, 2025
4906439
fix(boxplot): replace deprecated append call with concat
Ahmad8864 Oct 19, 2025
862e523
feat(test_performance): add performance tests for boxplot/histogram
Ahmad8864 Oct 19, 2025
c0762c3
fix(scripts): remove old performance testing script
Ahmad8864 Oct 19, 2025
c31c3ff
fix(performance_test): fix the speedup calculation logic
Ahmad8864 Oct 20, 2025
284c596
Merge pull request #407 from FNLCR-DMAP/galaxy_tools_v3
fangliu117 Oct 21, 2025
179482e
fix(histogram_performance): add clarifying comment for old hist imple…
Ahmad8864 Oct 21, 2025
9187e8d
Merge pull request #408 from Ahmad8864/benchmark-script
georgezakinih Oct 21, 2025
4e083fb
fix(nearest_neighbor_template): Break the title in two lines
georgezakinih Oct 30, 2025
fc664ad
test(perforamnce): skip performance tests by default
georgezakinih Oct 30, 2025
9c4d606
fix(test_performance): set the path to include spac
georgezakinih Oct 30, 2025
c2a2488
Merge pull request #409 from FNLCR-DMAP/nearest_neighbor_title
georgezakinih Nov 3, 2025
2232474
Merge reviewer comments: paper examples, paper.bib, paper.md, test sc…
fangliu117 Nov 30, 2025
9ae3ef3
refactor: Merge paper.bib and paper.md updates from address-reviewer-…
fangliu117 Dec 8, 2025
5287382
Update README with SPAC ecosystem details
fangliu117 Dec 10, 2025
d704626
Enhance README with SPAC ecosystem table
fangliu117 Dec 10, 2025
8747058
Update paper.md and replace figure.tif with figure.pptx
fangliu117 Dec 12, 2025
a2b4a9d
Update setup.py and environment.yml from refactor_template_outputs
fangliu117 Dec 12, 2025
b431afc
Update figure.pptx
fangliu117 Dec 12, 2025
e669d13
Add figure.pdf
fangliu117 Dec 12, 2025
a2f25ff
Fix capitalization of 'SPAC' in README.md
fangliu117 Dec 16, 2025
310e0a3
Update paper.md (add ORCIDs, fix EDA text) and replace figure files w…
fangliu117 Dec 17, 2025
09303c5
Update figure to PNG format for better compatibility
fangliu117 Dec 18, 2025
5933bb1
Update paper: add citations and standardize affiliations and bibliogr…
fangliu117 Jan 13, 2026
fda7302
Merge main into dev: restore Docker setup, paper resources, and main …
fangliu117 Jan 13, 2026
8005111
feat: refactor all templates and unit tests
fangliu117 Feb 27, 2026
7a5ec6d
fix: add missing 'import os' in performance tests
fangliu117 Feb 27, 2026
99f2de1
Merge pull request #415 from FNLCR-DMAP/templates-to-dev to dev
fangliu117 Feb 27, 2026
d0bbc5e
fix: Remove 6 deprecated templates (sync with tools_refactor)
fangliu117 Feb 27, 2026
93bfc70
Merge pull request #416 from FNLCR-DMAP/cleanup/remove-deprecated-tem…
fangliu117 Feb 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 114 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
FROM continuumio/miniconda3:24.3.0-0

# Build arguments
ARG ENV_NAME=spac

# Set labels
LABEL maintainer="FNLCR-DMAP"
LABEL description="SPAC - Single Cell Spatial Analysis Container"
LABEL version="0.9.0"

# Install system dependencies including Chromium for Kaleido (ARM64 compatible)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
git \
ca-certificates \
build-essential \
libgl1-mesa-glx \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
libglu1-mesa \
xvfb \
&& rm -rf /var/lib/apt/lists/*

# Install Chromium for Kaleido visualization support (ARM64 compatible)
RUN apt-get update && \
apt-get install -y chromium && \
rm -rf /var/lib/apt/lists/*

# Set Chrome binary path for Kaleido
ENV CHROME_BIN=/usr/bin/chromium

# Install and configure libmamba solver
RUN conda install -n base -y conda-libmamba-solver && \
conda config --set solver libmamba

# Simulate exactly what a reviewer would do following README.md instructions
WORKDIR /home/reviewer/SCSAWorkflow

# Step 1: Copy the repository files (simulating a reviewer's local setup)
COPY . .

# Step 2: Follow README.md instructions exactly
# "If conda is not activate" - conda activate (already active in base)

# Step 3: "Adding constumized scimap conda pacakge channel supported by DMAP"
RUN conda config --add channels https://fnlcr-dmap.github.io/scimap/ && \
conda config --add channels conda-forge && \
conda config --add channels ohsu-comp-bio && \
conda config --add channels leej3 && \
conda config --add channels bioconda

# Step 4: "Create the Conda environment from environment.yml"
# Set SSL verification to false for problematic channels
RUN conda config --set ssl_verify false && \
conda env create -f environment.yml && \
conda clean -afy && \
conda config --set ssl_verify true

# Step 5: Make the environment available (simulate "conda activate spac")
# Set all necessary environment variables for conda activation
ENV CONDA_DEFAULT_ENV=${ENV_NAME}
ENV CONDA_PREFIX=/opt/conda/envs/${ENV_NAME}
ENV PATH=/opt/conda/envs/${ENV_NAME}/bin:${PATH}
ENV PYTHONPATH=/opt/conda/envs/${ENV_NAME}/lib/python3.9/site-packages:${PYTHONPATH}

# Step 6: "Install the SPAC package in development mode"
RUN /opt/conda/envs/${ENV_NAME}/bin/pip install -e .

# Make conda activate spac environment automatically in bash shells
RUN echo "source /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
echo "conda activate ${ENV_NAME}" >> ~/.bashrc

# Create a wrapper script that ensures conda environment is activated
# This helps when Galaxy runs commands directly
RUN echo '#!/bin/bash' > /usr/local/bin/conda-run && \
echo 'source /opt/conda/etc/profile.d/conda.sh' >> /usr/local/bin/conda-run && \
echo 'conda activate spac' >> /usr/local/bin/conda-run && \
echo 'exec "$@"' >> /usr/local/bin/conda-run && \
chmod +x /usr/local/bin/conda-run

# Set the shell to use bash for RUN commands
SHELL ["/bin/bash", "-c"]

# Set environment variables for headless notebook execution
ENV QT_QPA_PLATFORM=offscreen
ENV MPLBACKEND=Agg

# Create working directories for volume mapping
RUN mkdir -p /workspace /data /results

# Install jupyter and nbconvert for notebook testing
RUN /opt/conda/envs/${ENV_NAME}/bin/pip install jupyter nbconvert

# Verify SPAC installation works correctly in multiple ways
RUN echo "=== VERIFYING SPAC INSTALLATION ===" && \
echo "Test 1: Direct python call" && \
python -c "import spac; print(f'SPAC version: {spac.__version__}')" && \
echo "Test 2: Which python" && \
which python && \
echo "Test 3: Python path" && \
python -c "import sys; print(sys.executable)" && \
echo "Test 4: Import scimap" && \
python -c "import scimap; print('scimap imported successfully')" && \
echo "=== ALL TESTS PASSED ===" || \
echo "Some import issues detected but proceeding"

# Set working directory for Jupyter (will be mounted via volume)
WORKDIR /workspace

# Default command starts Jupyter notebook server
CMD ["/opt/conda/envs/spac/bin/jupyter", "notebook", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root", "--NotebookApp.token=", "--NotebookApp.password="]
87 changes: 87 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
.PHONY: help build run dev stop clean rebuild test

# Default target
help:
@echo "SPAC Docker Management"
@echo "======================"
@echo ""
@echo "Production targets:"
@echo " make build - Build production Docker image"
@echo " make run - Run production container with Jupyter"
@echo " make test - Run tests in production container"
@echo ""
@echo "Development targets:"
@echo " make dev - Start development environment with live code mounting"
@echo " make dev-bash - Start development container with bash shell"
@echo " make dev-test - Run tests in development mode"
@echo ""
@echo "Utility targets:"
@echo " make stop - Stop all running containers"
@echo " make clean - Remove containers and images"
@echo " make rebuild - Clean and rebuild production image"
@echo " make logs - Show container logs"

# Production build
build:
@echo "Building production Docker image..."
docker build -t spac:latest .

# Run production container
run:
@echo "Starting production container with Jupyter..."
docker run -d \
--name spac-prod \
-p 8888:8888 \
-v $(PWD)/data:/data \
-v $(PWD)/results:/results \
spac:latest
@echo "Jupyter available at http://localhost:8888"

# Development environment with live code mounting
dev:
@echo "Starting development environment with live code mounting..."
docker-compose -f docker/docker-compose.dev.yml up -d
@echo "Development Jupyter available at http://localhost:8889"
@echo "Source code is mounted - changes will be reflected immediately!"

# Development with bash shell
dev-bash:
@echo "Starting development container with bash shell..."
docker-compose -f docker/docker-compose.dev.yml run --rm --service-ports spac-dev bash

# Run tests in development mode
dev-test:
@echo "Running tests in development mode..."
docker-compose -f docker/docker-compose.dev.yml run --rm spac-dev \
/opt/conda/envs/spac/bin/pytest tests/ -v

# Run tests in production container
test:
@echo "Running tests in production container..."
docker run --rm spac:latest \
/opt/conda/envs/spac/bin/pytest tests/ -v

# Stop all containers
stop:
@echo "Stopping containers..."
-docker stop spac-prod 2>/dev/null || true
-docker-compose -f docker/docker-compose.dev.yml down 2>/dev/null || true

# Clean up containers and images
clean: stop
@echo "Cleaning up containers and images..."
-docker rm spac-prod 2>/dev/null || true
-docker rmi spac:latest 2>/dev/null || true
-docker-compose -f docker/docker-compose.dev.yml down -v 2>/dev/null || true

# Rebuild from scratch
rebuild: clean build
@echo "Rebuild complete!"

# Show logs
logs:
@echo "=== Production logs ==="
-docker logs spac-prod 2>/dev/null || echo "No production container running"
@echo ""
@echo "=== Development logs ==="
-docker-compose -f docker/docker-compose.dev.yml logs 2>/dev/null || echo "No development container running"
133 changes: 130 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
# Analysis of SPAtial Single Cell Datasets (SPAC)
# SPAC: Analysis of SPAtial Single Cell Datasets

SPAC is a scalable, automated pipeline, under the Single Cell Spatial Analysis Workflow (SCSAWorkflow) project aiming at analyzing single-cell spatial protein data of multiplexed whole-slide tissue images generated from technologies such as MxIF Codex and Imaging Mass Cytometry (IMC).
This Python-based package leverages the anndata framework for easy integration with other single-cell toolkits. It includes a multitude of functional and visualization modules, test utilities, and is capable of running in user-friendly web interfaces. Spac offers insights into cell interactions within various environments, aiding in studies of the cancer microenvironment, stem cell niches, and drug response effects etc.
This Python-based package leverages the anndata framework for easy integration with other single-cell toolkits. It includes a multitude of functional and visualization modules, test utilities, and is capable of running in user-friendly web interfaces. SPAC offers insights into cell interactions within various environments, aiding in studies of the cancer microenvironment, stem cell niches, and drug response effects etc.

This repository is the official home of the SPAC Python package, part of the broader SPAC ecosystem for single-cell spatial analysis.

## SPAC Ecosystem

| Component | Description | Repository |
|-----------|-------------|------------|
| **SPAC Python Package** | Core analysis library | This repository |
| **SPAC Shiny** | Interactive web application | [FNLCR-DMAP/SPAC_Shiny](https://github.com/FNLCR-DMAP/SPAC_Shiny) |

## Installing SPAC with Conda
Run the following command to establish the Conda environment supporting usage and contribution to spac package:
Latest released version is v0.9.0 at 5/23/2025
```bash
cd <home directory of SCSAWorkflow folder>
git checkout address-reviewer-comments

# If conda is not activate
conda activate

Expand All @@ -19,8 +30,11 @@ conda env create -f environment.yml

# Once environment is established
conda activate spac

# Install the SPAC package in development mode
pip install -e .
```
The envrionment works for Linux and noarc, if your are working on amd processor (commonly seen for latest Mac users), please replace the ` - numpy=1.19.5` with `numpy>=1.19.5,<2.0.0`
The envrionment works for Linux and noarc, if your are working on amd processor (commonly seen for latest Mac users), please replace the ` - numpy=1.26.4` with `numpy>=1.26.4,<2.0.0`, and remove the `- scimap=2.1.3_dmap_pandas153` but add pip `- scimap`

If error occurs suggesting SSL certificate not found for our scimap channel, please run the following command before the environment creation:
```
Expand All @@ -31,6 +45,119 @@ Then set the verification to True after the installation:
conda config --set ssl_verify true
```

## Using SPAC with Docker

For a reproducible environment, you can use Docker to run SPAC.

**📘 For detailed Docker documentation including development mode with live code mounting, see [`docker/README.md`](docker/README.md)**

**Quick commands:**
- Production: `make build` → `make run`
- Development: `make dev` (changes to `src/` reflected immediately!)
- Help: `make help`

### Build the Docker Image
```bash
docker build -t spac .
```

### Run Jupyter Notebook Server with Your Data
Mount your working directory to access notebooks and data:
```bash
# Stop any existing containers using port 8888 (if needed)
docker stop $(docker ps -q --filter "publish=8888") 2>/dev/null || true

# From the project root directory
docker run --rm -p 8888:8888 -v $(pwd)/paper/examples:/workspace spac

# Or mount any directory containing your notebooks and data
docker run --rm -p 8888:8888 -v /path/to/your/data:/workspace spac
```

Then open your browser to: `http://localhost:8888`

### Test SPAC Installation
To validate that SPAC works correctly, run the notebook execution test:
```bash
# Navigate to the paper directory
cd paper

# Run the test script in Docker (mounts examples directory and test script)
docker run --rm -v $(pwd)/examples:/workspace -v $(pwd)/test_notebook_execution.sh:/test_script.sh spac bash /test_script.sh
```

This test will:
- ✅ Verify SPAC and scimap installation
- ✅ Execute the example lymphnode analysis notebook
- ✅ Create a timestamped output file (e.g., `lymphnode_analysis_executed_20231023_134803.ipynb`)
- 📓 Provide instructions for viewing results in Jupyter

### View Executed Notebooks
After running the test, you can view the executed notebook in Jupyter:
```bash
# Navigate to paper/examples directory
cd paper/examples

# Stop any existing containers using port 8888 (if needed)
docker stop $(docker ps -q --filter "publish=8888") 2>/dev/null || true

# Start Jupyter server with your data mounted
docker run --rm -p 8888:8888 -v $(pwd):/workspace spac
```

Then open your browser to: `http://localhost:8888` and navigate to the timestamped executed notebook file.

### Validate Performance Improvements
To verify the performance speedups implemented in SPAC:
```bash
# Navigate to the paper directory
cd paper

# Run the performance validation script in Docker (mounts current directory for results)
# Note: Ensure Docker has at least 16GB memory allocated for full validation
docker run --rm -v $(pwd):/workspace -v $(pwd)/test_performance_validation.sh:/test_script.sh spac bash /test_script.sh
```

This test will:
- ✅ Run boxplot performance benchmarks (up to 10M cells: `boxplot` vs `boxplot_interactive`)
- ✅ Run histogram performance benchmarks (up to 10M cells: `histogram_old` vs `histogram`)
- ✅ Generate detailed speedup analysis with concrete performance improvements
- 📊 Generate detailed speedup analysis and performance reports
- � Save results to your local `performance_results/` directory

Performance results are saved locally as timestamped files in `performance_results/`:
- `boxplot_performance_YYYYMMDD_HHMMSS.txt`
- `histogram_performance_YYYYMMDD_HHMMSS.txt`

### Interactive Shell Access
For debugging or manual exploration:
```bash
docker run --rm -it spac bash
```

### Mount Local Data
To work with your own data, mount a local directory:
```bash
# Stop any existing containers using port 8888 (if needed)
docker stop $(docker ps -q --filter "publish=8888") 2>/dev/null || true

# Mount your data directory
docker run --rm -p 8888:8888 -v /path/to/your/data:/data spac
```

### Docker Cleanup
If you need to clean up Docker resources:
```bash
# Stop all SPAC containers
docker stop $(docker ps -q --filter "ancestor=spac") 2>/dev/null || true

# Remove stopped containers (optional)
docker container prune -f

# Remove SPAC image (if you want to rebuild from scratch)
docker rmi spac
```

## Contirbuting to SPAC:
Review the [developer guide](CONTRIBUTING.md)

Expand Down
Loading