Skip to content

Commit

Permalink
add padding
Browse files Browse the repository at this point in the history
  • Loading branch information
rdmorin committed Apr 30, 2024
1 parent 9dca956 commit a8ccafa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions R/gene_to_region.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ gene_to_region = function(gene_symbol,
ensembl_id,
projection = "grch37",
return_as = "region",
sort_regions = TRUE){
sort_regions = TRUE,
pad_length = 0){

stopifnot('`projection` parameter must be "grch37" or "hg38"' = projection %in% c("grch37", "hg38"))
stopifnot('`return_as` parameter must be "region", "bed" or "df"' = return_as %in% c("region", "bed", "df"))
Expand Down Expand Up @@ -64,7 +65,7 @@ gene_to_region = function(gene_symbol,
region = dplyr::select(gene_coordinates, chromosome, start, end, gene_name, hugo_symbol, ensembl_gene_id) %>%
as.data.frame() %>%
dplyr::filter(chromosome %in% chr_select)

region = mutate(region, start = start - pad_length, end = end + pad_length)
if(sort_regions){
if(projection == "grch37"){
chrm_num = region$chromosome
Expand Down

0 comments on commit a8ccafa

Please sign in to comment.