Module: Bio::ColorScheme

Defined in:
lib/bio/util/color_scheme.rb,
lib/bio/util/color_scheme/turn.rb,
lib/bio/util/color_scheme/helix.rb,
lib/bio/util/color_scheme/zappo.rb,
lib/bio/util/color_scheme/buried.rb,
lib/bio/util/color_scheme/strand.rb,
lib/bio/util/color_scheme/taylor.rb,
lib/bio/util/color_scheme/hydropathy.rb,
lib/bio/util/color_scheme/nucleotide.rb

Overview

bio/util/color_scheme.rb - Popular color codings for nucleic and amino acids

Author

Trevor Wennblom <[email protected]>

Copyright

Copyright © 2005-2007 Midwinter Laboratories, LLC (midwinterlabs.com)

License

The Ruby License

Description

The Bio::ColorScheme module contains classes that return popular color codings for nucleic and amino acids in RGB hex format suitable for HTML code.

The current schemes supported are:

  • Buried - Buried index

  • Helix - Helix propensity

  • Hydropathy - Hydrophobicity

  • Nucleotide - Nucelotide color coding

  • Strand - Strand propensity

  • Taylor - Taylor color coding

  • Turn - Turn propensity

  • Zappo - Zappo color coding

Planned color schemes include:

  • BLOSUM62

  • ClustalX

  • Percentage Identity (PID)

Color schemes BLOSUM62, ClustalX, and Percentage Identity are all dependent on the alignment consensus.

This data is currently referenced from the JalView alignment editor. Clamp, M., Cuff, J., Searle, S. M. and Barton, G. J. (2004), “The Jalview Java Alignment Editor,” Bioinformatics, 12, 426-7 www.jalview.org

Currently the score data for things such as hydropathy, helix, turn, etc. are contained here but should be moved to bio/data/aa once a good reference is found for these values.

Usage

require 'bio'

seq = 'gattaca'
scheme = Bio::ColorScheme::Zappo
postfix = '</span>'
html = ''
seq.each_byte do |c|
  color = scheme[c.chr]
  prefix = %Q(<span style="background:\##{color};">)
  html += prefix + c.chr + postfix
end

puts html

Accessing colors

puts Bio::ColorScheme::Buried['A']  # 00DC22
puts Bio::ColorScheme::Buried[:c]   # 00BF3F
puts Bio::ColorScheme::Buried[nil]  # nil
puts Bio::ColorScheme::Buried['-']  # FFFFFF
puts Bio::ColorScheme::Buried[7]    # FFFFFF
puts Bio::ColorScheme::Buried['junk']  # FFFFFF
puts Bio::ColorScheme::Buried['t']  # 00CC32

Defined Under Namespace

Classes: Buried, Consensus, Helix, Hydropathy, Nucleotide, Score, Simple, Strand, Taylor, Turn, Zappo

Constant Summary collapse

NA =
Nuc = Nucleotide