From f8e7911e2cb2b383b09a8cdbca98ea86505ae9c5 Mon Sep 17 00:00:00 2001 From: Nico Trummer Date: Fri, 26 Apr 2024 18:04:48 +0200 Subject: [PATCH] Editorconfig --- modules/local/motifs/convert_motifs/main.nf | 6 ++-- .../motifs/convert_motifs/templates/convert.R | 28 +++++++++---------- modules/local/motifs/fetch_jaspar/main.nf | 2 +- modules/local/motifs/filter_motifs/main.nf | 6 ++-- modules/local/motifs/transfac_to_psem/main.nf | 6 ++-- .../transfac_to_psem/templates/convert.py | 6 ++-- subworkflows/local/motifs.nf | 4 +-- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/modules/local/motifs/convert_motifs/main.nf b/modules/local/motifs/convert_motifs/main.nf index 97f70d4..5b47a79 100644 --- a/modules/local/motifs/convert_motifs/main.nf +++ b/modules/local/motifs/convert_motifs/main.nf @@ -10,12 +10,12 @@ process CONVERT_MOTIFS { input: tuple val(meta), path(in_file), val(in_type) val(out_type) - + output: tuple val(meta), path("${out_file}"), emit: converted path "versions.yml" , emit: versions - + script: out_file = "${meta.id}.converted.${out_type}" template "convert.R" -} \ No newline at end of file +} diff --git a/modules/local/motifs/convert_motifs/templates/convert.R b/modules/local/motifs/convert_motifs/templates/convert.R index a7fe3c3..40e4ab1 100644 --- a/modules/local/motifs/convert_motifs/templates/convert.R +++ b/modules/local/motifs/convert_motifs/templates/convert.R @@ -8,32 +8,32 @@ in_type <- "$in_type" allowed_in_types <- c("cisbp", "homer", "jaspar", "meme", "transfac", "uniprobe", "universal") if (!(in_type %in% allowed_in_types)) { - stop("Input type '", in_type, "' not supported. Supported types are: ", paste(allowed_in_types, collapse=", ")) + stop("Input type '", in_type, "' not supported. Supported types are: ", paste(allowed_in_types, collapse=", ")) } out_type <- "$out_type" allowed_out_types <- c("homer", "jaspar", "meme", "transfac", "universal") if (!(out_type %in% allowed_out_types)) { - stop("Output type '", out_type, "' not supported. Supported types are: ", paste(allowed_out_types, collapse=", ")) + stop("Output type '", out_type, "' not supported. Supported types are: ", paste(allowed_out_types, collapse=", ")) } u.motif <- switch(in_type, - cisbp = read_cisbp, - homer = read_homer, - jaspar = read_jaspar, - meme = read_meme, - transfac = read_transfac, - uniprobe = read_uniprobe, - universal = readRDS + cisbp = read_cisbp, + homer = read_homer, + jaspar = read_jaspar, + meme = read_meme, + transfac = read_transfac, + uniprobe = read_uniprobe, + universal = readRDS )(in_file) switch(out_type, - homer = write_homer, - jaspar = write_jaspar, - meme = write_meme, - transfac = write_transfac, - universal = saveRDS + homer = write_homer, + jaspar = write_jaspar, + meme = write_meme, + transfac = write_transfac, + universal = saveRDS )(u.motif, "$out_file") writeLines( diff --git a/modules/local/motifs/fetch_jaspar/main.nf b/modules/local/motifs/fetch_jaspar/main.nf index 60454c7..eee64d5 100644 --- a/modules/local/motifs/fetch_jaspar/main.nf +++ b/modules/local/motifs/fetch_jaspar/main.nf @@ -16,4 +16,4 @@ process FETCH_JASPAR { script: template "fetch_jaspar.py" -} \ No newline at end of file +} diff --git a/modules/local/motifs/filter_motifs/main.nf b/modules/local/motifs/filter_motifs/main.nf index 7b885e9..2b8e0a1 100644 --- a/modules/local/motifs/filter_motifs/main.nf +++ b/modules/local/motifs/filter_motifs/main.nf @@ -10,12 +10,12 @@ process FILTER_MOTIFS { input: tuple val(meta), path(in_file) tuple val(meta2), path(tfs) - + output: tuple val(meta), path("${out_file}"), emit: filtered path "versions.yml" , emit: versions - + script: out_file = "${meta.id}.filtered.RDS" template "filter_motifs.R" -} \ No newline at end of file +} diff --git a/modules/local/motifs/transfac_to_psem/main.nf b/modules/local/motifs/transfac_to_psem/main.nf index 1933f99..9254f4a 100644 --- a/modules/local/motifs/transfac_to_psem/main.nf +++ b/modules/local/motifs/transfac_to_psem/main.nf @@ -9,11 +9,11 @@ process TRANSFAC_TO_PSEM { input: tuple val(meta), path(transfac) - + output: tuple val(meta), path("*.psem"), emit: psem path "versions.yml" , emit: versions - + script: template "convert.py" -} \ No newline at end of file +} diff --git a/modules/local/motifs/transfac_to_psem/templates/convert.py b/modules/local/motifs/transfac_to_psem/templates/convert.py index ae4c396..369ab43 100644 --- a/modules/local/motifs/transfac_to_psem/templates/convert.py +++ b/modules/local/motifs/transfac_to_psem/templates/convert.py @@ -46,10 +46,10 @@ def write_pwm(f, matrix, name, ma_id): pwm = np.zeros_like(matrix) - for i, active, active_content, other, other_content in zip([A, C, G, T], - [maxAT, maxGC, maxGC, maxAT], + for i, active, active_content, other, other_content in zip([A, C, G, T], + [maxAT, maxGC, maxGC, maxAT], [at_content, gc_content, gc_content, at_content], - [maxGC, maxAT, maxAT, maxGC], + [maxGC, maxAT, maxAT, maxGC], [gc_content, at_content, at_content, gc_content]): pwm[:, i] = np.where(active