From b8dc66ec8ed9d3755f52ddf42068928de8233bb2 Mon Sep 17 00:00:00 2001 From: Gisela Gabernet Date: Wed, 17 Jul 2024 13:35:23 -0400 Subject: [PATCH] add locus selection to rnaseq workflow --- conf/modules.config | 8 ++++++++ ...rsedb_select.nf => changeo_parsedb_select_locus.nf} | 10 +++------- subworkflows/local/rnaseq_input.nf | 6 +++++- 3 files changed, 16 insertions(+), 8 deletions(-) rename modules/local/changeo/{changeo_parsedb_select.nf => changeo_parsedb_select_locus.nf} (72%) diff --git a/conf/modules.config b/conf/modules.config index 3dc63fa9..dd315b85 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -422,6 +422,14 @@ process { ] } + withName: CHANGEO_PARSEDB_SELECT_LOCUS { + publishDir = [ + path: { "${params.outdir}/vdj_annotation/select-locus/${meta.id}" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + withName: CHANGEO_PARSEDB_SPLIT { publishDir = [ path: { "${params.outdir}/vdj_annotation/04-select-productive/${meta.id}" }, diff --git a/modules/local/changeo/changeo_parsedb_select.nf b/modules/local/changeo/changeo_parsedb_select_locus.nf similarity index 72% rename from modules/local/changeo/changeo_parsedb_select.nf rename to modules/local/changeo/changeo_parsedb_select_locus.nf index 2bba4916..32805c26 100644 --- a/modules/local/changeo/changeo_parsedb_select.nf +++ b/modules/local/changeo/changeo_parsedb_select_locus.nf @@ -1,4 +1,4 @@ -process CHANGEO_PARSEDB_SELECT { +process CHANGEO_PARSEDB_SELECT_LOCUS { tag "$meta.id" label 'process_low' label 'immcantation' @@ -18,25 +18,21 @@ process CHANGEO_PARSEDB_SELECT { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - def args2 = task.ext.args2 ?: '' if (meta.locus.toUpperCase() == 'IG'){ """ - ParseDb.py select -d $tab $args --outname ${meta.id} > ${meta.id}_select_command_log.txt + ParseDb.py select -d $tab -f locus -u "IG[HKL]" --regex --outname ${meta.id} > ${meta.id}_select_command_log.txt cat <<-END_VERSIONS > versions.yml "${task.process}": - igblastn: \$( igblastn -version | grep -o "igblast[0-9\\. ]\\+" | grep -o "[0-9\\. ]\\+" ) changeo: \$( ParseDb.py --version | awk -F' ' '{print \$2}' ) END_VERSIONS """ } else if (meta.locus.toUpperCase() == 'TR'){ """ - ParseDb.py select -d $tab $args2 --outname ${meta.id} > "${meta.id}_command_log.txt" + ParseDb.py select -d $tab -f locus -u "TR[ABDG]" --regex --outname ${meta.id} > "${meta.id}_command_log.txt" cat <<-END_VERSIONS > versions.yml "${task.process}": - igblastn: \$( igblastn -version | grep -o "igblast[0-9\\. ]\\+" | grep -o "[0-9\\. ]\\+" ) changeo: \$( ParseDb.py --version | awk -F' ' '{print \$2}' ) END_VERSIONS """ diff --git a/subworkflows/local/rnaseq_input.nf b/subworkflows/local/rnaseq_input.nf index a04898dd..12253f5a 100644 --- a/subworkflows/local/rnaseq_input.nf +++ b/subworkflows/local/rnaseq_input.nf @@ -1,6 +1,7 @@ include { PREPARE_TRUST4_REFERENCE } from '../../modules/local/prepare_trust4_reference' include { TRUST4 } from '../../modules/nf-core/trust4/main' include { FASTQ_INPUT_CHECK } from '../../subworkflows/local/fastq_input_check' +include { CHANGEO_PARSEDB_SELECT_LOCUS } from '../../modules/local/changeo/changeo_parsedb_select_locus' include { CHANGEO_CONVERTDB_FASTA as CHANGEO_CONVERTDB_FASTA_FROM_AIRR } from '../../modules/local/changeo/changeo_convertdb_fasta' include { FASTP } from '../../modules/nf-core/fastp/main' include { RENAME_FASTQ as RENAME_FASTQ_TRUST4 } from '../../modules/local/rename_fastq' @@ -106,10 +107,13 @@ workflow RNASEQ_INPUT { // create channel with airr file ch_trust4_airr_file.bulk.mix ( ch_trust4_airr_file.sc ).set { ch_trust4_airr } + // select only provided locus + CHANGEO_PARSEDB_SELECT_LOCUS(ch_trust4_airr) + // convert airr tsv to fasta CHANGEO_CONVERTDB_FASTA_FROM_AIRR( - ch_trust4_airr + CHANGEO_PARSEDB_SELECT_LOCUS.out.tab ) ch_fasta = CHANGEO_CONVERTDB_FASTA_FROM_AIRR.out.fasta