helper for converting ENSG to symbols, cbinding symbol and chromosome name for the genes to the input data.frame-like entity

bind_sym(
  dflike,
  gene_resource = genes_v75,
  ensgvbl = "trait",
  output_symvbl = "symbol",
  output_chromvbl = "gchrom"
)

Arguments

dflike

a data.frame-like entity with a column of ENSG gene identifiers; column name must be the value of bind_sym parameter ensgvbl

gene_resource

a data.frame with columns gene_name and seqnames, defaulting to gwaslake::genes_v75

ensgvbl

character(1) the column of dflike holding the ENSG ids

output_symvbl

character(1) name to be used for symbol in output data.frame, defaults to symbol

output_chromvbl

character(1) name to be used for chromosome in output data.frame, defaults to gchrom

Examples

head(little_eq)
#> # A tibble: 6 × 12
#>   chr   position   beta      se         p n     id       rsid  ea    nea     eaf
#>   <chr>    <int>  <dbl>   <dbl>     <dbl> <chr> <chr>    <chr> <chr> <chr> <dbl>
#> 1 17    38066240  0.497 0.0111  3.27e-310 31086 eqtl-a-… rs22… C     T     0.493
#> 2 17    38066240 -0.946 0.00885 3.27e-310 31300 eqtl-a-… rs22… C     T     0.493
#> 3 17    38066240 -1.03  0.00812 3.27e-310 31300 eqtl-a-… rs22… C     T     0.493
#> 4 17    38066240 -0.302 0.0116  9.89e-149 31300 eqtl-a-… rs22… C     T     0.493
#> 5 17    38066240  0.212 0.0118  2.26e- 72 5502  eqtl-a-… rs22… C     T     0.493
#> 6 17    38066240 -0.128 0.0119  2.66e- 27 31300 eqtl-a-… rs22… C     T     0.493
#> # … with 1 more variable: trait <chr>
#> # ℹ Use `colnames()` to see all variable names
head(bind_sym(little_eq))
#> # A tibble: 6 × 14
#>   chr   position   beta      se         p n     id       rsid  ea    nea     eaf
#>   <chr>    <int>  <dbl>   <dbl>     <dbl> <chr> <chr>    <chr> <chr> <chr> <dbl>
#> 1 17    38066240  0.497 0.0111  3.27e-310 31086 eqtl-a-… rs22… C     T     0.493
#> 2 17    38066240 -0.946 0.00885 3.27e-310 31300 eqtl-a-… rs22… C     T     0.493
#> 3 17    38066240 -1.03  0.00812 3.27e-310 31300 eqtl-a-… rs22… C     T     0.493
#> 4 17    38066240 -0.302 0.0116  9.89e-149 31300 eqtl-a-… rs22… C     T     0.493
#> 5 17    38066240  0.212 0.0118  2.26e- 72 5502  eqtl-a-… rs22… C     T     0.493
#> 6 17    38066240 -0.128 0.0119  2.66e- 27 31300 eqtl-a-… rs22… C     T     0.493
#> # … with 3 more variables: trait <chr>, symbol <chr>, gchrom <chr>
#> # ℹ Use `colnames()` to see all variable names