plogomaker: Main workhorse function that builds the positive logo plots

Description Usage Arguments Value Examples

View source: R/plogomaker.R

Description

stacks logos created by the makemylogo function on top of each other to build the logo plot.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
plogomaker(table, ic = NULL, color_profile, total_chars = c("A", "B",
  "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P",
  "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "zero", "one", "two",
  "three", "four", "five", "six", "seven", "eight", "nine", "dot", "comma",
  "dash", "colon", "semicolon", "leftarrow", "rightarrow"), bg = NULL,
  frame_width = NULL, ic.scale = TRUE, xaxis = TRUE, yaxis = TRUE,
  xaxis_fontsize = 10, xlab_fontsize = 15, y_fontsize = 15,
  main_fontsize = 16, start = 0.001, yscale_change = TRUE,
  pop_name = NULL, xlab = "X", ylab = "Information content",
  col_line_split = "grey80", addlogos = NULL, addlogos_text = NULL,
  newpage = TRUE, control = list())

Arguments

table

The input table (data frame or matrix) of counts across different logos or symbols (specified along the rows) ans across different sites or positions or groups (specified along the columns).

ic

A vector of same length as the number of columns in the table, repesenting the heights of the logo stacked bars for each position/site/block. It defaults to NULL, in which case, the function computes the ic vector using the ic_computer functionality.

color_profile

A list containing two elements - "type" and "col". The type can be of three types - "per-row", "per-column" and "per-symbol". The "col" element is a vector of colors, of same length as number of rows in table for "per-row" (assigning a color to each string), of same length as number of columns in table for "per-column" (assuming a color for each column), or a distinct color for a distinct symbol in "per-symbol". For "per-symbol", the length of the color_profile$col should be same as library size of the logos, but if the vector of colors provided is more or less, we can downsample or upsample the colors as required. The colors are matched with the symbols in the total_chars

total_chars

The total number of character symbols in the user library. The default is the default library provided by Logolas, but the user can add symbols that he creates to this list.

bg

The background probability, which defaults to NULL, in which case equal probability is assigned to each symbol. The user can however specify a vector (equal to in length to the number of symbols) which specifies the background probability for each symbol and assumes this background probability to be the same across the columns (sites), or a matrix, whose each cell specifies the background probability of the symbols for each position.

frame_width

The width of the frames for individual site/postion/column in the logo plot. As default, all the columns have same width, equal to 1.

ic.scale

if TRUE, the height of the bars in the stacked logo chart for each column is determined based on the information criterion input. Otherwise, the bars are normalized so that the height of each bar is $1$. Defaults to TRUE.

xaxis

Binary specifying if there should be a X axis in the logo plot or not. Defaults to TRUE.

yaxis

Binary specifying if there should be a Y axis in the logo plot or not. Defaults to TRUE.

xaxis_fontsize

The size of the X-axis axis ticks.

xlab_fontsize

The size of the X-axis label.

y_fontsize

The size of the Y-axis font.

main_fontsize

The size of the title.

start

The starting point in Y axis for the first logo. Default is 0.0001 which is very close to 0.

yscale_change

If TRUE, adjusts the Y axis scale based on the size of the bars, else keeps it to the maximum value possible, which is ceiling(max(ic) under ic_computer defined IC criteria.

pop_name

User can mention a name of the population for which the logo plot is created. Defaults to NULL when no population name is mentioned.

xlab

X axis label

ylab

Y axis label

col_line_split

The color of the line split between the consecutive groups or blocks

addlogos

Vector of additional logos/symbols defined by user

addlogos_text

Vector of the names given to the additional logos/symbols defined by user.

newpage

if TRUE, plots the logo plot in a new page. Defaults to TRUE.

control

control parameters fixing whether the height of the logos is detrmined by IC or histogram proportions (hist), the scales for the plot (scale0, scale1), whether the symbols should be filled with color or border colored (tofill), the Renyi alpha parameter for the entropy calculation (alpha), the gap between ylabel and y-axis and xlabel and x-axis texts (gap_ylab, gap_xlab), and the viewport configuration details for the plot (viewport.margin.bottom, viewport.margin.left, viewport.margin.top, viewport.margin.right), whether the height of the logos would be fixed apriori or determined by the PWM matrix as in seqLogo (use_seqLogo_heights) etc.

Value

Plots the logo plot for the table data, with column names representing the sites/blocks and the row names denoting the symbols for which logos are plotted

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
cols = RColorBrewer::brewer.pal.info[RColorBrewer::brewer.pal.info$category == 'qual',]
col_vector = unlist(mapply(RColorBrewer::brewer.pal, cols$maxcolors, 
                         rownames(cols)))
counts_mat <- rbind(c(0, 10, 100, 60, 20),
                   c(40, 30, 30, 35, 20),
                   c(100, 0, 15, 25, 75),
                   c(10, 30, 20, 50, 70))
colnames(counts_mat) <- c("2012", "2013", "2014", "2015", "2016")
rownames(counts_mat) <- c("MAN", "MAIL", "LAWN", "CAR")

color_profile <- list("type" = "per_symbol",
                     "col" = col_vector)
plogomaker(counts_mat,
          color_profile = color_profile,
          frame_width = 1,
          ic.scale = FALSE)

color_profile <- list("type" = "per_row",
                     "col" = col_vector[1:4])

plogomaker(counts_mat,
         color_profile = color_profile,
         frame_width = 1,
         ic.scale = FALSE)

color_profile <- list("type" = "per_column",
                      "col" = col_vector[1:5])

plogomaker(counts_mat,
         color_profile = color_profile,
         frame_width = 1,
         ic.scale = FALSE)

kkdey/Logolas documentation built on May 20, 2019, 10:30 a.m.