Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
842af6b
variable uniformity, main workflow to subworkflows, fixed stub runs
khersameesh24 May 17, 2025
0b4b945
manual testing changes
khersameesh24 May 17, 2025
49ce4ee
manual testing changes
khersameesh24 May 17, 2025
811fe5b
manual testing changes
khersameesh24 May 18, 2025
6792bce
test profile fixes
khersameesh24 May 18, 2025
248b7b2
changed transcripts handling to parquet file from csv
khersameesh24 May 19, 2025
0703cd2
cpu num fix for cellpose
khersameesh24 May 19, 2025
a487b60
memory fix for cellpose
khersameesh24 May 19, 2025
81d1960
fix for imp-seg pipestance errors
khersameesh24 May 19, 2025
cd6ba06
fixed time for CI test with reduced resources
khersameesh24 May 19, 2025
50431e8
validator function for input xenium bundle
khersameesh24 May 19, 2025
2fd92b8
xenium bundle validator, minor changes for ci
khersameesh24 May 20, 2025
5389b80
xenium bundle validator, minor changes for ci
khersameesh24 May 20, 2025
261a56e
xenium bundle validator, minor changes for ci
khersameesh24 May 20, 2025
cd984ac
time limit changes for ci
khersameesh24 May 20, 2025
4cdb980
added updated metromap for spatialxe
khersameesh24 May 21, 2025
62aa1c6
removed gunzip, changes to ci test pipeline, ci changed to stub runs
khersameesh24 May 21, 2025
e54e368
removed gunzip, changes to ci test pipeline, ci changed to stub runs
khersameesh24 May 21, 2025
9d6710d
added preview and segfree mode
khersameesh24 May 23, 2025
dc84908
stub run on ci
khersameesh24 May 23, 2025
8468855
testing segfree methods
khersameesh24 May 23, 2025
67d45c1
testing segfree methods
khersameesh24 May 23, 2025
eca34f3
stub run on ci
khersameesh24 May 23, 2025
13bc492
Merge branch 'dev' of https://github.com/khersameesh24/spatialxe into…
khersameesh24 May 23, 2025
5c97a67
updated pipeline docs
khersameesh24 May 23, 2025
5351a51
Merge branch 'nf-core:dev' into dev
khersameesh24 May 30, 2025
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
19 changes: 17 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,22 @@ jobs:
- name: Clean up Disk space
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1

- name: "Run pipeline with test data ${{ matrix.NXF_VER }} | ${{ matrix.test_name }} | ${{ matrix.profile }}"
- name: "Run pipeline in image mode with test data ${{ matrix.NXF_VER }} | ${{ matrix.test_name }} | ${{ matrix.profile }}"
continue-on-error: ${{ matrix.NXF_VER == 'latest-everything' }}
run: |
nextflow run ${GITHUB_WORKSPACE} -profile ${{ matrix.test_name }},${{ matrix.profile }} --outdir ./results
nextflow run ${GITHUB_WORKSPACE} -profile ${{ matrix.test_name }},${{ matrix.profile }} -stub --outdir ./results --mode image

- name: "Run pipeline in coordinate mode with test data ${{ matrix.NXF_VER }} | ${{ matrix.test_name }} | ${{ matrix.profile }}"
continue-on-error: ${{ matrix.NXF_VER == 'latest-everything' }}
run: |
nextflow run ${GITHUB_WORKSPACE} -profile ${{ matrix.test_name }},${{ matrix.profile }} -stub --outdir ./results --mode coordinate

- name: "Run pipeline in preview mode with test data ${{ matrix.NXF_VER }} | ${{ matrix.test_name }} | ${{ matrix.profile }}"
continue-on-error: ${{ matrix.NXF_VER == 'latest-everything' }}
run: |
nextflow run ${GITHUB_WORKSPACE} -profile ${{ matrix.test_name }},${{ matrix.profile }} -stub --outdir ./results --mode preview

- name: "Run pipeline in segfree mode with test data ${{ matrix.NXF_VER }} | ${{ matrix.test_name }} | ${{ matrix.profile }}"
continue-on-error: ${{ matrix.NXF_VER == 'latest-everything' }}
run: |
nextflow run ${GITHUB_WORKSPACE} -profile ${{ matrix.test_name }},${{ matrix.profile }} -stub --outdir ./results --mode segfree
28 changes: 25 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
<!-- TODO nf-core: Include a figure that guides the user through the major workflow steps. Many nf-core
workflows use the "tube map" design for that. See https://nf-co.re/docs/contributing/design_guidelines#examples for examples. -->

1. Present QC for raw reads ([`MultiQC`](http://multiqc.info/))

## Usage

On release, automated continuous integration tests run the pipeline on a full-sized dataset on the AWS cloud infrastructure. This ensures that the pipeline runs on AWS, has sensible resource allocation defaults set to run on real-world datasets, and permits the persistent storage of results to benchmark between pipeline releases and other analysis sources. The results obtained from the full-sized test can be viewed on the [nf-core website](https://nf-co.re/spatialxe/results).
Expand Down Expand Up @@ -61,7 +59,7 @@ nextflow run nf-core/spatialxe \

## Run coordinate-based segmentation mode <br>

`PROSEG -> BAYSOR -> XR-IMPORT_SEGMENTATION -> SPATIALDATA -> QC`
`PROSEG -> PROSEG2BAYSOR -> XR-IMPORT_SEGMENTATION -> SPATIALDATA -> QC`

```bash
nextflow run nf-core/spatialxe \
Expand All @@ -71,6 +69,30 @@ nextflow run nf-core/spatialxe \
--mode coordinate
```

## Run segfree mode <br>

`BAYSOR_SEGFREE`

```bash
nextflow run nf-core/spatialxe \
-profile <docker/singularity/.../institute> \
--input samplesheet.csv \
--outdir <OUTDIR> \
--mode segfree
```

## Run preview mode <br>

`BAYSOR_PREVIEW`

```bash
nextflow run nf-core/spatialxe \
-profile <docker/singularity/.../institute> \
--input samplesheet.csv \
--outdir <OUTDIR> \
--mode preview
```

> [!WARNING]
> Please provide pipeline parameters via the CLI or Nextflow `-params-file` option. Custom config files including those provided by the `-c` Nextflow option can be used to provide any configuration _**except for parameters**_; see [docs](https://nf-co.re/docs/usage/getting_started/configuration#custom-configuration-files).

Expand Down
7 changes: 7 additions & 0 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ process {
]
}

withName: XENIUMRANGER_RESEGMENT {
publishDir = [
path: "${params.outdir}/xeniumranger/resegment",
mode: params.publish_dir_mode
]
}

withName: XENIUMRANGER_IMPORT_SEGMENTATION {
publishDir = [
path: "${params.outdir}/xeniumranger/import_segementation",
Expand Down
19 changes: 7 additions & 12 deletions conf/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,14 @@

process {

withLabel: process_high {
resourceLimits = [
cpus: 8,
memory: '8.GB',
time: '1.h'
]
}
resourceLimits = [
cpus: 4,
memory: '15.GB',
time: '2.h'
]

withName: CELLPOSE {
resourceLimits = [
cpus: 4,
memory: '8.GB'
]
withName: UNTAR {
ext.prefix = "test_bundle"
}
}

Expand Down
Binary file modified docs/images/spatialxe-metromap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 1 addition & 4 deletions docs/images/spatialxe-metromap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 10 additions & 10 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ This runs the default image mode:<br>

```bash
nextflow run nf-core/spatialxe \
-profile <docker/singularity/...>
--input ./samplesheet.csv \
--outdir ./results \
--mode image \
-profile <docker/singularity/...>
--mode image
```

#### Coordinate-based (transcripts-based) segmentation mode
Expand All @@ -53,10 +53,10 @@ This runs the default coordinate mode:<br>

```bash
nextflow run nf-core/spatialxe \
-profile <docker/singularity/...>
--input ./samplesheet.csv \
--outdir ./results \
--mode coordinate \
-profile <docker/singularity/...>
--mode coordinate
```

### Image-based Segmentation mode (--mode image): <br>
Expand All @@ -73,26 +73,26 @@ nextflow run nf-core/spatialxe \

#### Run Segmentation with the methods methods mentioned above : <br>

eg: To run proseg segmentation use the `coordinate` mode and the `proseg` segmentation method
eg: To run proseg segmentation use the `coordinate` mode and the `proseg` segmentation method (--method)

```bash
nextflow run nf-core/spatialxe \
-profile <docker/singularity/...>
--input ./samplesheet.csv \
--outdir ./results \
--mode coordinate \
--segmentation proseg \
-profile <docker/singularity/...>
--method proseg
```

eg: To run cellpose segmentation use the `image` mode and the `cellpose` segmentation method
eg: To run cellpose segmentation use the `image` mode and the `cellpose` segmentation method (--method)

```bash
nextflow run nf-core/spatialxe \
-profile <docker/singularity/...>
--input ./samplesheet.csv \
--outdir ./results \
--mode image \
--segmentation cellpose \
-profile <docker/singularity/...>
--method cellpose
```

This will launch the pipeline with the `docker` configuration profile. See below for more information about profiles.
Expand Down
8 changes: 2 additions & 6 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
"installed_by": ["modules"],
"patch": "modules/nf-core/cellpose/cellpose.diff"
},
"gunzip": {
"branch": "master",
"git_sha": "81880787133db07d9b4c1febd152c090eb8325dc",
"installed_by": ["modules"]
},
"multiqc": {
"branch": "master",
"git_sha": "7b50cb7be890e4b28cffb82e438cc6a8d7805d3f",
Expand All @@ -24,7 +19,8 @@
"untar": {
"branch": "master",
"git_sha": "05954dab2ff481bcb999f24455da29a5828af08d",
"installed_by": ["modules"]
"installed_by": ["modules"],
"patch": "modules/nf-core/untar/untar.diff"
},
"unzip": {
"branch": "master",
Expand Down
15 changes: 6 additions & 9 deletions modules/local/baysor/create_dataset/templates/create_dataset.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import csv
import random
Expand Down Expand Up @@ -41,18 +41,16 @@ def generate_dataset(

# randomize csv rows to write
for row in reader:
if random.random() < sample_fraction:
if random.random() < float(sample_fraction):
writer.writerow(row)

# print(f"Sampled data written to {sampled_transcripts}")

return None

@staticmethod
def generate_version_yml(version: str) -> None:
def generate_version_yml() -> None:
with open("versions.yml", "w") as yml:
yml.write('"${task.process}":\\n')
yml.write(f'Baysor-Preview Create Dataset: {version}"\\n')
yml.write("Baysor-Preview Create Dataset: 0.7.1'\\n")

return None

Expand All @@ -64,17 +62,16 @@ def main() -> None:
transcripts: str = "${transcripts}"
sample_fraction: float = "${sample_fraction}"
sampled_transcripts: str = "sampled_transcripts.csv"
version: str = "${VERSION}"

# generate dataset
BaysorPreview.generate_dataset(
BaysorPreview.generate_dataset (
transcripts=transcripts,
sampled_transcripts=sampled_transcripts,
sample_fraction=sample_fraction
)

# generate versions.yml
BaysorPreview.generate_version_yml(version=version)
BaysorPreview.generate_version_yml()

return None

Expand Down
2 changes: 2 additions & 0 deletions modules/local/baysor/run/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@ process BAYSOR_RUN {
"""
touch segmentation.csv
touch segmentation_polygons_2d.json
touch segmentation_polygons_3d.json
touch segmentation_log.log
touch segmentation_counts.loom
touch segmentation_cell_stats.csv
touch segmentation_params.dump.toml
touch segmentation_run.html

cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
15 changes: 8 additions & 7 deletions modules/local/spatialconverter/parquet_to_csv/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,27 @@ process PARQUET_TO_CSV {

container "ghcr.io/scverse/spatialdata:spatialdata0.3.0_spatialdata-io0.1.7_spatialdata-plot0.2.9"

if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) {
error "PARQUET_TO_CSV module does not support Conda. Please use Docker / Singularity / Podman instead."
}

input:
tuple val(meta), path(transcripts)
val(extension)

output:
tuple val(meta), path("*.csv") , emit: transcripts_csv
path("versions.yml") , emit: versions
tuple val(meta), path("*.csv*"), emit: transcripts_csv
path("versions.yml") , emit: versions

when:
task.ext.when == null || task.ext.when

script:
if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) {
error "PARQUET_TO_CSV module does not support Conda. Please use Docker / Singularity / Podman instead."
}

template 'parquet_to_csv.py'

stub:
"""
touch ${transcripts}
touch ${transcripts}.csv
cat <<-END_VERSIONS > versions.yml
"${task.process}":
spatialconverter: "${task.version}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,38 @@
#!/usr/bin/env python

import pandas as pd
from pathlib import Path


def convert_parquet (
transcripts: Path,
extension: str = '.csv'
) -> None:

df = pd.read_parquet(transcripts, engine = 'pyarrow')

if extension == ".gz":
output = transcripts.replace(".parquet", ".csv.gz")
df.to_csv(f"{output}", compression='gzip', index=False)
else:
output = transcripts.replace(".parquet", ".csv")
df.to_csv(f"{output}", index=False)

return None


if __name__ == '__main__':
print("[START]")
df = pd.read_parquet("${transcripts}")
output="${transcripts}".replace(".parquet",".csv")
df.to_csv(f"{output}", index=False)

transcripts: str = "${transcripts}"
extension: str = "${extension}"

# generate transcripts.csv(.gz)
convert_parquet (
transcripts=transcripts,
extension=extension
)

#Output version information
with open("versions.yml", "w") as f:
f.write('"${task.process}":\\n')
f.write(f'spatialconverter: "v0.0.1"\\n')

print("[FINISH]")

7 changes: 4 additions & 3 deletions modules/local/spatialdata/merge/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ process SPATIALDATA_MERGE {

input:
tuple val(meta), path(ref_bundle, stageAs: "*")
tuple val(meta), path(add_bundle, stageAs: "*")
path(add_bundle, stageAs: "*")

output:
tuple val(meta), path("spatialdata_spatialxe") , emit: spatialxe_bundle
path "versions.yml" , emit: versions
tuple val(meta), path("spatialdata_spatialxe"), emit: spatialxe_bundle
path("versions.yml") , emit: versions

when:
task.ext.when == null || task.ext.when
Expand All @@ -22,6 +22,7 @@ process SPATIALDATA_MERGE {
}

def args = task.ext.args ?: ''

template 'merge.py'

stub:
Expand Down
Loading