trans_venn: Create trans_venn object.

trans_vennR Documentation

Create trans_venn object.

Description

This class is a wrapper for a series of venn analysis related methods, including venn result, 2- to 5-way venn diagram, more than 5-way petal plot and venn result transformations based on David et al. (2012) <doi:10.1128/AEM.01459-12>.

Methods

Public methods


Method new()

Usage
trans_venn$new(
  dataset = NULL,
  sample_names = NULL,
  ratio = NULL,
  add_abund_table = NULL,
  name_joint = "&"
)
Arguments
dataset

the object of microtable Class.

sample_names

default NULL; if provided, filter the samples.

ratio

default NULL; NULL, "numratio" or "seqratio"; numratio: calculate number percentage; seqratio: calculate sequence percentage; NULL: no additional percentage.

add_abund_table

default NULL; data.frame or matrix format; additional data provided instead of dataset$otu_table; Features must be rows.

name_joint

default "&"; the joint mark for generating multi-sample names.

Returns

data_details and data_summary stored in trans_venn object.

Examples
\donttest{
data(dataset)
t1 <- dataset$merge_samples(use_group = "Group")
t1 <- trans_venn$new(dataset = t1, ratio = "numratio")
}

Method plot_venn()

Plot venn diagram.

Usage
trans_venn$plot_venn(
  color_circle = RColorBrewer::brewer.pal(8, "Dark2"),
  fill_color = TRUE,
  text_size = 4.5,
  text_name_size = 6,
  text_name_position = NULL,
  alpha = 0.3,
  linesize = 1.1,
  petal_plot = FALSE,
  petal_color = "#BEAED4",
  petal_color_center = "#BEBADA",
  petal_a = 4,
  petal_r = 1,
  petal_use_lim = c(-12, 12),
  petal_center_size = 40,
  petal_move_xy = 4,
  petal_move_k = 2.3,
  petal_move_k_count = 1.3,
  petal_text_move = 40,
  other_text_show = NULL,
  other_text_position = c(2, 2),
  other_text_size = 5
)
Arguments
color_circle

default RColorBrewer::brewer.pal(8, "Dark2"); color pallete

fill_color

default TRUE; whether fill the area color

text_size

default 4.5; text size in plot

text_name_size

default 6; name size in plot

text_name_position

default NULL; name position in plot

alpha

default .3; alpha for transparency

linesize

default 1.1; cycle line size

petal_plot

default FALSE; whether use petal plot.

petal_color

default "#BEAED4"; color of the petals.

petal_color_center

default "#BEBADA"; color of the center in the petal plot.

petal_a

default 4; the length of the ellipse

petal_r

default 1; scaling up the size of the ellipse

petal_use_lim

default c(-12, 12); the width of the plot

petal_center_size

default 40; petal center circle size

petal_move_xy

default 4; the distance of text to circle

petal_move_k

default 2.3; the distance of title to circle

petal_move_k_count

default 1.3; the distance of data text to circle

petal_text_move

default 40; the distance between two data text

other_text_show

default NULL; other characters used to show in the plot

other_text_position

default c(1, 1); the text position for text in other_text_show

other_text_size

default 5; the text size for text in other_text_show

Returns

ggplot.

Examples
\donttest{
t1$plot_venn()
}

Method plot_bar()

Plot the intersections using histogram. Especially useful when samples > 5.

Usage
trans_venn$plot_bar(
  bottom_y_text_size = 12,
  up_y_title = "Intersection set",
  up_y_title_size = 15,
  up_y_text_size = 8,
  bar_color = "grey70",
  bar_fill = "grey70",
  point_size = 3,
  point_color = "black",
  bottom_height = 0.5
)
Arguments
bottom_y_text_size

default 12; y axis text size, i.e. sample name size, of bottom plot.

up_y_title

default "Intersection set"; y axis title of upper plot.

up_y_title_size

default 15; y axis title size of upper plot.

up_y_text_size

default 4; y axis text size of upper plot.

bar_color

default "grey70"; bar border color of upper plot.

bar_fill

default "grey70"; bar fill color of upper plot.

point_size

default 3; point size of bottom plot.

point_color

default "black"; point color of bottom plot.

bottom_height

default 0.5; bottom plot height.

Returns

a ggplot2 object.

Examples
\donttest{
t2 <- t1$plot_bar()
}

Method trans_comm()

Transform venn result to community-like microtable object for further composition analysis.

Usage
trans_venn$trans_comm(use_frequency = TRUE)
Arguments
use_frequency

default TRUE; whether only use OTUs occurrence frequency, i.e. presence/absence data; if FALSE, use abundance data.

Returns

a new microtable class.

Examples
\donttest{
t2 <- t1$trans_comm(use_frequency = TRUE)
}

Method print()

Print the trans_venn object.

Usage
trans_venn$print()

Method clone()

The objects of this class are cloneable with this method.

Usage
trans_venn$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `trans_venn$new`
## ------------------------------------------------


data(dataset)
t1 <- dataset$merge_samples(use_group = "Group")
t1 <- trans_venn$new(dataset = t1, ratio = "numratio")


## ------------------------------------------------
## Method `trans_venn$plot_venn`
## ------------------------------------------------


t1$plot_venn()


## ------------------------------------------------
## Method `trans_venn$plot_bar`
## ------------------------------------------------


t2 <- t1$plot_bar()


## ------------------------------------------------
## Method `trans_venn$trans_comm`
## ------------------------------------------------


t2 <- t1$trans_comm(use_frequency = TRUE)


microeco documentation built on June 22, 2022, 9:07 a.m.