diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 00000000000..13566b81b01
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 00000000000..60dc64bfda7
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 00000000000..79ee123c2b2
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 00000000000..105ce2da2d6
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 00000000000..dc9ea4906e1
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.iml b/.idea/modules.iml
new file mode 100644
index 00000000000..52f3a0e7e3f
--- /dev/null
+++ b/.idea/modules.iml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 00000000000..75a0f377d8e
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 00000000000..35eb1ddfbbc
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/nf-core/baysor/preview/main.nf b/modules/nf-core/baysor/preview/main.nf
new file mode 100644
index 00000000000..1fa054a775a
--- /dev/null
+++ b/modules/nf-core/baysor/preview/main.nf
@@ -0,0 +1,53 @@
+process BAYSOR_PREVIEW {
+ tag '$meta.id'
+ label 'process_high_memory'
+ container "docker.io/segonzal/baysor:0.7.1"
+
+ input:
+ tuple val(meta), path(transcripts_csv)
+ path(config_toml)
+
+ output:
+ tuple val(meta), path("preview.html"), emit: preview_html
+ path("preview_preview_log.log"), emit: preview_log
+
+ when:
+ task.ext.when == null || task.ext.when
+
+ script:
+ // Exit if running this module with -profile conda / -profile mamba
+ if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) {
+ error "BAYSOR_PREVIEW module does not support Conda. Please use Docker / Singularity / Podman instead."
+ }
+ def args = task.ext.args ?: ''
+ def prefix = task.ext.prefix ?: "${meta.id}"
+ def VERSION = "0.7.1"
+
+ """
+ baysor preview ${transcripts_csv} -c ${config_toml} $args
+
+ cat <<-END_VERSIONS > versions.yml
+ "${task.process}":
+ baysor: $VERSION
+ END_VERSIONS
+ """
+
+ stub:
+ // Exit if running this module with -profile conda / -profile mamba
+ if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) {
+ error "BAYSOR_PREVIEW module does not support Conda. Please use Docker / Singularity / Podman instead."
+ }
+ def args = task.ext.args ?: ''
+ def prefix = task.ext.prefix ?: "${meta.id}"
+ def VERSION = "0.7.1"
+
+ """
+ touch preview.html
+ touch preview_preview_log.log
+
+ cat <<-END_VERSIONS > versions.yml
+ "${task.process}":
+ baysor: $VERSION
+ END_VERSIONS
+ """
+}
diff --git a/modules/nf-core/baysor/preview/meta.yml b/modules/nf-core/baysor/preview/meta.yml
new file mode 100644
index 00000000000..731a8d2d6d9
--- /dev/null
+++ b/modules/nf-core/baysor/preview/meta.yml
@@ -0,0 +1,55 @@
+name: "baysor_preview"
+description: Preview run for visualization of data.
+keywords:
+ - exploratory-data-analysis
+tools:
+ - "baysor":
+ description: "Baysor is a tool that segments cells using spatial gene expression maps. Optionally, segmentation masks can be given as additional input."
+ homepage: "https://kharchenkolab.github.io/Baysor/dev/"
+ documentation: "https://kharchenkolab.github.io/Baysor/dev/"
+ tool_dev_url: "https://github.com/kharchenkolab/Baysor"
+ doi: "https://doi.org/10.1038/s41587-021-01044-w"
+ licence: ["MIT license"]
+ identifier:
+
+## baysor_preview requires a transcript map of the data and a configuration file with argument values
+input:
+ - - meta:
+ type: map
+ description: |
+ Groovy Map containing sample information
+ e.g. [ id:'test' ]
+ - transcripts_csv:
+ type: file
+ description: CSV file
+ pattern: "*.csv"
+
+ - config_toml:
+ type: file
+ description: TOML file with config arguments
+ pattern: "*.toml"
+
+## segmentation results
+output:
+ - preview_html:
+ - meta:
+ type: map
+ description: |
+ Groovy Map containing sample information
+ e.g. [ id:'test' ]
+ - "preview.html":
+ type: file
+ description: segmentation preview
+ pattern: "preview.html"
+
+ - preview_log:
+ type: file
+ description: |
+ Log file with summary statistics of preview
+ pattern: "preview_preview_log.log"
+
+
+authors:
+ - "@sebgoti8"
+maintainers:
+ - "@sebgoti8"
diff --git a/modules/nf-core/baysor/preview/tests/main.nf.test b/modules/nf-core/baysor/preview/tests/main.nf.test
new file mode 100644
index 00000000000..016e28f44e9
--- /dev/null
+++ b/modules/nf-core/baysor/preview/tests/main.nf.test
@@ -0,0 +1,63 @@
+nextflow_process {
+
+ name "Test Process BAYSOR_PREVIEW"
+ script "../main.nf"
+ process "BAYSOR_PREVIEW"
+
+ tag "modules"
+ tag "modules_nfcore"
+ tag "baysor"
+
+ test("baysor preview - html") {
+
+ when {
+ process {
+ """
+ input[0] = [
+ [ id:'test' ],
+ file(params.modules_testdata_base_path + 'spatial_omics/xenium/homo_sapiens/spatial_gene_expression.csv', checkIfExists: true),
+ ]
+
+ input[1] = [
+ file(params.modules_testdata_base_path + 'generic/config/config_baysor.toml', checkIfExists: true)
+ ]
+ """
+ }
+ }
+
+ then {
+ assertAll(
+ { assert process.success },
+ )
+ }
+
+ }
+
+ test("baysor preview - html - stub") {
+
+ options "-stub"
+
+ when {
+ process {
+ """
+ input[0] = [
+ [ id:'test' ],
+ file(params.modules_testdata_base_path + 'spatial_omics/xenium/homo_sapiens/spatial_gene_expression.csv', checkIfExists: true),
+ ]
+
+ input[1] = [
+ file(params.modules_testdata_base_path + 'generic/config/config_baysor.toml' , checkIfExists: true)
+ ]
+ """
+ }
+ }
+
+ then {
+ assertAll(
+ { assert process.success },
+ )
+ }
+
+ }
+
+}
diff --git a/modules/nf-core/baysor/preview/tests/tags.yml b/modules/nf-core/baysor/preview/tests/tags.yml
new file mode 100644
index 00000000000..62f8a278055
--- /dev/null
+++ b/modules/nf-core/baysor/preview/tests/tags.yml
@@ -0,0 +1,2 @@
+baysor:
+ - "modules/nf-core/baysor/preview/**"
diff --git a/modules/nf-core/baysor/run/main.nf b/modules/nf-core/baysor/run/main.nf
new file mode 100644
index 00000000000..e5be2e90245
--- /dev/null
+++ b/modules/nf-core/baysor/run/main.nf
@@ -0,0 +1,62 @@
+process BAYSOR_RUN {
+ tag '$meta.id'
+ label 'process_high_memory'
+ container "docker.io/segonzal/baysor:0.7.1"
+
+ input:
+ tuple val(meta), path(transcripts_csv)
+ path(config_toml)
+
+ output:
+ tuple val(meta), path("*segmentation.csv"), emit: segmentation
+ path("*.json"), emit: polygons
+ path("*.toml"), emit: params
+ path("*.log"), emit: log
+ path("*.loom"), emit: loom
+ path("segmentation_cell_stats.csv"), emit: stats
+ path "versions.yml" , emit: versions
+
+ when:
+ task.ext.when == null || task.ext.when
+
+ script:
+ // Exit if running this module with -profile conda / -profile mamba
+ if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) {
+ error "BAYSOR_RUN module does not support Conda. Please use Docker / Singularity / Podman instead."
+ }
+ def args = task.ext.args ?: ''
+ def prefix = task.ext.prefix ?: "${meta.id}"
+ def VERSION = "0.7.1"
+
+ """
+ baysor run ${transcripts_csv} -c ${config_toml} $args
+
+ cat <<-END_VERSIONS > versions.yml
+ "${task.process}":
+ baysor: $VERSION
+ END_VERSIONS
+ """
+
+ stub:
+ // Exit if running this module with -profile conda / -profile mamba
+ if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) {
+ error "BAYSOR_RUN module does not support Conda. Please use Docker / Singularity / Podman instead."
+ }
+ def args = task.ext.args ?: ''
+ def prefix = task.ext.prefix ?: "${meta.id}"
+ def VERSION = "0.7.1"
+
+ """
+ touch segmentation.csv
+ touch segmentation_polygons_2d.json
+ touch segmentation_log.log
+ touch segmentation_counts.loom
+ touch segmentation_cell_stats.csv
+ touch segmentation_params.dump.toml
+
+ cat <<-END_VERSIONS > versions.yml
+ "${task.process}":
+ baysor: $VERSION
+ END_VERSIONS
+ """
+}
diff --git a/modules/nf-core/baysor/run/meta.yml b/modules/nf-core/baysor/run/meta.yml
new file mode 100644
index 00000000000..a511658f906
--- /dev/null
+++ b/modules/nf-core/baysor/run/meta.yml
@@ -0,0 +1,86 @@
+name: "baysor_run"
+description: Bayesian segmentation of spatial transcriptomics data.
+keywords:
+ - segmentation
+ - spatial transcriptomics
+ - cell clustering
+ - imaging
+tools:
+ - "baysor":
+ description: "Baysor is a tool that segments cells using spatial gene expression maps. Optionally, segmentation masks can be given as additional input."
+ homepage: "https://kharchenkolab.github.io/Baysor/dev/"
+ documentation: "https://kharchenkolab.github.io/Baysor/dev/"
+ tool_dev_url: "https://github.com/kharchenkolab/Baysor"
+ doi: "https://doi.org/10.1038/s41587-021-01044-w"
+ licence: ["MIT license"]
+ identifier:
+
+## Baysor requires a transcript map of the data and a configuration file with argument values
+input:
+ - - meta:
+ type: map
+ description: |
+ Groovy Map containing sample information
+ e.g. [ id:'test' ]
+ - transcripts_csv:
+ type: file
+ description: CSV file
+ pattern: "*.csv"
+
+ - config_toml:
+ type: file
+ description: TOML file with config arguments
+ pattern: "*.toml"
+
+## segmentation results
+output:
+ - segmentation:
+ - meta:
+ type: map
+ description: |
+ Groovy Map containing sample information
+ e.g. [ id:'test' ]
+ - "*segmentation.csv":
+ type: file
+ description: results of segmentation
+ pattern: "segmentation.csv"
+
+ - polygons:
+ type: file
+ description: |
+ File with outlines of segmentation
+ pattern: "*.json"
+
+ - params:
+ type: file
+ description: |
+ File with full list of parameters used for the model
+ pattern: "segmentation_params.dump.toml"
+
+ - log:
+ type: file
+ description: |
+ Output file with metadata of running the workflow
+ pattern: "segmentation_log.log"
+
+ - loom:
+ type: file
+ description: |
+ Loom file with metadata
+ pattern: "segmentation_counts.loom"
+
+ - stats:
+ type: file
+ description: |
+ Statistics of segmented cells
+ pattern: "segmentation_cell_stats.csv"
+
+ - versions:
+ type: file
+ description: File containing software versions
+ pattern: "versions.yml"
+
+authors:
+ - "@sebgoti8"
+maintainers:
+ - "@sebgoti8"
diff --git a/modules/nf-core/baysor/run/tests/main.nf.test b/modules/nf-core/baysor/run/tests/main.nf.test
new file mode 100644
index 00000000000..92588aba262
--- /dev/null
+++ b/modules/nf-core/baysor/run/tests/main.nf.test
@@ -0,0 +1,63 @@
+nextflow_process {
+
+ name "Test Process BAYSOR_RUN"
+ script "../main.nf"
+ process "BAYSOR_RUN"
+
+ tag "modules"
+ tag "modules_nfcore"
+ tag "baysor"
+
+ test("baysor - csv") {
+
+ when {
+ process {
+ """
+ input[0] = Channel.of([
+ [ id:'segmentation' ],
+ file(params.modules_testdata_base_path + 'spatial_omics/xenium/homo_sapiens/spatial_gene_expression.csv', checkIfExists: true),
+ ])
+
+ input[1] = [
+ file(params.modules_testdata_base_path + 'generic/config/config_baysor.toml', checkIfExists: true)
+ ]
+ """
+ }
+ }
+
+ then {
+ assertAll(
+ { assert process.success },
+ )
+ }
+
+ }
+
+ test("baysor - csv - stub") {
+
+ options "-stub"
+
+ when {
+ process {
+ """
+ input[0] = [
+ [ id:'test' ],
+ file(params.modules_testdata_base_path + 'spatial_omics/xenium/homo_sapiens/spatial_gene_expression.csv', checkIfExists: true),
+ ]
+
+ input[1] = [
+ file(params.modules_testdata_base_path + 'generic/config/config_baysor.toml' , checkIfExists: true)
+ ]
+ """
+ }
+ }
+
+ then {
+ assertAll(
+ { assert process.success },
+ )
+ }
+
+ }
+
+}
diff --git a/modules/nf-core/baysor/run/tests/tags.yml b/modules/nf-core/baysor/run/tests/tags.yml
new file mode 100644
index 00000000000..0371b2b2952
--- /dev/null
+++ b/modules/nf-core/baysor/run/tests/tags.yml
@@ -0,0 +1,2 @@
+baysor:
+ - "modules/nf-core/baysor/run/**"
diff --git a/modules/nf-core/baysor/segfree/main.nf b/modules/nf-core/baysor/segfree/main.nf
new file mode 100644
index 00000000000..430b443f4d7
--- /dev/null
+++ b/modules/nf-core/baysor/segfree/main.nf
@@ -0,0 +1,53 @@
+process BAYSOR_SEGFREE {
+ tag '$meta.id'
+ label 'process_high_memory'
+ container "docker.io/segonzal/baysor:0.7.1"
+
+ input:
+ tuple val(meta), path(transcripts_csv)
+ path(config_toml)
+
+ output:
+ tuple val(meta), path("ncvs.loom"), emit: ncvs
+ path("ncvs_segfree_log.log"), emit: ncvs_log
+
+ when:
+ task.ext.when == null || task.ext.when
+
+ script:
+ // Exit if running this module with -profile conda / -profile mamba
+ if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) {
+ error "BAYSOR_SEGFREE module does not support Conda. Please use Docker / Singularity / Podman instead."
+ }
+ def args = task.ext.args ?: ''
+ def prefix = task.ext.prefix ?: "${meta.id}"
+ def VERSION = "0.7.1"
+
+ """
+ baysor segfree ${transcripts_csv} -c ${config_toml} $args
+
+ cat <<-END_VERSIONS > versions.yml
+ "${task.process}":
+ baysor: $VERSION
+ END_VERSIONS
+ """
+
+ stub:
+ // Exit if running this module with -profile conda / -profile mamba
+ if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) {
+ error "BAYSOR_SEGFREE module does not support Conda. Please use Docker / Singularity / Podman instead."
+ }
+ def args = task.ext.args ?: ''
+ def prefix = task.ext.prefix ?: "${meta.id}"
+ def VERSION = "0.7.1"
+
+ """
+ touch ncvs.loom
+ touch ncvs_segfree_log.log
+
+ cat <<-END_VERSIONS > versions.yml
+ "${task.process}":
+ baysor: $VERSION
+ END_VERSIONS
+ """
+}
diff --git a/modules/nf-core/baysor/segfree/meta.yml b/modules/nf-core/baysor/segfree/meta.yml
new file mode 100644
index 00000000000..965119edb55
--- /dev/null
+++ b/modules/nf-core/baysor/segfree/meta.yml
@@ -0,0 +1,55 @@
+name: "baysor_segfree"
+description: Extract neighborhood composition vectors (NVCs) from a dataset.
+keywords:
+ - neighborhood
+tools:
+ - "baysor":
+ description: "Baysor is a tool that segments cells using spatial gene expression maps. Optionally, segmentation masks can be given as additional input."
+ homepage: "https://kharchenkolab.github.io/Baysor/dev/"
+ documentation: "https://kharchenkolab.github.io/Baysor/dev/"
+ tool_dev_url: "https://github.com/kharchenkolab/Baysor"
+ doi: "https://doi.org/10.1038/s41587-021-01044-w"
+ licence: ["MIT license"]
+ identifier:
+
+## baysor_segfree requires a transcript map of the data and a configuration file with argument values
+input:
+ - - meta:
+ type: map
+ description: |
+ Groovy Map containing sample information
+ e.g. [ id:'test' ]
+ - transcripts_csv:
+ type: file
+ description: CSV file
+ pattern: "*.csv"
+
+ - config_toml:
+ type: file
+ description: TOML file with config arguments
+ pattern: "*.toml"
+
+## neighborhood composition vectors
+output:
+ - preview_html:
+ - meta:
+ type: map
+ description: |
+ Groovy Map containing sample information
+ e.g. [ id:'test' ]
+ - "ncvs.loom":
+ type: file
+ description: loom file with neighborhood results
+ pattern: "preview.html"
+
+ - ncvs_log:
+ type: file
+ description: |
+ Log file with summary statistics
+ pattern: "ncvs_segfree_log.log"
+
+
+authors:
+ - "@sebgoti8"
+maintainers:
+ - "@sebgoti8"
diff --git a/modules/nf-core/baysor/segfree/tests/main.nf.test b/modules/nf-core/baysor/segfree/tests/main.nf.test
new file mode 100644
index 00000000000..c5b7c9bdb1a
--- /dev/null
+++ b/modules/nf-core/baysor/segfree/tests/main.nf.test
@@ -0,0 +1,63 @@
+nextflow_process {
+
+ name "Test Process BAYSOR_SEGFREE"
+ script "../main.nf"
+ process "BAYSOR_SEGFREE"
+
+ tag "modules"
+ tag "modules_nfcore"
+ tag "baysor"
+
+ test("baysor segfree - loom") {
+
+ when {
+ process {
+ """
+ input[0] = [
+ [ id:'test' ],
+ file(params.modules_testdata_base_path + 'spatial_omics/xenium/homo_sapiens/spatial_gene_expression.csv', checkIfExists: true),
+ ]
+
+ input[1] = [
+ file(params.modules_testdata_base_path + 'generic/config/config_baysor.toml', checkIfExists: true)
+ ]
+ """
+ }
+ }
+
+ then {
+ assertAll(
+ { assert process.success },
+ )
+ }
+
+ }
+
+ test("baysor segfree - loom - stub") {
+
+ options "-stub"
+
+ when {
+ process {
+ """
+ input[0] = [
+ [ id:'test' ],
+ file(params.modules_testdata_base_path + 'spatial_omics/xenium/homo_sapiens/spatial_gene_expression.csv', checkIfExists: true),
+ ]
+
+ input[1] = [
+ file(params.modules_testdata_base_path + 'generic/config/config_baysor.toml' , checkIfExists: true)
+ ]
+ """
+ }
+ }
+
+ then {
+ assertAll(
+ { assert process.success },
+ )
+ }
+
+ }
+
+}
diff --git a/modules/nf-core/baysor/segfree/tests/tags.yml b/modules/nf-core/baysor/segfree/tests/tags.yml
new file mode 100644
index 00000000000..338452eb3ac
--- /dev/null
+++ b/modules/nf-core/baysor/segfree/tests/tags.yml
@@ -0,0 +1,2 @@
+baysor:
+ - "modules/nf-core/baysor/segfree/**"