A function to shift GRanges fragments by 5/-4. This is useful when dealing with fragments coming from ATAC-seq.

shiftATACGranges(g, pos_shift = 4, neg_shift = 5)

Arguments

g

GRanges of ATAC-seq fragments

pos_shift

Integer. How many bases should fragments on direct strand be shifted by?

neg_shift

Integer. How many bases should fragments on negative strand be shifted by?

Value

A GRanges object containing fragments from the input .bam file.

Examples

data(bam_test)
shiftATACGranges(bam_test)
#> GRanges object with 100000 ranges and 0 metadata columns:
#>            seqnames        ranges strand
#>               <Rle>     <IRanges>  <Rle>
#>        [1]     chrI       430-550      +
#>        [2]     chrI       431-551      +
#>        [3]     chrI       464-600      +
#>        [4]     chrI       464-600      +
#>        [5]     chrI       509-630      +
#>        ...      ...           ...    ...
#>    [99996]     chrI 355821-355902      -
#>    [99997]     chrI 355868-356014      +
#>    [99998]     chrI 355869-355971      +
#>    [99999]     chrI 355885-355913      +
#>   [100000]     chrI 355888-355984      +
#>   -------
#>   seqinfo: 7 sequences from an unspecified genome; no seqlengths