viewGRangesWinSample_dt {seqsetvis} | R Documentation

## get a windowed sampling of score_gr

### Description

This method is appropriate when all GRanges in qgr are identical width and when it is practical to use a window_size smaller than features in genomic signal. For instance, when retrieving signal around peaks or promoters this method maintains a fixed genomic scale across regions. This allows meaingful comparison of peak widths can be made.

### Usage

    viewGRangesWinSample_dt(score_gr, qgr, window_size, anchor = c("center",
      "center_unstranded", "left", "left_unstranded")[1])

### Arguments

`score_gr` | GRanges with a "score" metadata column.
`qgr` | regions to view by window.
`window_size` | qgr will be represented by value from score_gr every window_size bp.
`anchor` | character. controls how x value is derived from position for each region in qgr. 0 may be the left side or center. If not unstranded, x coordinates are flipped for (-) strand. One of c("center", "center_unstranded", "left", "left_unstranded"). Default is "center".

### Details

Summarizes score_gr by grabbing value of "score" every window_size bp. Columns in output data.table are: standard GRanges columns: seqnames, start, end, width, strand id - matched to names(score_gr). if names(score_gr) is missing, added as 1:length(score_gr) y - value of score from score_gr x - relative bp position

### Value

data.table that is GRanges compatible

### Examples

    bam_file = system.file("extdata/test.bam",
        package = "seqsetvis")
    qgr = CTCF_in_10a_overlaps_gr[1:5]
    qgr = GenomicRanges::resize(qgr, width = 500, fix = "center")
    bam_gr = seqsetvis:::fetchBam(bam_file, qgr)
    bam_dt = viewGRangesWinSample_dt(bam_gr, qgr, 50)

    if(Sys.info()['sysname'] != "Windows"){
        bw_file = system.file("extdata/MCF10A_CTCF_FE_random100.bw",
            package = "seqsetvis")
        bw_gr = rtracklayer::import.bw(bw_file, which = qgr)
        bw_dt = viewGRangesWinSample_dt(bw_gr, qgr, 50)
    }

[Package seqsetvis version 1.4.1 Index]