Question: Gviz: How to plot transcripts with grouping given transcript names and a TxDb?
1
gravatar for stianlagstad
3.0 years ago by
stianlagstad960
Oslo, Norway
stianlagstad960 wrote:

(I also asked this question on the Bioconductor support site here.)

I'm stumped. I'm trying to plot a few transcripts at the same time, given transcript names and a TxDb. These are examples of approaches I've tried:

# ------------------------------------------------------------------------------
# Setup:
library(TxDb.Hsapiens.UCSC.hg19.knownGene)
library(Gviz)
txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene

# ------------------------------------------------------------------------------
# Try 1:
gr <- GenomicFeatures::exons(
  txdb,
  vals = list(tx_name = c("uc001aaa.3", "uc010nxq.1")),
  columns = list("EXONNAME", "TXNAME", "GENEID"))
track <- Gviz::GeneRegionTrack(gr)
Gviz::plotTracks(track)
# Creates a plot, but doesn't show transcript grouping

enter image description here

# ------------------------------------------------------------------------------
# Try 2
gr <- GenomicFeatures::transcripts(
  txdb,
  vals = list(tx_name = c("uc001aaa.3", "uc010nxq.1")),
  columns = list("EXONNAME", "TXNAME", "GENEID"))
track <- Gviz::GeneRegionTrack(gr)
Gviz::plotTracks(track)
# Creates a plot, but has no exon/intron information

enter image description here

# ------------------------------------------------------------------------------
# Try 3
gr <- exonsBy(txdb, by = "tx", use.names=TRUE)[c("uc001aaa.3", "uc010nxq.1")]
track <- Gviz::GeneRegionTrack(gr)
# Error in .fillWithDefaults(DataFrame(chromosome = as.character(seqnames(range)),  : 
# Number of elements in argument 'feature' is invalid

None of these work for me. I want to display exon/intron-structures and have arrows between exons. Does anyone have suggestions?

gviz bioconductor R • 2.1k views
ADD COMMENTlink modified 3.0 years ago by Pierre Lindenbaum118k • written 3.0 years ago by stianlagstad960
2
gravatar for stianlagstad
3.0 years ago by
stianlagstad960
Oslo, Norway
stianlagstad960 wrote:

I found a solution that worked! Typical to find it shortly after asking the question, but here it is:

# ------------------------------------------------------------------------------
# Try 4
gr <- exonsBy(txdb, by = "tx", use.names=TRUE)[c("uc001aaa.3", "uc010nxq.1")]
gr <- unlist(gr)
elementMetadata(gr)$transcript <- names(gr)
track <- Gviz::GeneRegionTrack(gr)
Gviz::plotTracks(track)

enter image description here

Using exonsBy gives a GrangesList with one GRanges object for each transcript. Unlisting the GrangesList creates a named (important!) GRanges object with all exons. Using those names to set the $transcript metadata column solved the problem.

ADD COMMENTlink written 3.0 years ago by stianlagstad960
2
gravatar for Pierre Lindenbaum
3.0 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum118k wrote:

can't resist: using mysql+ucsc and XSLT :-P

the stylesheet: https://github.com/lindenb/xslt-sandbox/blob/master/stylesheets/bio/ucsc/ucsc-sql2svg.xsl

mysql --user=genome --host=genome-mysql.cse.ucsc.edu  -D hg19 -e 'select * from knownGene where name in ("uc001aaa.3","uc010nxq.1")' -X |\
xsltproc stylesheets/bio/ucsc/ucsc-sql2svg.xsl  - > out.svg

enter image description here

ADD COMMENTlink modified 3.0 years ago • written 3.0 years ago by Pierre Lindenbaum118k
3

dont like the design very much

ADD REPLYlink written 2.5 years ago by tiago2112871.1k

Thanks, that's an interesting way to create transcript visualizations!

ADD REPLYlink written 3.0 years ago by stianlagstad960
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1954 users visited in the last hour