Construct a Trace object from a Signac Object or Granges object
Source:R/trace_funcs.R
bb_makeTrace.Rd
Problem 1: Signac objects and GRanges made from bigwigs are large and it is computationally expensive to get data from them when tweaking plots. Problem 2: For the most part we like how Signac plots genomic coverage of track-like data and we would like to show bulk data in a similar way with a similar compuatational interface. The trace object is a small intermediate object that holds the minimal amount of data you need to make a coverage plot showing accessibility or binding to a specific genomic region. Then you can use the trace object to quickly and easily generate tracks as needed for your plot. These tracks are all ggplots and are easy to configure for legible graphics. There are options for displaying groups by color or facet which are built in with good graphical defaults. If these are not suitable, they can be changed post hoc like any other ggplot.
Usage
bb_makeTrace(
obj,
gene_to_plot,
genome = c("hg38", "danRer11"),
extend_left = 0,
extend_right = 0,
peaks = NULL,
bulk_group_col = NULL,
bulk_group_id = "bulk",
bulk_coverage_col = "score"
)
Arguments
- obj
A Signac/Seurat object or a GRanges object. Import a bigwig file to a GRanges object using import.bw from rtracklayer. Use plyranges functions to easily pre-filter the GRanges objec e.g. by chr to reduce processing time. The precise range will be defined by gene_to_plot and the extend arguments. You may wish to add grouping metadata columns and to merge several bulk tracks before importing.
- gene_to_plot
The gene you want to display. Must be a valid gene in the genome assembly being used.
- genome
The genome assembly. Required. Must be either "hg38" or "danRer11".
- extend_left
Bases to extend plot_range left, or upstream relative to the top strand.
- extend_right
Bases to extend plot_range right, or downstream relative to the top strand.
- peaks
An optional GRanges object holding peak data. Ignored for Signac/Seurat objects which carry this internally.
- bulk_group_col
This parameter allows identification of a grouping variable in your bigwig/Granges object if you have added one. One example is if you are adding multiple bulk tracks: You can use this to plot the data in different colors or facets. A new metadata column called "group" will be added to hold this. If you haven't added grouping data in upstream processing, leave it NULL (default). In this case the new group column will be filled with a single string (see bulk_group_id). Will be ignored for Signac/Seurat objects.
- bulk_group_id
The value you want to display with the track data on faceted plots when you haven't added any grouping information before making the object. Defaults to "bulk" which is not a great choice. Will be ignored for Signac/Seurat objects.
- bulk_coverage_col
If you are making the object from a bigwig/GRanges, you need to identify which column in your bigwig/GRanges object holds the coverage data to plot on the y axis. Defaults to "score". Will be ignored for Signac/Seurat objects.