make_feature_overlap_signal_profiles: make_feature_overlap_signal_profiles

View source: R/functions_make.R

make_feature_overlap_signal_profilesR Documentation

make_feature_overlap_signal_profiles

Description

Creates a data.table with grouping for profiles based on overlaps in overlap_gr and ranking of signal within each.

Usage

make_feature_overlap_signal_profiles(
  query_dt,
  overlaps_gr,
  feature_groups = NULL,
  view_size = NULL,
  group_var = "overlap_group",
  rank_var = "rnk",
  min_group_size = 50,
  max_group_size = 500,
  discard_group_below = 1,
  ...
)

Arguments

query_dt

data.table that specifies file paths with $file. Suitable for use with ssvFetchBam or ssvFetchBigwig

overlaps_gr

GRanges with membership table in mcols. Create with ssvOverlapIntervalSets or ssvConsensusIntervalSets.

feature_groups

Optional data.frame defining "id" and "group". Default of NULL uses ssvFactorizeMembTable on overlaps_gr

view_size

Size of regions to fetch. Will be median of widths of overlaps_gr if NULL. Default is NULL.

group_var

character. Must not already be present in query_dt Will be added. Default is "overlap_group".

rank_var

character. Must not already be present in query_dt Will be added. Default is "rnk".

min_group_size

Groups smaller than this are allowed but larger groups won't be shrunk below this length. Default is 50.

max_group_size

Even if the smallest group is larger than this, no group will exceed this size. Default is 500.

discard_group_below

Groups smaller than this will be discarded entirely. Default is 1.

...

Passed to ssvFetchBam or ssvFetchBigwig as appropriate to file type.

Value

A profile data.table with overlap grouping information add and independent ranking added to each group.

Examples

bw_files = dir(system.file("extdata", package = "seqqc"), pattern = "^M.+bw$", full.names = TRUE)
query_dt = make_dt(bw_files)
query_dt[, sample := sub("_FE_random100.A", "", name)]

peak_files = dir(system.file("extdata", package = "seqqc"), pattern = "Peak$", full.names = TRUE)
names(peak_files) = sub("_CTCF_rand.+", "", basename(peak_files))
peak_grs = seqsetvis::easyLoad_narrowPeak(peak_files, )
overlaps_gr = seqsetvis::ssvOverlapIntervalSets(peak_grs)
query_gr = resize(overlaps_gr, 6e2, fix = "center")

group_prof_dt = make_feature_overlap_signal_profiles(query_dt, overlaps_gr)
plot_feature_overlap_signal_profiles(group_prof_dt)

FrietzeLabUVM/ssvQC documentation built on March 25, 2024, 12:24 a.m.