panel_to_patient.Rd
Get mapping of panel regions to covered patients and mutations.
panel_to_patient(reg_gr, mut, sv = NULL, sv_mode = "single")
A GRanges object with regions defining the panel. Should have unique names and is expected to be sorted by decreasing priority.
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
end
A data.frame like object with all structural variations and patients of the cohort of interest. Should have the following columns:
patient_id
mut_id
bp1_chr
bp1_pos
bp2_chr
bp1_chr
A character specifing if both brekapoints need to be coverd ("both") or a single breakpoint is sufficient ("single")
A data set mapping the regions to affected patients and mutations. The output contains at least the following columns
reg_id
mut_id
patient_id
gr_toy
#> GRanges object with 2 ranges and 0 metadata columns:
#> seqnames ranges strand
#> <Rle> <IRanges> <Rle>
#> r1 1 1000 *
#> r3 2 3000 *
#> -------
#> seqinfo: 2 sequences from an unspecified genome; no seqlengths
mut_toy
#> # A tibble: 9 × 6
#> patient_id mut_id chr start end gene
#> <chr> <chr> <chr> <dbl> <dbl> <chr>
#> 1 p1 m01 1 1000 1000 g1
#> 2 p1 m02 1 2000 2000 g1
#> 3 p1 m03 2 3000 3000 g2
#> 4 p2 m01 1 1000 1000 g1
#> 5 p2 m04 2 4000 4000 g2
#> 6 p2 m05 3 5000 5000 g3
#> 7 p3 m02 1 2000 2000 g1
#> 8 p3 m04 2 4000 4000 g2
#> 9 p3 m06 2 6000 6000 g2
panel_to_patient(gr_toy, mut_toy)
#> # A tibble: 6 × 10
#> reg_id reg_chr reg_start reg_end mut_id patient_id chr start end gene
#> <chr> <chr> <int> <int> <chr> <chr> <chr> <dbl> <dbl> <chr>
#> 1 r1 1 1000 1000 m01 p1 1 1000 1000 g1
#> 2 r1 1 1000 1000 m01 p2 1 1000 1000 g1
#> 3 r1 1 1000 1000 m01 p1 1 1000 1000 g1
#> 4 r1 1 1000 1000 m01 p2 1 1000 1000 g1
#> 5 r3 2 3000 3000 m03 p1 2 3000 3000 g2
#> 6 NA NA NA NA NA p3 NA NA NA NA