diff --git a/subworkflows/local/convert.nf b/subworkflows/local/convert.nf new file mode 100644 index 0000000..71031e9 --- /dev/null +++ b/subworkflows/local/convert.nf @@ -0,0 +1,56 @@ + +/* +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + IMPORT LOCAL MODULES +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ + +include { CONVERT_ADAPTIVE } from '../../modules/local/convert/convert_adaptive' +include { PSEUDOBULK_CELLRANGER } from '../../modules/local/convert/pseudobulk_cellranger' +include { PSEUDOBULK_PHENOTYPE_CELLRANGER } from '../../modules/local/convert/pseudobulk_phenotype_cellranger' + +/* +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + RUN MAIN SUBWORKFLOW +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ + +workflow CONVERT { + take: + sample_map + input_format + + main: + pseudobulk_phenotype_files = channel.empty() // Initialize empty channel for phenotype files + + if (input_format == 'adaptive') { + CONVERT_ADAPTIVE( + sample_map, + file(params.airr_schema), + file(params.imgt_lookup) + ) + sample_map_converted = CONVERT_ADAPTIVE.out.adaptive_convert + + } else if (input_format == 'cellranger') { + PSEUDOBULK_CELLRANGER( + sample_map, + file(params.airr_schema) + ) + sample_map_converted = PSEUDOBULK_CELLRANGER.out.cellranger_pseudobulk + + if (params.sobject_gex) { + PSEUDOBULK_PHENOTYPE_CELLRANGER( + sample_map, + file(params.airr_schema), + file(params.sobject_gex) + ) + pseudobulk_phenotype_files = PSEUDOBULK_PHENOTYPE_CELLRANGER.out.cellranger_pseudobulk_phenotype + } + } else { + sample_map_converted = sample_map + } + + emit: + sample_map_converted + pseudobulk_phenotype_files +} \ No newline at end of file diff --git a/subworkflows/local/convert/adaptive.nf b/subworkflows/local/convert/adaptive.nf deleted file mode 100644 index 31980e5..0000000 --- a/subworkflows/local/convert/adaptive.nf +++ /dev/null @@ -1,16 +0,0 @@ -include { CONVERT_ADAPTIVE } from '../../../modules/local/convert/convert_adaptive' - -workflow ADAPTIVE { - take: - sample_map - - main: - CONVERT_ADAPTIVE( - sample_map, - params.airr_schema, - params.imgt_lookup - ) - - emit: - CONVERT_ADAPTIVE.out.adaptive_convert -} \ No newline at end of file diff --git a/subworkflows/local/convert/main.nf b/subworkflows/local/convert/main.nf deleted file mode 100644 index 5e0fb8c..0000000 --- a/subworkflows/local/convert/main.nf +++ /dev/null @@ -1,45 +0,0 @@ - -/* -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - IMPORT LOCAL MODULES -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*/ - -include { ADAPTIVE } from './adaptive' -include { PSEUDOBULK } from './pseudobulk_cellranger' -include { PSEUDOBULK_PHENOTYPE } from './pseudobulk_phenotype' - -/* -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - RUN MAIN SUBWORKFLOW -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*/ - -workflow CONVERT { - take: - sample_map - input_format - - main: - ch_pseudobulk_phenotype = channel.empty() // Initialize empty channel for phenotype files - - if (input_format == 'adaptive') { - ADAPTIVE(sample_map) - sample_map_converted = ADAPTIVE.out - } else if (input_format == 'cellranger') { - PSEUDOBULK(sample_map) - sample_map_converted = PSEUDOBULK.out - - if (params.sobject_gex) { - PSEUDOBULK_PHENOTYPE( - sample_map, - file(params.sobject_gex) - ) - ch_pseudobulk_phenotype = PSEUDOBULK_PHENOTYPE.out.ch_pseudobulk_phenotype - } - } - - emit: - sample_map_converted - pseudobulk_phenotype_files = ch_pseudobulk_phenotype -} \ No newline at end of file diff --git a/subworkflows/local/convert/pseudobulk_cellranger.nf b/subworkflows/local/convert/pseudobulk_cellranger.nf deleted file mode 100644 index 174d990..0000000 --- a/subworkflows/local/convert/pseudobulk_cellranger.nf +++ /dev/null @@ -1,15 +0,0 @@ -include { PSEUDOBULK_CELLRANGER } from '../../../modules/local/convert/pseudobulk_cellranger' - -workflow PSEUDOBULK { - take: - sample_map - - main: - PSEUDOBULK_CELLRANGER( - sample_map, - params.airr_schema, - ) - - emit: - PSEUDOBULK_CELLRANGER.out.cellranger_pseudobulk -} \ No newline at end of file diff --git a/subworkflows/local/convert/pseudobulk_phenotype.nf b/subworkflows/local/convert/pseudobulk_phenotype.nf deleted file mode 100644 index 4ada72c..0000000 --- a/subworkflows/local/convert/pseudobulk_phenotype.nf +++ /dev/null @@ -1,17 +0,0 @@ -include { PSEUDOBULK_PHENOTYPE_CELLRANGER } from '../../../modules/local/convert/pseudobulk_phenotype_cellranger' - -workflow PSEUDOBULK_PHENOTYPE { - take: - sample_map - sobject_gex - - main: - PSEUDOBULK_PHENOTYPE_CELLRANGER( - sample_map, - params.airr_schema, - sobject_gex - ) - - emit: - PSEUDOBULK_PHENOTYPE_CELLRANGER.out.cellranger_pseudobulk_phenotype -} \ No newline at end of file