Create unique regions of fixed size around mutations as GRanges

mut_to_reg_gr(mut, reg_size = 100)

Arguments

mut

A data.frame like object with all mutations and patients of the cohort of interest. Should have the following columns:

  • patient_id

  • mut_id

  • chr

  • start or pos

  • end or pos

reg_size

integer size of the region around mutations

Value

A GenomicRanges::GRanges() object with regions.

Examples

data(mut_toy)
mut_to_reg_gr(mut_toy)
#> GRanges object with 6 ranges and 1 metadata column:
#>       seqnames    ranges strand |        name
#>          <Rle> <IRanges>  <Rle> | <character>
#>   [1]        1  951-1050      * |      1_1000
#>   [2]        1 1951-2050      * |      1_2000
#>   [3]        2 2951-3050      * |      2_3000
#>   [4]        2 3951-4050      * |      2_4000
#>   [5]        3 4951-5050      * |      3_5000
#>   [6]        2 5951-6050      * |      2_6000
#>   -------
#>   seqinfo: 3 sequences from an unspecified genome; no seqlengths
mut_to_reg_gr(mut_toy, reg_size = 50)
#> GRanges object with 6 ranges and 1 metadata column:
#>       seqnames    ranges strand |        name
#>          <Rle> <IRanges>  <Rle> | <character>
#>   [1]        1  976-1025      * |      1_1000
#>   [2]        1 1976-2025      * |      1_2000
#>   [3]        2 2976-3025      * |      2_3000
#>   [4]        2 3976-4025      * |      2_4000
#>   [5]        3 4976-5025      * |      3_5000
#>   [6]        2 5976-6025      * |      2_6000
#>   -------
#>   seqinfo: 3 sequences from an unspecified genome; no seqlengths