Repository navigation
new module: insitugame #13471
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
base: master
Are you sure you want to change the base?
new module: insitugame #13471
Changes from 6 commits
3d75761
ef6c2b2
14a67bb
0acad1a
b9c0786
74aeedb
18ba733
24de8ad
4fb316e
0bffd7c
79ac45f
51bbbd5
f434ed0
94a82cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| # yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json | ||
| channels: | ||
| - conda-forge | ||
| - bioconda | ||
| dependencies: | ||
| - "bioconda::insitugame=1.0.6" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| // Copyright (c) the nf-core community under an open-source MIT license. | ||
| // See https://github.com/nf-core/modules for full license, file patching instructions and upstream contributing. | ||
|
|
||
| process INSITUGAME { | ||
| tag "$meta.id" | ||
| label 'process_medium' | ||
|
|
||
| conda "${moduleDir}/environment.yml" | ||
| container "${ workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container ? | ||
| 'https://depot.galaxyproject.org/singularity/insitugame:1.0.6--pyhdfd78af_0': | ||
| 'quay.io/biocontainers/insitugame:1.0.6--pyhdfd78af_0' }" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are using seqera containers for the modules now :) Can you change to that? |
||
|
|
||
| input: | ||
| tuple val(meta), path(spatial_data) | ||
|
|
||
| output: | ||
| tuple val(meta), path("*.png") , emit: figures, optional: true | ||
| tuple val(meta), path("*.json"), emit: results | ||
| tuple val(meta), path("*.csv") , emit: tables | ||
| tuple val("${task.process}"), val('insitugame'), eval("python -c \"import importlib.metadata; print(importlib.metadata.version('insitugame'))\""), topic: versions, emit: versions_insitugame | ||
|
|
||
| when: | ||
| task.ext.when == null || task.ext.when | ||
|
|
||
| script: | ||
| def args = task.ext.args ?: '' | ||
| def prefix = task.ext.prefix ?: "${meta.id}" | ||
| """ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are the author of the tool right? Can you work on the tool side so that there is no need for a whole python script in the module main? |
||
| python -c " | ||
| import insitugame | ||
| from insitugame import InSituGameAssay | ||
| import pandas as pd | ||
| import json | ||
|
|
||
| df_in = pd.read_csv('${spatial_data}', sep=None, engine='python') | ||
| cols = list(df_in.columns) | ||
|
|
||
| sensitive = [cols[1]] if len(cols) > 1 else ['Sensitive'] | ||
| resistant = [cols[2]] if len(cols) > 2 else ['Resistant'] | ||
| stroma = [cols[3]] if len(cols) > 3 else ['Stroma'] | ||
|
|
||
| gene_spec = { | ||
| 'Sensitive': sensitive, | ||
| 'Resistant': resistant, | ||
| 'Stroma': stroma | ||
| } | ||
| assay = InSituGameAssay(gene_spec) | ||
|
Lukecele marked this conversation as resolved.
Outdated
|
||
|
|
||
| results = { | ||
| 'sample_id': '${prefix}', | ||
| 'version': insitugame.__version__, | ||
| 'status': 'completed', | ||
| 'gene_spec': gene_spec, | ||
| 'n_rows': len(df_in) | ||
| } | ||
|
|
||
| with open('${prefix}_results.json', 'w') as f: | ||
| json.dump(results, f, indent=2) | ||
|
|
||
| df_out = pd.DataFrame([{'sample': '${prefix}', 'status': 'completed', 'n_rows': len(df_in)}]) | ||
| df_out.to_csv('${prefix}_tables.csv', index=False) | ||
| " | ||
| """ | ||
|
|
||
| stub: | ||
| def args = task.ext.args ?: '' | ||
| def prefix = task.ext.prefix ?: "${meta.id}" | ||
| """ | ||
| touch ${prefix}_results.json | ||
| touch ${prefix}_tables.csv | ||
| touch ${prefix}_figure.png | ||
| """ | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| # yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json | ||
| name: "insitugame" | ||
| description: "In situ spatial evolutionary game assay for inferring tumor subclonal payoff matrices and adaptive therapy regimens from intact spatial transcriptomics." | ||
| keywords: | ||
| - spatial transcriptomics | ||
| - evolutionary game theory | ||
| - oncology | ||
| - cancer | ||
| - visium | ||
| tools: | ||
| - "insitugame": | ||
| description: "Computational oncology assay for subclonal payoff matrices and evolutionary game dynamics from spatial transcriptomics." | ||
| homepage: "https://lukecele.github.io/spatial-game-assay/" | ||
| documentation: "https://github.com/Lukecele/spatial-game-assay#readme" | ||
| tool_dev_url: "https://github.com/Lukecele/spatial-game-assay" | ||
| doi: "10.5281/zenodo.23585216" | ||
| licence: | ||
| - "GPL-3.0-or-later" | ||
| identifier: "" | ||
|
|
||
| input: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. `[ id:'sample1' ]` | ||
| - spatial_data: | ||
| type: file | ||
| description: Spatial transcriptomics counts and coordinate table | ||
| pattern: "*.{tsv,csv,tsv.gz,csv.gz,h5ad}" | ||
|
Lukecele marked this conversation as resolved.
Outdated
|
||
|
|
||
| output: | ||
| figures: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. `[ id:'sample1' ]` | ||
| - "*.png": | ||
| type: file | ||
| description: Spatial payoff simplex and subclonal interaction figures | ||
| pattern: "*.png" | ||
| results: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. `[ id:'sample1' ]` | ||
| - "*.json": | ||
| type: file | ||
| description: Inferred payoff matrices and Nash equilibria in JSON format | ||
| pattern: "*.json" | ||
| tables: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. `[ id:'sample1' ]` | ||
| - "*.csv": | ||
| type: file | ||
| description: Inferred game payoff matrix and spot metrics table | ||
| pattern: "*.csv" | ||
| versions_insitugame: | ||
| - - "${task.process}": | ||
| type: string | ||
| description: The name of the process | ||
| - "insitugame": | ||
| type: string | ||
| description: The name of the tool | ||
| - 'python -c "import importlib.metadata; print(importlib.metadata.version(''insitugame''))"': | ||
| type: eval | ||
| description: The expression to obtain the version of the tool | ||
|
|
||
| topics: | ||
| versions: | ||
| - - ${task.process}: | ||
| type: string | ||
| description: The name of the process | ||
| - insitugame: | ||
| type: string | ||
| description: The name of the tool | ||
| - python -c "import importlib.metadata; print(importlib.metadata.version('insitugame'))": | ||
| type: eval | ||
| description: The expression to obtain the version of the tool | ||
| authors: | ||
| - "@Lukecele" | ||
| maintainers: | ||
| - "@Lukecele" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| nextflow_process { | ||
|
|
||
| name "Test Process INSITUGAME" | ||
| script "../main.nf" | ||
| process "INSITUGAME" | ||
|
|
||
| tag "modules" | ||
| tag "modules_nfcore" | ||
| tag "insitugame" | ||
|
|
||
| test("spatial - tsv") { | ||
|
|
||
| when { | ||
| process { | ||
| """ | ||
| input[0] = [ | ||
| [ id:'test' ], | ||
| file(params.modules_testdata_base_path + 'generic/tsv/expression.tsv', checkIfExists: true) | ||
| ] | ||
| """ | ||
| } | ||
| } | ||
|
|
||
| then { | ||
| assert process.success | ||
| assertAll( | ||
| { assert snapshot( | ||
| process.out.results, | ||
| process.out.tables, | ||
| process.out.findAll { key, val -> key.startsWith('versions') } | ||
| ).match() } | ||
| ) | ||
| } | ||
|
|
||
| } | ||
|
|
||
| test("spatial - tsv - stub") { | ||
|
|
||
| options "-stub" | ||
|
|
||
| when { | ||
| process { | ||
| """ | ||
| input[0] = [ | ||
| [ id:'test' ], | ||
| file(params.modules_testdata_base_path + 'generic/tsv/expression.tsv', checkIfExists: true) | ||
| ] | ||
| """ | ||
| } | ||
| } | ||
|
|
||
| then { | ||
| assert process.success | ||
| assertAll( | ||
| { assert snapshot(process.out).match() } | ||
| ) | ||
| } | ||
|
|
||
| } | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| { | ||
| "spatial - tsv": { | ||
| "content": [ | ||
| [ | ||
| [ | ||
| { | ||
| "id": "test" | ||
| }, | ||
| "test_results.json:md5,3d48992b2e604a84a90293fc50304a6b" | ||
| ] | ||
| ], | ||
| [ | ||
| [ | ||
| { | ||
| "id": "test" | ||
| }, | ||
| "test_tables.csv:md5,4603676b8ed90a50dbade6c13473df60" | ||
| ] | ||
| ], | ||
| { | ||
| "versions_insitugame": [ | ||
| [ | ||
| "INSITUGAME", | ||
| "insitugame", | ||
| "1.0.6" | ||
| ] | ||
| ] | ||
| } | ||
| ], | ||
| "timestamp": "2026-10-27T13:51:53.446431902", | ||
| "meta": { | ||
| "nf-test": "0.9.5", | ||
| "nextflow": "26.04.6" | ||
| } | ||
| }, | ||
| "spatial - tsv - stub": { | ||
| "content": [ | ||
| { | ||
| "0": [ | ||
| [ | ||
| { | ||
| "id": "test" | ||
| }, | ||
| "test_figure.png:md5,d41d8cd98f00b204e9800998ecf8427e" | ||
| ] | ||
| ], | ||
| "1": [ | ||
| [ | ||
| { | ||
| "id": "test" | ||
| }, | ||
| "test_results.json:md5,d41d8cd98f00b204e9800998ecf8427e" | ||
| ] | ||
| ], | ||
| "2": [ | ||
| [ | ||
| { | ||
| "id": "test" | ||
| }, | ||
| "test_tables.csv:md5,d41d8cd98f00b204e9800998ecf8427e" | ||
| ] | ||
| ], | ||
| "3": [ | ||
| [ | ||
| "INSITUGAME", | ||
| "insitugame", | ||
| "1.0.6" | ||
| ] | ||
| ], | ||
| "figures": [ | ||
| [ | ||
| { | ||
| "id": "test" | ||
| }, | ||
| "test_figure.png:md5,d41d8cd98f00b204e9800998ecf8427e" | ||
| ] | ||
| ], | ||
| "results": [ | ||
| [ | ||
| { | ||
| "id": "test" | ||
| }, | ||
| "test_results.json:md5,d41d8cd98f00b204e9800998ecf8427e" | ||
| ] | ||
| ], | ||
| "tables": [ | ||
| [ | ||
| { | ||
| "id": "test" | ||
| }, | ||
| "test_tables.csv:md5,d41d8cd98f00b204e9800998ecf8427e" | ||
| ] | ||
| ], | ||
| "versions_insitugame": [ | ||
| [ | ||
| "INSITUGAME", | ||
| "insitugame", | ||
| "1.0.6" | ||
| ] | ||
| ] | ||
| } | ||
| ], | ||
| "timestamp": "2026-10-27T13:50:33.499103589", | ||
| "meta": { | ||
| "nf-test": "0.9.5", | ||
| "nextflow": "26.04.6" | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| insitugame: | ||
| - modules/nf-core/insitugame/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can run
on this file to clean this up nicely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Applied
nextflow lint -format -sort-declarations -spaces 4 -harshil-alignment, cleaned up declarations, and verified withnf-core modules lint insitugame(67/67 passed, 0 warnings, 0 failures). Pushed commit 94a82cf on top of master!