diff --git a/.gitignore b/.gitignore index e7476d5..3de4d52 100644 --- a/.gitignore +++ b/.gitignore @@ -1,23 +1,11 @@ -/.nextflow -/work -.nextflow.log* -*.img -inference_mudata.h5mu -per_element_output.tsv -per_guide_output.tsv -nf-*-reports.tsv -/pipeline_outputs -/pipeline_dashboard -/results -pipeline-service-key.json -debug_dashboard.ipynb -.vscode/ -GCP_user_notebook.ipynb -.params_2026-01-29_13-02-48.json -.params_2026-02-03_23-14-20.json -.params_2026-02-03_23-14-49.json -GCP_user_notebook.ipynb -*.pyc -__pycache__/ +.nextflow* +work/ +data/ +results/ .DS_Store -sample_metadata +testing/ +testing* +*.pyc +null/ +.lineage/ +nf-core-perturbseq.code-workspace diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..e5d412e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "nextflow.telemetry.enabled": true +} \ No newline at end of file diff --git a/assets/email_template.html b/assets/email_template.html index a164ba1..6293782 100644 --- a/assets/email_template.html +++ b/assets/email_template.html @@ -1,53 +1,113 @@ - - - - + + + + - - nf-core/perturbseq Pipeline Report - - -
+ + nf-core/perturbseq Pipeline Report + + +
+ - +

nf-core/perturbseq ${version}

+

Run Name: $runName

-

nf-core/perturbseq ${version}

-

Run Name: $runName

- -<% if (!success){ - out << """ -
-

nf-core/perturbseq execution completed unsuccessfully!

+ <% if (!success){ out << """ +
+

nf-core/perturbseq execution completed unsuccessfully!

The exit status of the task that caused the workflow execution to fail was: $exitStatus.

The full error message was:

-
${errorReport}
-
- """ -} else { - out << """ -
+
${errorReport}
+
+ """ } else { out << """ +
nf-core/perturbseq execution completed successfully! -
- """ -} -%> +
+ """ } %> -

The workflow was completed at $dateComplete (duration: $duration)

-

The command used to launch the workflow was as follows:

-
$commandLine
+

The workflow was completed at $dateComplete (duration: $duration)

+

The command used to launch the workflow was as follows:

+
+$commandLine
-

Pipeline Configuration:

- - - <% out << summary.collect{ k,v -> "" }.join("\n") %> - -
$k
$v
+

Pipeline Configuration:

+ + + <% out << summary.collect{ k,v -> " + + + + + " }.join("\n") %> + +
+ $k + +
$v
+
-

nf-core/perturbseq

-

https://github.com/nf-core/perturbseq

- -
- - +

nf-core/perturbseq

+

https://github.com/nf-core/perturbseq

+
+ diff --git a/assets/samplesheet.csv b/assets/samplesheet.csv deleted file mode 100644 index 5f653ab..0000000 --- a/assets/samplesheet.csv +++ /dev/null @@ -1,3 +0,0 @@ -sample,fastq_1,fastq_2 -SAMPLE_PAIRED_END,/path/to/fastq/files/AEG588A1_S1_L002_R1_001.fastq.gz,/path/to/fastq/files/AEG588A1_S1_L002_R2_001.fastq.gz -SAMPLE_SINGLE_END,/path/to/fastq/files/AEG588A4_S4_L003_R1_001.fastq.gz, diff --git a/assets/schema_input.json b/assets/schema_input.json index 84be6e6..04e79fd 100644 --- a/assets/schema_input.json +++ b/assets/schema_input.json @@ -43,11 +43,11 @@ "meta": ["measurement_sets"] }, "sequencing_run": { - "type": "string", + "type": ["string", "integer"], "meta": ["sequencing_run"] }, "lane": { - "type": "string", + "type": ["string", "integer"], "meta": ["lane"] }, "flowcell_id": { diff --git a/main.nf b/main.nf index 2577340..9e9afa9 100644 --- a/main.nf +++ b/main.nf @@ -19,6 +19,7 @@ include { PERTURBSEQ } from './workflows/perturbseq' include { PIPELINE_INITIALISATION } from './subworkflows/local/utils_nfcore_perturbseq_pipeline' include { PIPELINE_COMPLETION } from './subworkflows/local/utils_nfcore_perturbseq_pipeline' include { getGenomeAttribute } from './subworkflows/local/utils_nfcore_perturbseq_pipeline' +include { PREPAREREFERENCERESOURCES } from './subworkflows/local/preparereferenceresources' /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -26,10 +27,8 @@ include { getGenomeAttribute } from './subworkflows/local/utils_nfcore_pert ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -// TODO nf-core: Remove this line if you don't need a FASTA file -// This is an example of how to use getGenomeAttribute() to fetch parameters -// from igenomes.config using `--genome` -params.fasta = getGenomeAttribute('fasta') +params.reference_fasta = params.reference_fasta ?: getGenomeAttribute('fasta') +params.reference_gtf = params.reference_gtf ?: getGenomeAttribute('gtf') /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -44,6 +43,10 @@ workflow NFCORE_PERTURBSEQ { take: samplesheet // channel: samplesheet read in from --input + transcriptome_index + transcriptome_t2g + reference_gtf + reference_versions main: @@ -52,6 +55,10 @@ workflow NFCORE_PERTURBSEQ { // PERTURBSEQ ( samplesheet, + transcriptome_index, + transcriptome_t2g, + reference_gtf, + reference_versions, params.multiqc_config, params.multiqc_logo, params.multiqc_methods_description, @@ -78,29 +85,67 @@ workflow { params.monochrome_logs, args, params.outdir, - params.input, params.help, params.help_full, params.show_hidden ) + def ch_input = file(params.input, checkIfExists: true) + def ch_samplesheet = channel + .fromPath(ch_input) + .splitCsv(header: true) + .map { row -> + def meta = [ + id: "sample_${row.file_modality}_${row.measurement_sets}", + measurement_sets: row.measurement_sets, + modality: (row.file_modality ?: '').toLowerCase(), + seqspec: row.seqspec, + barcode_onlist: row.barcode_onlist, + guide_design: row.guide_design, + barcode_hashtag_map: row.barcode_hashtag_map, + ] + def reads = [file(row.R1_path, checkIfExists: true)] + if (row.R2_path) { + reads += file(row.R2_path, checkIfExists: true) + } + [meta, reads] + } + + def ch_rna_workflow = channel.value('standard') + def ch_reference_fasta = params.reference_fasta + ? channel.value(file(params.reference_fasta, checkIfExists: true)) + : channel.empty() + def ch_reference_gtf = params.reference_gtf + ? channel.value(file(params.reference_gtf, checkIfExists: true)) + : channel.empty() + + def ReferenceResources = PREPAREREFERENCERESOURCES( + ch_reference_fasta, + ch_reference_gtf, + ch_rna_workflow + ) + // // WORKFLOW: Run main workflow // NFCORE_PERTURBSEQ ( - PIPELINE_INITIALISATION.out.samplesheet - ) - // - // SUBWORKFLOW: Run completion tasks - // - PIPELINE_COMPLETION ( - params.email, - params.email_on_fail, - params.plaintext_email, - params.outdir, - params.monochrome_logs, - NFCORE_PERTURBSEQ.out.multiqc_report + ch_samplesheet, + ReferenceResources.out.transcriptome_index, + ReferenceResources.out.transcriptome_t2g, + ReferenceResources.out.reference_gtf, + ReferenceResources.out.versions ) + // // + // // SUBWORKFLOW: Run completion tasks + // // + // PIPELINE_COMPLETION ( + // params.email, + // params.email_on_fail, + // params.plaintext_email, + // params.outdir, + // params.monochrome_logs, + // NFCORE_PERTURBSEQ.out.multiqc_report + // ) } /* diff --git a/modules.json b/modules.json index ac549d0..d59e0ac 100644 --- a/modules.json +++ b/modules.json @@ -1,37 +1,46 @@ { - "name": "nf-core/perturbseq", - "homePage": "https://github.com/nf-core/perturbseq", - "repos": { - "https://github.com/nf-core/modules.git": { - "modules": { - "nf-core": { - "fq/subsample": { - "branch": "master", - "git_sha": "6d46786420b4d7bc88eba026eb389c0c5535d120", - "installed_by": [ - "modules" - ] - } - } - }, - "subworkflows": { - "nf-core": { - "utils_nextflow_pipeline": { - "branch": "master", - "git_sha": "3aa0aec1d52d492fe241919f0c6100ebf0074082", - "installed_by": [ - "subworkflows" - ] - }, - "utils_nfcore_pipeline": { - "branch": "master", - "git_sha": "1b6b9a3338d011367137808b49b923515080e3ba", - "installed_by": [ - "subworkflows" - ] - } - } - } + "name": "nf-core/perturbseq", + "homePage": "https://github.com/nf-core/perturbseq", + "repos": { + "https://github.com/nf-core/modules.git": { + "modules": { + "nf-core": { + "fq/subsample": { + "branch": "master", + "git_sha": "6d46786420b4d7bc88eba026eb389c0c5535d120", + "installed_by": ["modules"] + }, + "kallistobustools/count": { + "branch": "master", + "git_sha": "013035eb5c80c9e3f37f2c89c92a1ae7925df8ea", + "installed_by": ["modules"] + }, + "kallistobustools/ref": { + "branch": "master", + "git_sha": "6d46786420b4d7bc88eba026eb389c0c5535d120", + "installed_by": ["modules"] + }, + "multiqc": { + "branch": "master", + "git_sha": "008f9d3e61209bf995edac3ba531f54e269e1215", + "installed_by": ["modules"] + } } + }, + "subworkflows": { + "nf-core": { + "utils_nextflow_pipeline": { + "branch": "master", + "git_sha": "3aa0aec1d52d492fe241919f0c6100ebf0074082", + "installed_by": ["subworkflows"] + }, + "utils_nfcore_pipeline": { + "branch": "master", + "git_sha": "1b6b9a3338d011367137808b49b923515080e3ba", + "installed_by": ["subworkflows"] + } + } + } } -} \ No newline at end of file + } +} diff --git a/modules/local/anndataconcat/main.nf b/modules/local/anndataconcat/main.nf index 1b3857b..480eae0 100644 --- a/modules/local/anndataconcat/main.nf +++ b/modules/local/anndataconcat/main.nf @@ -24,6 +24,7 @@ process ANNDATACONCAT { 'https://depot.galaxyproject.org/singularity/YOUR-TOOL-HERE': 'quay.io/biocontainers/YOUR-TOOL-HERE' }" + input: path parsed_covariate_df path adata_filepath diff --git a/modules/local/createguideref/main.nf b/modules/local/createguideref/main.nf index 0262818..db1b050 100644 --- a/modules/local/createguideref/main.nf +++ b/modules/local/createguideref/main.nf @@ -25,6 +25,7 @@ process CREATEGUIDEREF { 'https://depot.galaxyproject.org/singularity/YOUR-TOOL-HERE': 'quay.io/biocontainers/YOUR-TOOL-HERE' }" + input: path guide_metadata val rev_comp val spacer_tag diff --git a/nextflow.config b/nextflow.config index 88b15f5..a54f736 100644 --- a/nextflow.config +++ b/nextflow.config @@ -13,8 +13,52 @@ params { // Input options input = null + // Core pipeline parameters from legacy CRISPR_Pipeline config + ENABLE_DATA_HASHING = false + ENABLE_SCRUBLET = false + ENABLE_BENCHMARK = false + use_igvf_reference = true + is_10x3v3 = false + reverse_complement_guides = false + spacer_tag = '' + + Multiplicity_of_infection = 'high' + GUIDE_ASSIGNMENT_method = 'sceptre' + GUIDE_ASSIGNMENT_capture_method = 'CROP-seq' + GUIDE_ASSIGNMENT_cleanser_probability_threshold = 1 + GUIDE_ASSIGNMENT_SCEPTRE_probability_threshold = 'default' + GUIDE_ASSIGNMENT_SCEPTRE_n_em_rep = 'default' + + INFERENCE_method = 'default' + INFERENCE_target_guide_pairing_strategy = 'default' + INFERENCE_PERTURBO_BATCH_SIZE = 4096 + INFERENCE_PERTURBO_TRANS_MAX_GENES_PER_CHUNK = 8000 + INFERENCE_max_target_distance_bp = 1000000 + INFERENCE_SCEPTRE_side = 'both' + INFERENCE_SCEPTRE_grna_integration_strategy = 'union' + INFERENCE_SCEPTRE_resampling_approximation = 'skew_normal' + INFERENCE_SCEPTRE_control_group = 'complement' + INFERENCE_SCEPTRE_resampling_mechanism = 'default' + INFERENCE_SCEPTRE_formula_object = 'default' + INFERENCE_SCEPTRE_CHUNK_MODE = 'auto' + INFERENCE_SCEPTRE_MAX_MATRIX_ENTRIES = 2147483647 + INFERENCE_SCEPTRE_GENE_CHUNK_SIZE = 1000 + + NETWORK_custom_central_nodes = 'undefined' + NETWORK_central_nodes_num = 1 + ENCODE_BED_DIR = "${projectDir}/encode_bed_files" + + // Dashboard assets + css = 'assets/css' + js = 'assets/js' + svg = 'assets/svg' + // References genome = null + reference_fasta = null + reference_gtf = null + transcriptome_index = null + transcriptome_t2g = null igenomes_base = 's3://ngi-igenomes/igenomes/' igenomes_ignore = false diff --git a/nf-core-perturbseq.code-workspace b/nf-core-perturbseq.code-workspace deleted file mode 100644 index 8056da6..0000000 --- a/nf-core-perturbseq.code-workspace +++ /dev/null @@ -1,13 +0,0 @@ -{ - "folders": [ - { - "path": ".", - "name": "nf-core-perturbseq" - }, - { - "path": "../CRISPR_Pipeline", - "name": "orig" - } - ], - "settings": {} -} \ No newline at end of file diff --git a/subworkflows/local/preparereferenceresources/main.nf b/subworkflows/local/preparereferenceresources/main.nf new file mode 100644 index 0000000..b25afa7 --- /dev/null +++ b/subworkflows/local/preparereferenceresources/main.nf @@ -0,0 +1,43 @@ +include { KALLISTOBUSTOOLS_REF } from '../../../modules/nf-core/kallistobustools/ref/main' + +workflow PREPAREREFERENCERESOURCES { + + take: + ch_fasta + ch_gtf + ch_workflow_mode + + main: + def ch_versions = channel.empty() + def ch_index + def ch_t2g + def ch_reference_gtf + + if (params.transcriptome_index && params.transcriptome_t2g) { + ch_index = channel.value(file(params.transcriptome_index, checkIfExists: true)) + ch_t2g = channel.value(file(params.transcriptome_t2g, checkIfExists: true)) + if (!params.reference_gtf) { + error "`--reference_gtf` is required when using prebuilt transcriptome resources via `--transcriptome_index/--transcriptome_t2g`." + } + ch_reference_gtf = channel.value(file(params.reference_gtf, checkIfExists: true)) + } else { + if (!params.reference_fasta || !params.reference_gtf) { + error "Provide either `--transcriptome_index` and `--transcriptome_t2g` together, or provide `--reference_fasta` and `--reference_gtf` (or `--genome` that resolves them)." + } + KALLISTOBUSTOOLS_REF( + ch_fasta, + ch_gtf, + ch_workflow_mode + ) + ch_versions = ch_versions.mix(KALLISTOBUSTOOLS_REF.out.versions.first()) + ch_index = KALLISTOBUSTOOLS_REF.out.index + ch_t2g = KALLISTOBUSTOOLS_REF.out.t2g + ch_reference_gtf = ch_gtf + } + + emit: + transcriptome_index = ch_index + transcriptome_t2g = ch_t2g + reference_gtf = ch_reference_gtf + versions = ch_versions +} diff --git a/subworkflows/local/preparereferenceresources/meta.yml b/subworkflows/local/preparereferenceresources/meta.yml new file mode 100644 index 0000000..4552acd --- /dev/null +++ b/subworkflows/local/preparereferenceresources/meta.yml @@ -0,0 +1,57 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/subworkflows/yaml-schema.json +name: "preparereferenceresources" +description: Prepare transcriptome reference resources for kb count. +keywords: + - kallisto + - bustools + - reference + - transcriptome +components: + - kallistobustools/ref +input: + - ch_fasta: + type: file + description: | + Reference genome/transcriptome FASTA. + Structure: [ path(fasta) ] + pattern: "*.{fa,fasta,fa.gz,fasta.gz}" + - ch_gtf: + type: file + description: | + Gene annotation in GTF format. + Structure: [ path(gtf) ] + pattern: "*.{gtf,gtf.gz}" + - ch_workflow_mode: + type: string + description: | + kb workflow mode passed to kallistobustools/ref (for example standard or lamanno). + Structure: [ val(mode) ] +output: + - transcriptome_index: + type: file + description: | + Kallisto index for transcriptome quantification. + Structure: [ path(index) ] + pattern: "*.idx" + - transcriptome_t2g: + type: file + description: | + Transcript-to-gene mapping table. + Structure: [ path(t2g) ] + pattern: "*.txt" + - reference_gtf: + type: file + description: | + The input GTF propagated downstream. + Structure: [ path(gtf) ] + pattern: "*.{gtf,gtf.gz}" + - versions: + type: file + description: | + File containing software versions. + Structure: [ path(versions.yml) ] + pattern: "versions.yml" +authors: + - "@cmatKhan" +maintainers: + - "@cmatKhan" diff --git a/subworkflows/local/preparereferenceresources/tests/main.nf.test b/subworkflows/local/preparereferenceresources/tests/main.nf.test new file mode 100644 index 0000000..daf6c6a --- /dev/null +++ b/subworkflows/local/preparereferenceresources/tests/main.nf.test @@ -0,0 +1,46 @@ +// TODO nf-core: Once you have added the required tests, please run the following command to build this file: +// nf-core subworkflows test preparereferenceresources +nextflow_workflow { + + name "Test Subworkflow PREPAREREFERENCERESOURCES" + script "../main.nf" + workflow "PREPAREREFERENCERESOURCES" + + tag "subworkflows" + tag "subworkflows_" + tag "subworkflows/preparereferenceresources" + // TODO nf-core: Add tags for all modules used within this subworkflow. Example: + tag "samtools" + tag "samtools/sort" + tag "samtools/index" + + + // TODO nf-core: Change the test name preferably indicating the test-data and file-format used + test("sarscov2 - bam - single_end") { + + when { + workflow { + """ + // TODO nf-core: define inputs of the workflow here. Example: + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + ] + input[1] = [ + [ id:'genome' ], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + ] + """ + } + } + then { + assert workflow.success + assertAll( + { assert snapshot( + workflow.out + //TODO nf-core: Add all required assertions to verify the test output. + ).match() } + ) + } + } +} diff --git a/subworkflows/local/preprocessing_pipeline/main.nf b/subworkflows/local/preprocessing_pipeline/main.nf index 7996fd2..84f0b4d 100644 --- a/subworkflows/local/preprocessing_pipeline/main.nf +++ b/subworkflows/local/preprocessing_pipeline/main.nf @@ -2,6 +2,7 @@ process PREPROCESSING_STUB { input: path concat_anndata_rna path trans_out_dir + path gtf_reference output: path 'filtered_anndata_rna.h5ad', emit: filtered_anndata_rna @@ -15,9 +16,7 @@ process PREPROCESSING_STUB { cp ${concat_anndata_rna} adata_rna.h5ad mkdir -p figures touch figures/placeholder.txt - cat <<'EOF' > gencode.gtf -chr1\tstub\tgene\t1\t1000\t.\t+\t.\tgene_id "GENE0"; gene_name "GENE0"; -EOF + cp ${gtf_reference} gencode.gtf """ } @@ -25,9 +24,10 @@ workflow preprocessing_pipeline { take: concat_anndata_rna trans_out_dir + gtf_reference main: - PREPROCESSING_STUB(concat_anndata_rna, trans_out_dir) + PREPROCESSING_STUB(concat_anndata_rna, trans_out_dir, gtf_reference) emit: filtered_anndata_rna = PREPROCESSING_STUB.out.filtered_anndata_rna diff --git a/subworkflows/local/utils_nfcore_perturbseq_pipeline/main.nf b/subworkflows/local/utils_nfcore_perturbseq_pipeline/main.nf index 29b6bea..f28ac8c 100644 --- a/subworkflows/local/utils_nfcore_perturbseq_pipeline/main.nf +++ b/subworkflows/local/utils_nfcore_perturbseq_pipeline/main.nf @@ -1,3 +1,121 @@ +// +// Subworkflow with functionality specific to the nf-core/perturbseq pipeline +// + +/* +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + IMPORT FUNCTIONS / MODULES / SUBWORKFLOWS +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ + +include { UTILS_NFSCHEMA_PLUGIN } from '../../nf-core/utils_nfschema_plugin' +include { paramsSummaryMap } from 'plugin/nf-schema' +include { completionEmail } from '../../nf-core/utils_nfcore_pipeline' +include { completionSummary } from '../../nf-core/utils_nfcore_pipeline' +include { UTILS_NFCORE_PIPELINE } from '../../nf-core/utils_nfcore_pipeline' +include { UTILS_NEXTFLOW_PIPELINE } from '../../nf-core/utils_nextflow_pipeline' + +/* +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + SUBWORKFLOW TO INITIALISE PIPELINE +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ + +workflow PIPELINE_INITIALISATION { + + take: + version // boolean: Display version and exit + validate_params // boolean: Validate parameters against the schema + _monochrome_logs // boolean: Do not use coloured log outputs + nextflow_cli_args // array: List of positional nextflow CLI args + outdir // string: Output directory where results are saved + help // boolean: Display help message and exit + help_full // boolean: Show the full help message + show_hidden // boolean: Show hidden parameters in the help message + + main: + + UTILS_NEXTFLOW_PIPELINE ( + version, + true, + outdir, + workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1 + ) + + def command = "nextflow run ${workflow.manifest.name} --input samplesheet.csv --outdir -profile " + UTILS_NFSCHEMA_PLUGIN ( + workflow, + validate_params, + null, + help, + help_full, + show_hidden, + '', + '', + command + ) + + UTILS_NFCORE_PIPELINE ( + nextflow_cli_args + ) +} + +/* +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + SUBWORKFLOW FOR PIPELINE COMPLETION +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ + +workflow PIPELINE_COMPLETION { + + take: + email // string: Email address + email_on_fail // string: Email address sent on pipeline failure + plaintext_email // boolean: Send plain-text email instead of HTML + outdir // path: Path to output directory where results will be published + monochrome_logs // boolean: Disable ANSI colour codes in log output + multiqc_report // channel: Path to MultiQC report + + main: + + summary_params = paramsSummaryMap(workflow, parameters_schema: 'nextflow_schema.json') + def multiqc_reports = multiqc_report.toList() + + workflow.onComplete { + if (email || email_on_fail) { + completionEmail( + summary_params, + email, + email_on_fail, + plaintext_email, + outdir, + monochrome_logs, + multiqc_reports.getVal(), + ) + } + + completionSummary(monochrome_logs) + } +} + +/* +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + FUNCTIONS +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ + +// +// Get attribute from genome config file e.g. fasta +// +def getGenomeAttribute(attribute) { + if (params.genomes && params.genome && params.genomes.containsKey(params.genome)) { + if (params.genomes[params.genome].containsKey(attribute)) { + return params.genomes[params.genome][attribute] + } + } + return null +} + def methodsDescriptionText(mqc_methods_yaml) { return mqc_methods_yaml.text } \ No newline at end of file diff --git a/workflows/perturbseq.nf b/workflows/perturbseq.nf index 1e7ecdc..3b5b249 100644 --- a/workflows/perturbseq.nf +++ b/workflows/perturbseq.nf @@ -50,6 +50,10 @@ workflow PERTURBSEQ { take: ch_samplesheet // channel: samplesheet read in from --input + ch_transcriptome_index + ch_transcriptome_t2g + ch_reference_gtf + ch_reference_versions multiqc_config multiqc_logo multiqc_methods_description @@ -60,10 +64,9 @@ workflow PERTURBSEQ { def ch_versions = channel.empty() def ch_multiqc_files = channel.empty() def ch_empty_file = channel.value([]) - def ch_rna_workflow = channel.value('standard') def ch_hash_workflow = channel.value('kite') - def ch_transcriptome_index = channel.value(file(params.transcriptome_index, checkIfExists: true)) - def ch_transcriptome_t2g = channel.value(file(params.transcriptome_t2g, checkIfExists: true)) + ch_versions = ch_versions.mix(ch_reference_versions) + def ch_rna_workflow = channel.value('standard') // Parse the samplesheet and create channels for each modality def ch_samples = ch_samplesheet.map { meta, fastqs -> @@ -236,7 +239,8 @@ workflow PERTURBSEQ { // Common preprocessing for both workflows def Preprocessing = preprocessing_pipeline( ConcatRna.out.concat_anndata, - QuantRna.out.count.map { _meta, count_dir -> count_dir } + QuantRna.out.count.map { _meta, count_dir -> count_dir }, + ch_reference_gtf ) def benchmark_output_dir