[BioRuby] bio.pdb + biographics

jan aerts (RI) jan.aerts at bbsrc.ac.uk
Fri Feb 22 07:49:42 UTC 2008


> sequences.  I've been meaning to try adding secondary structure glyphs
> (Helix glyph, Sheet (arrow) glyph, etc) onto protein sequences similar to
> what you might see in the results of a secondary structure prediction.  The
> topology graphics like those generated in PDBsum are very nice but just
> having the glyphs along a sequence would be convenient.  If I really want to

@Adam:
Nice to see you're interested in Bio::Graphics. Have you had any success in writing those helix and sheet glyphs? At least the arrow glyph is easily done by modifying directed_generic a little bit. Note this is not the best code yet... Just a quick fix :-)

module Bio::Graphics::Glyph
  class Bio::Graphics::Glyph::Arrow < Bio::Graphics::Glyph::Common
    def draw
      if @subfeature.strand == -1 # Reverse strand
        @feature_context.rectangle(self.left_pixel+Bio::Graphics::FEATURE_ARROW_LENGTH, 0, self.right_pixel - self.left_pixel - Bio::Graphics::FEATURE_ARROW_LENGTH, Bio::Graphics::FEATURE_HEIGHT).fill
        arrow(@feature_context,:left,self.left_pixel+Bio::Graphics::FEATURE_ARROW_LENGTH + 4,-4,Bio::Graphics::FEATURE_ARROW_LENGTH + 4)
        @feature_context.close_path.fill
      else #default is forward strand
        @feature_context.rectangle(self.left_pixel, 0, self.right_pixel- self.left_pixel - Bio::Graphics::FEATURE_ARROW_LENGTH, Bio::Graphics::FEATURE_HEIGHT).fill
        arrow(@feature_context,:right,self.right_pixel-Bio::Graphics::FEATURE_ARROW_LENGTH - 4,-4,Bio::Graphics::FEATURE_ARROW_LENGTH + 4)
        @feature_context.close_path.fill
      end
    end
  end
end

I'm looking into making feature height and stuff also adjustable by the user. At the moment it's fixed at 10 pixels. I suppose for a glyph like this you'd want much wider glyphs.

It depends on what type of glyph you'd like to see for a helix if it's straightforward or not. At least _something_ should be possible. Whether it'd really look like a helix is up to our creativity...

jan.




More information about the BioRuby mailing list