Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Baysor module #7270

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 57 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions .idea/modules.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions modules/nf-core/baysor/preview/main.nf
Original file line number Diff line number Diff line change
@@ -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
"""
}
55 changes: 55 additions & 0 deletions modules/nf-core/baysor/preview/meta.yml
Original file line number Diff line number Diff line change
@@ -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"
63 changes: 63 additions & 0 deletions modules/nf-core/baysor/preview/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -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 },
)
}

}

}
2 changes: 2 additions & 0 deletions modules/nf-core/baysor/preview/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
baysor:
- "modules/nf-core/baysor/preview/**"
62 changes: 62 additions & 0 deletions modules/nf-core/baysor/run/main.nf
Original file line number Diff line number Diff line change
@@ -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
"""
}
Loading