plot_connections: Plot connections

Description Usage Arguments Value Examples

View source: R/plotting.R

Description

Plotting function for Cicero connections. Uses plotTracks as its basis

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
plot_connections(connection_df, chr, minbp, maxbp, coaccess_cutoff = 0,
  peak_color = "#B4656F", connection_color = "#7F7CAF",
  connection_color_legend = TRUE, alpha_by_coaccess = FALSE,
  connection_width = 2, connection_ymax = NULL, gene_model = NULL,
  gene_model_color = "#81D2C7", gene_model_shape = c("smallArrow",
  "box"), comparison_track = NULL, comparison_coaccess_cutoff = 0,
  comparison_peak_color = "#B4656F",
  comparison_connection_color = "#7F7CAF",
  comparison_connection_color_legend = TRUE,
  comparison_connection_width = 2, comparison_ymax = NULL,
  collapseTranscripts = FALSE, include_axis_track = TRUE,
  return_as_list = FALSE, viewpoint = NULL,
  comparison_viewpoint = TRUE, viewpoint_color = "#F0544F",
  viewpoint_fill = "#EFD8D7", viewpoint_alpha = 0.5)

Arguments

connection_df

Data frame of connections, which must include the columns 'Peak1', 'Peak2', and 'coaccess'. Generally, the output of run_cicero or assemble_connections.

chr

The chromosome of the region you would like to plot in the form 'chr10'.

minbp

The base pair coordinate of the start of the region to be plotted.

maxbp

The base pair coordinate of the end of the region to be plotted.

coaccess_cutoff

The minimum cicero co-accessibility score you would like to be plotted. Default is 0.

peak_color

Color for peak annotations - a single color, the name of a column containing color values that correspond to Peak1, or the name of column containing a character or factor to base peak colors on.

connection_color

Color for connection lines. A single color, the name of a column containing color values, or the name of a column containing a character or factor to base connection colors on.

connection_color_legend

Logical, should connection color legend be shown?

alpha_by_coaccess

Logical, should the transparency of connection lines be scaled based on co-accessibility score?

connection_width

Width of connection lines.

connection_ymax

Connection y-axis height. If NULL, chosen automatically.

gene_model

Either NULL or a data.frame. The data.frame should be in a form compatible with the Gviz function GeneRegionTrack-class (cannot have NA as column names).

gene_model_color

Color for gene annotations.

gene_model_shape

Shape for gene models, passed to GeneRegionTrack-class. Options described at GeneRegionTrack-class.

comparison_track

Either NULL or a data frame. If a data frame, a second track of connections will be plotted based on this data. This data frame has the same requirements as connection_df (Peak1, Peak2 and coaccess columns).

comparison_coaccess_cutoff

The minimum cicero co-accessibility score you would like to be plotted for the comparison dataset. Default = 0.

comparison_peak_color

Color for comparison peak annotations - a single color, the name of a column containing color values that correspond to Peak1, or the name of a column containing a character or factor to base peak colors on.

comparison_connection_color

Color for comparison connection lines. A single color, the name of a column containing color values, or the name of a column containing a character or factor to base connection colors on.

comparison_connection_color_legend

Logical, should comparison connection color legend be shown?

comparison_connection_width

Width of comparison connection lines.

comparison_ymax

Connection y-axis height for comparison track. If NULL, chosen automatically.

collapseTranscripts

Logical or character scalar. Can be one in gene, longest, shortest or meta. Variable is passed to the GeneRegionTrack-class function of Gviz. Determines whether and how to collapse related transcripts. See Gviz documentation for details.

include_axis_track

Logical, should a genomic axis be plotted?

return_as_list

Logical, if TRUE, the function will not plot, but will return the plot components as a list. Allows user to add/customize Gviz components and plot them separately using plotTracks.

viewpoint

NULL or Coordinates in form "chr1_10000_10020". Use viewpoint if you would like to plot cicero connections "4C-seq style". Only connections originating in the viewpoint will be shown. Ideal for comparisons with 4C-seq data. If comparison_viewpoint is TRUE, any comparison track will be subsetted as well.

comparison_viewpoint

Logical, should viewpoint apply to comparison track as well?

viewpoint_color

Color for the highlight border.

viewpoint_fill

Color for the highlight fill.

viewpoint_alpha

Alpha value for the highlight fill.

Value

A gene region plot, or list of components if return_as_list is TRUE.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
  cicero_cons <- data.frame(
             Peak1 = c("chr18_10034652_10034983", "chr18_10034652_10034983",
                       "chr18_10034652_10034983", "chr18_10034652_10034983",
                       "chr18_10087586_10087901", "chr18_10120685_10127115",
                       "chr18_10097718_10097934", "chr18_10087586_10087901",
                       "chr18_10154818_10155215", "chr18_10238762_10238983",
                       "chr18_10198959_10199183", "chr18_10250985_10251585"),
             Peak2 = c("chr18_10097718_10097934", "chr18_10087586_10087901",
                       "chr18_10154818_10155215", "chr18_10238762_10238983",
                       "chr18_10198959_10199183", "chr18_10250985_10251585",
                       "chr18_10034652_10034983", "chr18_10034652_10034983",
                       "chr18_10034652_10034983", "chr18_10034652_10034983",
                       "chr18_10087586_10087901", "chr18_10120685_10127115"),
             coaccess = c(0.0051121787, 0.0016698617, 0.0006570246,
                          0.0013466927, 0.0737935011, 0.3264019452,
                          0.0051121787, 0.0016698617, 0.0006570246,
                          0.0013466927, 0.0737935011, 0.3264019452))
  plot_connections(cicero_cons, chr = "chr18",
                   minbp = 10034652,
                   maxbp = 10251585,
                   peak_color = "purple")

cicero documentation built on Dec. 7, 2018, 6 p.m.