diff --git a/DESCRIPTION b/DESCRIPTION index aa6ae2c..3702877 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -26,4 +26,4 @@ LazyData: true VignetteBuilder: knitr Suggests: knitr -RoxygenNote: 5.0.1 +RoxygenNote: 6.0.1.9000 diff --git a/NAMESPACE b/NAMESPACE index 61251e7..ef26143 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,5 +1,6 @@ # Generated by roxygen2: do not edit by hand +S3method(print,upset) export(elements) export(fromExpression) export(fromList) diff --git a/R/Matrix.R b/R/Matrix.R index da39416..b828672 100644 --- a/R/Matrix.R +++ b/R/Matrix.R @@ -38,11 +38,11 @@ Create_layout <- function(setup, mat_color, mat_col, matrix_dot_alpha){ Matrix_layout$Intersection[i] <- paste(Matrix_layout$x[i], "yes", sep ="") } else{ - + Matrix_layout$color[i] <- "gray83" Matrix_layout$alpha[i] <- matrix_dot_alpha Matrix_layout$Intersection[i] <- paste(i, "No", sep = "") - } + } } if(is.null(mat_col) == F){ for(i in 1:nrow(mat_col)){ @@ -58,7 +58,7 @@ Create_layout <- function(setup, mat_color, mat_col, matrix_dot_alpha){ return(Matrix_layout) } -## Create data set to shade matrix +## Create data set to shade matrix MakeShading <- function(Mat_data, color){ y <- unique(Mat_data$y) y <- (y[which(y %% 2 != 0)]) @@ -76,23 +76,23 @@ MakeShading <- function(Mat_data, color){ ## Generate matrix plot Make_matrix_plot <- function(Mat_data,Set_size_data, Main_bar_data, point_size, line_size, text_scale, labels, shading_data, shade_alpha){ - + if(length(text_scale) == 1){ - name_size_scale <- text_scale + name_size_scale <- text_scale } if(length(text_scale) > 1 && length(text_scale) <= 6){ name_size_scale <- text_scale[5] } - - Matrix_plot <- (ggplot() + + Matrix_plot <- (ggplot() + theme(panel.background = element_rect(fill = "white"), plot.margin=unit(c(-0.2,0.5,0.5,0.5), "lines"), axis.text.x = element_blank(), axis.ticks.x = element_blank(), axis.ticks.y = element_blank(), - axis.text.y = element_text(colour = "gray0", + axis.text.y = element_text(colour = "gray0", size = 7*name_size_scale, hjust = 0.4), - panel.grid.major = element_blank(), + panel.grid.major = element_blank(), panel.grid.minor = element_blank()) + xlab(NULL) + ylab(" ") + scale_y_continuous(breaks = c(1:nrow(Set_size_data)), @@ -103,10 +103,10 @@ Make_matrix_plot <- function(Mat_data,Set_size_data, Main_bar_data, point_size, ymin = "y_min", ymax = "y_max"), fill = shading_data$shade_color, alpha = shade_alpha) + geom_point(data= Mat_data, aes_string(x= "x", y= "y"), colour = Mat_data$color, - size= point_size, alpha = Mat_data$alpha) + size= point_size, alpha = Mat_data$alpha, shape=16) + geom_line(data= Mat_data, aes_string(group = "Intersection", x="x", y="y", colour = "color"), size = line_size) + scale_color_identity()) Matrix_plot <- ggplot_gtable(ggplot_build(Matrix_plot)) return(Matrix_plot) -} \ No newline at end of file +} diff --git a/R/UpSet.plot.R b/R/UpSet.plot.R index 4e3ac5e..27ab9d8 100644 --- a/R/UpSet.plot.R +++ b/R/UpSet.plot.R @@ -11,13 +11,13 @@ Make_base_plot <- function(Main_bar_plot, Matrix_plot, Size_plot, labels, hratios, att_x, att_y, Set_data, exp, position, start_col, att_color, QueryData, attribute_plots, legend, query_legend, boxplot, names, set_metadata, - set_metadata_plots){ - + set_metadata_plots, newpage){ + end_col <- ((start_col + as.integer(length(labels))) - 1) Set_data <- Set_data[which(rowSums(Set_data[ ,start_col:end_col]) != 0), ] Main_bar_plot$widths <- Matrix_plot$widths Matrix_plot$heights <- Size_plot$heights - if(is.null(set_metadata) ==F){ + if(!is.null(set_metadata)){ ncols <- 0 for(i in 1:length(set_metadata_plots)){ ncols <- ncols + set_metadata$plots[[i]]$assign @@ -25,33 +25,33 @@ Make_base_plot <- function(Main_bar_plot, Matrix_plot, Size_plot, labels, hratio } set_metadata$ncols <- ncols } - if(is.null(legend)==F){ + if(!is.null(legend)) { legend$widths <- Matrix_plot$widths } - if(is.null(boxplot) == F){ + if(!is.null(boxplot)){ for(i in seq_along(boxplot)){ boxplot[[i]]$widths <- Matrix_plot$widths } } - + size_plot_height <- (((hratios[1])+0.01)*100) if((hratios[1] > 0.7 || hratios[1] < 0.3) || (hratios[2] > 0.7 || hratios[2] < 0.3)) warning("Plot might be out of range if ratio > 0.7 or < 0.3") - if(is.null(attribute_plots) == T && is.null(boxplot) == T){ + if(is.null(attribute_plots) && is.null(boxplot)){ NoAttBasePlot(legend, size_plot_height, Main_bar_plot, Matrix_plot, hratios, Size_plot, query_legend, - set_metadata, set_metadata_plots) + set_metadata, set_metadata_plots, newpage=newpage) } - else if(is.null(attribute_plots) == F && is.null(boxplot) == T){ + else if(!is.null(attribute_plots) && is.null(boxplot)){ plots <- GenerateCustomPlots(attribute_plots, Set_data, QueryData, att_color, att_x, att_y, names) # for(i in seq_along(plots)){ # attribute_plots$plots[[i]]$plot <- plots[[i]] # } BaseCustomPlot(attribute_plots, plots, position, size_plot_height, Main_bar_plot, Matrix_plot, Size_plot, - hratios, legend, query_legend, set_metadata, set_metadata_plots) + hratios, legend, query_legend, set_metadata, set_metadata_plots, newpage=newpage) } - else if(is.null(boxplot)==F && is.null(attribute_plots) == T){ + else if(!is.null(boxplot) && is.null(attribute_plots)){ BaseBoxPlot(boxplot, position, size_plot_height, Main_bar_plot, Matrix_plot, Size_plot, - hratios, set_metadata, set_metadata_plots) + hratios, set_metadata, set_metadata_plots, newpage=newpage) } } @@ -62,11 +62,12 @@ vplayout <- function(x,y){ ## Generates UpSet plot with boxplots representing distributions of attributes BaseBoxPlot <- function(box_plot, position, size_plot_height, Main_bar_plot, Matrix_plot, - Size_plot, hratios, set_metadata, set_metadata_plots){ + Size_plot, hratios, set_metadata, set_metadata_plots, newpage){ + if(length(box_plot) > 2){ return(warning("UpSet can only show 2 box plots at a time")) } - if(is.null(position) == T || position == tolower("bottom")){ + if(is.null(position) || position == tolower("bottom")){ bar_top <- 1 matrix_bottom <- 100 att_top <- 101 @@ -77,7 +78,7 @@ BaseBoxPlot <- function(box_plot, position, size_plot_height, Main_bar_plot, Mat gridrow <- 145 } } - if((is.null(position) == F) && (position != tolower("bottom"))){ + if((!is.null(position)) && (position != tolower("bottom"))){ if(length(box_plot)==1){ size_plot_height <- (size_plot_height + 35) bar_top <- 36 @@ -94,13 +95,13 @@ BaseBoxPlot <- function(box_plot, position, size_plot_height, Main_bar_plot, Mat gridrow <- 150 } } - if(is.null(set_metadata) == T){ + if(is.null(set_metadata)){ matrix_and_mainbar_right <- 100 matrix_and_mainbar_left <- 21 size_bar_right <- 20 size_bar_left <- 1 } - else if(is.null(set_metadata) == F){ + else if(!is.null(set_metadata)){ matrix_and_mainbar_right <- set_metadata$ncols + 100 matrix_and_mainbar_left <- set_metadata$ncols + 21 size_bar_right <- set_metadata$ncols + 20 @@ -108,7 +109,9 @@ BaseBoxPlot <- function(box_plot, position, size_plot_height, Main_bar_plot, Mat metadata_right <- set_metadata$ncols metadata_left <- 1 } - grid.newpage() + if (newpage) { + grid.newpage() + } if(length(box_plot) == 1){ pushViewport(viewport(layout = grid.layout(135,matrix_and_mainbar_right))) } @@ -123,7 +126,7 @@ BaseBoxPlot <- function(box_plot, position, size_plot_height, Main_bar_plot, Mat pushViewport(vp) grid.draw(arrangeGrob(Size_plot)) popViewport() - if(is.null(set_metadata) == F){ + if(!is.null(set_metadata)){ for(i in 1:length(set_metadata_plots)){ if(i != 1){ metadata_left <- 1+metadata_right @@ -133,7 +136,7 @@ BaseBoxPlot <- function(box_plot, position, size_plot_height, Main_bar_plot, Mat metadata_left <- 1 metadata_right <- set_metadata$plots[[i]]$assign } - + vp = vplayout(size_plot_height:matrix_bottom, metadata_left:metadata_right) pushViewport(vp) grid.draw(arrangeGrob(set_metadata_plots[[i]])) @@ -154,10 +157,10 @@ BaseBoxPlot <- function(box_plot, position, size_plot_height, Main_bar_plot, Mat ## Generates UpSet plot when no attributes are selected to be plotted NoAttBasePlot <- function(legend, size_plot_height, Main_bar_plot, Matrix_plot, hratios, - Size_plot, query_legend, set_metadata, set_metadata_plots){ + Size_plot, query_legend, set_metadata, set_metadata_plots, newpage){ top <- 1 bottom <- 100 - if((is.null(legend) == F) && (query_legend != tolower("none"))){ + if((!is.null(legend)) && (query_legend != tolower("none"))){ if(query_legend == tolower("top")){ top <- 3 bottom <- 102 @@ -170,13 +173,13 @@ NoAttBasePlot <- function(legend, size_plot_height, Main_bar_plot, Matrix_plot, legend_bottom <- 103 } } - if(is.null(set_metadata) == T){ + if(is.null(set_metadata)){ matrix_and_mainbar_right <- 100 matrix_and_mainbar_left <- 21 size_bar_right <- 20 size_bar_left <- 1 } - else if(is.null(set_metadata) == F){ + else if(!is.null(set_metadata)){ matrix_and_mainbar_right <- set_metadata$ncols + 100 matrix_and_mainbar_left <- set_metadata$ncols + 21 size_bar_right <- set_metadata$ncols + 20 @@ -184,8 +187,10 @@ NoAttBasePlot <- function(legend, size_plot_height, Main_bar_plot, Matrix_plot, metadata_right <- set_metadata$ncols metadata_left <- 1 } - grid.newpage() - if((is.null(legend) == F) && (query_legend != tolower("none"))){ + if (newpage) { + grid.newpage() + } + if((!is.null(legend)) && (query_legend != tolower("none"))){ if(query_legend == tolower("top")){ pushViewport(viewport(layout = grid.layout(102, matrix_and_mainbar_right))) } @@ -193,7 +198,7 @@ NoAttBasePlot <- function(legend, size_plot_height, Main_bar_plot, Matrix_plot, pushViewport(viewport(layout = grid.layout(103, matrix_and_mainbar_right))) } } - else if((is.null(legend) == T)|| (query_legend == tolower("none"))){ + else if((is.null(legend))|| (query_legend == tolower("none"))){ pushViewport(viewport(layout = grid.layout(100,matrix_and_mainbar_right))) } vp = vplayout(top:bottom, matrix_and_mainbar_left:matrix_and_mainbar_right) @@ -204,7 +209,7 @@ NoAttBasePlot <- function(legend, size_plot_height, Main_bar_plot, Matrix_plot, pushViewport(vp) grid.draw(arrangeGrob(Size_plot)) popViewport() - if(is.null(set_metadata) == F){ + if(!is.null(set_metadata)){ for(i in 1:length(set_metadata_plots)){ if(i != 1){ metadata_left <- 1+metadata_right @@ -214,14 +219,14 @@ NoAttBasePlot <- function(legend, size_plot_height, Main_bar_plot, Matrix_plot, metadata_left <- 1 metadata_right <- set_metadata$plots[[i]]$assign } - + vp = vplayout(size_plot_height:bottom, metadata_left:metadata_right) pushViewport(vp) grid.draw(arrangeGrob(set_metadata_plots[[i]])) popViewport() } } - if((is.null(legend) == F) && (query_legend != tolower("none"))){ + if((!is.null(legend)) && (query_legend != tolower("none"))){ vp = vplayout(legend_top:legend_bottom, matrix_and_mainbar_left:matrix_and_mainbar_right) pushViewport(vp) grid.draw(arrangeGrob(legend)) @@ -231,19 +236,19 @@ NoAttBasePlot <- function(legend, size_plot_height, Main_bar_plot, Matrix_plot, ## Function that plots out the list of plots generated from custom plot input BaseCustomPlot <- function(attribute_plots, plots, position, size_plot_height, Main_bar_plot, Matrix_plot, - Size_plot, hratios, legend, q_legend, set_metadata, set_metadata_plots){ + Size_plot, hratios, legend, q_legend, set_metadata, set_metadata_plots, newpage){ bar_top <- 1 matrix_bottom <- 100 custom_top <- 101 custom_bottom <- (attribute_plots$gridrows + 100) - - if(is.null(set_metadata) == T){ + + if(is.null(set_metadata)){ matrix_and_mainbar_right <- 100 matrix_and_mainbar_left <- 21 size_bar_right <- 20 size_bar_left <- 1 } - else if(is.null(set_metadata) == F){ + else if(!is.null(set_metadata)){ matrix_and_mainbar_right <- set_metadata$ncols + 100 matrix_and_mainbar_left <- set_metadata$ncols + 21 size_bar_right <- set_metadata$ncols + 20 @@ -251,15 +256,17 @@ BaseCustomPlot <- function(attribute_plots, plots, position, size_plot_height, M metadata_right <- set_metadata$ncols metadata_left <- 1 } - - if((is.null(legend) == F) && (q_legend == tolower("bottom"))){custom_bottom <- (custom_bottom + 5)} - if((is.null(legend) == F) && (q_legend == tolower("top"))){ + + if((!is.null(legend)) && (q_legend == tolower("bottom"))){custom_bottom <- (custom_bottom + 5)} + if((!is.null(legend)) && (q_legend == tolower("top"))){ bar_top <- bar_top + 5 matrix_bottom <- matrix_bottom + 5 custom_top <- custom_top + 5 custom_bottom <- custom_bottom + 5 } - grid.newpage() + if (newpage) { + grid.newpage() + } pushViewport(viewport(layout = grid.layout(custom_bottom,matrix_and_mainbar_right))) vp = vplayout(bar_top:matrix_bottom, matrix_and_mainbar_left:matrix_and_mainbar_right) pushViewport(vp) @@ -269,7 +276,7 @@ BaseCustomPlot <- function(attribute_plots, plots, position, size_plot_height, M pushViewport(vp) grid.draw(arrangeGrob(Size_plot)) popViewport() - if(is.null(set_metadata) == F){ + if(!is.null(set_metadata)){ for(i in 1:length(set_metadata_plots)){ if(i != 1){ metadata_left <- 1+metadata_right @@ -279,14 +286,14 @@ BaseCustomPlot <- function(attribute_plots, plots, position, size_plot_height, M metadata_left <- 1 metadata_right <- set_metadata$plots[[i]]$assign } - + vp = vplayout(size_plot_height:matrix_bottom, metadata_left:metadata_right) pushViewport(vp) grid.draw(arrangeGrob(set_metadata_plots[[i]])) popViewport() } } - if((is.null(legend) == F) && (q_legend == tolower("bottom"))){ + if((!is.null(legend)) && (q_legend == tolower("bottom"))){ vp = vplayout(custom_top:(custom_bottom - 5), 1:matrix_and_mainbar_right) pushViewport(vp) grid.draw(do.call(arrangeGrob, c(plots, ncol = attribute_plots$ncols))) @@ -296,7 +303,7 @@ BaseCustomPlot <- function(attribute_plots, plots, position, size_plot_height, M grid.draw(arrangeGrob(legend)) popViewport() } - else if((is.null(legend) == F) && (q_legend == tolower("top"))){ + else if((!is.null(legend)) && (q_legend == tolower("top"))){ vp = vplayout(custom_top:custom_bottom, 1:matrix_and_mainbar_right) pushViewport(vp) grid.draw(do.call(arrangeGrob, c(plots, ncol = attribute_plots$ncols))) @@ -317,4 +324,4 @@ BaseCustomPlot <- function(attribute_plots, plots, position, size_plot_height, M # printCustom <- function(attribute_plots){ # print(attribute_plots$plot, vp = vplayout(attribute_plots$rows, attribute_plots$cols), newpage = F) -# } \ No newline at end of file +# } diff --git a/R/scatter_plot.R b/R/scatter_plot.R index 6a9bfd7..8a0144c 100644 --- a/R/scatter_plot.R +++ b/R/scatter_plot.R @@ -4,11 +4,11 @@ #' @param mydata A data set containing intersection data provided internally #' @param x The x aesthetic for the scatter plot #' @param y The y aesthetic for the scatter plot -#' @note See examples section for upset function on how to use custom.plot parameter. +#' @note See examples section for upset function on how to use custom.plot parameter. #' @export scatter_plot <- function(mydata, x, y){ - att_plot <- (ggplot(data = mydata, aes_string(x = x, y = y, colour = "color")) - + geom_point() + scale_color_identity() + att_plot <- (ggplot(data = mydata, aes_string(x = x, y = y, colour = "color")) + + geom_point(shape=16) + scale_color_identity() + theme(panel.background = element_rect(fill = "white"), plot.title = element_text(vjust = 1.3), panel.grid.minor = element_blank(), @@ -16,4 +16,4 @@ scatter_plot <- function(mydata, x, y){ axis.title.y = element_text(vjust = 1.3, size = 8.3), axis.title.x = element_text(size = 8.3), plot.margin=unit(c(0.5,0,0,1), "cm"))) -} \ No newline at end of file +} diff --git a/R/upset.R b/R/upset.R index 2212308..dddb8ec 100644 --- a/R/upset.R +++ b/R/upset.R @@ -6,7 +6,7 @@ #' @param nintersects Number of intersections to plot. If set to NA, all intersections will be plotted. #' @param sets Specific sets to look at (Include as combinations. Ex: c("Name1", "Name2")) #' @param keep.order Keep sets in the order entered using the sets parameter. The default is FALSE, which orders the sets by their sizes. -#' @param set.metadata Metadata that offers insight to an attribute of the sets. Input should be a data frame where the first column is set names, and the +#' @param set.metadata Metadata that offers insight to an attribute of the sets. Input should be a data frame where the first column is set names, and the #' remaining columns are attributes of those sets. To learn how to use this parameter it is highly suggested to view the set metadata vignette. The link #' can be found on the package's GitHub page. #' @param intersections Specific intersections to include in plot entered as a list of lists. @@ -42,7 +42,7 @@ #' @param empty.intersections Additionally display empty sets up to nintersects #' @param color.pal Color palette for attribute plots #' @param boxplot.summary Boxplots representing the distribution of a selected attribute for each intersection. Select attributes by entering a character vector of attribute names (e.g. c("Name1", "Name2")). -#' The maximum number of attributes that can be entered is 2. +#' The maximum number of attributes that can be entered is 2. #' @param attribute.plots Create custom ggplot using intersection data represented in the main bar plot. Prior to adding custom plots, the UpSet plot is set up in a 100 by 100 grid. #' The attribute.plots parameter takes a list that contains the number of rows that should be allocated for the custom plot, and a list of plots with specified positions. #' nrows is the number of rows the custom plots should take up. There is already 100 allocated for the custom plot. plots takes a list that contains a function that returns @@ -83,7 +83,7 @@ #' + geom_point() + scale_color_identity() #' + theme_bw() + theme(plot.margin = unit(c(0,0,0,0), "cm"))) #' } -#' +#' #' attributeplots <- list(gridrows = 55, #' plots = list(list(plot = plot1, x= "ReleaseDate", queries = FALSE), #' list(plot = plot1, x= "ReleaseDate", queries = TRUE), @@ -103,14 +103,14 @@ #' list(query = intersects, params = list("Drama"), color= "red"), #' list(query = elements, params = list("ReleaseDate", 1990, 1991, 1992))), #' main.bar.color = "yellow") -#' +#' #' @import gridExtra #' @import ggplot2 #' @import utils #' @import stats #' @import methods #' @import grDevices -#' @import scales +#' @import scales #' @export upset <- function(data, nsets = 5, nintersects = 40, sets = NULL, keep.order = F, set.metadata = NULL, intersections = NULL, matrix.color = "gray23", main.bar.color = "gray23", mainbar.y.label = "Intersection Size", mainbar.y.max = NULL, @@ -120,11 +120,11 @@ upset <- function(data, nsets = 5, nintersects = 40, sets = NULL, keep.order = F queries = NULL, query.legend = "none", shade.color = "gray88", shade.alpha = 0.25, matrix.dot.alpha =0.5, empty.intersections = NULL, color.pal = 1, boxplot.summary = NULL, attribute.plots = NULL, scale.intersections = "identity", scale.sets = "identity", text.scale = 1, set_size.angles = 0 ){ - + startend <-FindStartEnd(data) first.col <- startend[1] last.col <- startend[2] - + if(color.pal == 1){ palette <- c("#1F77B4", "#FF7F0E", "#2CA02C", "#D62728", "#9467BD", "#8C564B", "#E377C2", "#7F7F7F", "#BCBD22", "#17BECF") @@ -133,7 +133,7 @@ upset <- function(data, nsets = 5, nintersects = 40, sets = NULL, keep.order = F palette <- c("#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7") } - + if(is.null(intersections) == F){ Set_names <- unique((unlist(intersections))) Sets_to_remove <- Remove(data, first.col, last.col, Set_names) @@ -182,7 +182,7 @@ upset <- function(data, nsets = 5, nintersects = 40, sets = NULL, keep.order = F } } } - + BoxPlots <- NULL if(is.null(boxplot.summary) == F){ BoxData <- IntersectionBoxPlot(All_Freqs, New_data, first.col, Set_names) @@ -191,7 +191,7 @@ upset <- function(data, nsets = 5, nintersects = 40, sets = NULL, keep.order = F BoxPlots[[i]] <- BoxPlotsPlot(BoxData, boxplot.summary[i], att.color) } } - + customAttDat <- NULL customQBar <- NULL Intersection <- NULL @@ -218,7 +218,7 @@ upset <- function(data, nsets = 5, nintersects = 40, sets = NULL, keep.order = F else{ Matrix_col <- NULL } - + Matrix_layout <- Create_layout(Matrix_setup, matrix.color, Matrix_col, matrix.dot.alpha) Set_sizes <- FindSetFreqs(New_data, first.col, Num_of_set, Set_names, keep.order) Bar_Q <- NULL @@ -234,18 +234,20 @@ upset <- function(data, nsets = 5, nintersects = 40, sets = NULL, keep.order = F palette) } AllQueryData <- combineQueriesData(QInter_att_data, QElem_att_data, customAttDat, att.x, att.y) - + ShadingData <- NULL - + if(is.null(set.metadata) == F){ ShadingData <- get_shade_groups(set.metadata, Set_names, Matrix_layout, shade.alpha) output <- Make_set_metadata_plot(set.metadata, Set_names) set.metadata.plots <- output[[1]] set.metadata <- output[[2]] - + if(is.null(ShadingData) == FALSE){ shade.alpha <- unique(ShadingData$alpha) } + } else { + set.metadata.plots <- NULL } if(is.null(ShadingData) == TRUE){ ShadingData <- MakeShading(Matrix_layout, shade.color) @@ -255,9 +257,62 @@ upset <- function(data, nsets = 5, nintersects = 40, sets = NULL, keep.order = F Matrix <- Make_matrix_plot(Matrix_layout, Set_sizes, All_Freqs, point.size, line.size, text.scale, labels, ShadingData, shade.alpha) Sizes <- Make_size_plot(Set_sizes, sets.bar.color, mb.ratio, sets.x.label, scale.sets, text.scale, set_size.angles) - - Make_base_plot(Main_bar, Matrix, Sizes, labels, mb.ratio, att.x, att.y, New_data, - expression, att.pos, first.col, att.color, AllQueryData, attribute.plots, - legend, query.legend, BoxPlots, Set_names, set.metadata, set.metadata.plots) - -} \ No newline at end of file + + # Make_base_plot(Main_bar, Matrix, Sizes, labels, mb.ratio, att.x, att.y, New_data, + # expression, att.pos, first.col, att.color, AllQueryData, attribute.plots, + # legend, query.legend, BoxPlots, Set_names, set.metadata, set.metadata.plots) + + structure(class = "upset", + .Data=list( + Main_bar = Main_bar, + Matrix = Matrix, + Sizes = Sizes, + labels = labels, + mb.ratio = mb.ratio, + att.x = att.x, + att.y = att.y, + New_data = New_data, + expression = expression, + att.pos = att.pos, + first.col = first.col, + att.color = att.color, + AllQueryData = AllQueryData, + attribute.plots = attribute.plots, + legend = legend, + query.legend = query.legend, + BoxPlots = BoxPlots, + Set_names = Set_names, + set.metadata = set.metadata, + set.metadata.plots = set.metadata.plots) + ) +} +#' @export +print.upset <- function(x, newpage = TRUE) { + Make_base_plot( + Main_bar_plot = x$Main_bar, + Matrix_plot = x$Matrix, + Size_plot = x$Sizes, + labels = x$labels, + hratios = x$mb.ratio, + att_x = x$att.x, + att_y = x$att.y, + Set_data = x$New_data, + exp = x$expression, + position = x$att.pos, + start_col = x$first.col, + att_color = x$att.color, + QueryData = x$AllQueryData, + attribute_plots = x$attribute.plots, + legend = x$legend, + query_legend = x$query.legend, + boxplot = x$BoxPlots, + names = x$Set_names, + set_metadata = x$set.metadata, + set_metadata_plots = x$set.metadata.plots, + newpage = newpage) +} + +#' @export +summary.upset <- function(x) { + cat("An object of class `upset`. Call print() to show.") +} diff --git a/man/elements.Rd b/man/elements.Rd index 03b0dd1..d8420a0 100644 --- a/man/elements.Rd +++ b/man/elements.Rd @@ -19,4 +19,3 @@ A query paramter to visualize specific elements of interest if queries = active \note{ See examples section of upset function on how to use this function in the queries parameter. } - diff --git a/man/fromExpression.Rd b/man/fromExpression.Rd index 10f42fa..175947c 100644 --- a/man/fromExpression.Rd +++ b/man/fromExpression.Rd @@ -15,4 +15,3 @@ A function to convert an expression to a data frame compatible with UpSetR. \note{ See "Basic Usage" vignette for an example on how to use this function in UpSetR. } - diff --git a/man/fromList.Rd b/man/fromList.Rd index 63397bb..f5f4ce5 100644 --- a/man/fromList.Rd +++ b/man/fromList.Rd @@ -15,4 +15,3 @@ A function to convert a list of named vectors to a data frame compatible with Up \note{ See "Basic Usage" vignette for an example on how to use this function in UpSetR. } - diff --git a/man/histogram.Rd b/man/histogram.Rd index 7df7d80..006c7e9 100644 --- a/man/histogram.Rd +++ b/man/histogram.Rd @@ -17,4 +17,3 @@ A pre-made histogram that can be added to custom.plot paramter. \note{ See examples section for upset function on how to use custom.plot parameter } - diff --git a/man/intersects.Rd b/man/intersects.Rd index c20573b..beffc73 100644 --- a/man/intersects.Rd +++ b/man/intersects.Rd @@ -19,4 +19,3 @@ A query paramter to visualize elements contained in specific intersections \note{ See examples section of upset function on how to use this function in the queries parameter. } - diff --git a/man/scatter_plot.Rd b/man/scatter_plot.Rd index ef6a6bf..cff0be2 100644 --- a/man/scatter_plot.Rd +++ b/man/scatter_plot.Rd @@ -19,4 +19,3 @@ A pre-made scatter plot that can be added to the custom.plot paramter. \note{ See examples section for upset function on how to use custom.plot parameter. } - diff --git a/man/upset.Rd b/man/upset.Rd index 8f1dc7d..7740109 100644 --- a/man/upset.Rd +++ b/man/upset.Rd @@ -176,4 +176,3 @@ Original UpSet Website: \url{http://vcg.github.io/upset/about/} UpSetR github for additional examples: \url{http://github.com/hms-dbmi/UpSetR} } -