plot_gtracks {rGenomeTracks}R Documentation

Plotting genomic tracks

Description

This is a generic function used to plot genome_track objects.

Usage

plot_gtracks(
  obj,
  chr,
  start,
  end,
  dir = NULL,
  plot = TRUE,
  verbose = FALSE,
  dpi = 100,
  title = NULL,
  fontsize = NULL,
  width = 40,
  height = NULL,
  trackLabelFraction = 0.05,
  trackLabelHAlign = "left",
  ...
)

## S4 method for signature 'genome_track'
plot_gtracks(
  obj,
  chr,
  start,
  end,
  dir = NULL,
  plot = TRUE,
  verbose = FALSE,
  dpi = 100,
  title = NULL,
  fontsize = NULL,
  width = 40,
  height = NULL,
  trackLabelFraction = 0.05,
  trackLabelHAlign = "left",
  ...
)

Arguments

obj

genome_track object. Define all tracks to be plotted.

chr

String or numeric value to indicate the chromosome desire.

start

Numeric. Starting position of plotting on the defined chromosome.

end

Numeric. Starting position of plotting on the defined chromosome.

dir

String. Default is NULL. If defined, a string to directory and extension to which image is exported. Extension could be png, svg or pdf.

plot

Boolean. Default if TRUE. If FALSE, plot will not be generated, only exported.

verbose

If TRUE, print command that will be passed to pyGenomeTracks.

dpi

Numeric. Default is 100

title

String. Title of the generated plot. Default is NULL.

fontsize

If set, global fontsize value overrides individual tracks.R . argument of all tracks passed.

width

Numeric. The width of the plot. Default is 40

height

Numeric. Height of the plot. Default is NULL to set is based on tracks height.

trackLabelFraction

Numeric. Default is 0.05.

trackLabelHAlign

String. Position of labels aligment. Options are "left", "right" or "center". Default is "left".

...

Extra arguments to be passed for generic plot().

Value

None

None

Note

For this function to run, you need pyGenomeTracks installed in R's loading enviroment. If not, please run install_pyGenomeTracks()

Author(s)

Omar Elashkar

Omar Elashkar

Examples

## Not run: 
# Get example data directories
# Download h5 example
ah <- AnnotationHub()
query(ah, "rGenomeTracksData")
h5_dir <- ah[["AH95901"]]
tads_dir <- system.file("extdata", "tad_classification.bed",
  package = "rGenomeTracks"
)
arcs_dir <- system.file("extdata", "links2.links", package = "rGenomeTracks")
bw_dir <- system.file("extdata", "bigwig2_X_2.5e6_3.5e6.bw", package = "rGenomeTracks")
#
# Create HiC track from HiC matrix
h5 <- track_hic_matrix(
  file = h5_dir, depth = 250000, min_value = 5, max_value = 200,
  transform = "log1p", show_masked_bins = FALSE
)

# Create TADS track
tads <- track_domains(
  file = tads_dir, border_color = "black",
  color = "none", height = 5,
  line_width = 5,
  show_data_range = FALSE,
  overlay_previous = "share-y"
)

# Create arcs track
arcs <- track_links(
  file = arcs_dir, links_type = "triangles", line_style = "dashed",
  overlay_previous = "share-y",
  color = "darkred",
  line_width = 3,
  show_data_range = FALSE
)

# Create bigwig track
bw <- track_bigwig(
  file = bw_dir, color = "red",
  max_value = 50,
  min_value = 0,
  height = 4,
  overlay_previous = "yes",
  show_data_range = FALSE
)

# Create one object from HiC, arcs and bigwid
tracks <- h5 + arcs + bw

# Plot the tracks
plot_gtracks(tracks, chr = "X", start = 25 * 10^5, end = 31 * 10^5)
# Plot HiC, TADS and bigwig tracks
plot_gtracks(h5 + tads + bw, chr = "X", start = 25 * 10^5, end = 31 * 10^5)

## End(Not run)

[Package rGenomeTracks version 1.0.0 Index]