Skip to content

Commit

Permalink
Result precision (#113)
Browse files Browse the repository at this point in the history
* Update plot_cpdb.R

* Update DESCRIPTION
  • Loading branch information
zktuong authored Jun 28, 2024
1 parent ca82013 commit 18c0ac0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: ktplots
Title: Plot single-cell data dotplots
Version: 2.3.0
Version: 2.4.0
Authors@R: person("Kelvin", "Tuong", email = c("[email protected]"), role = c("aut", "cre"))
Description: Plotting tools for scData.
License: MIT + file LICENSE
Expand Down
4 changes: 3 additions & 1 deletion R/plot_cpdb.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#' @param scale_alpha_by_cellsign Whether or not to filter the transparency of interactions by the cellsign.
#' @param filter_by_cellsign Filter out interactions with a 0 value cellsign.
#' @param keep_id_cp_interaction Whether or not to keep the id_cp_interaction in the plot.
#' @param result_precision Sets integer value for decimal points of p_value, default to 3
#' @param ... passes arguments to grep for cell_type1 and cell_type2.
#' @return ggplot dot plot object of cellphone db output
#' @examples
Expand All @@ -55,6 +56,7 @@ plot_cpdb <- function(
special_character_regex_pattern = NULL, degs_analysis = FALSE, return_table = FALSE,
exclude_interactions = NULL, min_interaction_score = 0, scale_alpha_by_interaction_scores = FALSE,
scale_alpha_by_cellsign = FALSE, filter_by_cellsign = FALSE, title = "", keep_id_cp_interaction = FALSE,
result_precision = 3,
...) {
requireNamespace("SingleCellExperiment")
requireNamespace("grDevices")
Expand Down Expand Up @@ -354,7 +356,7 @@ plot_cpdb <- function(
names(df_) <- NULL
df <- do.call(rbind, df_)
}
df$pvals[which(df$pvals == 0)] <- 0.001
df$pvals[which(df$pvals == 0)] <- 10^-result_precision
df$pvals[which(df$pvals >= 0.05)] <- NA
if (!is.null(splitby_key)) {
if (length(groups) > 0) {
Expand Down

0 comments on commit 18c0ac0

Please sign in to comment.