Bug in ggbio's geom_alignment when using facet
1
0
Entering edit mode
@kristoffervittingseerup-7310
Last seen 4.2 years ago
European Union

I'm currently trying to plot a couple of transcripts along with their properties and I want to highlight the type of transcript (Type 1 vs Type2). Since I'm already using color for something else (and cannot seem to get any parsing of a alpha value to work) the remaining (and nice) choice is to use facttes to distinguish the transcript types.

The problem/bug is easily illustrated by this small example:

### Generate test data

grl <- GRangesList(
    A=GRanges(seqnames = "chr1", ranges = IRanges(c(1, 10), end = c(4,20)), strand ='+', class=rep('Type 1',2) ),
    B=GRanges("chr1", IRanges(15, end = 20),            strand='+', class='Type 2')
)

### Plot it - including facette

tracks('Test' =ggplot() + geom_alignment(grl) + facet_wrap(~class, ncol=1, scales='free_y' ) )

 

From the resulting plot: https://www.dropbox.com/s/73cb1r6hban6ccw/transcript_plot.png?dl=0

It looks like the "gap" (intron), which is calculated internally, does not contain the "class" column, whereby it is added to both facettes. 

Would it be possible to fix this? Or is there a way I can specify gaps myself?

In advance - thanks!

Kristoffer

ggbio facet • 769 views
ADD COMMENT
1
Entering edit mode
@michael-lawrence-3846
Last seen 8 months ago
United States

I fixed this in the devel version of biovizBase. Btw, I thought you might be able to use the facets argument to geom_alignment (why does it even have one?), but it turns out that the code for handling it was commented out and so it just fails silently. Fun!

ADD COMMENT

Login before adding your answer.

Traffic: 412 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6