Skip to content

Visium HD integration - #41

Open
ch99l wants to merge 24 commits into
develfrom
visium-hd-clean
Open

Visium HD integration#41
ch99l wants to merge 24 commits into
develfrom
visium-hd-clean

Conversation

@ch99l

@ch99l ch99l commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a dedicated Visium HD execution path to the Nextflow pipeline, alongside a refactor of standard clustering/quantification modules to support both automated and “manual clustering” restarts. It also introduces separate bambu and seurat containers and expands smoke tests to cover the new workflows.

Changes:

  • Added a Visium HD workflow (--visium_hd) including bin aggregation, spot/bin mapping, optional Banksy clustering, and per-resolution quantification.
  • Refactored standard clustering + quantification into shared/standard/visium_hd module structure; renamed --resolution--seurat_resolution and EM_clustersclusteredEM.
  • Added --manual_clustering restart mode, updated docs/examples, and extended CI smoke tests + container build workflow.

Reviewed changes

Copilot reviewed 38 out of 60 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
subworkflows/prepare_input_visium_hd.nf New Visium HD input preparation subworkflow.
subworkflows/prepare_input_standard.nf Updated module include paths for standard input prep.
subworkflows/clustering.nf Removed legacy clustering subworkflow.
subworkflows/clustering_standard.nf New standard clustering subworkflow with updated inputs.
README.md Documented Visium HD + manual clustering + parameter renames.
nextflow.config Added Visium HD/manual params; renamed clustering params.
modules/seurat/visium_hd/clustering.nf New Seurat/Banksy clustering process for Visium HD.
modules/seurat/standard/single_sample_clustering.nf Refactored single-sample clustering to use count dirs + colData.
modules/seurat/standard/multi_sample_clustering.nf Refactored multi-sample clustering (Harmony integration) inputs.
modules/prepare_input/visium_hd/spot_bin_mappings.nf New process to produce spot→bin mapping CSVs.
modules/prepare_input/visium_hd/filter_barcoded_bam.nf New BAM filter process using in-tissue barcodes.
modules/prepare_input/visium_hd/convert_tissue_positions.nf New parquet→CSV conversion for tissue positions (+ barcodes).
modules/prepare_input/visium_hd/convert_barcode_mappings.nf New parquet→CSV conversion for barcode mappings per resolution.
modules/prepare_input/standard/extract_spatial_coordinates.nf New process extracting spatial coordinates for Visium chemistries.
modules/prepare_input/standard/extract_barcodes.nf New process extracting 10x barcode whitelist per chemistry.
modules/bambu/visium_hd/transcript_discovery.nf New transcript discovery for Visium HD at 2µm.
modules/bambu/visium_hd/spot_level_quantification.nf New per-resolution spot/bin-level EM quantification for Visium HD.
modules/bambu/visium_hd/map_clusters_to_2um_spots.nf New mapping of bin clusters down to 2µm spots.
modules/bambu/visium_hd/extract_spot_barcodes.nf New helper to extract 2µm barcodes + sample name from quantData.
modules/bambu/visium_hd/aggregate_bins.nf New aggregation of 2µm SE into coarser bin resolutions.
modules/bambu/standard/transcript_discovery.nf Refactored standard discovery; now always publishes restart artifacts.
modules/bambu/standard/single_cell_quantification.nf New single-cell EM quantification module (standard workflow).
modules/bambu/shared/prepare_annotation.nf Retagged process label to bambu container.
modules/bambu/shared/construct_read_class.nf Retagged process label to bambu container.
modules/bambu/shared/cluster_level_quantification.nf Refactored cluster-level quantification into shared module.
main.nf Split into STANDARD and VISIUM_HD workflows; rewired modules.
lib/Validation.groovy Added Visium HD + new param validations; renamed seurat param.
examples/samplesheet_visium_hd_synthetic.csv Added Visium HD synthetic example samplesheet.
examples/samplesheet_visium_hd_quant_data.csv Added Visium HD manual-clustering restart samplesheet.
examples/samplesheet_test_sc_quant_data.csv Added standard manual-clustering restart samplesheet.
examples/bins_visium_hd_synthetic.csv Added synthetic Visium HD bins CSV example.
containers/seurat/Dockerfile New Seurat container (Seurat, Harmony, Banksy, wrappers).
containers/bambu/Dockerfile Updated bambu container dependencies and removed Seurat/Harmony.
conf/smoke_test.config Added smoke-test profiles for Visium HD + manual clustering.
conf/dev.config Updated valid quantification mode list (clusteredEM).
conf/containers.config Split r into bambu + seurat; add pyarrow/pandas image.
conf/base.config Updated retry strategy labels to `bambu
CHANGELOG.md Added v0.10.0 notes for Visium HD + refactor.
bin/visium_hd_spot_bin_mappings.py New script to subset barcode mappings to quantified spots.
bin/visium_hd_convert_tissue_positions.py New script to convert tissue_positions parquet→CSV (+ barcodes).
bin/visium_hd_convert_barcode_mappings.py New script to subset barcode_mappings parquet per resolution.
bin/visium_hd_cluster.R New R helpers for Banksy/expression-only Visium HD clustering.
bin/visium_hd_aggregate_resolution.R New R helper to aggregate 2µm counts to bins.
bin/save_counts.R Renamed helper to saveCounts() and refactored variable names.
bin/map_spots_to_clusters.R New R helpers to read clusters and expand bin clusters to spots.
bin/create_seurat_object.R New R helper to build Seurat objects from count directories.
bin/bambu_discovery.R New shared R helper encapsulating discovery + quantData + uniqueCounts.
.github/workflows/smoke_test.yml Expanded smoke-test matrix with Visium HD/manual variants.
.github/workflows/build_container.yml Generalized container build to multiple labeled images.
Suppressed comments (1)

modules/bambu/shared/cluster_level_quantification.nf:31

  • Manual clustering docs indicate the clusters input can be a CSV/TSV with id,cluster, but this code passes non-.rds inputs as a string path into bambu.singlecell(). That’s unlikely to match the expected named-vector type and will break manual clustering with CSV input. Parse the file into an id -> cluster named vector (the repo already includes a readClusters() helper).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +10 to +17
// Visium HD: single sample, starting from a pre-aligned, barcode-tagged BAM file
ch_rows.collect(flat: false).map { rows -> Validation.validateVisiumHDRows(rows) }

ch_sample = ch_rows.map { row ->
def sample_path = file(row.path, checkIfExists: true)
def meta = [chemistry: 'visium-hd', technology: 'NA']
[row.sample, sample_path, meta]
}
Comment thread modules/seurat/visium_hd/clustering.nf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants