Class: Bioroebe::GUI::Gtk::Gene

Inherits:
Gtk::Box
  • Object
show all
Includes:
Gtk::BaseModule
Defined in:
lib/bioroebe/gui/gtk3/gene/gene.rb

Overview

Bioroebe::GUI::Gtk::Gene

Constant Summary collapse

NAMESPACE =
#

NAMESPACE

#
inspect
TITLE =
#

TITLE

#
'A gene'
WIDTH =
#

WIDTH

#
'50% or minimum 800px'
HEIGHT =
#

HEIGHT

#
500
USE_THIS_FONT =
#

USE_THIS_FONT

#
:dejavu_condensed_22

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(commandline_arguments = ARGV, run_already = true) ⇒ Gene

#

initialize

#

56
57
58
59
60
61
62
63
64
65
66
# File 'lib/bioroebe/gui/gtk3/gene/gene.rb', line 56

def initialize(
    commandline_arguments = ARGV,
    run_already           = true
  )
  super(:vertical)
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  run if run_already
end

Class Method Details

.run(i = ARGV) ⇒ Object

#

Bioroebe::GUI::Gtk::Gene.run

#

167
168
169
170
171
172
173
174
175
176
# File 'lib/bioroebe/gui/gtk3/gene/gene.rb', line 167

def self.run(
    i = ARGV
  )
  require 'gtk_paradise/run'
  _ = ::Bioroebe::GUI::Gtk::Gene.new(i)
  r = ::Gtk.run
  r << _
  r.automatic_size_then_automatic_title
  r.top_left_then_run
end

Instance Method Details

#border_size?Boolean

#

border_size?

#

Returns:

  • (Boolean)

93
94
95
# File 'lib/bioroebe/gui/gtk3/gene/gene.rb', line 93

def border_size?
  2
end

#colourize_contig(start_position = 3, end_position = 12, use_this_colour = :steelblue) ⇒ Object

#

colourize_contig

This method can be used to colourize a specific contig in the nucleotide sequence at hand.

#

135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/bioroebe/gui/gtk3/gene/gene.rb', line 135

def colourize_contig(
    start_position  =  3,
    end_position    = 12,
    use_this_colour = :steelblue
  )
  old_text = @sequence.label.to_s
  new_text = old_text.dup
  new_text[start_position, end_position] =
    '<span foreground="'+use_this_colour.to_s+'">'+
    new_text[start_position, end_position]+
    '</span>'
  @sequence.set_text(
    new_text
  )
  @sequence.parse_markup
end

#connect_skeletonObject

#

connect_skeleton (connect tag)

#

106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/bioroebe/gui/gtk3/gene/gene.rb', line 106

def connect_skeleton
  abort_on_exception
  hbox = gtk_hbox
  hbox.minimal(
    text("5' - ")
  )
  @sequence = text('ATGGTACGTACGTCAGTGAGTCA')
  hbox.minimal(
    @sequence
  )
  hbox.minimal(
    text(" - '3")
  )
  add(hbox)
end

#create_skeletonObject

#

create_skeleton (create tag)

#

100
101
# File 'lib/bioroebe/gui/gtk3/gene/gene.rb', line 100

def create_skeleton
end

#padding?Boolean

#

padding?

#

Returns:

  • (Boolean)

86
87
88
# File 'lib/bioroebe/gui/gtk3/gene/gene.rb', line 86

def padding?
  4
end

#resetObject

#

reset (reset tag)

#

71
72
73
74
75
76
77
78
79
80
81
# File 'lib/bioroebe/gui/gtk3/gene/gene.rb', line 71

def reset
  reset_the_internal_variables
  # ======================================================================= #
  # === @configuration
  # ======================================================================= #
  @configuration = [true, __dir__, NAMESPACE]
  title_width_height_font(TITLE, WIDTH, HEIGHT, USE_THIS_FONT)
  use_gtk_paradise_project_css_file
  append_project_CSS_file 
  infer_the_size_automatically
end

#runObject

#

run (run tag)

#

155
156
157
158
159
160
161
162
# File 'lib/bioroebe/gui/gtk3/gene/gene.rb', line 155

def run
  create_skeleton_then_connect_skeleton
  # ======================================================================= #
  # The next line is for testing purposes. It will be removed at some
  # point in the future.
  # ======================================================================= #
  colourize_contig
end

#set_sequence(i) ⇒ Object

#

set_sequence

#

125
126
127
# File 'lib/bioroebe/gui/gtk3/gene/gene.rb', line 125

def set_sequence(i)
  @sequence.set_text("#{i}")
end