From 58e5e408077db18dd879de868f6db94a14cc2012 Mon Sep 17 00:00:00 2001 From: ShixiangWang Date: Wed, 15 May 2024 00:55:44 +0800 Subject: [PATCH] fix cran test issue --- CRAN-SUBMISSION | 4 ++-- R/vis_dim_dist.R | 4 ++-- R/vis_identifier_dim_dist.R | 36 ++++++++++++++++++++++++------------ 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION index c2a9698a..db95db22 100644 --- a/CRAN-SUBMISSION +++ b/CRAN-SUBMISSION @@ -1,3 +1,3 @@ Version: 2.1.0 -Date: 2024-05-13 12:01:17 UTC -SHA: bf3ca4cfce6fe45d44ca50ba5b624bbc448c6a13 +Date: 2024-05-14 16:54:49 UTC +SHA: 6d114397c129f2d8eec8e36f19e0a5054d77b306 diff --git a/R/vis_dim_dist.R b/R/vis_dim_dist.R index 66cc5e50..e26d5104 100644 --- a/R/vis_dim_dist.R +++ b/R/vis_dim_dist.R @@ -51,8 +51,8 @@ vis_dim_dist <- function(ids = c("TP53", "KRAS", "PTEN", "MDM2", "CDKN1A"), }) %>% purrr::reduce(dplyr::full_join, by = "Sample") }, error = function(e) { - rlang::warn("access data failed, the message is provided below") - print(e$message) + rlang::inform("access data failed, the message is provided below") + rlang::warn(conditionMessage(e)) NULL } ) diff --git a/R/vis_identifier_dim_dist.R b/R/vis_identifier_dim_dist.R index 256eb334..732b3102 100644 --- a/R/vis_identifier_dim_dist.R +++ b/R/vis_identifier_dim_dist.R @@ -45,18 +45,30 @@ vis_identifier_dim_dist = function(dataset = NULL, ids = NULL, grp_df, samples = colnames(grp_df)[1] <- "sample" if (!is.null(dataset) && !is.null(ids)) { - df <- purrr::map(ids, function(x) { - message("Querying data of identifier ", x, " from dataset ", dataset, " for DR") - data <- if (dataset == "custom_feature_dataset") query_custom_feature_value(x) else - query_molecule_value(dataset, x) - data <- dplyr::tibble( - sample = names(data), - y = as.numeric(data) - ) - colnames(data)[2] <- x - data - }) %>% - purrr::reduce(dplyr::full_join, by = "sample") + + df <- tryCatch( + { + purrr::map(ids, function(x) { + message("Querying data of identifier ", x, " from dataset ", dataset, " for DR") + data <- if (dataset == "custom_feature_dataset") query_custom_feature_value(x) else + query_molecule_value(dataset, x) + data <- dplyr::tibble( + sample = names(data), + y = as.numeric(data) + ) + colnames(data)[2] <- x + data + }) %>% + purrr::reduce(dplyr::full_join, by = "sample") + }, + error = function(e) { + rlang::inform("access data failed, the message is provided below") + rlang::warn(conditionMessage(e)) + NULL + } + ) + if (is.null(df)) return(NULL) + df <- dplyr::inner_join(grp_df, df, by = "sample") } else { message("Directly use 'grp_df' for comparison analysis.")