From 00ec14ba46d460d6c0467913d32a662dbbe5a1f8 Mon Sep 17 00:00:00 2001
From: aduvermy <arnaud.duvermy@ens-lyon.fr>
Date: Mon, 25 Mar 2024 10:33:19 +0100
Subject: [PATCH] fix message info genes counts bellow_threshold

Former-commit-id: 2ed2a843ffdbbbfa3ec776f680b64d984d2820bb
Former-commit-id: 6b71038e295cdf928de3c50bbf20f662b6a08e86
Former-commit-id: 8b0724d579460dbe992e11c6fba60a693d77da75
---
 R/mock_rnaseq.R      | 2 +-
 R/prepare_data2fit.R | 2 +-
 R/utils.R            | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/R/mock_rnaseq.R b/R/mock_rnaseq.R
index 89ae03e..ce43744 100644
--- a/R/mock_rnaseq.R
+++ b/R/mock_rnaseq.R
@@ -80,7 +80,7 @@ get_messages_sequencing_depth <- function(scaling_factors, threshold_cov_var = 1
 warning_too_low_mu_ij_row <- function(mu_ij_matrix, threshold = 1 ){
   n_too_low_row <- length(which(detect_row_matx_bellow_threshold(mu_ij_matrix, threshold)))
   if (n_too_low_row > 0){
-    msg <- paste("INFO:", n_too_low_row, "genes have all(mu_ij) < 1, indicating very low counts. Consider removing them for future analysis using prepareData2fit with row_cnt_threshold = 10. To detect them, try increasing sequencing depth.\n", 
+    msg <- paste("INFO:", n_too_low_row, "genes have all(mu_ij) < 1, indicating very low counts. Consider removing them for future analysis using prepareData2fit with row_threshold = 10. To detect them in future experiment, try increasing sequencing depth.\n", 
                  sep = " ")
     message(msg)
   }
diff --git a/R/prepare_data2fit.R b/R/prepare_data2fit.R
index 03d1f1f..e10e1fd 100644
--- a/R/prepare_data2fit.R
+++ b/R/prepare_data2fit.R
@@ -147,7 +147,7 @@ prepareData2fit <- function(countMatrix, metadata, response_name = "kij",
   if (row_threshold > 0){          
       message(paste("INFO: filtering", response_name, "<", row_threshold, sep = " " ))
       idx <- detect_row_matx_bellow_threshold(countMatrix, threshold = row_threshold)
-      message(paste(length(idx), "genes removed from data.", sep = " "))
+      message(paste(length(which(idx)), "genes removed from data.", sep = " "))
       countMatrix <- countMatrix[ !idx , ]
   }
   
diff --git a/R/utils.R b/R/utils.R
index 7e2bb8f..ae4ac4e 100644
--- a/R/utils.R
+++ b/R/utils.R
@@ -54,7 +54,7 @@ first_non_null_index <- function(lst) {
 #' @return A logical vector indicating rows below the threshold
 #' @export
 detect_row_matx_bellow_threshold <- function(matrix, threshold) {
-             apply(matrix, 1, function(row) all(row < threshold))
+    apply(matrix, 1, function(row) all(row < threshold))
 }
 
 
-- 
GitLab