calculate genome coverage

cal_coverage(loc_df)

Arguments

loc_df

data.frame. must contain 4 columns: chrom, strand, start, end

Value

tibble. 4 elements, chrom, strand, pos, n_reads. n_reads means number of reads covering given position.

Details

we use 1-based coordinate, start, end

Examples

sam_file <- system.file('extdata', 'Neat1_1.Aligend_trunc.sam', package = 'paristools') sam_file %>% read_sam() %>% sam_to_loc_df() %>% cal_coverage()
#> Warning: All elements of `...` must be named. #> Did you want `data = c(strand, start, end)`?
#> Warning: `cols` is now required. #> Please use `cols = c(data)`
#> # A tibble: 6,354 x 4 #> chrom strand pos n_reads #> <chr> <chr> <int> <int> #> 1 neat1 + 1 14 #> 2 neat1 + 2 15 #> 3 neat1 + 3 15 #> 4 neat1 + 4 15 #> 5 neat1 + 5 16 #> 6 neat1 + 6 17 #> 7 neat1 + 7 17 #> 8 neat1 + 8 20 #> 9 neat1 + 9 23 #> 10 neat1 + 10 24 #> # … with 6,344 more rows