Evaluate and annotate a given region to patient association data set

eval_regions(reg_to_patient_mut)

Arguments

reg_to_patient_mut

A data.frame like object from panel_to_patient() with all regions reg_id linked to patients patient_id via mutations mut_id. It should additionally contain the following columns:

  • reg_chr

  • reg_start one-based

  • reg_end one-based

Value

A data frame with all unique regions and additional annotations.

Examples


r2p <- panel_to_patient(gr_toy, mut_toy)
r2p
#> # A tibble: 6 × 10
#>   reg_id reg_chr reg_start reg_end mut_id patient_id chr   start   end gene 
#>   <chr>  <chr>       <dbl>   <dbl> <chr>  <chr>      <chr> <dbl> <dbl> <chr>
#> 1 r1     1               1       2 m01    p1         1      1000  1000 g1   
#> 2 r1     1               1       2 m01    p2         1      1000  1000 g1   
#> 3 r1     1               1       2 m01    p1         1      1000  1000 g1   
#> 4 r1     1               1       2 m01    p2         1      1000  1000 g1   
#> 5 r3     2               1       1 m03    p1         2      3000  3000 g2   
#> 6 NA     NA             NA      NA NA     p3         NA       NA    NA NA   

eval_regions(r2p)
#> # A tibble: 2 × 15
#>   reg_id reg_chr reg_start reg_end n_region reg_size reg_size_cum n_patient
#>   <chr>  <chr>       <dbl>   <dbl>    <int>    <dbl>        <dbl>     <int>
#> 1 r1     1               1       2        1        2            2         2
#> 2 r3     2               1       1        2        1            3         1
#> # ℹ 7 more variables: n_patients_cum <dbl>, total_patients <int>,
#> #   percent_patients <dbl>, percent_patients_cum <dbl>, n_patient_gain <dbl>,
#> #   n_mut <int>, n_mut_cum <dbl>