From 1c0e4099c5d79a0ec4813c3465ea7c2c4938cc7c Mon Sep 17 00:00:00 2001
From: Laurent Modolo <laurent.modolo@ens-lyon.fr>
Date: Tue, 13 Jun 2023 15:31:28 +0200
Subject: [PATCH] fix kmer_merge to kmer_plot connection

---
 src/bin/kmerclust_merge.R | 3 ++-
 src/bin/kmerclust_plot.R  | 7 ++++---
 src/main.nf               | 4 ++--
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/bin/kmerclust_merge.R b/src/bin/kmerclust_merge.R
index cadf100..675b3da 100644
--- a/src/bin/kmerclust_merge.R
+++ b/src/bin/kmerclust_merge.R
@@ -3,10 +3,11 @@ library(kmerclust)
 args <- commandArgs(trailingOnly = TRUE)
 print(args)
 res_files <- list.files(pattern = "Rdata$")
+print(res_files)
 res_total <- NULL
 for (res_file in res_files) {
   load(res_file)
   res_total <- rbind(res_total, res)
 }
 res <- res_total
-save(res, file = paste0(args[1], "_boot", ".Rdata"))
+save(res, file = paste0(args[1], "_boot.Rdata"))
diff --git a/src/bin/kmerclust_plot.R b/src/bin/kmerclust_plot.R
index 42d1aab..9f7bca8 100644
--- a/src/bin/kmerclust_plot.R
+++ b/src/bin/kmerclust_plot.R
@@ -6,17 +6,18 @@ print(args)
 load(file = paste0(args[1], ".Rdata"))
 load(file = paste0(args[1], "_boot.Rdata"))
 
+print(res)
 res %>%
   ggplot(aes(x = name, y = BIC)) +
-  geom_violin() %>%
+  geom_violin() +
   theme_bw()
 ggsave(paste0(args[1], "_BIC.pdf"))
 res %>%
   ggplot(aes(x = name, y = WSS_f / BSS)) +
-  geom_violin() %>%
+  geom_violin() +
   theme_bw()
 ggsave(paste0(args[1], "_WSS_BSS.pdf"))
 count %>%
-  ggplot(aes(x = count_m, y = count_f)) %>%
+  ggplot(aes(x = count_m, y = count_f)) +
   theme_bw()
 ggsave(paste0(args[1], "_scatter.pdf"))
diff --git a/src/main.nf b/src/main.nf
index 423c4d3..174ca75 100644
--- a/src/main.nf
+++ b/src/main.nf
@@ -33,6 +33,6 @@ workflow {
   COLLATEKMER(MERGEKMER.out.csv.map{it -> [it[0].specie, it[1]] }.groupTuple())
   KMERCLUST_LOAD(COLLATEKMER.out.csv, params_csv.collect())
   KMERCLUST(Channel.of(1..params.bootstrap).combine(KMERCLUST_LOAD.out.rdata))
-  KMERCLUST_MERGE(KMERCLUST.out.rdata.map{it -> [it[1], it[2]]}.groupTuple())
-  KMERCLUST_PLOT(KMERCLUST_MERGE.out.rdata)
+  KMERCLUST_MERGE(KMERCLUST.out.rdata.groupTuple())
+  KMERCLUST_PLOT(KMERCLUST_MERGE.out.rdata.mix(KMERCLUST_LOAD.out.rdata).groupTuple())
 }
-- 
GitLab