timbitz / Whippet.jl

Lightweight and Fast; RNA-seq quantification at the event-level
MIT License
105 stars 21 forks source link

Visualization of Splicing Events #6

Open timbitz opened 8 years ago

timbitz commented 8 years ago

It would be nice to integrate a visualization tool like sashimi plots or write a fast version

timbitz commented 7 years ago

+1 for fast version in Julia!

Some backend like this using Gadfly might be possible>>

using Gadfly

function make_arc( xmin, xmax, ymin, ymax, upright::Bool=true )
    seq = 0:0.0001:pi
    xseq = seq ./ pi
    xseq = xseq .* (xmax - xmin)
    xseq = xseq .+ xmin
    seq = upright ? seq : seq .- pi
    yseq = sin(seq) .* (ymax - ymin)
    yseq = yseq .+ ymin
    xseq, yseq
end

make_box( xmin, xmax, ymin, ymax ) = [xmin, xmin, xmax, xmax], [ymin, ymax, ymax, ymin] 

xtop, ytop     = make_arc( 1.0, 4.0, 1.5, 2.5 )
xleft, yleft   = make_arc( 1.0, 2.0, 0.5, 1.0, false )
xright, yright = make_arc( 3.0, 4.0, 0.5, 1.0, false )

xex1, yex1 = make_box( 0.0, 1.0, 0.5, 1.5 )
xex2, yex2 = make_box( 2.0, 3.0, 0.5, 1.5 )
xex3, yex3 = make_box( 4.0, 5.0, 0.5, 1.5 )

polygon_theme = Theme(default_color=colorant"gray75", discrete_highlight_color=x->colorant"black")

plot(layer(x=xtop, y=ytop, Geom.path, Theme(default_color=colorant"black", line_width=1mm)), 
                   layer(x=xleft, y=yleft, Geom.path),
                   layer(x=xright, y=yright, Geom.path), 
                   layer(x=xex1, y=yex1, Geom.polygon(fill=true), polygon_theme),
                   layer(x=xex2, y=yex2, Geom.polygon(fill=true), polygon_theme),
                   layer(x=xex3, y=yex3, Geom.polygon(fill=true), polygon_theme),
                   Coord.cartesian( ymin=0.0, ymax=4.0, xmin=0.0, xmax=5.0), Theme(default_color=colorant"black"))

@harpur, I can add a new branch, or we can make a new repository?

harpur commented 7 years ago

I leave this up to you! I'm going to learn julia graphics to make a decent plot.

On Fri, Jun 2, 2017 at 5:10 PM, Tim Sterne-Weiler notifications@github.com wrote:

+1 for fast version in Julia!

Some backend like this using Gadfly might be possible>>

using Gadfly function make_arc( xmin::Float64, xmax::Float64, ymin::Float64, ymax::Float64, upright::Bool=true ) seq = 0:0.0001:pi xseq = seq ./ pi xseq = xseq . (xmax - xmin) xseq = xseq .+ xmin if upright yseq = sin(seq) . (ymax - ymin) yseq = yseq .+ ymin else yseq = sin(seq .- pi) .* (ymax - ymin) yseq = yseq .+ ymin end xseq, yseqend

xtop, ytop = make_arc( 1.0, 4.0, 1.5, 2.5 ) xleft, yleft = make_arc( 1.0, 2.0, 0.5, 1.0, false ) xright, yright = make_arc( 3.0, 4.0, 0.5, 1.0, false )

xex1, yex1 = [0.0, 0.0, 1.0, 1.0], [0.5, 1.5, 1.5, 0.5] xex2, yex2 = [2.0, 2.0, 3.0, 3.0], [0.5, 1.5, 1.5, 0.5] xex3, yex3 = [4.0, 4.0, 5.0, 5.0], [0.5, 1.5, 1.5, 0.5] plot(layer(x=xtop, y=ytop, Geom.path), layer(x=xleft, y=yleft, Geom.path), layer(x=xright, y=yright, Geom.path), layer(x=xex1, y=yex1, Geom.polygon), layer(x=xex2, y=yex2, Geom.polygon), layer(x=xex3, y=yex3, Geom.polygon), Coord.cartesian( ymin=0.0, ymax=4.0, xmin=0.0, xmax=5.0))

@harpur https://github.com/harpur, I can add a new branch, or we can make a new repository?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/timbitz/Whippet.jl/issues/6#issuecomment-305910012, or mute the thread https://github.com/notifications/unsubscribe-auth/AGTKWltZwrnvQb4xu8czxdmpMAemXncfks5sAHo2gaJpZM4H-rGV .

-- Brock Harpur


NSERC Postdoctoral Fellow Donnelly Centre, University of Toronto 160 College Street Toronto, Ontario Canada M5S 3E1