fragLen_calcStranded: calculate fragLen from a bam file for specified regions

Description Usage Arguments Value Examples

View source: R/functions_fetch_bam.R

Description

calculate fragLen from a bam file for specified regions

Usage

1
2
3
fragLen_calcStranded(bam_f, qgr, ma_distance = 21, n_regions = 100,
  force_no_which = FALSE, include_plot_in_output = FALSE,
  max_fragLen = 300, ...)

Arguments

bam_f

character or BamFile. bam file to read from. .bai index file must be in same directory

qgr

GRanges. used as which for ScanBamParam. Can be NULL if it's REALLY important to load the entire bam, force_no_which = TRUE also required.

ma_distance

numeric (integer) range to use for movingRange. Default is 21.

n_regions

numeric (integer) it's generally overkill to pull all regions at this stage and will slow calculation down. Default is 100.

force_no_which

logical. if TRUE and qgr is also NULL, the entire bam will be read.

include_plot_in_output

if TRUE ouptut is a list of fragLen and a ggplot showing values considered by calculation. Default is FALSE.

max_fragLen

numeric. The maximum fragLen to calculate for. Calculation time is directly proportional to this number. Default is 300.

...

passed to Rsamtools::ScanBamParam, can't be which or what.

Value

numeric fragment length

Examples

1
2
3
4
5
6
7
bam_file = system.file("extdata/test.bam",
    package = "seqsetvis")
qgr = CTCF_in_10a_overlaps_gr[1:5]
fragLen_calcStranded(bam_file, qgr)
#if plot is included, a list is returned, item 2 is the plot
fragLen_calcStranded(bam_file, qgr,
  include_plot_in_output = TRUE)[[2]]

jrboyd/seqsetvis documentation built on Oct. 14, 2018, 3:04 p.m.