From 2e4481d276f1af5a5b91fa1e8251b5aa61069a3c Mon Sep 17 00:00:00 2001 From: jmw86069 Date: Mon, 30 Sep 2024 11:08:41 -0400 Subject: [PATCH] Silenced unintended verbose output, minor adjustes to label positioning logic. --- DESCRIPTION | 2 +- NAMESPACE | 2 +- NEWS.md | 5 ++++ R/venndir-grob-assembly.R | 1 + R/venndir-label-style.R | 18 +++++++++----- R/venndir-labels.R | 36 +++++++++++++++++++++------- R/venndir-render-jp.R | 28 +++++++++++----------- R/venndir-shrinkdf.R | 21 ++++++++++++++++ TODO.md | 18 ++++++++++++++ man/JamPolygon-class.Rd | 2 +- man/JamPolygon-methods.Rd | 6 ++--- man/Venndir-class.Rd | 2 +- man/add_orientation_JamPolygon.Rd | 2 +- man/area_JamPolygon.Rd | 2 +- man/bbox_JamPolygon.Rd | 2 +- man/buffer_JamPolygon.Rd | 2 +- man/check_JamPolygon.Rd | 2 +- man/check_Venndir.Rd | 2 +- man/eulerr_to_JamPolygon.Rd | 2 +- man/farthest_point_JamPolygon.Rd | 2 +- man/find_venn_overlaps_JamPolygon.Rd | 2 +- man/has_point_in_JamPolygon.Rd | 2 +- man/intersect_JamPolygon.Rd | 2 +- man/label_fill_JamPolygon.Rd | 2 +- man/label_outside_JamPolygon.Rd | 2 +- man/label_segment_JamPolygon.Rd | 2 +- man/labelr_JamPolygon.Rd | 2 +- man/minus_JamPolygon.Rd | 2 +- man/nearest_point_JamPolygon.Rd | 2 +- man/nudge_JamPolygon.Rd | 2 +- man/plot.JamPolygon.Rd | 4 ++-- man/point_in_JamPolygon.Rd | 2 +- man/polyclip_to_JamPolygon.Rd | 2 +- man/polygon_circles.Rd | 2 +- man/polygon_ellipses.Rd | 2 +- man/render_venndir.Rd | 5 +++- man/sample_JamPolygon.Rd | 2 +- man/shrink_df.Rd | 22 +++++++++++++++++ man/split_JamPolygon.Rd | 2 +- man/union_JamPolygon.Rd | 2 +- man/update_JamPolygon.Rd | 2 +- 41 files changed, 159 insertions(+), 65 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index b17c252..e534135 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: venndir Title: Directional Venn diagrams -Version: 0.0.39.950 +Version: 0.0.40.900 Authors@R: c( person(given="James M.", family="Ward", diff --git a/NAMESPACE b/NAMESPACE index caa7243..d653e6f 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,6 +1,5 @@ # Generated by roxygen2: do not edit by hand -S3method(plot,JamPolygon) export(add_orientation_JamPolygon) export(area_JamPolygon) export(bbox_JamPolygon) @@ -39,6 +38,7 @@ export(nearest_point_JamPolygon) export(nudge_JamPolygon) export(nudge_venndir_label) export(overlaplist2setlist) +export(plot.JamPolygon) export(point_in_JamPolygon) export(polyclip_to_JamPolygon) export(polygon_circles) diff --git a/NEWS.md b/NEWS.md index f7d1663..97da73a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +# venndir 0.0.40.900 + +* Updated label positioning logic, silenced some unintended verbose output +from `render_venndir()`. + # venndir 0.0.39.950 * Small change to use `gridGeometry` 0.4.1 from Github until released to CRAN, diff --git a/R/venndir-grob-assembly.R b/R/venndir-grob-assembly.R index 90eca1e..000ab87 100644 --- a/R/venndir-grob-assembly.R +++ b/R/venndir-grob-assembly.R @@ -604,6 +604,7 @@ grobs_yalign <- function ## define x reference coordinate for alignment if (verbose) { + jamba::printDebug("ref_grob: ", ref_grob); jamba::printDebug("yext_init:");print(yext_init); } if (length(use_y) > 0) { diff --git a/R/venndir-label-style.R b/R/venndir-label-style.R index 5497a34..9e48a57 100644 --- a/R/venndir-label-style.R +++ b/R/venndir-label-style.R @@ -828,12 +828,18 @@ venndir_label_style <- function # vjust does y-axis justification # (0=above point, 1=below point, 0.5=centered) - venndir_output$label_df$vjust_outside <- ifelse(venndir_output$label_df$type %in% "main", - 1 - llo_adjy, - venndir_output$label_df$vjust); - venndir_output$label_df$vjust_inside <- ifelse(venndir_output$label_df$type %in% "main", - 1 - lli_adjy, - venndir_output$label_df$vjust); + if (FALSE) { + venndir_output$label_df$vjust_outside <- ifelse(venndir_output$label_df$type %in% "main", + 1 - llo_adjy, + venndir_output$label_df$vjust); + venndir_output$label_df$vjust_inside <- ifelse(venndir_output$label_df$type %in% "main", + 1 - lli_adjy, + venndir_output$label_df$vjust); + } else { + # test + venndir_output$label_df$vjust_outside <- venndir_output$label_df$vjust; + venndir_output$label_df$vjust_inside <- venndir_output$label_df$vjust; + } # toupdate toupdate <- venndir_output$label_df$type %in% label_types; diff --git a/R/venndir-labels.R b/R/venndir-labels.R index 25facb1..454c894 100644 --- a/R/venndir-labels.R +++ b/R/venndir-labels.R @@ -87,7 +87,8 @@ draw_gridtext_groups <- function # adjust_centered=FALSE turns off adjustment for adj=0.5 # # adapted from gridtext::richtext_grob() internals - if (verbose) { + # if (all(c(1,2,3) %in% k)) { verbose <- TRUE } + if (verbose > 1) { jamba::printDebug("draw_gridtext_groups(): ", "grob_group_roundrect(), k:", k); print(head(gdf[k,,drop=FALSE])); @@ -98,7 +99,10 @@ draw_gridtext_groups <- function use_groupdf <- groupdf[k, , drop=FALSE]; k_childnames <- use_groupdf$childName; k <- match(k_childnames, grid::childNames(g_labels)); - # jamba::printDebug("use_groupdf:");print(use_groupdf);# debug + if (verbose > 1) { + jamba::printDebug("draw_gridtext_groups(): ", + "grob_group_roundrect(), use_groupdf:");print(use_groupdf);# debug + } } ## Experimental realign strategy @@ -110,6 +114,11 @@ draw_gridtext_groups <- function is_signed_count <- (grepl("count", use_groupdf$type) & grepl("signed", use_groupdf$counttype)); is_overlap_label <- (grepl("overlap", use_groupdf$type)); + if (verbose > 1) { + jamba::printDebug("draw_gridtext_groups(): ", + "grob_group_roundrect(), params:"); + print(data.frame(is_main_count, is_signed_count, is_overlap_label));# debug + } use_segment_df <- head(segment_df, 0); if ("label_group" %in% colnames(segment_df)) { @@ -132,8 +141,6 @@ draw_gridtext_groups <- function # - assemble overlap and count labels top to bottom: grobs_stack() # - center-align: grobs_xalign() - # all_g_labels_cns <- grid::childNames(g_labels); - # jamba::printDebug("all_g_labels_cns:");print(data.frame(all_g_labels_cns));# debug g_labels_cns <- use_groupdf$childName; # jamba::printDebug("g_labels_cns:");print(g_labels_cns);# debug use_vp <- NULL; @@ -229,7 +236,7 @@ draw_gridtext_groups <- function use_y <- grid::unit(adjy_fn(head(gdf$y[korig], 1)), "snpc"); } # jamba::printDebug("adjx:", adjx, ", adjy:", adjy);# debug - # jamba::printDebug("use_xalign:", use_xalign, ", use_yalign:", use_yalign);# debug + if (verbose) jamba::printDebug("use_xalign:", use_xalign, ", use_yalign:", use_yalign);# debug # jamba::printDebug("adjy_fn(use_segment_df$y):");print(adjy_fn(use_segment_df$y)); # ge1 <- grobs_exts(gt_final); # jamba::printDebug("ge1:");print(ge1); @@ -237,12 +244,23 @@ draw_gridtext_groups <- function gt_final2 <- grobs_xalign(xalign=use_xalign, use_x=use_x, grobs_yalign(yalign=use_yalign, + verbose=verbose, use_y=use_y, list(gt_final))) gt_final <- gt_final2; - + if (verbose > 1) { + jamba::printDebug("str(gt_final):"); + print(str(gt_final, max.level=3));# debug + } + ## Now create roundrectGrob to bind them scm_exts <- grobs_exts(gt_final) + if (verbose) { + # jamba::printDebug("scm_exts:"); + # print(str(scm_exts, max.level=5));# debug + jamba::printDebug("length(scm_exts$xext):"); + print(length(scm_exts$xext));# debug + } scm_exts_x <- (scm_exts$xext[[1]] + scm_exts$xext[[2]]) / 2; scm_exts_y <- (scm_exts$yext[[1]] + scm_exts$yext[[2]]) / 2; scm_exts_w <- (scm_exts$xext[[2]] - scm_exts$xext[[1]]); @@ -477,7 +495,6 @@ draw_gridtext_groups <- function } gdf_split <- split(gdf$num, gdf_group); # jamba::printDebug("gdf:");print(gdf);# debug - # jamba::printDebug("gdf:");print(gdf);# debug # jamba::printDebug("head(gdf_split, 2):");print(head(gdf_split, 2));# debug # jamba::printDebug("unique(segment_df):");print(unique(segment_df));# debug @@ -496,7 +513,7 @@ draw_gridtext_groups <- function })); rownames(adj_df) <- names(gdf_split); # jamba::printDebug("adj_df:");print(adj_df);# debug - + # jamba::printDebug("gdf_group:");print(gdf_group);# debug rr_grobs <- list(); new_g_labels <- list(); #rr_grobs <- lapply(split(gdf$num, gdf_group), function(k){ @@ -504,7 +521,8 @@ draw_gridtext_groups <- function k <- gdf_split[[ki]]; # determine if any labels have a line segment kgroup <- gdf_group[k][1]; - # jamba::printDebug("adj_df[kgroup, ]:");print(adj_df[kgroup, ]); + # jamba::printDebug("k:");print(k);# debug + # jamba::printDebug("adj_df[kgroup, ]:");print(adj_df[kgroup, ]);# debug # jamba::printDebug("prior to grob_group_roundrect() childNames(g_labels):");print(childNames(g_labels));# debug rr_grob_l <- grob_group_roundrect( g_labels=g_labels, diff --git a/R/venndir-render-jp.R b/R/venndir-render-jp.R index 9afd5c5..dd99683 100644 --- a/R/venndir-render-jp.R +++ b/R/venndir-render-jp.R @@ -57,6 +57,8 @@ #' `grid::grid.newpage()`. This option allows the figure to be rendered #' inside an active display device, or active `grid::viewport`. #' Note: When `do_draw=FALSE`, it also forces `do_newpage=FALSE`. +#' @param verbose `logical` indicating whether to print verbose output. +#' @param ... additional arguments are passed to internal functions. #' #' @returns `Venndir` object with attributes that contain underlying #' `grid` graphical objects (grobs): @@ -114,6 +116,7 @@ render_venndir <- function do_newpage=TRUE, do_draw=TRUE, draw_buffer=FALSE, + verbose=FALSE, ...) { # validate input @@ -477,7 +480,7 @@ render_venndir <- function y1=test_xy$y1, jp=jp_list, buffer=test_xy$segment_buffer, - verbose=FALSE, + verbose=verbose, ...); rownames(new_xy) <- names(sp_index); # jamba::printDebug("new_xy:");print(new_xy);# debug @@ -591,7 +594,7 @@ render_venndir <- function degrees=items_df1$item_degrees[1], buffer=item_buffer, seed=123, - verbose=TRUE, + verbose=verbose, ...); if (length(lpf) == 0) { return(lpf) @@ -955,6 +958,8 @@ render_venndir <- function vjust=igdf$vjust, hjust=igdf$hjust, halign=igdf$halign, + # valign=igdf$valign, + valign=0.5, rot=igdf$rot, padding=grid::unit(igdf$padding, igdf$padding_unit), @@ -974,9 +979,7 @@ render_venndir <- function lty=igdf$box_lty, lwd=igdf$box_lwd) ); - # attempt to re-assign custom childNames to the grobs - # jamba::printDebug("childNames(g_labels):");print(childNames(g_labels));# debug - # jamba::printDebug("igdf:");print(igdf);# debug + # re-assign custom childNames to the grobs new_childNames <- paste0( igdf$overlap_set, ":", igdf$type, ":", @@ -987,18 +990,15 @@ render_venndir <- function grid::getGrob(g_labels, iname); }) names(templist) <- new_childNames; + # jamba::printDebug("names(templist):");print(names(templist));# debug templist - # tempgList <- do.call(grid::gList, templist); - # g_labels <- grid::setChildren(g_labels, children=tempgList) - # # g_labels$childrenOrder <- jamba::nameVector(new_childNames); - # jamba::printDebug("childNames(g_labels):");print(childNames(g_labels));# debug - # g_labels; }); # grid::popViewport(); # assemble g_labels_list into gTree g_labels_gTree <- grid::grobTree( vp=jp_viewport, - do.call(grid::gList, unlist(unname(g_labels_list), recursive=FALSE)), + do.call(grid::gList, + unlist(unname(g_labels_list), recursive=FALSE)), name="labels"); # jamba::printDebug("names(grid::childNames(g_labels_gTree)):");print(names(grid::childNames(g_labels_gTree)));# debug g_labels_groupdf <- data.frame(check.names=FALSE, @@ -1031,10 +1031,10 @@ render_venndir <- function groupdf=g_labels_groupdf, segment_df=unique(segment_df), adjust_center=adjust_center, - adjx=adjx, - adjy=adjy, + adjx_fn=adjx, + adjy_fn=adjy, do_draw=FALSE, - verbose=FALSE) + verbose=verbose) # dgg$g_labels; dgg }, error=function(e){ diff --git a/R/venndir-shrinkdf.R b/R/venndir-shrinkdf.R index 2a17f7d..84ffbd8 100644 --- a/R/venndir-shrinkdf.R +++ b/R/venndir-shrinkdf.R @@ -14,6 +14,27 @@ #' #' @import data.table #' +#' @examples +#' testdf <- data.frame(check.names=FALSE, +#' SYMBOL=rep(c("ACTB", "GAPDH", "PPIA"), c(2, 3, 1)), +#' `logFC B-A`=c(1.4, 1.4, 2.3, NA, 2.3, 5.1), +#' probe=paste0("probe", 1:6)) +#' shrink_df(testdf, by="SYMBOL", num_func=function(x){mean(x, na.rm=TRUE)}) +#' +#' testdftall <- do.call(rbind, lapply(1:10000, function(i){ +#' idf <- testdf; +#' idf$SYMBOL <- paste0(idf$SYMBOL, "_", i); +#' idf; +#' })) +#' head(testdftall, 12) +#' shrunk_tall <- shrink_df(testdftall, +#' by="SYMBOL", +#' num_func=function(x){mean(x, na.rm=TRUE)}) +#' +#' shrunk_tall2 <- jamses::shrinkDataFrame(testdftall, +#' groupBy="SYMBOL") +#' head(shrunk_tall2, 12) +#' #' @export shrink_df <- function (df, diff --git a/TODO.md b/TODO.md index ec48e01..11a4682 100644 --- a/TODO.md +++ b/TODO.md @@ -1,5 +1,23 @@ # TODO for venndir +## 13sep2024 + +* Adjust aesthetics based upon feedback. + + * The arrows could be larger relative to the signed counts. + * Consider removing the colon `":"` between arrows and signed counts. + * When adjusting arrow/signed count font sizes, the text is bottom-aligned, + should probably be middle (top-middle-bottom) aligned. + + * Using `vjust=0.5` caused signed labels not to be grouped properly. + +## 04sep2024 + +* Fix bug when `names(setlist)` contains parentheses, causing the set +name to appear inside the polygon. Removing the parentheses fixes +the problem, but unclear why this happens? Probably errant `grep()` +call somewhere. + ## 28aug2024 * Need some way to move outside labels to the top (or bottom), diff --git a/man/JamPolygon-class.Rd b/man/JamPolygon-class.Rd index 99c26b3..5e8109c 100644 --- a/man/JamPolygon-class.Rd +++ b/man/JamPolygon-class.Rd @@ -25,7 +25,7 @@ jpdf <- new("JamPolygon", polygons=df); \seealso{ Other JamPolygon: \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, diff --git a/man/JamPolygon-methods.Rd b/man/JamPolygon-methods.Rd index 313c3fb..c3ff53a 100644 --- a/man/JamPolygon-methods.Rd +++ b/man/JamPolygon-methods.Rd @@ -1,14 +1,14 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/JamPolygon.R \docType{methods} -\name{[,JamPolygon,ANY,ANY,ANY-method} -\alias{[,JamPolygon,ANY,ANY,ANY-method} +\name{[,JamPolygon-method} +\alias{[,JamPolygon-method} \alias{plot,JamPolygon,missing-method} \alias{rbind2.JamPolygon} \alias{rbind2,JamPolygon,ANY-method} \title{Subset JamPolygon object} \usage{ -\S4method{[}{JamPolygon,ANY,ANY,ANY}(x, i, j, ..., drop = TRUE) +\S4method{[}{JamPolygon}(x, i, j, ..., drop = TRUE) \S4method{plot}{JamPolygon,missing}(x, y, ...) diff --git a/man/Venndir-class.Rd b/man/Venndir-class.Rd index 6be37ef..a5ebc62 100644 --- a/man/Venndir-class.Rd +++ b/man/Venndir-class.Rd @@ -91,7 +91,7 @@ That said, \code{setlist} can be an empty \code{list()}. \seealso{ Other JamPolygon: \code{\link{JamPolygon-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, diff --git a/man/add_orientation_JamPolygon.Rd b/man/add_orientation_JamPolygon.Rd index 16efb58..d1d8888 100644 --- a/man/add_orientation_JamPolygon.Rd +++ b/man/add_orientation_JamPolygon.Rd @@ -95,7 +95,7 @@ add_orientation_JamPolygon(jp3, Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, \code{\link{buffer_JamPolygon}()}, diff --git a/man/area_JamPolygon.Rd b/man/area_JamPolygon.Rd index 0d012f5..73f3d2a 100644 --- a/man/area_JamPolygon.Rd +++ b/man/area_JamPolygon.Rd @@ -106,7 +106,7 @@ plot(jp3) Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, \code{\link{buffer_JamPolygon}()}, diff --git a/man/bbox_JamPolygon.Rd b/man/bbox_JamPolygon.Rd index fd479eb..2052f0f 100644 --- a/man/bbox_JamPolygon.Rd +++ b/man/bbox_JamPolygon.Rd @@ -18,7 +18,7 @@ Bounding box for JamPolygon Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{buffer_JamPolygon}()}, diff --git a/man/buffer_JamPolygon.Rd b/man/buffer_JamPolygon.Rd index 86df2a5..e493074 100644 --- a/man/buffer_JamPolygon.Rd +++ b/man/buffer_JamPolygon.Rd @@ -64,7 +64,7 @@ plot(jp_jp2, Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, diff --git a/man/check_JamPolygon.Rd b/man/check_JamPolygon.Rd index 0d13d13..4ff341c 100644 --- a/man/check_JamPolygon.Rd +++ b/man/check_JamPolygon.Rd @@ -36,7 +36,7 @@ empty polygons and handle or ignore them accordingly. Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, diff --git a/man/check_Venndir.Rd b/man/check_Venndir.Rd index 18d3bd1..e454156 100644 --- a/man/check_Venndir.Rd +++ b/man/check_Venndir.Rd @@ -23,7 +23,7 @@ Check Venndir object integrity Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, diff --git a/man/eulerr_to_JamPolygon.Rd b/man/eulerr_to_JamPolygon.Rd index e9cec1f..11b64e1 100644 --- a/man/eulerr_to_JamPolygon.Rd +++ b/man/eulerr_to_JamPolygon.Rd @@ -16,7 +16,7 @@ Convert eulerr output to JamPolygon Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, diff --git a/man/farthest_point_JamPolygon.Rd b/man/farthest_point_JamPolygon.Rd index 52cfb60..c623e2e 100644 --- a/man/farthest_point_JamPolygon.Rd +++ b/man/farthest_point_JamPolygon.Rd @@ -23,7 +23,7 @@ Get the farthest polygon point from a reference point Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, diff --git a/man/find_venn_overlaps_JamPolygon.Rd b/man/find_venn_overlaps_JamPolygon.Rd index b52df05..3e303f9 100644 --- a/man/find_venn_overlaps_JamPolygon.Rd +++ b/man/find_venn_overlaps_JamPolygon.Rd @@ -94,7 +94,7 @@ plot(xo); Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, diff --git a/man/has_point_in_JamPolygon.Rd b/man/has_point_in_JamPolygon.Rd index f23d1b6..206db6d 100644 --- a/man/has_point_in_JamPolygon.Rd +++ b/man/has_point_in_JamPolygon.Rd @@ -36,7 +36,7 @@ Determine if a point is inside any JamPolygon Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, diff --git a/man/intersect_JamPolygon.Rd b/man/intersect_JamPolygon.Rd index 06f297e..6563fff 100644 --- a/man/intersect_JamPolygon.Rd +++ b/man/intersect_JamPolygon.Rd @@ -25,7 +25,7 @@ Intersect one or more JamPolygon objects Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, diff --git a/man/label_fill_JamPolygon.Rd b/man/label_fill_JamPolygon.Rd index ad7910c..5319492 100644 --- a/man/label_fill_JamPolygon.Rd +++ b/man/label_fill_JamPolygon.Rd @@ -198,7 +198,7 @@ text(lfj$items_df[, c("x", "y")], labels=lfj$items_df$text) Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, diff --git a/man/label_outside_JamPolygon.Rd b/man/label_outside_JamPolygon.Rd index f69b027..e35e5f2 100644 --- a/man/label_outside_JamPolygon.Rd +++ b/man/label_outside_JamPolygon.Rd @@ -60,7 +60,7 @@ Position labels outside JamPolygon Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, diff --git a/man/label_segment_JamPolygon.Rd b/man/label_segment_JamPolygon.Rd index c0df2d2..e07da7c 100644 --- a/man/label_segment_JamPolygon.Rd +++ b/man/label_segment_JamPolygon.Rd @@ -25,7 +25,7 @@ Define a label segment for JamPolygon Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, diff --git a/man/labelr_JamPolygon.Rd b/man/labelr_JamPolygon.Rd index 7acb8b2..eb1b1d7 100644 --- a/man/labelr_JamPolygon.Rd +++ b/man/labelr_JamPolygon.Rd @@ -42,7 +42,7 @@ This rule could serve to solve (1) as well. Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, diff --git a/man/minus_JamPolygon.Rd b/man/minus_JamPolygon.Rd index a5cd5e8..cc9b975 100644 --- a/man/minus_JamPolygon.Rd +++ b/man/minus_JamPolygon.Rd @@ -21,7 +21,7 @@ Subtract one or more JamPolygon objects Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, diff --git a/man/nearest_point_JamPolygon.Rd b/man/nearest_point_JamPolygon.Rd index 148897c..4fbffed 100644 --- a/man/nearest_point_JamPolygon.Rd +++ b/man/nearest_point_JamPolygon.Rd @@ -23,7 +23,7 @@ Get the nearest polygon point to a reference point Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, diff --git a/man/nudge_JamPolygon.Rd b/man/nudge_JamPolygon.Rd index f59cfb6..7bb3f8d 100644 --- a/man/nudge_JamPolygon.Rd +++ b/man/nudge_JamPolygon.Rd @@ -57,7 +57,7 @@ plot(rbind2(DEjp, DEjp_nudged), Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, diff --git a/man/plot.JamPolygon.Rd b/man/plot.JamPolygon.Rd index 6582171..3bdd797 100644 --- a/man/plot.JamPolygon.Rd +++ b/man/plot.JamPolygon.Rd @@ -4,7 +4,7 @@ \alias{plot.JamPolygon} \title{Plot JamPolygon object} \usage{ -\method{plot}{JamPolygon}( +plot.JamPolygon( x, y, xlim = NULL, @@ -236,7 +236,7 @@ plot(jpz); Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, diff --git a/man/point_in_JamPolygon.Rd b/man/point_in_JamPolygon.Rd index 9963eb5..ed24c89 100644 --- a/man/point_in_JamPolygon.Rd +++ b/man/point_in_JamPolygon.Rd @@ -46,7 +46,7 @@ Determine if a point is inside a JamPolygon Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, diff --git a/man/polyclip_to_JamPolygon.Rd b/man/polyclip_to_JamPolygon.Rd index 49ce4d9..7c7a8da 100644 --- a/man/polyclip_to_JamPolygon.Rd +++ b/man/polyclip_to_JamPolygon.Rd @@ -30,7 +30,7 @@ jpdf <- new("JamPolygon", polygons=df); Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, diff --git a/man/polygon_circles.Rd b/man/polygon_circles.Rd index 3a35862..b8b027a 100644 --- a/man/polygon_circles.Rd +++ b/man/polygon_circles.Rd @@ -40,7 +40,7 @@ plot(circle_jp, fill=c("red", "gold")) Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, diff --git a/man/polygon_ellipses.Rd b/man/polygon_ellipses.Rd index 8eb4f8e..ce383ad 100644 --- a/man/polygon_ellipses.Rd +++ b/man/polygon_ellipses.Rd @@ -56,7 +56,7 @@ plot(ejp, fill=c("#FF000077", "#FFDD0077")) Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, diff --git a/man/render_venndir.Rd b/man/render_venndir.Rd index 2b587a1..0cca964 100644 --- a/man/render_venndir.Rd +++ b/man/render_venndir.Rd @@ -34,6 +34,7 @@ render_venndir( do_newpage = TRUE, do_draw = TRUE, draw_buffer = FALSE, + verbose = FALSE, ... ) } @@ -188,7 +189,9 @@ Note: When \code{do_draw=FALSE}, it also forces \code{do_newpage=FALSE}.} The \code{grid} graphical objects are returned in attributes: "gtree", "grob_list", "viewport", and can be drawn separately.} -\item{...}{additional arguments are passed to \code{render_venndir()}.} +\item{verbose}{\code{logical} indicating whether to print verbose output.} + +\item{...}{additional arguments are passed to internal functions.} } \value{ \code{Venndir} object with attributes that contain underlying diff --git a/man/sample_JamPolygon.Rd b/man/sample_JamPolygon.Rd index 0cd1b76..ec7b439 100644 --- a/man/sample_JamPolygon.Rd +++ b/man/sample_JamPolygon.Rd @@ -108,7 +108,7 @@ sample_JamPolygon(jp3[1,], n=40, xyratio=1/1.5, do_plot=TRUE) Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, diff --git a/man/shrink_df.Rd b/man/shrink_df.Rd index 440a358..662c096 100644 --- a/man/shrink_df.Rd +++ b/man/shrink_df.Rd @@ -25,6 +25,28 @@ and \code{numeric} columns. It is intended to be a simple but configurable tool for the majority of scenarios. This function uses \code{data.table} for overall speed. +} +\examples{ +testdf <- data.frame(check.names=FALSE, + SYMBOL=rep(c("ACTB", "GAPDH", "PPIA"), c(2, 3, 1)), + `logFC B-A`=c(1.4, 1.4, 2.3, NA, 2.3, 5.1), + probe=paste0("probe", 1:6)) +shrink_df(testdf, by="SYMBOL", num_func=function(x){mean(x, na.rm=TRUE)}) + +testdftall <- do.call(rbind, lapply(1:10000, function(i){ + idf <- testdf; + idf$SYMBOL <- paste0(idf$SYMBOL, "_", i); + idf; +})) +head(testdftall, 12) +shrunk_tall <- shrink_df(testdftall, + by="SYMBOL", + num_func=function(x){mean(x, na.rm=TRUE)}) + +shrunk_tall2 <- jamses::shrinkDataFrame(testdftall, + groupBy="SYMBOL") +head(shrunk_tall2, 12) + } \seealso{ Other venndir utility: diff --git a/man/split_JamPolygon.Rd b/man/split_JamPolygon.Rd index 63888ed..1e99926 100644 --- a/man/split_JamPolygon.Rd +++ b/man/split_JamPolygon.Rd @@ -27,7 +27,7 @@ polygon per row in \code{jp@polygons}. Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, diff --git a/man/union_JamPolygon.Rd b/man/union_JamPolygon.Rd index e7783b2..e8515e5 100644 --- a/man/union_JamPolygon.Rd +++ b/man/union_JamPolygon.Rd @@ -61,7 +61,7 @@ union_JamPolygon(jp3na) Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()}, diff --git a/man/update_JamPolygon.Rd b/man/update_JamPolygon.Rd index 05829fe..08956d8 100644 --- a/man/update_JamPolygon.Rd +++ b/man/update_JamPolygon.Rd @@ -28,7 +28,7 @@ subsequently adds columns \code{"holes"}, \code{"polygon_clockwise"}, and Other JamPolygon: \code{\link{JamPolygon-class}}, \code{\link{Venndir-class}}, -\code{\link{[,JamPolygon,ANY,ANY,ANY-method}}, +\code{\link{[,JamPolygon-method}}, \code{\link{add_orientation_JamPolygon}()}, \code{\link{area_JamPolygon}()}, \code{\link{bbox_JamPolygon}()},