Updating expressed regions with the expressed gene that is closest to it. After entering the tissue that has been sequenced, the nearest gene and nearest expressed gene will be added to the metadata columns of the annotated ERs.

add_expressed_genes(
  input_file = NULL,
  tissue,
  gtf,
  species = "Homo_sapiens",
  annot_ers,
  type_col_name = "type"
)

Arguments

input_file

GTEX median expression file, if left as NULL the default file will be used.

tissue

Tissue to filter for. See tissue_options for options

gtf

Either a string containg the path to a .gtf file or a pre-imported gtf using rtracklayer::import . Provides gene data to help determine the nearest gene and nearest expressed gene.

species

character string containing the species to filter for, Homo sapiens is the default

annot_ers

annotated ERs i.e. the product of annotatERs, should have an mcols column called "annotation"

type_col_name

column name in the gtf file to filter on genes. Default is "type

Value

Granges with annotated ERs and details of their nearest expressed genes

Examples


gtf_url <- paste0(
    "http://ftp.ensembl.org/pub/release-103/gtf/",
    "homo_sapiens/Homo_sapiens.GRCh38.103.chr.gtf.gz"
)
gtf_path <- file_cache(gtf_url)
gtf_gr <- rtracklayer::import(gtf_path)

ex_opt_ers <- GenomicRanges::GRanges(
    seqnames = S4Vectors::Rle(c("chr21", "chr22"), c(2, 2)),
    ranges = IRanges::IRanges(
        start = c(5116369, 5118691, 5125879, 5128214),
        end = c(5117231, 5118847, 5125988, 5128403)
    )
)

ex_opt_ers_w_exp_genes <- add_expressed_genes(
    tissue = "lung", gtf = gtf_gr,
    annot_ers = ex_opt_ers
)

ex_opt_ers_w_exp_genes
#> GRanges object with 4 ranges and 2 metadata columns:
#>       seqnames          ranges strand | nearest_gene_v94_name
#>          <Rle>       <IRanges>  <Rle> |           <character>
#>   [1]    chr21 5116369-5117231      * |       ENSG00000276612
#>   [2]    chr21 5118691-5118847      * |       ENSG00000276612
#>   [3]    chr22 5125879-5125988      * |       ENSG00000277248
#>   [4]    chr22 5128214-5128403      * |       ENSG00000277248
#>       nearest_expressed_gene_v94_name
#>                           <character>
#>   [1]                 ENSG00000264462
#>   [2]                 ENSG00000264462
#>   [3]                 ENSG00000206195
#>   [4]                 ENSG00000206195
#>   -------
#>   seqinfo: 2 sequences from an unspecified genome; no seqlengths