fragLen_calcStranded: calculate fragLen from a bam file for specified regions

Description Usage Arguments Value Examples

View source: R/functions_fragLen.R

Description

calculate fragLen from a bam file for specified regions

Usage

1
2
3
4
5
6
7
8
9
fragLen_calcStranded(
  bam_f,
  qgr,
  n_regions = 100,
  include_plot_in_output = FALSE,
  test_fragLen = seq(100, 400, 5),
  flip_strand = FALSE,
  ...
)

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.

n_regions

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

include_plot_in_output

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

test_fragLen

numeric. The set of fragment lenghts to gather strand cross correlation for.

flip_strand

boolean. if TRUE strands that reads align to are swapped. This is typically only necessary if there was a mismatch between library chemistry and aligner settings. Default is FALSE.

...

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]]

seqsetvis documentation built on Nov. 8, 2020, 5:57 p.m.