write_bed_frip: write_bed_frip

View source: R/functions_write.R

write_bed_fripR Documentation

write_bed_frip

Description

write_bed_frip

Usage

write_bed_frip(query_gr, assign_dt, frip_dt, file = "regions_with_FRIP.txt")

Arguments

query_gr

GRanges of regions used to make frip_dt and assign_dt

assign_dt

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

frip_dt

output from make_frip_dt

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

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

bam_files = dir(system.file("extdata", package = "seqqc"), pattern = "^M.+bam$", full.names = TRUE)
query_dt.bam = make_dt(bam_files)
frip_dt = make_frip_dt(query_dt.bam, query_gr)

sig_res = plot_signals(prof_dt, query_gr)

assign_dt = sig_res$cluster_assignment

outdir = system.file("extdata", package = "seqqc")
write_bed_frip(query_gr, assign_dt, frip_dt,
  file = file.path(outdir, "regions_with_FRIP.txt"))

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