Last data update: 2014.03.03
R: From a transcript identifier to 'GRanges' object
From a transcript identifier to GRanges
object
Description
This function takes on or more Ensembl transcript identifiers,
queries Biomart and constructs a GRangesList
object as
would Gviz::BiomartGeneRegionTrack
for a genomic region (in
fact, currently most of the code has been taken from
Gviz::.fetchBMData
and GViz::.chrName
is used to
validate chromosome names).
Usage
etrid2grl(etrid, ens, use.names = FALSE)
Arguments
etrid
A vector of Ensembl transcript identifiers.
ens
A instance of class Mart
from biomaRt. If
missing, useMart("ensembl", "hsapiens_gene_ensembl")
is
used.
use.names
If set to TRUE
and etrid
has names,
then the latter are used to name the output.
Value
A GRangesList
object of length
length(etrid)
.
Author(s)
Laurent Gatto
Examples
id <- c("ENST00000612959", "ENST00000317091")
grl1 <- etrid2grl(id[1])
grl1
grl <- etrid2grl(id)
stopifnot(all.equal(id, names(grl)))
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(Pbase)
Loading required package: BiocGenerics
Loading required package: parallel
Attaching package: 'BiocGenerics'
The following objects are masked from 'package:parallel':
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from 'package:stats':
IQR, mad, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
rbind, rownames, sapply, setdiff, sort, table, tapply, union,
unique, unsplit
Loading required package: Rcpp
Loading required package: Gviz
Loading required package: S4Vectors
Loading required package: stats4
Attaching package: 'S4Vectors'
The following objects are masked from 'package:base':
colMeans, colSums, expand.grid, rowMeans, rowSums
Loading required package: IRanges
Loading required package: GenomicRanges
Loading required package: GenomeInfoDb
Loading required package: grid
This is Pbase version 0.12.2
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/Pbase/etrid2grl.Rd_%03d_medium.png", width=480, height=480)
> ### Name: etrid2grl
> ### Title: From a transcript identifier to 'GRanges' object
> ### Aliases: etrid2grl
>
> ### ** Examples
>
> id <- c("ENST00000612959", "ENST00000317091")
> grl1 <- etrid2grl(id[1])
> grl1
GRangesList object of length 1:
$ENST00000612959
GRanges object with 8 ranges and 7 metadata columns:
seqnames ranges strand | feature gene
<Rle> <IRanges> <Rle> | <character> <character>
[1] chr17 [30116807, 30116863] + | utr5 ENSG00000126653
[2] chr17 [30172542, 30172589] + | utr5 ENSG00000126653
[3] chr17 [30172590, 30172598] + | protein_coding ENSG00000126653
[4] chr17 [30178071, 30178199] + | protein_coding ENSG00000126653
[5] chr17 [30179090, 30179297] + | protein_coding ENSG00000126653
[6] chr17 [30180908, 30181016] + | protein_coding ENSG00000126653
[7] chr17 [30184615, 30185674] + | protein_coding ENSG00000126653
[8] chr17 [30185675, 30186474] + | utr3 ENSG00000126653
exon transcript symbol rank phase
<character> <character> <character> <numeric> <integer>
[1] ENSE00003738663 ENST00000612959 NSRP1 1 -1
[2] ENSE00003689679 ENST00000612959 NSRP1 2 -1
[3] ENSE00003689679 ENST00000612959 NSRP1 2 -1
[4] ENSE00003519306 ENST00000612959 NSRP1 3 0
[5] ENSE00003659893 ENST00000612959 NSRP1 4 0
[6] ENSE00003562538 ENST00000612959 NSRP1 5 1
[7] ENSE00003744594 ENST00000612959 NSRP1 6 0
[8] ENSE00003744594 ENST00000612959 NSRP1 6 -1
-------
seqinfo: 1 sequence from an unspecified genome; no seqlengths
> grl <- etrid2grl(id)
> stopifnot(all.equal(id, names(grl)))
>
>
>
>
>
> dev.off()
null device
1
>