From 892a8f38a6add7898d5f53b386326b5c011e4457 Mon Sep 17 00:00:00 2001 From: Gene233 Date: Wed, 27 Mar 2024 03:02:00 +1100 Subject: [PATCH] Remove un-used codes and use && instead of & in condition. --- R/tf_idf_iae_wrappers.R | 2 -- R/top_markers.R | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/R/tf_idf_iae_wrappers.R b/R/tf_idf_iae_wrappers.R index f722949..206b8a3 100644 --- a/R/tf_idf_iae_wrappers.R +++ b/R/tf_idf_iae_wrappers.R @@ -79,7 +79,6 @@ idf <- function(expr, features = NULL, thres = 0) { #' smartid:::idf_m(data) idf_m <- function(expr, features = NULL, thres = 0) { if (is.null(features)) features <- seq_len(nrow(expr)) - n_obs <- ncol(expr) ## number of total obs # thres <- 0 # thres <- sparseMatrixStats::rowQuantiles(expr, probs = 0.25, na.rm = TRUE) @@ -359,7 +358,6 @@ iae <- function(expr, features = NULL, thres = 0) { #' smartid:::iae_m(data) iae_m <- function(expr, features = NULL, thres = 0) { if (is.null(features)) features <- seq_len(nrow(expr)) - n_obs <- ncol(expr) ## number of total obs # thres <- 0 # thres <- sparseMatrixStats::rowQuantiles(expr, probs = 0.25, na.rm = TRUE) diff --git a/R/top_markers.R b/R/top_markers.R index 01374ef..d7a095b 100644 --- a/R/top_markers.R +++ b/R/top_markers.R @@ -65,9 +65,9 @@ top_markers_abs <- function(data, label, n = 10, scale = TRUE, use.mgm = TRUE, softmax = TRUE) { method <- match.arg(method) - if (scale & use.mgm) { + if (scale && use.mgm) { data <- scale_mgm(expr = data, label = label) - } else if (scale & !use.mgm) { + } else if (scale && !use.mgm) { ## scale scores on rows # mu_s <- sparseMatrixStats::rowMeans2(data, na.rm = TRUE) # sd_s <- sparseMatrixStats::rowSds(data, na.rm = TRUE) @@ -126,7 +126,7 @@ top_markers_glm <- function(data, label, n = 10, label <- factor(label) # factorize label ## scale - if (scale & !use.mgm) { + if (scale && !use.mgm) { ## scale scores on rows # mu_s <- sparseMatrixStats::rowMeans2(data, na.rm = TRUE) # sd_s <- sparseMatrixStats::rowSds(data, na.rm = TRUE) @@ -134,7 +134,7 @@ top_markers_glm <- function(data, label, n = 10, data <- t(scale(t(data))) data[is.na(data)] <- 0 # assign 0 to NA when sd = 0 - } else if (scale & use.mgm) { + } else if (scale && use.mgm) { data <- scale_mgm(expr = data, label = label) }