Title: | A package for visualization and extract details |
---|---|
Description: | A set of functions to generate high-resolution Venn,Vennpie plot,extract and combine details of these subsets with user datasets in data frame is available. |
Authors: | Kai Guo, Brett McGregor |
Maintainer: | Kai Guo <[email protected]> |
License: | GPL-2 |
Version: | 1.23.0 |
Built: | 2024-10-31 06:25:35 UTC |
Source: | https://github.com/bioc/VennDetail |
Give first colname as RowNxyz
.add_colnames(x)
.add_colnames(x)
x |
data frame |
return data frame with the first colnames change to "RowNxyz"
make table for venndetail modified from make.truth.table (VennDiagram)
.make.table(x)
.make.table(x)
x |
A list with input groups |
A data frame with logical vector columns and 2 ^ length(x)-1 rows.
Kai Guo
The objective of this function is to summarizes the overlaps across groups identified by venndetail without creating diagram.
detail(object) ## S4 method for signature 'Venn' detail(object)
detail(object) ## S4 method for signature 'Venn' detail(object)
object |
Venn object |
Numeric vector with set names and amounts for each set
Kai Guo
A <- sample(1:100, 40, replace = FALSE) B <- sample(1:100, 60, replace = FALSE) C <- sample(1:100, 40, replace = FALSE) res <- venndetail(list(A = A, B = B, C = C)) detail(res)
A <- sample(1:100, 40, replace = FALSE) B <- sample(1:100, 60, replace = FALSE) C <- sample(1:100, 40, replace = FALSE) res <- venndetail(list(A = A, B = B, C = C)) detail(res)
The amount of members within each group determined by venndetail will be displayed as a bar plot. This will include all groups such as shared, pairwise, and unique. The order of the figure can be adjusted by the users by using the order argument.The text size argument will allow users to change the size of the numbers above the bars indicating the total number of members within each group.
dplot(object, order = FALSE, textsize = 5) ## S4 method for signature 'Venn' dplot(object, order = FALSE, textsize = 5)
dplot(object, order = FALSE, textsize = 5) ## S4 method for signature 'Venn' dplot(object, order = FALSE, textsize = 5)
object |
Venn object |
order |
Boolean indicating whether to sort the bar (default: FALSE). |
textsize |
Numeric vector giving the text size above the bar. |
Produces a bar plot displaying the total counts within each group
Kai Guo
A <- sample(1:100, 40, replace = FALSE) B <- sample(1:100, 60, replace = FALSE) C <- sample(1:100, 40, replace = FALSE) res <- venndetail(list(A = A, B = B, C = C)) dplot(res, order = TRUE, textsize = 3)
A <- sample(1:100, 40, replace = FALSE) B <- sample(1:100, 60, replace = FALSE) C <- sample(1:100, 40, replace = FALSE) res <- venndetail(list(A = A, B = B, C = C)) dplot(res, order = TRUE, textsize = 3)
GetFeature allows users to extract subsets from venn object into a table format along with accompanying information from the data frames provided in the rlist argument
getFeature(object, subset, rlist, userowname = TRUE, gind = NULL, sep = "_", wide = FALSE) ## S4 method for signature 'Venn' getFeature(object, subset, rlist, userowname = TRUE, gind = NULL, sep = "_", wide = FALSE)
getFeature(object, subset, rlist, userowname = TRUE, gind = NULL, sep = "_", wide = FALSE) ## S4 method for signature 'Venn' getFeature(object, subset, rlist, userowname = TRUE, gind = NULL, sep = "_", wide = FALSE)
object |
Venn object |
subset |
Character vector giving the names of the user-defined subset to extract |
rlist |
List of user-supplied data frames to combine with venndetail result |
userowname |
Boolean indicating whether to use row names to join data frames or not (default: TRUE) |
gind |
Column name or index of each user-supplied data.frame to use to join data frames(valid only when userowname=FALSE) |
sep |
Character string used to separate the terms when concatenating group names into new separation character for new column names in the resulting data frame |
wide |
Boolean indicating whether to use wide format(default:FALSE) |
data.frame with subsets information and details from the user supplied data frame
Kai Guo
A <- sample(1:100, 40, replace = FALSE) B <- sample(1:100, 60, replace = FALSE) C <- sample(1:100, 40, replace = FALSE) dA <- data.frame(A = A, "FC" = rnorm(40)) dB <- data.frame(B = B, "FC" = rnorm(60)) dC <- data.frame(C = C, "FC" = rnorm(40)) res <- venndetail(list(A = A, B = B, C = C)) rhs <- getFeature(res, subset = "Shared", rlist = list(dA, dB, dC), userowname= FALSE, gind = rep(1, 3))
A <- sample(1:100, 40, replace = FALSE) B <- sample(1:100, 60, replace = FALSE) C <- sample(1:100, 40, replace = FALSE) dA <- data.frame(A = A, "FC" = rnorm(40)) dB <- data.frame(B = B, "FC" = rnorm(60)) dC <- data.frame(C = C, "FC" = rnorm(40)) res <- venndetail(list(A = A, B = B, C = C)) rhs <- getFeature(res, subset = "Shared", rlist = list(dA, dB, dC), userowname= FALSE, gind = rep(1, 3))
getSet function provides a way to extract subsets from venndetail object
getSet(object, subset = NULL, min = 0, wide = FALSE) ## S4 method for signature 'Venn' getSet(object, subset = NULL, min = 0, wide = FALSE)
getSet(object, subset = NULL, min = 0, wide = FALSE) ## S4 method for signature 'Venn' getSet(object, subset = NULL, min = 0, wide = FALSE)
object |
Venn object |
subset |
Character vector giving the subset names |
min |
The minimum number of input groups that a subset must belong to e.g. min = 2 will only report those subsets with elements shared by 2 or more input groups. |
wide |
Boolean indicating return wide format (default: FALSE). |
Specific subset information
Kai Guo
A <- sample(1:100, 40, replace = FALSE) B <- sample(1:100, 60, replace = FALSE) C <- sample(1:100, 40, replace = FALSE) res <- venndetail(list(A = A, B = B, C = C)) getSet(res, "A")
A <- sample(1:100, 40, replace = FALSE) B <- sample(1:100, 60, replace = FALSE) C <- sample(1:100, 40, replace = FALSE) res <- venndetail(list(A = A, B = B, C = C)) getSet(res, "A")
Get subset from list of input groups
make.subset(x, sep = "_")
make.subset(x, sep = "_")
x |
A list with input groups |
sep |
symbol character used when concatenating group names into subset names |
A list of subsets. The names on the list are the subset names and the list elements are the subset details.
Kai Guo
A <- sample(1:100, 40, replace = FALSE) B <- sample(1:100, 60, replace = FALSE) C <- sample(1:100, 40, replace = FALSE) x <- list(A = A, B = B, C = C) out <- make.subset(x)
A <- sample(1:100, 40, replace = FALSE) B <- sample(1:100, 60, replace = FALSE) C <- sample(1:100, 40, replace = FALSE) x <- list(A = A, B = B, C = C) out <- make.subset(x)
Merge will combine multiple venn diagrams to allow comparison between multiple groups
## S3 method for class 'Venn' merge(x, y, ignore.case = FALSE, useupper = TRUE, plot = FALSE, ...)
## S3 method for class 'Venn' merge(x, y, ignore.case = FALSE, useupper = TRUE, plot = FALSE, ...)
x |
Venn object |
y |
Venn object |
ignore.case |
Boolean indicating whether to ignore case of group names (default: FALSE) |
useupper |
Boolean indicating whether to use uppercases for group names (default: TRUE) |
plot |
Boolean indicating whether to plot figure or not (default: FALSE) |
... |
arguments for venndetail |
venn object
A <- sample(1:100, 40, replace = FALSE) B <- sample(1:100, 60, replace = FALSE) C <- sample(1:100, 40, replace = FALSE) res1 <- venndetail(list(A = A, B = B)) res2 <- venndetail(list(A = A, C = C)) res <- merge(res1, res2)
A <- sample(1:100, 40, replace = FALSE) B <- sample(1:100, 60, replace = FALSE) C <- sample(1:100, 40, replace = FALSE) res1 <- venndetail(list(A = A, B = B)) res2 <- venndetail(list(A = A, C = C)) res <- merge(res1, res2)
The plot function allows users to graphically display the groups and overlap between groups in their venn class object through a variety of graph types such as a bar plot, traditional venn, or venn pie chart.
## S3 method for class 'Venn' plot(x, type = "venn", col = "black", sep = "_", mycol = c("dodgerblue", "goldenrod1", "darkorange1", "seagreen3", "orchid3"), cat.cex = 1.5, alpha = 0.5, cex = 2, cat.fontface = "bold", margin = 0.05, text.scale = c(1.5, 1.5, 1.5, 1.5, 1.5, 1.5), filename = NULL, piecolor = NULL, revcolor = "lightgrey", any = NULL, show.number = TRUE, show.x = TRUE, log = FALSE, base = NULL, percentage = FALSE, sets.x.label = "Set Size", mainbar.y.label = "Intersection Size", nintersects = 40, abbr = FALSE, abbr.method = "both.sides", minlength = 3, ...)
## S3 method for class 'Venn' plot(x, type = "venn", col = "black", sep = "_", mycol = c("dodgerblue", "goldenrod1", "darkorange1", "seagreen3", "orchid3"), cat.cex = 1.5, alpha = 0.5, cex = 2, cat.fontface = "bold", margin = 0.05, text.scale = c(1.5, 1.5, 1.5, 1.5, 1.5, 1.5), filename = NULL, piecolor = NULL, revcolor = "lightgrey", any = NULL, show.number = TRUE, show.x = TRUE, log = FALSE, base = NULL, percentage = FALSE, sets.x.label = "Set Size", mainbar.y.label = "Intersection Size", nintersects = 40, abbr = FALSE, abbr.method = "both.sides", minlength = 3, ...)
x |
Venn object |
type |
Use venn, vennpie or upset (default: venn) |
col |
Character vector giving the color of the circles. |
sep |
Character string used to separate the terms when concatenating group names into new column names (colnames)(vennpie). |
mycol |
Character vector giving the filled color for VennDiagram circles. |
cat.cex |
Numeric vector giving the size of the category names. |
alpha |
A number giving the transparency value. |
cex |
A numerical value giving the text size for venndiagram |
cat.fontface |
A character giving the fontface (font style) for category name. |
margin |
Number giving the amount of whitespace around the diagram in grid units |
text.scale |
Numeric vector of text sizes for upset diagram (ylab, yaxis, xlab, subset name, xaxis, insection). |
filename |
Filename for output figure. |
piecolor |
Character vector giving the colors of the subsets(vennpie). |
revcolor |
Character giving the color for the non-selected subsets(vennpie). |
any |
Number to indicate selected subsets, such as 1 means any unique subsets, 2 means any subsets shared by two groups(vennpie). |
show.number |
Boolean indicating whether to display the element numbers of the subsets or not (default: TRUE)(vennpie). |
show.x |
Boolean indicating whether to show subset labels outside the circle (default: TRUE)(vennpie). |
log |
Boolean indicating whether to transform the data in log scale(vennpie). |
base |
Base value for log transformation(vennpie). |
percentage |
Boolean indicating whether to display subset percentages (default: FALSE)(vennpie). |
sets.x.label |
x-axis label (upset) |
mainbar.y.label |
y-axis label (upset) |
nintersects |
Number of intersections to plot. If subset to NA, all intersections will be plotted. |
abbr |
Boolean indicating whether to abbreviate subset names (default: FALSE). |
abbr.method |
a character string specifying the method used. Partial matches allowed. (default: both side). |
minlength |
Minmal length for the subset name. |
... |
further arguments passed to or from other methods |
different type of graphics based on user chose
Kai Guo
A <- sample(1:100, 40, replace = FALSE) B <- sample(1:100, 60, replace = FALSE) C <- sample(1:100, 40, replace = FALSE) res <- venndetail(list(A = A, B = B, C = C)) plot(res, type = "venn")
A <- sample(1:100, 40, replace = FALSE) B <- sample(1:100, 60, replace = FALSE) C <- sample(1:100, 40, replace = FALSE) res <- venndetail(list(A = A, B = B, C = C)) plot(res, type = "venn")
Result will return output in a table format including the contents of the subsets included in the venndetail object
result(object, wide = FALSE) ## S4 method for signature 'Venn' result(object, wide = FALSE)
result(object, wide = FALSE) ## S4 method for signature 'Venn' result(object, wide = FALSE)
object |
Venn object |
wide |
Boolean indicating whether to return wide format(default:FALSE) |
return dataframe and print header of dataframe
Kai Guo
A <- sample(1:100, 40, replace = FALSE) B <- sample(1:100, 60, replace = FALSE) C <- sample(1:100, 40, replace = FALSE) res <- venndetail(list(A = A, B = B, C = C)) result <- result(res)
A <- sample(1:100, 40, replace = FALSE) B <- sample(1:100, 60, replace = FALSE) C <- sample(1:100, 40, replace = FALSE) res <- venndetail(list(A = A, B = B, C = C)) result <- result(res)
join two dataframes by rownames
rowjoin(x, y, fun = "fun_join") ## S4 method for signature 'data.frame,data.frame' rowjoin(x, y, fun = "full_join")
rowjoin(x, y, fun = "fun_join") ## S4 method for signature 'data.frame,data.frame' rowjoin(x, y, fun = "full_join")
x |
data.frame x |
y |
data.frame y |
fun |
Different join format: left_join, full_join, right_join (default:full_join) |
dataframe with join results
Kai Guo
library(dplyr) A <- sample(1:100, 40, replace = FALSE) B <- sample(1:100, 60, replace = FALSE) dA <- data.frame(A = A, "FC" = rnorm(40)) dB <- data.frame(B = B, "FC" = rnorm(60)) rownames(dA) <- A rownames(dB) <- B rowjoin(dA, dB)
library(dplyr) A <- sample(1:100, 40, replace = FALSE) B <- sample(1:100, 60, replace = FALSE) dA <- data.frame(A = A, "FC" = rnorm(40)) dB <- data.frame(B = B, "FC" = rnorm(60)) rownames(dA) <- A rownames(dB) <- B rowjoin(dA, dB)
Setcolor will provide a list of color vectors based on the number used as an input.
setcolor(x)
setcolor(x)
x |
Number of color |
color vector
Kai Guo
mycol <- setcolor(10) mycol
mycol <- setcolor(10) mycol
This function provides a summary of the venn object, including a full results and subsets as well as an summary information.
## S4 method for signature 'Venn' show(object)
## S4 method for signature 'Venn' show(object)
object |
venn object |
summary information for the venn object
Kai Guo
A <- sample(1:100, 40, replace = FALSE) B <- sample(1:100, 60, replace = FALSE) C <- sample(1:100, 40, replace = FALSE) res <- venndetail(list(A = A, B = B, C = C)) show(res)
A <- sample(1:100, 40, replace = FALSE) B <- sample(1:100, 60, replace = FALSE) C <- sample(1:100, 40, replace = FALSE) res <- venndetail(list(A = A, B = B, C = C)) show(res)
print the summary information of Venn object
## S3 method for class 'Venn' summary(object, ...)
## S3 method for class 'Venn' summary(object, ...)
object |
Venn object |
... |
other arguments ignored (for compatibility with generic) |
summary information
A <- sample(1:100, 40, replace = FALSE) B <- sample(1:100, 60, replace = FALSE) C <- sample(1:100, 40, replace = FALSE) res <- venndetail(list(A = A, B = B, C = C)) summary(res)
A <- sample(1:100, 40, replace = FALSE) B <- sample(1:100, 60, replace = FALSE) C <- sample(1:100, 40, replace = FALSE) res <- venndetail(list(A = A, B = B, C = C)) summary(res)
T2DM data are differential expression genes (DEGs) with annotation from the publication by Hinder et al. The data contains three DEG sets from three different tissues (Cortex,SCN,Glom). DEGs were determined by using Cuffdiff with a false discovery rate (FDR) < 0.05 between groups with or without pioglitazone treatment.
T2DM
T2DM
A list of data frame with five columns individually:
Entrez gene IDs
HGNC symbols
Gene function
log2 Fold Change
False Discovery Rate
T2DM
T2DM
Class 'Venn' This class includes all information from venndetail
input
orginal input datasets
raw
summary of the input datasets
sep
separation character
GroupNames
input group names
result
shared or unique sets
detail
shared of unique number belongs to each sets
wide
result in wide format
Kai Guo
Extracts shared and unique elements from groups provided to the function.This base function will create a formal class venn object and can also graphically plot the amount of objects in each group. The plot will be in the form of a traditional venn diagram as default.And users can also use vennpie or upset methods to display the result.
venndetail(x, sep = "_", abbr = FALSE, minlength = 3, abbr.method = "both side")
venndetail(x, sep = "_", abbr = FALSE, minlength = 3, abbr.method = "both side")
x |
A list of variables with group names. |
sep |
symbol character used when concatenating group names into subset names (default: ‘_’). |
abbr |
Boolean indicating whether to abbreviate subset names (default: FALSE). |
minlength |
Minmal length for the subset name. |
abbr.method |
a character string specifying the method used. Partial matches allowed. (default: both side). |
Extract shared and unique subsets
venn object and figures
Kai Guo
A <- sample(1:100, 40, replace = FALSE) B <- sample(1:100, 60, replace = FALSE) C <- sample(1:100, 40, replace = FALSE) res <- venndetail(list(A = A, B = B, C = C))
A <- sample(1:100, 40, replace = FALSE) B <- sample(1:100, 60, replace = FALSE) C <- sample(1:100, 40, replace = FALSE) res <- venndetail(list(A = A, B = B, C = C))
Vennpie uses the venn object and to creates a figure in the form of a venn pie diagram rather than a traditional venn diagram. Users can highlight a specific sections of the venn pie.
vennpie(object, subset = NULL, top = 31, min = 0, color = NULL, revcolor = "lightgrey", any = NULL, show.number = TRUE, show.x = TRUE, sep = "_", log = FALSE, base = NULL, percentage = FALSE) ## S4 method for signature 'Venn' vennpie(object, subset = NULL, top = 31, min = 0, color = NULL, revcolor = "lightgrey", any = NULL, show.number = TRUE, show.x = TRUE, sep = "_", log = FALSE, base = NULL, percentage = FALSE)
vennpie(object, subset = NULL, top = 31, min = 0, color = NULL, revcolor = "lightgrey", any = NULL, show.number = TRUE, show.x = TRUE, sep = "_", log = FALSE, base = NULL, percentage = FALSE) ## S4 method for signature 'Venn' vennpie(object, subset = NULL, top = 31, min = 0, color = NULL, revcolor = "lightgrey", any = NULL, show.number = TRUE, show.x = TRUE, sep = "_", log = FALSE, base = NULL, percentage = FALSE)
object |
Venn object |
subset |
Character vector giving the subset users want to highlight. |
top |
number of subsets with largest to display (default: 31) |
min |
The minimum number of input groups that a subset must belong to e.g. min = 2 will only report those subsets with elements shared by 2 or more input groups. |
color |
Character vector giving the colors of the subsets. |
revcolor |
Character giving the color for the non-selected subsets. |
any |
Number to indicate selected subsets, such as 1 means any unique subsets, 2 means any subsets shared by two groups. |
show.number |
Boolean indicating whether to display the element numbers of the subsets or not (default: TRUE). |
show.x |
Boolean indicating whether to show subset labels outside the circle (default: TRUE). |
sep |
Character string used to separate the terms when concatenating group names into new column names (colnames). |
log |
Boolean indicating whether to transform the data in log scale . |
base |
Base value for log transformation. |
percentage |
Boolean indicating whether to display subset percentages (default: FALSE). |
vennpie figure
Kai Guo
A <- sample(1:100, 40, replace = FALSE) B <- sample(1:100, 60, replace = FALSE) C <- sample(1:100, 40, replace = FALSE) res <- venndetail(list(A = A, B = B, C = C)) vennpie(res)
A <- sample(1:100, 40, replace = FALSE) B <- sample(1:100, 60, replace = FALSE) C <- sample(1:100, 40, replace = FALSE) res <- venndetail(list(A = A, B = B, C = C)) vennpie(res)