[BioRuby] Bioruby graphics classes

George Githinji georgkam at gmail.com
Fri Apr 20 16:16:39 UTC 2007


Hi Jan,
That is very encouraging.  For now i want to keep it very simple. Just
display the features, using different coloring, So i would really appreciate
if you can send me the code.
Thanks

george

On 4/20/07, jan aerts (RI) <jan.aerts at bbsrc.ac.uk> wrote:
>
> Hey George,
>
> I worked a bit on some Bio::Graphics code, but it still is quite crude
> and could use some thorough testing, but at least it's well-documented
> :-) How polished do you need the output to be? The code I have at the
> moment creates an SVG using a piece of code as sampled at the bottom of
> my mail. The actual output picture (in SVG) is attached as an example
> and should be opened in FireFox for the links to work.
>
> The setup for this code is similar to that of BioPerl: you have a panel
> for the whole graphic, which contains tracks for each of the different
> types of features (e.g. 1 track for SNPs, 1 track for genes, ...). Each
> track then contains all features of that type.
>
> Note that this code is _not_ in bioruby and it could use some TLC before
> reaching its full potential. Issues that still have to be solved:
> * Feature names are not be displayed yet.
> * The scale does not 'scale' yet: for a large sequence, you just get a
> black bar because the tick marks are so close together.
> * The SVG doesn't look as nice as I would like in FireFox (maybe produce
> PNG instead of SVG)
> * It's not possible yet to display just _part_ of your sequence, as if
> you zoomed in.
> At least some of these issues can be solved in quite a limited period of
> time, but unfortunately I'm really covered in work at the moment...
>
>
> If you want the code, just drop me a line and I'll send you the
> necessary files.
>
> jan.
>
> <BEGIN CODE>
> #!/usr/bin/ruby
> require 'bio_ext'
>
> #Initialize graphic for a nucleotide sequence of 600 bp
> my_panel = BioExt::Graphics::Panel.new(600)
>
> #Create and configure tracks
> #(NOTE TO SELF: this should be possible with a method_missing)
> track_SNP = my_panel.add_track('SNP')
> track_gene = my_panel.add_track('gene')
> track_transcript = my_panel.add_track('transcript')
>
> track_SNP.feature_colour = 'red'
> track_SNP.feature_glyph = 'triangle'
> track_gene.feature_glyph = 'directed_generic'
> track_transcript.feature_glyph = 'spliced'
> track_transcript.feature_colour = 'green'
>
> # Add data to tracks
> DATA.each do |line|
>   line.chomp!
>   ref, type, name, location, link = line.split(/\s+/)
>   if link == ''
>     link = nil
>   end
>   if type == 'SNP'
>     track_SNP.add_feature(name, location, link)
>   elsif type == 'gene'
>     track_gene.add_feature(name, location, link)
>   elsif type == 'transcript'
>     track_transcript.add_feature(name, location, link)
>   end
> end
>
> # And print out
> output = File.new('output.svg', 'w')
> output.puts my_panel.to_svg
> output.close
>
> __END__
> chr1  gene        CYP2D6      50..134
> http://www.bioruby.org
> chr1  gene        ALDH        250..344
> http://www.google.com
> chr1  SNP         rs1234      150
> http://www.newsforge.com
> chr1  gene        bla         complement(400..435)
> http://news.bbc.co.uk
> chr1  SNP         rs9876      445
> http://www.roslin.ac.uk
> chr1  gene        some_gene   complement(465..495)
> http://digg.com
> chr1  transcript  transcript1 join(250..300,390..425)
> http://www.ruby-lang.org
> chr1  transcript  transcript2 253..330
> http://www.sourceforge.net
> chr1  transcript  transcript3 266..344
>
> chr1  transcript  transcript4
> complement(join(410..430,239..286,129..151)) http://www.vrtnieuws.net
> <END CODE>
>
>
>
> > -----Original Message-----
> > From: bioruby-bounces at lists.open-bio.org
> > [mailto:bioruby-bounces at lists.open-bio.org] On Behalf Of
> > George Githinji
> > Sent: 19 April 2007 21:41
> > To: bioruby at lists.open-bio.org
> > Subject: [BioRuby] Bioruby graphics classes
> >
> > Hi everyone!
> > Please can someone show me how to access bioruby graphics classes?
> > am using bioruby version 1.0.0 but i need to render glyphs
> > for some sequence features
> >
> > Thanks
> > --
> > ---rgds
> >   George
> > _______________________________________________
> > BioRuby mailing list
> > BioRuby at lists.open-bio.org
> > http://lists.open-bio.org/mailman/listinfo/bioruby
> >
>
>


-- 
---rgds
  George



More information about the BioRuby mailing list