Class: SequenceLogo::PPMLogo
- Defined in:
- lib/sequence_logo/data_models/ppm_logo.rb
Overview
wrapper around PPM to make it possible to configure rendering in a flexible way
Instance Attribute Summary collapse
-
#enable_threshold_lines ⇒ Object
readonly
Returns the value of attribute enable_threshold_lines.
-
#icd_mode ⇒ Object
readonly
Returns the value of attribute icd_mode.
-
#ppm ⇒ Object
readonly
Returns the value of attribute ppm.
-
#words_count ⇒ Object
readonly
Returns the value of attribute words_count.
Instance Method Summary collapse
-
#initialize(ppm, options = {}) ⇒ PPMLogo
constructor
A new instance of PPMLogo.
- #length ⇒ Object
- #logo_matrix ⇒ Object
- #name ⇒ Object
- #render(canvas_factory) ⇒ Object
- #revcomp ⇒ Object
Constructor Details
#initialize(ppm, options = {}) ⇒ PPMLogo
Returns a new instance of PPMLogo.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/sequence_logo/data_models/ppm_logo.rb', line 8 def initialize(ppm, = {}) @ppm = ppm @words_count = [:words_count] @icd_mode = [:icd_mode] @enable_threshold_lines = [:enable_threshold_lines] @ppm.words_count = @words_count if @words_count unless ppm.words_count report "words count for PPM is undefined, assuming weblogo mode" @icd_mode = :weblogo end end |
Instance Attribute Details
#enable_threshold_lines ⇒ Object (readonly)
Returns the value of attribute enable_threshold_lines.
6 7 8 |
# File 'lib/sequence_logo/data_models/ppm_logo.rb', line 6 def enable_threshold_lines @enable_threshold_lines end |
#icd_mode ⇒ Object (readonly)
Returns the value of attribute icd_mode.
6 7 8 |
# File 'lib/sequence_logo/data_models/ppm_logo.rb', line 6 def icd_mode @icd_mode end |
#ppm ⇒ Object (readonly)
Returns the value of attribute ppm.
6 7 8 |
# File 'lib/sequence_logo/data_models/ppm_logo.rb', line 6 def ppm @ppm end |
#words_count ⇒ Object (readonly)
Returns the value of attribute words_count.
6 7 8 |
# File 'lib/sequence_logo/data_models/ppm_logo.rb', line 6 def words_count @words_count end |
Instance Method Details
#length ⇒ Object
21 22 23 |
# File 'lib/sequence_logo/data_models/ppm_logo.rb', line 21 def length ppm.length end |
#logo_matrix ⇒ Object
33 34 35 |
# File 'lib/sequence_logo/data_models/ppm_logo.rb', line 33 def logo_matrix ppm.get_logo(icd_mode) end |
#name ⇒ Object
25 26 27 |
# File 'lib/sequence_logo/data_models/ppm_logo.rb', line 25 def name ppm.name end |
#render(canvas_factory) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/sequence_logo/data_models/ppm_logo.rb', line 37 def render(canvas_factory) canvas = LogoCanvas.new(canvas_factory) if icd_mode == :discrete canvas.background(Magick::HatchFill.new('white', 'white')) if enable_threshold_lines canvas.draw_threshold_line(ppm.get_line(ppm.icd2of4)) canvas.draw_threshold_line(ppm.get_line(ppm.icdThc)) canvas.draw_threshold_line(ppm.get_line(ppm.icdTlc)) end else canvas.background(Magick::HatchFill.new('white', 'bisque')) end logo_matrix.each do |position| canvas.add_position_ordered( position_sorted_by_height(position) ) end canvas.image end |
#revcomp ⇒ Object
29 30 31 |
# File 'lib/sequence_logo/data_models/ppm_logo.rb', line 29 def revcomp PPMLogo.new(ppm.revcomp, words_count: words_count, icd_mode: icd_mode, enable_threshold_lines: enable_threshold_lines) end |