Question: Plot Of Exons In R
4
gravatar for pufferfish
8.7 years ago by
pufferfish260
South Africa
pufferfish260 wrote:

I have a vector of ids in R which corresponds to the exons that another vector of probes belongs to. e.g

c(10001,10001,10002,10003,10004,10005)

where the first two probes belong to the same exon

How can I plot this on a graph as thick rectangles? The example below was generated with python, but I'd like to do this in R alt text

A more generic, portable solution would be preferable, since I could experiment with different plotting libraries myself. i.e. What sort of object would I need to create and plot?

This could perhaps be generalized and posted on Stackoverflow instead, but I suspect this is a problem others here have encountered already.

R exon visualization • 3.8k views
ADD COMMENTlink modified 8.6 years ago by Steve Lianoglou5.0k • written 8.7 years ago by pufferfish260
4
gravatar for Neilfws
8.7 years ago by
Neilfws48k
Sydney, Australia
Neilfws48k wrote:

I assume you have more information than the vector of probe IDs, since you'll need it to generate a plot like your example.

I use GenomeGraphs from R Bioconductor for this type of plot. Take a look at the publication; you'll see some examples very similar to the one that you posted.

If that's not suitably "generic and portable", a lot can be achieved using ggplot2.

ADD COMMENTlink modified 4 months ago by RamRS26k • written 8.7 years ago by Neilfws48k

Looking for something more generic. E.g. in python I converted it to vector of rectangle coordinates, then drew them. I'm hoping it's something easier in R. Some sort of interval operation on the list first to check whether a probe is part of the previous exon Will carry on scratching around...

ADD REPLYlink written 8.7 years ago by pufferfish260

Oops, yes I also have the intensity data, which I know how to plot. Only supplied the exon IDs because I'm specifically interested in how one would plot the horizontal bars below.

ADD REPLYlink written 8.7 years ago by pufferfish260

I assumed you'd need the exon coordinates (relative or absolute) for that.

ADD REPLYlink written 8.7 years ago by Neilfws48k
0
gravatar for Steve Lianoglou
8.7 years ago by
Steve Lianoglou5.0k
US
Steve Lianoglou5.0k wrote:

Answering the questions that appear in your comments to @neifws:

  • You would simply plot a vector of rectangle coordinates using the rect function.
  • For generic interval operations, you should look into the GenomicRanges package, which is built on top of the functionality found in IRanges. Briefly, you would store the positions of where your probes align in a GRanges object and your exonic locations in an other GRanges object, then you'd use the findOverlaps or subsetByOverlaps functions to figure out which probes land in which exons.
ADD COMMENTlink written 8.7 years ago by Steve Lianoglou5.0k
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: 1284 users visited in the last hour