Skip to contents

[Experimental]

This function extracts the chromosome number, the start position and the end position of transcripts in given data.frame with coordinates as returned by biomaRt::getBM() and converts them to a GRanges object.

Usage

h_get_granges_by_id(coords, id)

Arguments

coords

(data.frame)
as returned by biomaRt::getBM(), containing the columns ensembl_gene_id, chromosome_name, exon_chrom_start, exon_chrom_end.

id

(string)
single Ensembl gene ID to convert the coordinates for.

Value

GRange objects for the respective single gene ID.

Examples

if (interactive()) {
  mart <- biomaRt::useMart("ensembl", dataset = "hsapiens_gene_ensembl")
  attrs <- c(
    "ensembl_gene_id",
    "ensembl_exon_id",
    "chromosome_name",
    "exon_chrom_start",
    "exon_chrom_end"
  )
  coords <- biomaRt::getBM(
    filters = "entrezgene_id",
    attributes = attrs,
    values = c("11185", "10677"),
    mart = mart
  )
  h_get_granges_by_id(coords, "ENSG00000135407")
}