Entering edit mode
4.7 years ago
GabrielMontenegro
▴
680
I am trying to plot an specific region using ggbio
. I am using the below code that produces my desire output, except that it contains several transcript. Is it possible to only plot the longest transcript for each gene? I've not been able to access the genomic ranges object within Homo.sapiens
that I assume contains this information.
library(ggbio)
library(Homo.sapiens)
data(genesymbol, package = "biovizBase")
range <- GRanges("chr10" , IRanges(start = 78000000 , end = 79000000))
p.txdb <- autoplot(Homo.sapiens, which = range)
p.txdb
I tried this yesterday for quite some time and did not come up with a satisfying and simple solution, maybe some Twitter people have an idea: https://twitter.com/ATpoint90/status/1265946486602444800
Thanks for the help. I've checked which data can be retrieved from the
Homo.sapiens
object usingcolumns(Homo.sapiens)
, and there is actually information on the transcript start and transcript end. I think I will need to get the width first, and then modify theHomo.sapiens
object somehow?Looks like this is what you want to (once you get the ID of the longest transcript) : A: Plotting a single transcript with ggbio
I checked that, and a
TxDb
object does not contain gene names... I would like to show the name of the genes not the transcripts names.That definitely works but there must be an easier (in-built way, I hope). Anyway, getting the longest transcript is simple:
Great, thanks! So, then, within the
autoplot
function, how do I select only those transcripts? I am trying to do that, but it keeps printing all transcripts.I just found out that I can
reduce
the transcripts... which is not exactly what I want, as I think this is collapsing all the transcripts... i.e.p.txdb <- autoplot(Homo.sapiens, which = range, stat = "reduce")
Yeah, that is unfortunately what I did not find out yet.