Gene Ranger.
gene_ranger.Rd
Return the coordinates in different formats for one gene or a set of genes.
Usage
gene_ranger(
these_genes = NULL,
projection = "hg38",
return_as = "data.frame",
write_to_bed = FALSE,
bed_path = NULL,
track_name = NULL,
track_description = NULL
)
Arguments
- these_genes
Specify genes of interest. This function accepts multiple genes. Genes can be specified either in Hugo Format or Ensembl IDs. The function will figure out what format you are requesting.
- projection
The desired projection you want back coordinates for. Available projections are hg38 and grch37. Default is hg38.
- return_as
Speciy the format for the returned object. Possible values are; data.frame (default). in this mode, the following columns are kept; chrom, start, end, width, strand, gene_biotype, and gene symbol (in Hugo or Ensembl format, depending on what the user specifies under `these_genes`). With `return_as = "bed"`, the function returns the standard bed columns chrom, start, end. It also attaches the following optional columns; score and strand. The user can also request the return in "region" format (chr:start-end).
- write_to_bed
Boolean parameter. Set to TRUE (default is FALSE) to write output to a bed file.
- bed_path
If `write_to_bed = TRUE`, this parameter is required. Specify the path of the generated ebd file.
- track_name
If `write_to_bed = TRUE`, this parameter is required. Specify the track name in the generated bed file.
- track_description
If `write_to_bed = TRUE`, this parameter is required. Specify the track description in the generated bed file.
Value
A data frame with coordinates for the requested gene. See `return_as` for more information on controlling the return of this function.
Details
This function takes gene or a set of genes with the `these_genes` parameter and returns the genomic coordinates in the selected projection. Genes can be formatted in one of the following formats; Hugo Symbol or Ensembl Gene ID. The user gets to decide the projection with `projection` parameter (hg38 and grch37 are available). Furthermore, this function has flexible return formats available. For more information see the parameter description `return_as`. Note if the user sets `write_to_bed = TRUE`, the function only writes to bed file (i.e nothing is returned).
Examples
#Example 1 - Request one gene (in Hugo format) and with default parameters
gene_ranger(these_genes = "MYC")
#> chrom start end width strand gene_biotype hugo_symbol
#> 1 chr8 127735434 127742951 7518 + protein_coding MYC
#Example 2 - Same as example one but MYC is here specified as Ensembl ID
gene_ranger(these_genes = "ENSG00000136997")
#> chrom start end width strand gene_biotype ensembl_gene_id
#> 1 chr8 127735434 127742951 7518 + protein_coding ENSG00000136997
#Example 3 - Request multiple genes with non-default parameters
gene_ranger(these_genes = c("MYC", "BCL2"),
projection = "grch37",
return_as = "region")
#> MYC BCL2
#> "8:128747680-128753674" "18:60790579-60987361"
#Example 4 - Request multiple Ensembl IDs and return in bed format
gene_ranger(these_genes = c("ENSG00000136997", "ENSG00000171791"),
return_as = "bed")
#> chrom start end score strand
#> 1 chr18 63123346 63320128 NA -
#> 2 chr8 127735434 127742951 NA +
#Example 5 - Write to bed file
gene_ranger(these_genes = c("BCL2", "MYC"),
projection = "grch37",
write_to_bed = TRUE,
bed_path = "my_bed",
track_name = "MYC and BCL2",
track_description = "Genes of interest")
#> SUCCESS! bed file written to my_bed
#> NULL