From 7140ac8c62f8ad6c8d03496008a2df3fe43acdc9 Mon Sep 17 00:00:00 2001 From: Laurent Modolo <laurent.modolo@ens-lyon.fr> Date: Wed, 25 Oct 2023 14:49:39 +0200 Subject: [PATCH] add kmermerclust_clust process and switch to v0.1.0 of kmerclust --- src/bin/kmerclust_boot.R | 9 +++++++-- src/main.nf | 1 + src/modules/kmerclust.nf | 26 +++++++++++++------------- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/bin/kmerclust_boot.R b/src/bin/kmerclust_boot.R index d5c9a96..f2ecc17 100644 --- a/src/bin/kmerclust_boot.R +++ b/src/bin/kmerclust_boot.R @@ -1,11 +1,16 @@ library(kmerclust) +library(tidyverse) args <- commandArgs(trailingOnly = TRUE) print(args) load(file = paste0(args[1], ".Rdata")) res <- count %>% dplyr::select(count_m, count_f) %>% + mutate( + count_m = round(count_m), + count_f = round(count_f) + ) %>% + dplyr::filter(count_m + count_f > 0) %>% as.matrix() %>% - poiss_compare_models(count, nboot = as.numeric(args[2]) * 2, frac = 1e-3, bootsize = 1, core = as.numeric(args[2])) + poiss_compare_models(count, nboot = as.numeric(args[2]) * 2, nbatch = 100, max_iter = 1e4, bootsize = 1, core = as.numeric(args[2])) save(res, file = paste0(args[1], "_boot_", args[3], ".Rdata")) - diff --git a/src/main.nf b/src/main.nf index dd2bba6..877692c 100644 --- a/src/main.nf +++ b/src/main.nf @@ -35,6 +35,7 @@ workflow { COLLATEKMER(MERGEKMER.out.csv.map{it -> [it[0].specie, it[1]] }.groupTuple()) KMERCLUST_LOAD(COLLATEKMER.out.csv, params_csv.collect()) KMERCLUST_BOOT(Channel.of(1..params.bootstrap).combine(KMERCLUST_LOAD.out.rdata)) + KMERCLUST_CLUST(Channel.of(["XY", "XO", "OO"]).combine(KMERCLUST_LOAD.out.rdata)) KMERCLUST_MERGE(KMERCLUST_BOOT.out.rdata.groupTuple()) KMERCLUST_PLOT(KMERCLUST_MERGE.out.rdata.mix(KMERCLUST_LOAD.out.rdata).groupTuple()) } diff --git a/src/modules/kmerclust.nf b/src/modules/kmerclust.nf index 61842d6..e8115b5 100644 --- a/src/modules/kmerclust.nf +++ b/src/modules/kmerclust.nf @@ -2,7 +2,7 @@ process KMERCLUST_LOAD { tag "$specie" label 'big_mem_mono_cpus' - container "lbmc/kmerclust:0.0.7" + container "lbmc/kmerclust:0.1.0" publishDir "results/${params.kmer_size}/${specie}/", mode: 'copy' input: @@ -20,7 +20,7 @@ process KMERCLUST_LOAD { cat <<-END_VERSIONS > versions.yml "${task.process}": - Rkmerclust: 0.0.7 + Rkmerclust: 0.1.0 END_VERSIONS """ } @@ -29,7 +29,7 @@ process KMERCLUST_BOOT { tag "$specie" label 'big_mem_multi_cpus' - container "lbmc/kmerclust:0.0.7" + container "lbmc/kmerclust:0.1.0" publishDir "results/${params.kmer_size}/${specie}/", mode: 'copy' input: @@ -46,16 +46,16 @@ process KMERCLUST_BOOT { cat <<-END_VERSIONS > versions.yml "${task.process}": - Rkmerclust: 0.0.7 + Rkmerclust: 0.1.0 END_VERSIONS """ } -process KMERCLUST { +process KMERCLUST_CLUST { tag "$specie" - label 'big_mem_multi_cpus' + label 'small_mem_mono_cpus' - container "lbmc/kmerclust:0.0.7" + container "lbmc/kmerclust:0.1.0" publishDir "results/${params.kmer_size}/${specie}/", mode: 'copy' input: @@ -68,11 +68,11 @@ process KMERCLUST { script: def args = task.ext.args ?: '' """ - Rscript ${projectDir}/bin/kmerclust.R ${specie} ${task.cpus} + Rscript ${projectDir}/bin/kmerclust_clust.R ${specie} ${task.cpus} ${id} cat <<-END_VERSIONS > versions.yml "${task.process}": - Rkmerclust: 0.0.7 + Rkmerclust: 0.1.0 END_VERSIONS """ } @@ -81,7 +81,7 @@ process KMERCLUST_MERGE { tag "$specie" label 'big_mem_mono_cpus' - container "lbmc/kmerclust:0.0.7" + container "lbmc/kmerclust:0.1.0" publishDir "results/${params.kmer_size}/${specie}/", mode: 'copy' input: @@ -98,7 +98,7 @@ process KMERCLUST_MERGE { cat <<-END_VERSIONS > versions.yml "${task.process}": - Rkmerclust: 0.0.7 + Rkmerclust: 0.1.0 END_VERSIONS """ } @@ -107,7 +107,7 @@ process KMERCLUST_PLOT { tag "$specie" label 'big_mem_mono_cpus' - container "lbmc/kmerclust:0.0.7" + container "lbmc/kmerclust:0.1.0" publishDir "results/${params.kmer_size}/${specie}/", mode: 'copy' input: @@ -124,7 +124,7 @@ process KMERCLUST_PLOT { cat <<-END_VERSIONS > versions.yml "${task.process}": - Rkmerclust: 0.0.7 + Rkmerclust: 0.1.0 END_VERSIONS """ } -- GitLab