From 6ef1df3cdf7d7b244b36f2eb79e52848b3fda8ea Mon Sep 17 00:00:00 2001 From: laurencekuhl Date: Wed, 24 Jul 2024 20:39:09 +0200 Subject: [PATCH 01/24] add control_sgrna option --- docs/usage/screening.md | 5 +++++ modules/nf-core/mageck/mle/main.nf | 4 ++++ nextflow.config | 2 ++ nextflow_schema.json | 4 ++++ workflows/crisprseq_screening.nf | 12 +++++++++--- 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/docs/usage/screening.md b/docs/usage/screening.md index 645aec8e..6b757c18 100644 --- a/docs/usage/screening.md +++ b/docs/usage/screening.md @@ -105,6 +105,11 @@ If there are several designs to be run, you can input a folder containing all th If you wish to run MAGeCK MLE with the day0 label you can do so by specifying `--day0_label` and the sample names that should be used as day0. +#### Using negative control sgRNAs for MAGeCK MLE + +You can add the parameter `--mle_control_sgrna` followed by your file (one non targeting control sgRNA per line) to integrate the control sgRNA in MAGeCK MLE. + + ### Running BAGEL2 BAGEL2 (Bayesian Analysis of Gene Essentiality with Location) is a computational tool developed by the Hart Lab at Harvard University. It is designed for analyzing large-scale genetic screens, particularly CRISPR-Cas9 screens, to identify genes that are essential for the survival or growth of cells under different conditions. BAGEL2 integrates information about the location of guide RNAs within a gene and leverages this information to improve the accuracy of gene essentiality predictions. diff --git a/modules/nf-core/mageck/mle/main.nf b/modules/nf-core/mageck/mle/main.nf index fac59c23..a7451249 100644 --- a/modules/nf-core/mageck/mle/main.nf +++ b/modules/nf-core/mageck/mle/main.nf @@ -9,6 +9,7 @@ process MAGECK_MLE { input: tuple val(meta), path(design_matrix), path(count_table) + path(mle_control_sgrna) output: tuple val(meta), path("*.gene_summary.txt") , emit: gene_summary @@ -20,13 +21,16 @@ process MAGECK_MLE { script: def args = task.ext.args ?: '' + def args2 = task.ext.args2 ?: '' prefix = meta.id ?: "${meta.treatment}_vs_${meta.reference}" def design_command = design_matrix ? "-d $design_matrix" : '' + def control_sgrna = mle_control_sgrna ? "--control-sgrna $mle_control_sgrna" : '' """ mageck \\ mle \\ $args \\ + $control_sgrna \\ --threads $task.cpus \\ -k $count_table \\ -n $prefix \\ diff --git a/nextflow.config b/nextflow.config index 956a91d7..3911e9e2 100644 --- a/nextflow.config +++ b/nextflow.config @@ -17,6 +17,8 @@ params { library = null crisprcleanr = null contrasts = null + contrasts = null + mle_control_sgrna = null mle_design_matrix = null count_table = null fasta = null diff --git a/nextflow_schema.json b/nextflow_schema.json index 22ae1ff2..8dcc32dd 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -189,6 +189,10 @@ "exists": true, "description": "Design matrix used for MAGeCK MLE to call essential genes under multiple conditions while considering sgRNA knockout efficiency" }, + "mle_control_sgrna": { + "type": "string", + "description": "control-sgrna file for MAGeCK MLE" + }, "contrasts": { "type": "string", "format": "file-path", diff --git a/workflows/crisprseq_screening.nf b/workflows/crisprseq_screening.nf index 5ccb9310..dfd31ace 100644 --- a/workflows/crisprseq_screening.nf +++ b/workflows/crisprseq_screening.nf @@ -262,6 +262,12 @@ workflow CRISPRSEQ_SCREENING { } + if(params.mle_control_sgrna) { + ch_mle_control_sgrna = Channel.fromPath(params.mle_control_sgrna) + } else { + ch_mle_control_sgrna = Channel.of([[]]) + } + if((params.mle_design_matrix) || (params.contrasts && !params.rra) || (params.day0_label)) { if(params.mle_design_matrix) { INITIALISATION_CHANNEL_CREATION_SCREENING.out.design.map { @@ -269,7 +275,7 @@ workflow CRISPRSEQ_SCREENING { }.set { ch_designed_mle } ch_mle = ch_designed_mle.combine(ch_counts) - MAGECK_MLE_MATRIX (ch_mle) + MAGECK_MLE_MATRIX (ch_mle, ch_mle_control_sgrna) ch_versions = ch_versions.mix(MAGECK_MLE_MATRIX.out.versions) MAGECK_FLUTEMLE(MAGECK_MLE_MATRIX.out.gene_summary) ch_versions = ch_versions.mix(MAGECK_FLUTEMLE.out.versions) @@ -277,7 +283,7 @@ workflow CRISPRSEQ_SCREENING { if(params.contrasts) { MATRICESCREATION(ch_contrasts) ch_mle = MATRICESCREATION.out.design_matrix.combine(ch_counts) - MAGECK_MLE (ch_mle) + MAGECK_MLE (ch_mle, ch_mle_control_sgrna) ch_versions = ch_versions.mix(MAGECK_MLE.out.versions) MAGECK_FLUTEMLE_CONTRASTS(MAGECK_MLE.out.gene_summary) ch_versions = ch_versions.mix(MAGECK_FLUTEMLE_CONTRASTS.out.versions) @@ -287,7 +293,7 @@ workflow CRISPRSEQ_SCREENING { } if(params.day0_label) { ch_mle = Channel.of([id: "day0"]).merge(Channel.of([[]])).merge(ch_counts) - MAGECK_MLE_DAY0 (ch_mle) + MAGECK_MLE_DAY0 (ch_mle, ch_mle_control_sgrna) ch_versions = ch_versions.mix(MAGECK_MLE_DAY0.out.versions) MAGECK_FLUTEMLE_DAY0(MAGECK_MLE_DAY0.out.gene_summary) ch_versions = ch_versions.mix(MAGECK_FLUTEMLE_DAY0.out.versions) From c1c3d03833df9860eb1083c0bc46862e587f7e4f Mon Sep 17 00:00:00 2001 From: laurencekuhl Date: Wed, 24 Jul 2024 20:53:32 +0200 Subject: [PATCH 02/24] Fix empty channel --- workflows/crisprseq_screening.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflows/crisprseq_screening.nf b/workflows/crisprseq_screening.nf index dfd31ace..bea62811 100644 --- a/workflows/crisprseq_screening.nf +++ b/workflows/crisprseq_screening.nf @@ -265,7 +265,7 @@ workflow CRISPRSEQ_SCREENING { if(params.mle_control_sgrna) { ch_mle_control_sgrna = Channel.fromPath(params.mle_control_sgrna) } else { - ch_mle_control_sgrna = Channel.of([[]]) + ch_mle_control_sgrna = Channel.empty() } if((params.mle_design_matrix) || (params.contrasts && !params.rra) || (params.day0_label)) { From 472d8d9fbf32532554a38cead8a92cd6fc5b9d2d Mon Sep 17 00:00:00 2001 From: laurencekuhl Date: Wed, 24 Jul 2024 20:57:43 +0200 Subject: [PATCH 03/24] Ran prettier --- docs/usage/screening.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/usage/screening.md b/docs/usage/screening.md index 6b757c18..20bf0f46 100644 --- a/docs/usage/screening.md +++ b/docs/usage/screening.md @@ -109,7 +109,6 @@ If you wish to run MAGeCK MLE with the day0 label you can do so by specifying `- You can add the parameter `--mle_control_sgrna` followed by your file (one non targeting control sgRNA per line) to integrate the control sgRNA in MAGeCK MLE. - ### Running BAGEL2 BAGEL2 (Bayesian Analysis of Gene Essentiality with Location) is a computational tool developed by the Hart Lab at Harvard University. It is designed for analyzing large-scale genetic screens, particularly CRISPR-Cas9 screens, to identify genes that are essential for the survival or growth of cells under different conditions. BAGEL2 integrates information about the location of guide RNAs within a gene and leverages this information to improve the accuracy of gene essentiality predictions. From 944d98808f3abe35e7da80c6c15b05f3c8d331a7 Mon Sep 17 00:00:00 2001 From: LaurenceKuhl Date: Thu, 1 Aug 2024 13:58:13 +0200 Subject: [PATCH 04/24] Update bin/BAGEL.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Matthias Hörtenhuber --- bin/BAGEL.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/BAGEL.py b/bin/BAGEL.py index ba757feb..d57d0289 100755 --- a/bin/BAGEL.py +++ b/bin/BAGEL.py @@ -677,7 +677,6 @@ def calculate_bayes_factors( print("Iter TrainEss TrainNon TestSet") sys.stdout.flush() for loop in range(LOOPCOUNT): - # currentbf = {} printstr = "" printstr += str(loop) From 52dd1df5a59ade09aa730cfc575e50c8b57e31cb Mon Sep 17 00:00:00 2001 From: LaurenceKuhl Date: Thu, 1 Aug 2024 13:58:29 +0200 Subject: [PATCH 05/24] Update .pre-commit-config.yaml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Matthias Hörtenhuber --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7fa18afa..3c2472a9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ repos: rev: v0.4.3 hooks: - id: ruff # linter - args: [--fix, --exit-non-zero-on-fix] # sort imports and fix + args: [--fix, --exit-non-zero-on-fix, --select E4,E7,E9,F,I] # default ruff rules + import sorting - id: ruff-format # formatter - repo: https://github.com/pre-commit/mirrors-prettier rev: "v3.1.0" From 730e7b3cfa279b256999442904da50c8c3661dd5 Mon Sep 17 00:00:00 2001 From: LaurenceKuhl Date: Thu, 1 Aug 2024 13:58:38 +0200 Subject: [PATCH 06/24] Update bin/drugz.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Matthias Hörtenhuber --- bin/drugz.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/drugz.py b/bin/drugz.py index 3e822ae5..6a0a6c44 100755 --- a/bin/drugz.py +++ b/bin/drugz.py @@ -123,7 +123,6 @@ def calculate_fold_change( fc_replicate_id = "fc_{replicate}".format(replicate=replicate) fc_zscore_id = "zscore_" + fc_replicate_id empirical_bayes_id = "eb_std_{replicate}".format(replicate=replicate) - # one_based_idx = replicate + 1 # Get the control and treatment sample ids for each replicate control_sample = control_samples[replicate] From b0e45e03c59925732279ea0b9ceb768c280b1d20 Mon Sep 17 00:00:00 2001 From: LaurenceKuhl Date: Thu, 1 Aug 2024 13:58:47 +0200 Subject: [PATCH 07/24] Update bin/BAGEL.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Matthias Hörtenhuber --- bin/BAGEL.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/BAGEL.py b/bin/BAGEL.py index d57d0289..d7add161 100755 --- a/bin/BAGEL.py +++ b/bin/BAGEL.py @@ -983,7 +983,6 @@ def calculate_bayes_factors( # for loop in range(LOOPCOUNT): - # currentnbf = {} printstr = "" printstr += str(loop) From 3e9c21e0a495a6e02ac4e01d348ff0084e5ecb08 Mon Sep 17 00:00:00 2001 From: LaurenceKuhl Date: Thu, 1 Aug 2024 14:05:25 +0200 Subject: [PATCH 08/24] Update .pre-commit-config.yaml --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3c2472a9..7fa18afa 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ repos: rev: v0.4.3 hooks: - id: ruff # linter - args: [--fix, --exit-non-zero-on-fix, --select E4,E7,E9,F,I] # default ruff rules + import sorting + args: [--fix, --exit-non-zero-on-fix] # sort imports and fix - id: ruff-format # formatter - repo: https://github.com/pre-commit/mirrors-prettier rev: "v3.1.0" From 11b61b5591785dae417b637f5a4476ba032592ee Mon Sep 17 00:00:00 2001 From: laurencekuhl Date: Tue, 13 Aug 2024 12:47:45 +0200 Subject: [PATCH 09/24] Fix design matrix bug --- CHANGELOG.md | 1 + modules/local/matricescreation.nf | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d2e2955..0e5a6f11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fix cutadapt 3' and 5' no such variable found bug ([#187](https://github.com/nf-core/crisprseq/pull/187)) +- Fix design matrix bug that introduced dots instead of a hyphen ### Deprecated diff --git a/modules/local/matricescreation.nf b/modules/local/matricescreation.nf index 86c00ee4..ac876c67 100644 --- a/modules/local/matricescreation.nf +++ b/modules/local/matricescreation.nf @@ -40,6 +40,7 @@ process MATRICESCREATION { design_matrix[treatment_samples, name] <- 1 design_matrix[treatment_samples, paste0(gsub(',', '_', '$meta.treatment'),"_vs_",gsub(",","_",'$meta.reference'))] <- 1 + colnames(design_matrix) <- c("Samples", "baseline", name) # Print the design matrix to a file output_file <- paste0(gsub(',', '_', '$meta.treatment' ),"_vs_",gsub(",","_",'$meta.reference'),".txt") write.table(design_matrix, output_file, sep = "\t", quote = FALSE, row.names=FALSE) From 1a2c142c07a3b28659367fd5cefa2bf661b64ade Mon Sep 17 00:00:00 2001 From: laurencekuhl Date: Tue, 13 Aug 2024 12:52:40 +0200 Subject: [PATCH 10/24] Fix FluteMLE channels --- CHANGELOG.md | 3 ++- modules/local/mageck/flutemle.nf | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e5a6f11..8fafb666 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fix cutadapt 3' and 5' no such variable found bug ([#187](https://github.com/nf-core/crisprseq/pull/187)) -- Fix design matrix bug that introduced dots instead of a hyphen +- Fix design matrix bug that introduced dots instead of a hyphen ([#190](https://github.com/nf-core/crisprseq/pull/190)) +- Make output of FluteMLE optional as when some pathways produce bugs some channels are then empty ([#190](https://github.com/nf-core/crisprseq/pull/190)) ### Deprecated diff --git a/modules/local/mageck/flutemle.nf b/modules/local/mageck/flutemle.nf index b2b0c6cd..0dd5a9f5 100644 --- a/modules/local/mageck/flutemle.nf +++ b/modules/local/mageck/flutemle.nf @@ -12,11 +12,11 @@ process MAGECK_FLUTEMLE { tuple val(meta), path(gene_summary) output: - tuple val(meta), path("MAGeCKFlute_*/Enrichment/*") , emit: enrich - tuple val(meta), path("MAGeCKFlute_*/QC/*") , emit: qc - tuple val(meta), path("MAGeCKFlute_*/Selection/*") , emit: select - tuple val(meta), path("MAGeCKFlute_*/PathwayView/*"), emit: pathwayview - path "versions.yml" , emit: versions + tuple val(meta), path("MAGeCKFlute_*/Enrichment/*") , emit: enrich, optional: true + tuple val(meta), path("MAGeCKFlute_*/QC/*") , emit: qc, optional: true + tuple val(meta), path("MAGeCKFlute_*/Selection/*") , emit: select, optional: true + tuple val(meta), path("MAGeCKFlute_*/PathwayView/*"), emit: pathwayview, optional: true + path "versions.yml" , emit: versions, optional: true when: task.ext.when == null || task.ext.when From 8fd0285e713d73e43ac7c7c6ca1d0bddaf5cb3af Mon Sep 17 00:00:00 2001 From: LaurenceKuhl Date: Tue, 13 Aug 2024 13:35:47 +0200 Subject: [PATCH 11/24] Update nextflow.config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Júlia Mir Pedrol --- nextflow.config | 1 - 1 file changed, 1 deletion(-) diff --git a/nextflow.config b/nextflow.config index b0f80543..13d5005c 100644 --- a/nextflow.config +++ b/nextflow.config @@ -17,7 +17,6 @@ params { library = null crisprcleanr = null contrasts = null - contrasts = null mle_control_sgrna = null mle_design_matrix = null count_table = null From 256d548f2348ebee963d02452242471d8e68e80a Mon Sep 17 00:00:00 2001 From: LaurenceKuhl Date: Tue, 13 Aug 2024 13:36:02 +0200 Subject: [PATCH 12/24] Update workflows/crisprseq_screening.nf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Júlia Mir Pedrol --- workflows/crisprseq_screening.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflows/crisprseq_screening.nf b/workflows/crisprseq_screening.nf index 025bdc16..93a53914 100644 --- a/workflows/crisprseq_screening.nf +++ b/workflows/crisprseq_screening.nf @@ -265,7 +265,7 @@ workflow CRISPRSEQ_SCREENING { if(params.mle_control_sgrna) { ch_mle_control_sgrna = Channel.fromPath(params.mle_control_sgrna) } else { - ch_mle_control_sgrna = Channel.empty() + ch_mle_control_sgrna =[] } if((params.mle_design_matrix) || (params.contrasts && !params.rra) || (params.day0_label)) { From 6e37c0d879c302574e02ef10b78074025d795423 Mon Sep 17 00:00:00 2001 From: laurencekuhl Date: Tue, 13 Aug 2024 13:42:43 +0200 Subject: [PATCH 13/24] Commit suggestions, add the initialisation in the initialisation subworkflow --- .../local/utils_nfcore_crisprseq_pipeline/main.nf | 13 ++++++++++--- workflows/crisprseq_screening.nf | 11 +++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/subworkflows/local/utils_nfcore_crisprseq_pipeline/main.nf b/subworkflows/local/utils_nfcore_crisprseq_pipeline/main.nf index 1a73efd1..760d31c6 100644 --- a/subworkflows/local/utils_nfcore_crisprseq_pipeline/main.nf +++ b/subworkflows/local/utils_nfcore_crisprseq_pipeline/main.nf @@ -168,11 +168,18 @@ workflow INITIALISATION_CHANNEL_CREATION_SCREENING { ch_design = Channel.fromPath(params.mle_design_matrix) } + if(params.mle_control_sgrna) { + ch_mle_control_sgrna = Channel.fromPath(params.mle_control_sgrna) + } else { + ch_mle_control_sgrna = [] + } + emit: - library = ch_library // channel: library file - crisprcleanr = ch_crisprcleanr // channel: crisprcleanr file or value - design = ch_design // channel: design matrix file + library = ch_library // channel: library file + crisprcleanr = ch_crisprcleanr // channel: crisprcleanr file or value + design = ch_design // channel: design matrix file + mle_control_sgrna = ch_mle_control_sgrna // channel: negative control sgRNA for MAGeCK MLE } /* diff --git a/workflows/crisprseq_screening.nf b/workflows/crisprseq_screening.nf index bea62811..7512ca7b 100644 --- a/workflows/crisprseq_screening.nf +++ b/workflows/crisprseq_screening.nf @@ -262,11 +262,6 @@ workflow CRISPRSEQ_SCREENING { } - if(params.mle_control_sgrna) { - ch_mle_control_sgrna = Channel.fromPath(params.mle_control_sgrna) - } else { - ch_mle_control_sgrna = Channel.empty() - } if((params.mle_design_matrix) || (params.contrasts && !params.rra) || (params.day0_label)) { if(params.mle_design_matrix) { @@ -275,7 +270,7 @@ workflow CRISPRSEQ_SCREENING { }.set { ch_designed_mle } ch_mle = ch_designed_mle.combine(ch_counts) - MAGECK_MLE_MATRIX (ch_mle, ch_mle_control_sgrna) + MAGECK_MLE_MATRIX (ch_mle, mle_control_sgrna) ch_versions = ch_versions.mix(MAGECK_MLE_MATRIX.out.versions) MAGECK_FLUTEMLE(MAGECK_MLE_MATRIX.out.gene_summary) ch_versions = ch_versions.mix(MAGECK_FLUTEMLE.out.versions) @@ -283,7 +278,7 @@ workflow CRISPRSEQ_SCREENING { if(params.contrasts) { MATRICESCREATION(ch_contrasts) ch_mle = MATRICESCREATION.out.design_matrix.combine(ch_counts) - MAGECK_MLE (ch_mle, ch_mle_control_sgrna) + MAGECK_MLE (ch_mle, mle_control_sgrna) ch_versions = ch_versions.mix(MAGECK_MLE.out.versions) MAGECK_FLUTEMLE_CONTRASTS(MAGECK_MLE.out.gene_summary) ch_versions = ch_versions.mix(MAGECK_FLUTEMLE_CONTRASTS.out.versions) @@ -293,7 +288,7 @@ workflow CRISPRSEQ_SCREENING { } if(params.day0_label) { ch_mle = Channel.of([id: "day0"]).merge(Channel.of([[]])).merge(ch_counts) - MAGECK_MLE_DAY0 (ch_mle, ch_mle_control_sgrna) + MAGECK_MLE_DAY0 (ch_mle, mle_control_sgrna) ch_versions = ch_versions.mix(MAGECK_MLE_DAY0.out.versions) MAGECK_FLUTEMLE_DAY0(MAGECK_MLE_DAY0.out.gene_summary) ch_versions = ch_versions.mix(MAGECK_FLUTEMLE_DAY0.out.versions) From 499f8cbc98ae2d6a2fb8a82a9ac7ddd2b17fd9bc Mon Sep 17 00:00:00 2001 From: laurencekuhl Date: Tue, 13 Aug 2024 13:48:09 +0200 Subject: [PATCH 14/24] patch mageck mle --- modules/nf-core/mageck/mle/mageck-mle.diff | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/nf-core/mageck/mle/mageck-mle.diff b/modules/nf-core/mageck/mle/mageck-mle.diff index 9cb169b0..37f7de1d 100644 --- a/modules/nf-core/mageck/mle/mageck-mle.diff +++ b/modules/nf-core/mageck/mle/mageck-mle.diff @@ -1,28 +1,32 @@ Changes in module 'nf-core/mageck/mle' --- modules/nf-core/mageck/mle/main.nf +++ modules/nf-core/mageck/mle/main.nf -@@ -8,8 +8,7 @@ +@@ -8,8 +8,8 @@ 'biocontainers/mageck:0.5.9.5--py39h1f90b4d_3' }" input: - tuple val(meta), path(count_table) - path(design_matrix) + tuple val(meta), path(design_matrix), path(count_table) ++ path(mle_control_sgrna) output: tuple val(meta), path("*.gene_summary.txt") , emit: gene_summary -@@ -21,7 +20,8 @@ +@@ -21,16 +21,21 @@ script: def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" ++ def args2 = task.ext.args2 ?: '' + prefix = meta.id ?: "${meta.treatment}_vs_${meta.reference}" + def design_command = design_matrix ? "-d $design_matrix" : '' ++ def control_sgrna = mle_control_sgrna ? "--control-sgrna $mle_control_sgrna" : '' """ mageck \\ -@@ -29,8 +29,9 @@ + mle \\ $args \\ ++ $control_sgrna \\ --threads $task.cpus \\ -k $count_table \\ - -d $design_matrix \\ @@ -33,7 +37,7 @@ Changes in module 'nf-core/mageck/mle' cat <<-END_VERSIONS > versions.yml "${task.process}": -@@ -49,6 +50,5 @@ +@@ -49,6 +54,5 @@ mageck: \$(mageck -v) END_VERSIONS """ From 0844e0c83ddaf3bdef85e8735e183da379ceaa9e Mon Sep 17 00:00:00 2001 From: laurencekuhl Date: Tue, 13 Aug 2024 14:00:14 +0200 Subject: [PATCH 15/24] Add a small clarification in the doc --- docs/usage/screening.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/usage/screening.md b/docs/usage/screening.md index 20bf0f46..409e614e 100644 --- a/docs/usage/screening.md +++ b/docs/usage/screening.md @@ -89,7 +89,8 @@ Running MAGeCK MLE and BAGEL2 with a contrast file will also output a Venn diagr ### Running MAGeCK RRA only -MAGeCK RRA performs robust ranking aggregation to identify genes that are consistently ranked highly across multiple replicate screens. To run MAGeCK RRA, you can define the contrasts as previously stated in the last section (with a `.txt` extension) and also specify `--rra`. +MAGeCK RRA performs robust ranking aggregation to identify genes that are consistently ranked highly across multiple replicate screens. To run MAGeCK RRA, you can define the contrasts as previously stated in the last section with --contrasts your_file.txt(with a `.txt` extension) and also specify `--rra`. +MAGeCK RRA performs robust ranking aggregation to identify genes that are consistently ranked highly across multiple replicate screens. To run MAGeCK RRA, you can define the contrasts as previously stated in the last section with `--contrasts your_file.txt` (with a `.txt` extension) and also specify `--rra`. ### Running MAGeCK MLE only From 53aabc2903907cfd4017b27634483e92ab3dac38 Mon Sep 17 00:00:00 2001 From: LaurenceKuhl Date: Wed, 14 Aug 2024 14:26:40 +0200 Subject: [PATCH 16/24] Update modules/local/mageck/flutemle.nf Co-authored-by: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com> --- modules/local/mageck/flutemle.nf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/local/mageck/flutemle.nf b/modules/local/mageck/flutemle.nf index 0dd5a9f5..e620c446 100644 --- a/modules/local/mageck/flutemle.nf +++ b/modules/local/mageck/flutemle.nf @@ -12,11 +12,11 @@ process MAGECK_FLUTEMLE { tuple val(meta), path(gene_summary) output: - tuple val(meta), path("MAGeCKFlute_*/Enrichment/*") , emit: enrich, optional: true - tuple val(meta), path("MAGeCKFlute_*/QC/*") , emit: qc, optional: true - tuple val(meta), path("MAGeCKFlute_*/Selection/*") , emit: select, optional: true + tuple val(meta), path("MAGeCKFlute_*/Enrichment/*") , emit: enrich , optional: true + tuple val(meta), path("MAGeCKFlute_*/QC/*") , emit: qc , optional: true + tuple val(meta), path("MAGeCKFlute_*/Selection/*") , emit: select , optional: true tuple val(meta), path("MAGeCKFlute_*/PathwayView/*"), emit: pathwayview, optional: true - path "versions.yml" , emit: versions, optional: true + path "versions.yml" , emit: versions , optional: true when: task.ext.when == null || task.ext.when From 64266f75b277148a753cf5624efd6231a34f7072 Mon Sep 17 00:00:00 2001 From: laurencekuhl Date: Wed, 14 Aug 2024 16:12:04 +0200 Subject: [PATCH 17/24] Add explanations --- modules/local/matricescreation.nf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/local/matricescreation.nf b/modules/local/matricescreation.nf index ac876c67..9470b5da 100644 --- a/modules/local/matricescreation.nf +++ b/modules/local/matricescreation.nf @@ -33,6 +33,9 @@ process MATRICESCREATION { dimnames = list(all_samples, c("Samples", "baseline", name)))) + # R automatically converts "-" to "." in the column names + # so here we re-assign the column names to keep the dashes defined by the user + colnames(design_matrix) <- c("Samples", "baseline", name) # Set baseline and treatment values in the design matrix design_matrix[, "Samples"] <- rownames(design_matrix) @@ -40,7 +43,7 @@ process MATRICESCREATION { design_matrix[treatment_samples, name] <- 1 design_matrix[treatment_samples, paste0(gsub(',', '_', '$meta.treatment'),"_vs_",gsub(",","_",'$meta.reference'))] <- 1 - colnames(design_matrix) <- c("Samples", "baseline", name) + # Print the design matrix to a file output_file <- paste0(gsub(',', '_', '$meta.treatment' ),"_vs_",gsub(",","_",'$meta.reference'),".txt") write.table(design_matrix, output_file, sep = "\t", quote = FALSE, row.names=FALSE) From 4f20186bb99025fc55ed080d5784b2b7c95a7a0b Mon Sep 17 00:00:00 2001 From: laurencekuhl Date: Tue, 20 Aug 2024 09:11:12 +0200 Subject: [PATCH 18/24] Ran pre commit --- modules/nf-core/mageck/mle/mageck-mle.diff | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/nf-core/mageck/mle/mageck-mle.diff b/modules/nf-core/mageck/mle/mageck-mle.diff index 37f7de1d..bec828fb 100644 --- a/modules/nf-core/mageck/mle/mageck-mle.diff +++ b/modules/nf-core/mageck/mle/mageck-mle.diff @@ -1,4 +1,7 @@ Changes in module 'nf-core/mageck/mle' +'modules/nf-core/mageck/mle/environment.yml' is unchanged +'modules/nf-core/mageck/mle/meta.yml' is unchanged +Changes in 'mageck/mle/main.nf': --- modules/nf-core/mageck/mle/main.nf +++ modules/nf-core/mageck/mle/main.nf @@ -8,8 +8,8 @@ @@ -46,4 +49,7 @@ Changes in module 'nf-core/mageck/mle' -} + +} +'modules/nf-core/mageck/mle/tests/main.nf.test.snap' is unchanged +'modules/nf-core/mageck/mle/tests/tags.yml' is unchanged +'modules/nf-core/mageck/mle/tests/main.nf.test' is unchanged ************************************************************ From 56e07c070968f757272741cb05b341f2639dc4ff Mon Sep 17 00:00:00 2001 From: laurencekuhl Date: Tue, 20 Aug 2024 10:27:27 +0200 Subject: [PATCH 19/24] Test --- modules/nf-core/mageck/mle/mageck-mle.diff | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/nf-core/mageck/mle/mageck-mle.diff b/modules/nf-core/mageck/mle/mageck-mle.diff index bec828fb..06823614 100644 --- a/modules/nf-core/mageck/mle/mageck-mle.diff +++ b/modules/nf-core/mageck/mle/mageck-mle.diff @@ -18,6 +18,7 @@ Changes in 'mageck/mle/main.nf': @@ -21,16 +21,21 @@ script: + def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" + def args2 = task.ext.args2 ?: '' From 70b99590426c34bce4d4a0ef53028c323fab3932 Mon Sep 17 00:00:00 2001 From: laurencekuhl Date: Tue, 20 Aug 2024 10:52:50 +0200 Subject: [PATCH 20/24] Fix definition of mle_control_sgrna --- workflows/crisprseq_screening.nf | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/workflows/crisprseq_screening.nf b/workflows/crisprseq_screening.nf index 6ae85db4..0602725f 100644 --- a/workflows/crisprseq_screening.nf +++ b/workflows/crisprseq_screening.nf @@ -262,12 +262,6 @@ workflow CRISPRSEQ_SCREENING { ch_versions = ch_versions.mix(BAGEL2_GRAPH.out.versions) } - if(params.mle_control_sgrna) { - ch_mle_control_sgrna = Channel.fromPath(params.mle_control_sgrna) - } else { - ch_mle_control_sgrna =[] - } - if((params.mle_design_matrix) || (params.contrasts && !params.rra) || (params.day0_label)) { //if the user only wants to run mle through their own design matrices if(params.mle_design_matrix) { @@ -276,7 +270,7 @@ workflow CRISPRSEQ_SCREENING { }.set { ch_designed_mle } ch_mle = ch_designed_mle.combine(ch_counts) - MAGECK_MLE_MATRIX (ch_mle, mle_control_sgrna) + MAGECK_MLE_MATRIX (ch_mle, INITIALISATION_CHANNEL_CREATION_SCREENING.out.mle_control_sgrna) ch_versions = ch_versions.mix(MAGECK_MLE_MATRIX.out.versions) MAGECK_FLUTEMLE(MAGECK_MLE_MATRIX.out.gene_summary) ch_versions = ch_versions.mix(MAGECK_FLUTEMLE.out.versions) @@ -285,7 +279,7 @@ workflow CRISPRSEQ_SCREENING { if(params.contrasts) { MATRICESCREATION(ch_contrasts) ch_mle = MATRICESCREATION.out.design_matrix.combine(ch_counts) - MAGECK_MLE (ch_mle, mle_control_sgrna) + MAGECK_MLE (ch_mle, INITIALISATION_CHANNEL_CREATION_SCREENING.out.mle_control_sgrna) ch_versions = ch_versions.mix(MAGECK_MLE.out.versions) MAGECK_FLUTEMLE_CONTRASTS(MAGECK_MLE.out.gene_summary) ch_versions = ch_versions.mix(MAGECK_FLUTEMLE_CONTRASTS.out.versions) @@ -295,7 +289,7 @@ workflow CRISPRSEQ_SCREENING { } if(params.day0_label) { ch_mle = Channel.of([id: "day0"]).merge(Channel.of([[]])).merge(ch_counts) - MAGECK_MLE_DAY0 (ch_mle, mle_control_sgrna) + MAGECK_MLE_DAY0 (ch_mle, INITIALISATION_CHANNEL_CREATION_SCREENING.out.mle_control_sgrna) ch_versions = ch_versions.mix(MAGECK_MLE_DAY0.out.versions) MAGECK_FLUTEMLE_DAY0(MAGECK_MLE_DAY0.out.gene_summary) ch_versions = ch_versions.mix(MAGECK_FLUTEMLE_DAY0.out.versions) From 4673818562b8578c145c9278fabdb75963f2a052 Mon Sep 17 00:00:00 2001 From: laurencekuhl Date: Tue, 20 Aug 2024 16:00:55 +0200 Subject: [PATCH 21/24] Test --- CHANGELOG.md | 1 + README.md | 2 ++ .../crisprcleanr/normalize/crisprcleanr-normalize.diff | 8 ++++++-- modules/nf-core/crisprcleanr/normalize/main.nf | 3 ++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fafb666..2feb0c4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix cutadapt 3' and 5' no such variable found bug ([#187](https://github.com/nf-core/crisprseq/pull/187)) - Fix design matrix bug that introduced dots instead of a hyphen ([#190](https://github.com/nf-core/crisprseq/pull/190)) - Make output of FluteMLE optional as when some pathways produce bugs some channels are then empty ([#190](https://github.com/nf-core/crisprseq/pull/190)) +- Fix a typo in crisprcleanr/normalize, when a user inputs a file ### Deprecated diff --git a/README.md b/README.md index 99859c3e..efb18385 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,8 @@ We thank the following people for their extensive assistance in the development - [@SusiJo](https://github.com/SusiJo) - [@joannakraw](https://github.com/joannakraw) - [@metinyazar](https://github.com/metinyazar) +- [@metinyazar](https://github.com/metinyazar) +- [@bolenala](https://github.com/bolenala) ## Contributions and Support diff --git a/modules/nf-core/crisprcleanr/normalize/crisprcleanr-normalize.diff b/modules/nf-core/crisprcleanr/normalize/crisprcleanr-normalize.diff index daa9446f..c3438e19 100644 --- a/modules/nf-core/crisprcleanr/normalize/crisprcleanr-normalize.diff +++ b/modules/nf-core/crisprcleanr/normalize/crisprcleanr-normalize.diff @@ -1,4 +1,7 @@ Changes in module 'nf-core/crisprcleanr/normalize' +'modules/nf-core/crisprcleanr/normalize/environment.yml' is unchanged +'modules/nf-core/crisprcleanr/normalize/meta.yml' is unchanged +Changes in 'crisprcleanr/normalize/main.nf': --- modules/nf-core/crisprcleanr/normalize/main.nf +++ modules/nf-core/crisprcleanr/normalize/main.nf @@ -8,12 +8,15 @@ @@ -18,7 +21,7 @@ Changes in module 'nf-core/crisprcleanr/normalize' path "versions.yml", emit: versions when: -@@ -26,20 +29,48 @@ +@@ -26,20 +29,49 @@ """ #!/usr/bin/env Rscript library(CRISPRcleanR) @@ -51,7 +54,8 @@ Changes in module 'nf-core/crisprcleanr/normalize' + rownames(library) = library[,1] + library = library[order(rownames(library)),] + library = library[,-1] -+ count_file_to_normalize <- count_file ++ names(count_file)[names(count_file) == 'Gene'] <- 'gene' ++ count_file_to_normalize <- count_file %>% dplyr::select(sgRNA, gene, everything()) + } + + normANDfcs <- ccr.NormfoldChanges(Dframe=count_file_to_normalize,saveToFig = FALSE,min_reads=${min_reads},EXPname="${prefix}", libraryAnnotation=library,display=FALSE) diff --git a/modules/nf-core/crisprcleanr/normalize/main.nf b/modules/nf-core/crisprcleanr/normalize/main.nf index d8969379..07f286f2 100644 --- a/modules/nf-core/crisprcleanr/normalize/main.nf +++ b/modules/nf-core/crisprcleanr/normalize/main.nf @@ -55,7 +55,8 @@ process CRISPRCLEANR_NORMALIZE { rownames(library) = library[,1] library = library[order(rownames(library)),] library = library[,-1] - count_file_to_normalize <- count_file + names(count_file)[names(count_file) == 'Gene'] <- 'gene' + count_file_to_normalize <- count_file %>% dplyr::select(sgRNA, gene, everything()) } normANDfcs <- ccr.NormfoldChanges(Dframe=count_file_to_normalize,saveToFig = FALSE,min_reads=${min_reads},EXPname="${prefix}", libraryAnnotation=library,display=FALSE) From b52ee8febc3643c7df9292722d3d06629acec1a6 Mon Sep 17 00:00:00 2001 From: laurencekuhl Date: Tue, 20 Aug 2024 16:04:37 +0200 Subject: [PATCH 22/24] Update PR number --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2feb0c4c..eac1d11b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix cutadapt 3' and 5' no such variable found bug ([#187](https://github.com/nf-core/crisprseq/pull/187)) - Fix design matrix bug that introduced dots instead of a hyphen ([#190](https://github.com/nf-core/crisprseq/pull/190)) - Make output of FluteMLE optional as when some pathways produce bugs some channels are then empty ([#190](https://github.com/nf-core/crisprseq/pull/190)) -- Fix a typo in crisprcleanr/normalize, when a user inputs a file +- Fix a typo in crisprcleanr/normalize, when a user inputs a file ([#192](https://github.com/nf-core/crisprseq/pull/192)) ### Deprecated From 0d6cfc4aa3f3902963fbb8ca25542c0c3854f0dc Mon Sep 17 00:00:00 2001 From: LaurenceKuhl Date: Tue, 20 Aug 2024 19:50:41 +0200 Subject: [PATCH 23/24] Update README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Júlia Mir Pedrol --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index efb18385..9fb8bffa 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,6 @@ We thank the following people for their extensive assistance in the development - [@SusiJo](https://github.com/SusiJo) - [@joannakraw](https://github.com/joannakraw) - [@metinyazar](https://github.com/metinyazar) -- [@metinyazar](https://github.com/metinyazar) - [@bolenala](https://github.com/bolenala) ## Contributions and Support From 671ca2ff101d0de9642a88dd33fa7e62ea6ffcb9 Mon Sep 17 00:00:00 2001 From: laurencekuhl Date: Wed, 21 Aug 2024 09:22:22 +0200 Subject: [PATCH 24/24] Alphabetically sort the order --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9fb8bffa..6841ca44 100644 --- a/README.md +++ b/README.md @@ -126,15 +126,15 @@ Main developers: We thank the following people for their extensive assistance in the development of this pipeline: - [@alan-tracey](https://github.com/alan-tracey) +- [@bolenala](https://github.com/bolenala) - [@ggabernet](https://github.com/ggabernet) - [@jianhong](https://github.com/jianhong) +- [@joannakraw](https://github.com/joannakraw) - [@mashehu](https://github.com/mashehu) +- [@metinyazar](https://github.com/metinyazar) - [@msanvicente](https://github.com/msanvicente) - [@mschaffer-incyte](https://github.com/mschaffer-incyte) - [@SusiJo](https://github.com/SusiJo) -- [@joannakraw](https://github.com/joannakraw) -- [@metinyazar](https://github.com/metinyazar) -- [@bolenala](https://github.com/bolenala) ## Contributions and Support