Skip to content

Commit 248b7b2

Browse files
committed
changed transcripts handling to parquet file from csv
1 parent 6792bce commit 248b7b2

File tree

13 files changed

+105
-96
lines changed

13 files changed

+105
-96
lines changed

conf/modules.config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ process {
2727
]
2828
}
2929

30+
withName: GUNZIP {
31+
ext.prefix = "transcripts.csv"
32+
}
33+
3034
withName: XENIUMRANGER_RESEGMENT {
3135
publishDir = [
3236
path: "${params.outdir}/xeniumranger/resegment",

modules.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"gunzip": {
1515
"branch": "master",
1616
"git_sha": "81880787133db07d9b4c1febd152c090eb8325dc",
17-
"installed_by": ["modules"]
17+
"installed_by": ["modules"],
18+
"patch": "modules/nf-core/gunzip/gunzip.diff"
1819
},
1920
"multiqc": {
2021
"branch": "master",

modules/local/spatialconverter/parquet_to_csv/main.nf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ process PARQUET_TO_CSV {
44

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

7-
if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) {
8-
error "PARQUET_TO_CSV module does not support Conda. Please use Docker / Singularity / Podman instead."
9-
}
10-
117
input:
128
tuple val(meta), path(transcripts)
139

1410
output:
15-
tuple val(meta), path("*.csv") , emit: transcripts_csv
16-
path("versions.yml") , emit: versions
11+
tuple val(meta), path("*.csv"), emit: transcripts_csv
12+
path("versions.yml") , emit: versions
1713

1814
when:
1915
task.ext.when == null || task.ext.when
2016

2117
script:
18+
if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) {
19+
error "PARQUET_TO_CSV module does not support Conda. Please use Docker / Singularity / Podman instead."
20+
}
21+
2222
template 'parquet_to_csv.py'
2323

2424
stub:

modules/nf-core/gunzip/gunzip.diff

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/nf-core/gunzip/main.nf

Lines changed: 4 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nextflow.config

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ params {
5151
features = null
5252

5353
// Baysor specific
54-
baysor_run_image = true // run baysor with image/seg-mask
55-
baysor_run_transcripts = false // run baysor with transcripts.csv.gz
56-
baysor_preview = false // generate preview with baysor preview cmd
5754

5855
// MultiQC options
5956
multiqc_config = null

nextflow_schema.json

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
"properties": {
8686
"generate_preview": {
8787
"type": "boolean",
88-
"description": "Whether to generate a preview of the dataset with the transcripts.csv.gz."
88+
"description": "Whether to generate a preview of the dataset with the transcripts.parquet."
8989
},
9090
"segmentation_refinement": {
9191
"type": "boolean",
@@ -175,19 +175,6 @@
175175
"features": {
176176
"type": "string",
177177
"description": "List of features to be passed to the ficture method. (eg: TP53,OCIAD1,BCAS3,SOX)"
178-
},
179-
"baysor_run_image": {
180-
"type": "boolean",
181-
"default": true,
182-
"description": "Whether to run bayor with image/segmentation-mask."
183-
},
184-
"baysor_run_transcripts": {
185-
"type": "boolean",
186-
"description": "Whether to run baysor with transcripts.csv.gz."
187-
},
188-
"baysor_preview": {
189-
"type": "boolean",
190-
"description": "Whether to create a preview of the dataset with transcripts.csv.gz."
191178
}
192179
}
193180
},

subworkflows/local/baysor_generate_preview/main.nf

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,29 @@
22
// Run baysor create_dataset & preview
33
//
44

5-
include { GUNZIP } from '../../../modules/nf-core/gunzip/main'
65
include { BAYSOR_PREVIEW } from '../../../modules/local/baysor/preview/main'
76
include { BAYSOR_CREATE_DATASET } from '../../../modules/local/baysor/create_dataset/main'
7+
include { PARQUET_TO_CSV } from '../../../modules/local/spatialconverter/parquet_to_csv/main'
88

99
workflow BAYSOR_GENERATE_PREVIEW {
1010

1111
take:
1212

13-
ch_transcripts_csv // channel: [ val(meta), ["path-to-transcripts.csv.gz"] ]
14-
ch_config // channel: ["path-to-xenium.toml"]
13+
ch_transcripts_parquet // channel: [ val(meta), ["path-to-transcripts.parquet"] ]
14+
ch_config // channel: ["path-to-xenium.toml"]
1515

1616
main:
1717

1818
ch_versions = Channel.empty()
1919
ch_preview_html = Channel.empty()
2020

2121

22-
// unzip transcripts.csv.gz
23-
GUNZIP ( ch_transcripts_csv )
24-
ch_versions = ch_versions.mix ( GUNZIP.out.versions )
25-
26-
ch_unzipped_transcripts = GUNZIP.out.gunzip
22+
// run parquet to csv
23+
PARQUET_TO_CSV ( ch_transcripts_parquet )
24+
ch_versions = ch_versions.mix ( PARQUET_TO_CSV.out.versions )
2725

2826
// generate randomised sample data
29-
BAYSOR_CREATE_DATASET ( ch_unzipped_transcripts, "0.3" )
27+
BAYSOR_CREATE_DATASET ( PARQUET_TO_CSV.out.transcripts_csv, "0.3" )
3028
ch_versions = ch_versions.mix ( BAYSOR_CREATE_DATASET.out.versions )
3129

3230
// run baysor preview if param - generate_preview is true

subworkflows/local/baysor_generate_segfree/main.nf

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,27 @@ workflow BAYSOR_GENERATE_SEGFREE {
1010

1111
take:
1212

13-
ch_transcripts // channel: [ val(meta), ["transcripts.csv.gz"] ]
13+
ch_transcripts_parquet // channel: [ val(meta), ["transcripts.parquet"] ]
14+
ch_config
1415

1516
main:
1617

1718
ch_versions = Channel.empty()
1819

1920
ch_ncvs = Channel.empty()
2021

21-
// unzip transcripts.csv.gz
22-
GUNZIP ( ch_transcripts )
23-
ch_versions = ch_versions.mix ( GUNZIP.out.versions )
24-
2522
// run baysor segfree
2623
BAYSOR_SEGFREE (
27-
GUNZIP.out.gunzip
24+
ch_transcripts_parquet,
25+
ch_config
2826
)
2927
ch_versions = ch_versions.mix( BAYSOR_SEGFREE.out.versions )
3028

29+
ch_ncvs = BAYSOR_SEGFREE.out.ncvs
30+
3131
emit:
3232

33-
ncvs = ch_ncvs
33+
ncvs = ch_ncvs // channel: [ val(meta), ["ncvs.loom"] ]
3434

35-
versions = ch_versions // channel: [ versions.yml ]
35+
versions = ch_versions // channel: [ versions.yml ]
3636
}

subworkflows/local/baysor_run_prior_segmentation_mask/main.nf

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,18 @@
22
// Run baysor run & import-segmentation
33
//
44

5-
include { GUNZIP } from '../../../modules/nf-core/gunzip/main'
6-
include { RESOLIFT } from '../../../modules/local/resolift/main'
7-
include { BAYSOR_RUN as BAYSOR_RUN_IMAGE } from '../../../modules/local/baysor/run/main'
8-
include { XENIUMRANGER_IMPORT_SEGMENTATION } from '../../../modules/nf-core/xeniumranger/import-segmentation/main'
5+
include { BAYSOR_RUN as BAYSOR_RUN_IMAGE } from '../../../modules/local/baysor/run/main'
6+
include { XENIUMRANGER_IMPORT_SEGMENTATION } from '../../../modules/nf-core/xeniumranger/import-segmentation/main'
97

108

119
workflow BAYSOR_RUN_PRIOR_SEGMENTATION_MASK {
1210

1311
take:
1412

15-
ch_bundle_path // channel: [ val(meta), ["path-to-xenium-bundle"] ]
16-
ch_transcripts_csv // channel: [ val(meta), ["path-to-transcripts.csv.gz"] ]
17-
ch_segmentation_mask // channel: [ ["path-to-prior-segmentation-mask"] ]
18-
ch_config // channel: ["path-to-xenium.toml"]
13+
ch_bundle_path // channel: [ val(meta), ["path-to-xenium-bundle"] ]
14+
ch_transcripts_parquet // channel: [ val(meta), ["path-to-transcripts.parquet"] ]
15+
ch_segmentation_mask // channel: [ ["path-to-prior-segmentation-mask"] ]
16+
ch_config // channel: [ "path-to-xenium.toml" ]
1917

2018
main:
2119

@@ -26,17 +24,11 @@ workflow BAYSOR_RUN_PRIOR_SEGMENTATION_MASK {
2624
ch_htmls = Channel.empty()
2725

2826
ch_redefined_bundle = Channel.empty()
29-
ch_unzipped_transcripts = Channel.empty()
3027

31-
// unzip transcripts.csv.gz
32-
GUNZIP ( ch_transcripts_csv )
33-
ch_versions = ch_versions.mix ( GUNZIP.out.versions )
34-
35-
ch_unzipped_transcripts = GUNZIP.out.gunzip
3628

3729
// run baysor with morphology.tiff
3830
BAYSOR_RUN_IMAGE (
39-
ch_unzipped_transcripts,
31+
ch_transcripts_parquet,
4032
ch_segmentation_mask,
4133
ch_config,
4234
30

0 commit comments

Comments
 (0)