ssvFetchBam {seqsetvis} | R Documentation |
ssvFetchBam.single
on each. Appends grouping variable to each resulting data.table and uses
rbindlist to efficiently combine resultsssvFetchBam
iteratively calls fetchWindowedBam.single
.
See ssvFetchBam.single
for more info.
ssvFetchBam(file_paths, qgr, unique_names = names(file_paths), win_size = 50, win_method = c("sample", "summary")[1], summary_FUN = stats::weighted.mean, fragLens = "auto", target_strand = c("*", "+", "-")[1], anchor = c("left", "left_unstranded", "center", "center_unstranded")[3], names_variable = "sample", return_data.table = FALSE)
file_paths |
The character vector or list of paths to bigwig files to read from. |
qgr |
Set of GRanges to query. For valid results the width of each
interval should be identical and evenly divisible by |
unique_names |
names to use in final data.table to designate source bigwig. Default is 'sample' |
win_size |
The window size that evenly divides widths in |
win_method |
character. one of c("sample", "summary"). Determines
if |
summary_FUN |
function. only relevant if win_method is "summary".
passed to |
fragLens |
numeric. The fragment length to use to extend reads. The default value "auto" causes an automatic calculation from 100 regions in qgr. NA causes no extension of reads to fragment size. |
target_strand |
character. One of c("*", "+", "-"). Controls filtering of reads by strand. Default of "*" combines both strands. |
anchor |
character, one of c("center", "center_unstranded", "left", "left_unstranded") |
names_variable |
The column name where unique_names are stored. |
return_data.table |
logical. If TRUE the internal data.table is returned instead of GRanges. Default is FALSE. |
if qgr
contains the range chr1:1-100 and win_size
is
10, values from positions chr1 5,15,25...85, and 95 will be
retrieved from bw_file
A tidy formatted GRanges (or data.table if specified) containing fetched values.
if(Sys.info()['sysname'] != "Windows"){ library(GenomicRanges) bam_f = system.file("extdata/test.bam", package = "seqsetvis", mustWork = TRUE) bam_files = c("a" = bam_f, "b" = bam_f) qgr = CTCF_in_10a_overlaps_gr[1:5] bw_gr = ssvFetchBam(bam_files, qgr, win_size = 10) bw_gr2 = ssvFetchBam(as.list(bam_files), qgr, win_size = 10) bw_dt = ssvFetchBam(bam_files, qgr, win_size = 10, return_data.table = TRUE) }