ssvFetchBam.single {seqsetvis}R Documentation

fetch a windowed version of a bam file, returns GRanges

Description

fetch a windowed version of a bam file, returns GRanges

Usage

ssvFetchBam.single(bam_f, qgr, win_size = 50, win_method = c("sample",
  "summary")[1], summary_FUN = stats::weighted.mean, fragLen = NULL,
  target_strand = c("*", "+", "-")[1], anchor = c("left", "left_unstranded",
  "center", "center_unstranded")[3], return_data.table = FALSE)

Arguments

bam_f

character or BamFile to load

qgr

GRanges regions to fetchs

win_size

numeric >=1. pileup grabbed every win_size bp for win_method sample. If win_method is summary, this is the number of windows used (confusing, sorry).

win_method

character. one of c("sample", "summary"). Determines if viewGRangesWinSample_dt or viewGRangesWinSummary_dt is used to represent each region in qgr.

summary_FUN

function. only relevant if win_method is "summary". passed to viewGRangesWinSummary_dt.

fragLen

numeric, NULL, or NA. if numeric, supplied value is used. if NULL, value is calculated with fragLen_calcStranded if NA, raw bam pileup with no cross strand shift is returned.

target_strand

character. if one of "+" or "-", reads are filtered accordingly. ignored if any other value.

anchor

character, one of c("center", "center_unstranded", "left", "left_unstranded")

return_data.table

logical. If TRUE the internal data.table is returned instead of GRanges. Default is FALSE.

Value

tidy GRanges (or data.table if specified) with pileups from bam file. pileup is calculated only every win_size bp.

Examples

bam_file = system.file("extdata/test.bam",
    package = "seqsetvis")
qgr = CTCF_in_10a_overlaps_gr[1:5]
bam_gr = ssvFetchBam.single(bam_file, qgr)
bam_gr = ssvFetchBam.single(bam_file, qgr, fragLen = 180,
    win_size = 10, target_strand = "+")

bam_dt = ssvFetchBam.single(bam_file, qgr,
    return_data.table = TRUE)

[Package seqsetvis version 1.0.2 Index]