Class: Bioroebe::GUI::UniversalWidgets::Gene

Inherits:
UniversalWidgets::Base
  • Object
show all
Includes:
CommandlineArguments, Bioroebe::GUI
Defined in:
lib/bioroebe/gui/universal_widgets/gene/gene.rb

Overview

Bioroebe::GUI::UniversalWidgets::Gene

Constant Summary collapse

TITLE =
#

TITLE

Specify which title to use for this small widget.

#
'A gene'
WIDTH =
#

WIDTH

#
'65% or 500px minimum'
HEIGHT =
#

HEIGHT

#
'55% or 300px minimum'
TEXT_COMPARE_THE_TWO_SEQUENCES =
#

TEXT_COMPARE_THE_TWO_SEQUENCES

#
'_Compare the two sequences'
MONOSPACED_FONT =
#

MONOSPACED_FONT

When this font is changed, don’t forget to also change the font at SMALLER_FONT.

#
:hack_20
USE_THIS_FONT =
MONOSPACED_FONT
SMALLER_FONT =
#

SMALLER_FONT

#
:hack_16
USE_THIS_SLIGHTLY_SMALLER_FONT =
#

USE_THIS_SLIGHTLY_SMALLER_FONT

#
:hack_16
USE_THIS_TITLE_FOR_THE_MAIN_BUTTON =
#

USE_THIS_TITLE_FOR_THE_MAIN_BUTTON

#
'_Determine the DNA sequence'
PADDING_TO_USE =
#

PADDING_TO_USE

#
12
DEFAULT_TEXT_FOR_ENTRY1 =
#

DEFAULT_TEXT_FOR_ENTRY1

#
'AGUUCGAUGGAAAATAT'
DEFAULT_TEXT_FOR_ENTRY2 =
#

DEFAULT_TEXT_FOR_ENTRY2

#
'AGUCCGGUCGAAAAAAA'

Constants included from Bioroebe::GUI

ARRAY_ALL_GTK_WIDGETS, FONT_SIZE, OLD_VERBOSE_VALUE, Bioroebe::GUI::USE_THIS_FONT_FAMILY_FOR_GUI_APPLICATIONS

Constants included from ColoursForBase

ColoursForBase::ARRAY_HTML_COLOURS_IN_USE

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Bioroebe::GUI

#disable_warnings, #enable_warnings, #log_dir?

Methods included from CommandlineArguments

#commandline_arguments?, #commandline_arguments_that_are_files?, #e, #first?, #first_non_hyphen_argument?, #remove_hyphens_from_the_commandline_arguments, #return_commandline_arguments_as_string, #return_commandline_arguments_that_are_not_files, #return_entries_without_two_leading_hyphens, #select_commandline_arguments, #select_entries_starting_with_two_hyphens, #set_commandline_arguments

Methods included from ColoursForBase

#colourize_this_aminoacid_sequence_for_the_commandline, #colourize_this_nucleotide_sequence, #disable_colours, #ecomment, #efancy, #egold, #enable_colours, #eorange, #eparse, #erev, #red, #remove_trailing_escape_part, #return_colour_for_nucleotides, #rev, #sdir, #set_will_we_use_colours, #sfancy, #sfile, #simp, #swarn, #use_colours?, #use_colours_within_the_bioroebe_namespace?

Constructor Details

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

#

initialize

#


101
102
103
104
105
106
107
108
109
110
111
# File 'lib/bioroebe/gui/universal_widgets/gene/gene.rb', line 101

def initialize(
    commandline_arguments = nil,
    run_already           = true
  )
  determine_the_GUI_to_be_used(commandline_arguments)
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  run if run_already
end

Class Method Details

.[](i = ARGV) ⇒ Object

#

Bioroebe::GUI::UniversalWidgets::Gene[]

#


256
257
258
# File 'lib/bioroebe/gui/universal_widgets/gene/gene.rb', line 256

def self.[](i = ARGV)
  new(i)
end

.run(i = ARGV) ⇒ Object

#

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

#


263
264
265
266
267
268
269
270
271
# File 'lib/bioroebe/gui/universal_widgets/gene/gene.rb', line 263

def self.run(
    i = ARGV
  )
  r = ::Gtk.runner_factory(
    ::Bioroebe::GUI::Gtk::Gene.new(i)
  )
  r.modify_background(:normal, :mintcream)
  return r
end

Instance Method Details

#border_size?Boolean

#

border_size?

#

Returns:

  • (Boolean)


143
144
145
# File 'lib/bioroebe/gui/universal_widgets/gene/gene.rb', line 143

def border_size?
  8
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.

#


236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# File 'lib/bioroebe/gui/universal_widgets/gene/gene.rb', line 236

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_the_skeletonObject

#

connect_the_skeleton (connect tag, skeleton tag)

#


190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/bioroebe/gui/universal_widgets/gene/gene.rb', line 190

def connect_the_skeleton
  abort_on_exception
  
  hbox = create_hbox
  hbox.minimal(
    text("5' - ")
  )
  @sequence = text('ATGGTACGTACGTCAGTGAGTCA')
  hbox.minimal(
    @sequence
  )
  hbox.minimal(
    text(" - '3")
  )

  window = runner_widget(nil, width?, height?, title?)
  window << hbox

  ::UniversalWidgets.set_main_window(window)
  upon_delete_event_quit_the_application

  colourize_contig

  window.use_this_font = font?
  window.show_all
  window.set_size_request(width?, height?)
  window.set_default_size(width?, height?)
  window.set_padding(padding?)
  window.set_border_size(border_size?)
  window.set_size_request(80, 100)
  window.top_left
  run_main
end

#create_the_skeletonObject

#

create_the_skeleton (create tag, skeleton tag)

#


176
177
# File 'lib/bioroebe/gui/universal_widgets/gene/gene.rb', line 176

def create_the_skeleton
end

#handle_CSS_rulesObject Also known as: handle_CSS

#

handle_CSS_rules (CSS tag, css tag)

#


164
165
166
167
168
169
170
171
# File 'lib/bioroebe/gui/universal_widgets/gene/gene.rb', line 164

def handle_CSS_rules
  use_gtk_paradise_project_css_file
  append_project_css_file
  add_these_custom_CSS_rules '

'
  apply_the_CSS_rules
end

#main_font?Boolean

#

main_font?

#

Returns:

  • (Boolean)


150
151
152
# File 'lib/bioroebe/gui/universal_widgets/gene/gene.rb', line 150

def main_font?
  USE_THIS_FONT
end

#padding?Boolean

#

padding?

#

Returns:

  • (Boolean)


136
137
138
# File 'lib/bioroebe/gui/universal_widgets/gene/gene.rb', line 136

def padding?
  PADDING_TO_USE
end

#resetObject

#

reset (reset tag)

#


116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/bioroebe/gui/universal_widgets/gene/gene.rb', line 116

def reset
  super() if respond_to?(:super)
  reset_the_internal_variables
  reset_the_base_module # This must come after reset_the_internal_variables().
  infer_the_namespace
  # ======================================================================= #
  # === @configuration
  # ======================================================================= #
  @configuration = [true, __dir__, namespace?]
  # ======================================================================= #
  # === Set the title, width, height and the font in use.
  # ======================================================================= #
  title_width_height_font(TITLE, WIDTH, HEIGHT, USE_THIS_FONT)
  handle_CSS if use_gtk3?
  set_border_width(5)
end

#runObject

#

run (run tag)

#


182
183
184
# File 'lib/bioroebe/gui/universal_widgets/gene/gene.rb', line 182

def run
  run_super
end

#set_sequence(i) ⇒ Object

#

set_sequence

#


226
227
228
# File 'lib/bioroebe/gui/universal_widgets/gene/gene.rb', line 226

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

#slightly_smaller_font?Boolean

#

slightly_smaller_font?

#

Returns:

  • (Boolean)


157
158
159
# File 'lib/bioroebe/gui/universal_widgets/gene/gene.rb', line 157

def slightly_smaller_font?
  USE_THIS_SLIGHTLY_SMALLER_FONT
end