write_bed_overlaps: write_bed_overlaps

View source: R/functions_write.R

write_bed_overlapsR Documentation

write_bed_overlaps

Description

write_bed_overlaps

Usage

write_bed_overlaps(overlaps_gr, assign_dt, file = "regions_with_overlaps.txt")

Arguments

overlaps_gr

GRanges of regions used to make assign_dt with memb table in mcols.

assign_dt

data.table with "id" and "cluster_id" that maps region ids to clusters. In output from plot_signals.

file

File to write to

Value

invisibly returns data that is written to file

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)
peak_grs = seqsetvis::easyLoad_narrowPeak(peak_files)
overlaps_gr = seqsetvis::ssvOverlapIntervalSets(peak_grs)
query_gr = resize(overlaps_gr, 6e2, fix = "center")

prof_dt = seqsetvis::ssvFetchBigwig(query_dt, query_gr, return_data.table = TRUE)

sig_res = plot_signals(prof_dt, query_gr)
assign_dt = sig_res$cluster_assignment

outdir = system.file("extdata", package = "seqqc")
write_bed_overlaps(overlaps_gr, assign_dt,
  file = file.path(outdir, "regions_with_overlaps.txt"))

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