shaman_generate_feature_grid

shaman_generate_feature_grid(feature1, feature2, obs_track_nm,
  exp_track_nm = paste0(obs_track_nm, "_shuffle"),
  score_track_nm = paste0(obs_track_nm, "_score"), score_filter = 30,
  range = 25000, resolution = 500, min_dist = 2e+05, max_dist = 1e+06)

Arguments

feature1

1d intervals representing feature 1. Strand, if provided will be ignored.

feature2

1d intervals representing feature 2. Strand, if provided will be ignored.

obs_track_nm

Name of observed 2D genomic track for the hic data.

exp_track_nm

Name of expected 2D genomic track.

score_track_nm

Name of 2D score track. If track doesn't exist, no filter on grid will be applied.

score_filter

Minimum value of score within the expanded window surrounding the grid point for the window to be considered in the statistics.

range

Window size around the grid point.

resolution

Size of bins (in base pairs).

min_dist

Minimum distance between features on the grid.

max_dist

Maximum distance between features on the grid.

Value

list containing obs - observed matrix, sum of the number of observed contacts in each bin in the window, exp - expected matrix, sum of the number of expected contacts in each bin in the window, grid_size - number of windows included in statistics

Details

Build a grid comprising of all combinations of intervals from feature 1 and feature 2 that fall within a band defined by min_dist and max_dist. For each point on the grid, look at th surrounding window, defined by range parameter. Discard all windows that do not contain a point with a score (defined in scotre_track_nm) above the score_filter parameter. This allows for focusing on potentially enriched pairs. Discect the window into small bins, size in base pairs defined by the resolution parameter, and count the number of observed contacts, and the number of expected contacts in each bin. All windows are then summed together, generating a single matrix of observed and expected contacts, which is returned by function. Note that grid contains only points in which feature 1 position is smaller than feature 2 position.

Examples

#Set misha db to test gsetroot(shaman_get_test_track_db()) grid = shaman_generate_feature_grid(shaman::ctcf_forward, shaman::ctcf_reverse, "hic_obs", exp_track_nm="hic_exp")
#> building grid...
#> screening for filter
#> found 43999 regions
#> obs neighbors...
#> 34%...82%...100%
#> exp neighbors...
#> 56%...100%
plot = shaman_plot_feature_grid(list(grid), 25000, 500, 1000)
#> Using sum as value column: use value.var to override.
#> Using sum as value column: use value.var to override.