track_bedgraph {rGenomeTracks}R Documentation

Generate bedgraph track

Description

Generate genome_track object from bedgraph files.

Usage

track_bedgraph(
  file,
  title = NULL,
  height = 2,
  overlay_previous = "no",
  orientation = NULL,
  color = "#1f78b4",
  alpha = 1,
  max_value = NULL,
  min_value = NULL,
  use_middle = FALSE,
  show_data_range = TRUE,
  type = "fill",
  negative_color = NULL,
  nans_to_zeros = FALSE,
  summary_method = NULL,
  number_of_bins = 700,
  transform = "no",
  log_pseudocount = 0,
  y_axis_values = "transformed",
  second_file = NULL,
  operation = "file",
  grid = FALSE,
  rasterize = FALSE
)

Arguments

file

String. The location of the track file

title

String. If specificed, the title of the track to be displayed.

height

Numeric. The height of the plotted track in cm. Default is 2. See notes.

overlay_previous

String. Options are "no" (default) or "yes" or "share-y".

orientation

String. Default is NULL. Other option is "inverted".

color

String. Hex color or string color. Default is "#1f78b4".

alpha

Numeric variable between 0 and 1 to indicate level of transparancy. Default is 1.

max_value

Numeric. Default is NULL. The max value cut-off for the numeric column.

min_value

Numeric. Default is NULL. The max value cut-off for the numeric column.

use_middle

Boolean. Default is FALSE.

show_data_range

Boolean. Default is TRUE.

type

String. Options are "fill" (default),"line", "points".

negative_color

Hex color or string to indicate color of negative values. Default is NULL.

nans_to_zeros

Boolean. To convert empty values to zeros, set this to TRUE. Default is FALSE.

summary_method

String. summary_method applied over bin range. This parameter is set to NULL. See details for options.

number_of_bins

Numeric value to indicate summary method used over the bin range. Default is 700

transform

String to indicate type of transformation applied. Default is "no".

log_pseudocount

Numeric. Default is 0.

y_axis_values

String with two options "transformed" (default) or "original".

second_file

Path for another file to be included in operations. This parameter is not set by default.

operation

Default is set to "file". See details.

grid

Boolean. Default is FALSE.

rasterize

Boolean. Default is FALSE.

Details

summary_method parameter can be choosen to be by "mean", "average", "max", "min", "stdev", "dev", "coverage", "cov" or "sum". Tranform paramter options are "no" (default) or "log", "log1p", "-log", "log2" or "log10". 'log1p': transformed_values = log(1 + initial_values) 'log': transformed_values = log(log_pseudocount + initial_values) 'log2': transformed_values = log2(log_pseudocount + initial_values) 'log10': transformed_values = log10(log_pseudocount + initial_values) '-log': transformed_values = log(log_pseudocount + initial_values) To compute operations on the fly on the file or between 2 bedgraph files, you can tweak operation parameter, it should contains file or file and second_file. It is adviced to use nans_to_zeros = TRUE to avoid unexpected results. Example value for operation are "0.89 * file", "- file", "file - second_file", "log2((1 + file) / (1 + second_file))" and "max(file, second_file)"

to add the preferred line width or point size : type = "line:lw" where lw (linewidth) is numeric value. Like type = "line:0.5" and type = "points:0.5"

By default the bedgraph is plotted at the base pair resolution. This can lead to very large pdf/svg files. If plotting large regions. If you want to decrase the size of your file. You can either rasterize the bedgraph profile by using: rasterize = TRUE

Value

genome_track

Note

fontsize parameter can be overriden by the same argument in plot_gtracks() height parameter will be ignored if overlay_previous is set.

Author(s)

Omar Elashkar

Examples

bg_dir <- system.file("extdata", "GSM3182416_E12DHL_WT_Hoxd11vp.bedgraph.gz",
  package = "rGenomeTracks"
)
bed_genes_dir <- system.file("extdata", "HoxD_cluster_regulatory_regions_mm10.bed",
  package = "rGenomeTracks"
)

bg <- track_bedgraph(bg_dir, color = "green", height = 5, max_value = 10)
bg_middle <- track_bedgraph(bg_dir,
  use_middle = TRUE, color = "blue",
  height = 5, max_value = 10
)
bed_genes <- track_bed(bed_genes_dir,
  title = "Regulatory regions", ,
  color = "red", height = 3
)

tracks <- track_x_axis(where = "top") + bg + bg_middle + bed_genes
## Not run: 
plot_gtracks(tracks,
  chr = 2, start = 738 * 10^5, end = 750 * 10^5,
  trackLabelFraction = 0.2
)

## End(Not run)

[Package rGenomeTracks version 1.0.0 Index]