diff --git a/modules/rklib/rk_check_complementary/main.nf b/modules/rklib/rk_check_complementary/main.nf index 308db07..dddec7b 100644 --- a/modules/rklib/rk_check_complementary/main.nf +++ b/modules/rklib/rk_check_complementary/main.nf @@ -7,7 +7,7 @@ options = initOptions(params.options) def VERSION = '0.0' process RKLIB_CHECK_COMPLEMENTARY { - tag "$meta.id" + tag "$meta.id $meta_compl.id" label 'process_low' publishDir "${params.outdir}", mode: params.publish_dir_mode, @@ -22,13 +22,14 @@ process RKLIB_CHECK_COMPLEMENTARY { val(meta_compl) output: - tuple val(meta), path("*.complHits.tsv"), emit: hits + tuple val(meta), path("*.tsv"), emit: hits path "*.version.txt" , emit: version script: def software = getSoftwareName(task.process) def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" + def complName = meta_compl.getOrDefault("id", "compl") def rna_compl_length = meta_compl.length as Integer def extraN = "N"*(500+3*rna_compl_length) @@ -87,13 +88,17 @@ process RKLIB_CHECK_COMPLEMENTARY { # Merge two tabular outputs: # 1. Design header head -n 1 ${prefix}.hits_compl.R1.tsv \\ - | sed 's/\\t/_compl_R1\\t/g' | sed 's/\$/_compl_R1/' | sed 's/#//g' | tr '\\n' '\\t' > ${prefix}.complHits.tsv + | sed 's/\\t/_${complName}_R1\\t/g' | sed 's/\$/_${complName}_R1/' | sed 's/#//g' | tr '\\n' '\\t' > ${prefix}.${complName}.tsv head -n 1 ${prefix}.hits_compl.R2.tsv \\ - | sed 's/\\t/_compl_R2\\t/g' | sed 's/\$/_compl_R2/' | sed 's/#//g' | tr '\\n' '\\t' >> ${prefix}.complHits.tsv - sed -i "s/\\t\$/\\n/" ${prefix}.complHits.tsv + | sed 's/\\t/_${complName}_R2\\t/g' | sed 's/\$/_${complName}_R2/' | sed 's/#//g' | tr '\\n' '\\t' >> ${prefix}.${complName}.tsv + sed -i "s/\\t\$/\\n/" ${prefix}.${complName}.tsv # 2. Write to the body paste <(tail -n +2 ${prefix}.hits_compl.R1.tsv) \\ - <(tail -n +2 ${prefix}.hits_compl.R2.tsv) >> ${prefix}.complHits.tsv + <(tail -n +2 ${prefix}.hits_compl.R2.tsv) >> ${prefix}.${complName}.tsv + + # Remove temporary files: + rm ${prefix}.hits_compl.R1.tsv + rm ${prefix}.hits_compl.R2.tsv echo $VERSION > ${software}.version.txt """ diff --git a/params-redc.yml b/params-redc.yml index 02cc43c..ddcdf34 100644 --- a/params-redc.yml +++ b/params-redc.yml @@ -1,4 +1,4 @@ -input: 'samplesheet_redc.csv' # required +input: 'samplesheet_test.csv' # required cache: 'lenient' outdir: "output_redc/" enable_conda: true @@ -106,6 +106,10 @@ oligos: expected_length: 16 right_to_left: true # Search right-to-left (3'-5') instead of regular left-to-right (5'-3') +# The output of "short_oligos" section will be added to the output stats as: +# oligo__at_35 +# for example: +# oligo_ga_at_35 short_oligos: ga: sequence: 'GA' @@ -120,13 +124,23 @@ short_oligos: # position: 0 # side: 2 +# The output of the "complementary" section will be added to the output stats as: +# start_hit_<title>_R1, end_hit_<title>_R1, start_hit_<title>_R2, end_hit_<title>_R2 +# for example: +# start_hit_compl_R1, end_hit_compl_R1, start_hit_compl_R2, end_hit_compl_R2 complementary: - length: 14 - left_side: 1 - left_reference_oligo: bridge_forward - right_side: 2 - right_reference_oligo: ggg - + compl: + length: 14 + left_side: 1 + left_reference_oligo: bridge_forward + right_side: 2 + right_reference_oligo: ggg +# compl_additional: +# length: 8 +# left_side: 1 +# left_reference_oligo: bridge_forward +# right_side: 2 +# right_reference_oligo: ggg fragments: # dna_noext: diff --git a/subworkflows/local/oligos_map.nf b/subworkflows/local/oligos_map.nf index da2261b..e999fa0 100644 --- a/subworkflows/local/oligos_map.nf +++ b/subworkflows/local/oligos_map.nf @@ -100,7 +100,15 @@ workflow OLIGOS_MAP { HitsComplementary = Channel.empty() } else { /* Step 1: Collect information about left and right side of complementary regions */ - ComplementaryInput = Channel.from(params.complementary) + ComplementaryInput = Channel + .from( params.complementary.keySet().withIndex() ) + .map { it, idx -> [it, idx, params.complementary[it]] } // meta for each complementary fragment + .map { compl_name, idx, meta -> + meta.id = compl_name + meta.idx = idx + meta.single_end = true + [meta] + }.view() InputComplementary = TableChunks .combine(IndexedFastqs)