Class: Bioroebe::GUI::UniversalWidgets::DnaToAminoacidWidget

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

Overview

Bioroebe::GUI::UniversalWidgets::DnaToAminoacidWidget

Constant Summary collapse

TITLE =
#

TITLE

Specify which title to use for this small widget.

#
'DNA to Aminoacid Sequence converter'
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

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) ⇒ DnaToAminoacidWidget

#

initialize

#


80
81
82
83
84
85
86
87
88
89
90
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 80

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::DnaToAminoacidWidget[]

#


674
675
676
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 674

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

.run(i = ARGV) ⇒ Object

#

Bioroebe::GUI::Gtk::DnaToAminoacidWidget.run

#


681
682
683
684
685
686
687
688
689
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 681

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

Instance Method Details

#assign_this_fasta_file(i) ⇒ Object

#

assign_this_fasta_file

#


577
578
579
580
581
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 577

def assign_this_fasta_file(i)
  i = ::Bioroebe.parse_fasta(i).sequence?
  i.upcase! if i
  set_dna_sequence(i)
end

#border_size?Boolean

#

border_size?

#

Returns:

  • (Boolean)


137
138
139
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 137

def border_size?
  8
end

#button_trigger_the_conversion?Boolean

#

button_trigger_the_conversion?

#

Returns:

  • (Boolean)


263
264
265
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 263

def button_trigger_the_conversion?
  @button_trigger_conversion
end

#connect_the_skeletonObject

#

connect_the_skeleton (connect tag, skeleton tag)

#


586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 586

def connect_the_skeleton
  abort_on_exception

  vbox = create_vbox

  # ======================================================================= #
  # The two top labels denote which widget is the one for the DNA
  # sequence, and which one is for the aminoacid sequence.
  # ======================================================================= #
  dna_sequence_label       = bold_label('DNA sequence')
  dna_sequence_label.set_size_request(sanitized_half_width, 42)
  aminoacid_sequence_label = bold_label('Aminoacid sequence')
  aminoacid_sequence_label.set_size_request(sanitized_half_width, 42)
  # ======================================================================= #
  # API for .attach() is:
  #   .attach(child, left, top, width, height)
  # ======================================================================= #
  @grid.attach(dna_sequence_label,                    0, 0, 2, 1)
  @grid.attach(aminoacid_sequence_label,              3, 0, 2, 1)
  @grid.attach(@left_entry,                           0, 1, 2, 1)
  @grid.attach(@event_box_containing_the_right_arrow, 2, 1, 1, 1)
  @grid.attach(@right_entry,                          3, 1, 2, 1)
  button_box = simplified_button_box(button_trigger_the_conversion?)
  button_box.set_size_request(350, 40)
  @grid.attach(
    button_box, 0, 2, 5, 1
  )
  vbox.minimal(@header_bar)
  vbox.add(horizontal_spacer)
  vbox.minimal(@grid, 8)
  vbox.add(horizontal_spacer)
  hbox = create_hbox
  # ======================================================================= #
  # Add the dropdown box next; also known as the combobox.
  # ======================================================================= #
  dropdown_box = gtk_dropdown_box(
    Bioroebe.available_codon_tables?
  )
  dropdown_box.use_this_font = SMALLER_FONT
  dropdown_box.first_element_is_active
  dropdown_box.bblack1
  dropdown_box.pad5px
  dropdown_box.hint = 'When a new codon table is assigned, via the '\
    'drop-down menu, then any assigned DNA sequence will be automatically '\
    'translated to its corresponding amino acid sequence.'
  dropdown_box.on_changed {
    new_text = dropdown_box.text?.to_s
    @entry_for_the_codon_table_in_use.set_text(new_text)
    do_determine_the_aminoacid_sequence
  }
  hbox.minimal(text('Codon table in use:'),       3)
  hbox.minimal(@entry_for_the_codon_table_in_use, 3)
  hbox.minimal(dropdown_box,                      3)
  vbox.add(hbox)
  
  # ======================================================================= #
  # === @label_n_DNA_nucleotides
  # ======================================================================= #
  @label_n_DNA_nucleotides = bold_label('n DNA nucleotides: ')
  @label_n_DNA_nucleotides.align_left
  @label_n_DNA_nucleotides.make_selectable
  vbox.add(@label_n_DNA_nucleotides)
  @label_n_aminoacids = bold_label('n aminoacids:      ')
  @label_n_aminoacids.align_left
  @label_n_aminoacids.make_selectable
  vbox.add(@label_n_aminoacids)

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

  menu

  ::UniversalWidgets.set_main_window(window)
  upon_delete_event_quit_the_application
  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_button_trigger_conversionObject

#

create_button_trigger_conversion

#


424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 424

def create_button_trigger_conversion
  # ======================================================================= #
  # === @button_trigger_conversion
  # ======================================================================= #
  @button_trigger_conversion = bold_button('_Trigger Conversion')
  @button_trigger_conversion.clear_background
  @button_trigger_conversion.disallow_resizing
  @button_trigger_conversion.set_size_request(125, 40)
  @button_trigger_conversion.set_background_colour :whitesmoke
  @button_trigger_conversion.on_hover(:lightgreen)
  @button_trigger_conversion.on_clicked {
    update_the_dna_sequence_then_do_the_conversion
    do_properly_space_the_top_left_entry
  }
  @button_trigger_conversion.bblack2
  # ======================================================================= #
  # Use a tooltip as well for our button:
  # ======================================================================= #
  @button_trigger_conversion.hint = 
    "Clicking on this button will convert from a <b>DNA</b> "\
    "<b>sequence</b> \n(on the left hand side) to the <b>corresponding "\
    "Aminoacid sequence</b>.\n\nMake sure you input the DNA sequence "\
    "on the left hand side. The space character, aka ' ', will "\
    "be ignored."
end

#create_the_entriesObject

#

create_the_entries (entries tag)

#


372
373
374
375
376
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 372

def create_the_entries
  create_the_left_entry
  create_the_right_entry
  create_the_entry_for_the_codon_table_in_use
end

#create_the_entry_for_the_codon_table_in_useObject

#

create_the_entry_for_the_codon_table_in_use

#


235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 235

def create_the_entry_for_the_codon_table_in_use
  # ======================================================================= #
  # === @entry_for_the_codon_table_in_use
  # ======================================================================= #
  @entry_for_the_codon_table_in_use = create_entry(Bioroebe.codon_table_in_use?.to_s)
  @entry_for_the_codon_table_in_use.center
  @entry_for_the_codon_table_in_use.bblack2
  @entry_for_the_codon_table_in_use.bg_azure
  @entry_for_the_codon_table_in_use.read_only
  @entry_for_the_codon_table_in_use.use_this_font = SMALLER_FONT
  @entry_for_the_codon_table_in_use.width_height(450, 42)
end

#create_the_event_boxObject

#

create_the_event_box

#


251
252
253
254
255
256
257
258
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 251

def create_the_event_box
  @event_box_containing_the_right_arrow = create_eventbox(
    text(:arrow_right)
  )
  @event_box_containing_the_right_arrow.on_clicked {
    update_the_dna_sequence_then_do_the_conversion
  }
end

#create_the_gridObject

#

create_the_grid (grid tag)

#


277
278
279
280
281
282
283
284
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 277

def create_the_grid
  # ======================================================================= #
  # === @grid
  # ======================================================================= #
  @grid = create_grid
  @grid.set_column_spacing(5)
  @grid.set_row_spacing(5)
end

#create_the_header_barObject

#

create_the_header_bar

#


460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 460

def create_the_header_bar
  @header_bar = return_default_header_bar
  @header_bar.pad8px
  @header_bar.bblack1
  button_open_file = icon_theme(:open_file)
  button_open_file.hint = 'Click on this button to open a '\
                          'local FASTA file.'
  button_open_file.on_clicked {
    result = do_pick_a_local_file
    if result and File.file?(result) and result.end_with?('.fasta','.fa')
      assign_this_fasta_file(result)
    end
  }
  @header_bar.pack_left(button_open_file)
end

#create_the_left_entryObject

#

create_the_left_entry (left tag)

This entry will keep the DNA sequence.

#


557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 557

def create_the_left_entry
  # ======================================================================= #
  # The left entry, a DNA widget as a gtk-entry widget.
  # ======================================================================= #
  @left_entry = create_entry
  @left_entry.clear_background
  @left_entry.yellow_background
  @left_entry.bblack1
  @left_entry.pad5px
  @left_entry.set_size_request(sanitized_half_width, 42)
  @left_entry.hint = 'You can either hit the enter key here, or '\
    'click the trigger-conversion button.'
  @left_entry.on_enter_key {
    update_the_dna_sequence_then_do_the_conversion
  }
end

#create_the_right_entryObject

#

create_the_right_entry

#


345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 345

def create_the_right_entry
  # ======================================================================= #
  # === The right Aminoacid widget.
  # ======================================================================= #
  @right_entry = create_entry
  @right_entry.clear_background
  @right_entry.lightskyblue_background
  @right_entry.bblack1
  @right_entry.pad5px
  @right_entry.set_size_request(sanitized_half_width, 42)
  # ======================================================================= #
  # The AA widget. Will be highlighted on a click event. This was
  # reconsidered and disabled as of August 2021.
  # ======================================================================= #
  # @right_entry.on_click_event { :select_text }
end

#create_the_skeletonObject

#

create_the_skeleton (create tag, skeleton tag)

#


413
414
415
416
417
418
419
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 413

def create_the_skeleton
  create_the_header_bar
  create_the_grid
  create_button_trigger_conversion
  create_the_entries
  create_the_event_box
end

#dna_sequence?Boolean Also known as: return_the_main_DNA_sequence

#

dna_sequence?

#

Returns:

  • (Boolean)


365
366
367
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 365

def dna_sequence?
  left_entry?.text.to_s
end

#do_pick_a_local_fileObject

#

do_pick_a_local_file (open tag)

This method is run when the user wants to open a local file.

#


481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 481

def do_pick_a_local_file
  create_a_new_file_chooser_dialog(self) {{
    start_dir:              return_pwd,
    show_hidden_files:      :yes,
    current_folder:         ::Bioroebe.log_dir?,
    additional_directories: [
      ::Bioroebe.log_dir?,
      ENV['PC'].to_s,
      ENV['MY_TEMP'].to_s,
      ENV['RSRC'].to_s
    ]
  }}
  _ = ::Gtk.main_file?.to_s
  return _
end

#do_properly_space_the_top_left_entryObject

#

do_properly_space_the_top_left_entry

#


303
304
305
306
307
308
309
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 303

def do_properly_space_the_top_left_entry
  old_text = @left_entry.text?.delete(' ')
  _ = old_text.
      gsub(/(.{3})/,' \1').
      lstrip
  @left_entry.set_text(_)
end

#do_the_conversion(i = @dna_sequence) ⇒ Object Also known as: do_sync_fields, do_trigger_the_conversion, do_determine_the_aminoacid_sequence

#

do_the_conversion (conversion tag)

This is the method that is to be used for the actual conversion.

#


187
188
189
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
223
224
225
226
227
228
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 187

def do_the_conversion(
    i = @dna_sequence
  )
  # ======================================================================= #
  # Next, we must translate from DNA to Aminoacid sequence.
  # ======================================================================= #
  sanitized_input = i.delete(' ').delete('-')
  i.tr!('U','T') if i.include? 'U'
  set_dna_sequence(i)
  if ::Bioroebe.const_defined? :Controller
    # ===================================================================== #
    # Ok, in this case we can store the dataset via a class-method.
    # ===================================================================== #
    ::Bioroebe::GUI::Controller.set_dna_sequence(i)
  end
  aminoacid_sequence = ::Bioroebe.convert_dna_to_protein_sequence(
    sanitized_input,
    :default,
    Bioroebe::CodonTable.by_name(
      entry_for_the_codon_table?.text?
    )
  )
  set_aminoacid_sequence(aminoacid_sequence)
  update_the_entries
  sync_the_entries_back_onto_the_two_main_strings
  if @parent_widget and @parent_widget.respond_to?(:set_aminoacid_sequence)
    @parent_widget.set_aminoacid_sequence(aminoacid_sequence)
  end
  @label_n_DNA_nucleotides.set_text(
    'n DNA nucleotides: '+
    i.delete(' ').
      delete('-').size.to_s
  )
  @label_n_DNA_nucleotides.make_bold
  @label_n_DNA_nucleotides.align_left
  @label_n_aminoacids.set_text(
    'n aminoacids:      '+
    aminoacid_sequence.size.to_s
  )
  @label_n_aminoacids.make_bold
  @label_n_aminoacids.align_left
end

#entry_for_the_codon_table?Boolean

#

entry_for_the_codon_table?

#

Returns:

  • (Boolean)


314
315
316
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 314

def entry_for_the_codon_table?
  @entry_for_the_codon_table_in_use
end

#handle_CSS_rulesObject Also known as: handle_CSS

#

handle_CSS_rules (CSS tag, css tag)

#


395
396
397
398
399
400
401
402
403
404
405
406
407
408
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 395

def handle_CSS_rules
  use_gtk_paradise_project_css_file
  append_project_css_file
  add_these_custom_CSS_rules '

#custom_treeview.view header button {
background-color: white;
color: royalblue;
font-weight: bold;
font-size: larger;
padding: 8px;
}'
  apply_the_CSS_rules
end

#left_entry?Boolean

#

left_entry?

#

Returns:

  • (Boolean)


296
297
298
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 296

def left_entry?
  @left_entry
end

#main_font?Boolean

#

main_font?

#

Returns:

  • (Boolean)


381
382
383
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 381

def main_font?
  USE_THIS_FONT
end
#

menu (menu tag)

#


519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 519

def menu(
    i = commandline_arguments?
  )
  if i and i.is_a?(Array)
    if i.empty?
      set_dna_sequence(:default)
      update_the_left_entry
    else
      i.each {|entry| menu(entry) }
    end
  else
    case i # Perform some sanitizing here. (case tag)
    # ===================================================================== #
    # === ubiquitin
    # ===================================================================== #
    when 'ubiquitin',
         'ubi'
      i = ''
      set_these_aminoacids(
        ::Bioroebe.return_ubiquitin_sequence
      )
    else
      # =================================================================== #
      # Else we will simply assign the DNA sequence as-is. If the input
      # is a .fasta or .fasta file then we will use ParseFasta to obtain
      # the real sequence instead.
      # =================================================================== #
      assign_this_fasta_file(i)
      update_the_left_entry
    end
  end
end

#padding?Boolean

#

padding?

#

Returns:

  • (Boolean)


130
131
132
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 130

def padding?
  8
end

#resetObject

#

reset (reset tag)

#


95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 95

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?
  # ======================================================================= #
  # === @dna_sequence
  #
  # This is the dna sequence we will use. We will not work on the
  # entry directly, as this depends on gtk-initialization which
  # may not yet have happened.
  # ======================================================================= #
  @dna_sequence = :default
  # ======================================================================= #
  # === @aminoacid_sequence
  # ======================================================================= #
  @aminoacid_sequence = ''.dup
  # ======================================================================= #
  # === @parent_widget
  # ======================================================================= #
  @parent_widget = nil
end

#right_entry?Boolean

#

right_entry?

#

Returns:

  • (Boolean)


321
322
323
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 321

def right_entry?
  @right_entry
end

#runObject

#

run (run tag)

#


453
454
455
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 453

def run
  run_super
end

#sanitized_half_widthObject

#

sanitized_half_width

#


289
290
291
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 289

def sanitized_half_width
  (width? / 2.to_f) - 30
end

#set_aminoacid_sequence(i) ⇒ Object Also known as: set_these_aminoacids

#

set_aminoacid_sequence

#


178
179
180
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 178

def set_aminoacid_sequence(i)
  @aminoacid_sequence = i
end

#set_dna_sequence(i = left_entry?.text) ⇒ Object

#

set_dna_sequence

#


500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 500

def set_dna_sequence(
    i = left_entry?.text
  )
  case i
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default
    i = 'ATG CGG'.dup
  end
  if i and i.start_with?('--')
    i = '' # Ad-hoc fix.
  end
  @dna_sequence = i.to_s.dup
end

#set_left_entry(i = @dna_sequence) ⇒ Object

#

set_left_entry

#


161
162
163
164
165
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 161

def set_left_entry(
    i = @dna_sequence
  )
  left_entry?.set_text(i)
end

#set_parent_widget(i) ⇒ Object

#

set_parent_widget

#


328
329
330
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 328

def set_parent_widget(i)
  @parent_widget = i
end

#set_right_entry(i = @aminoacid_sequence) ⇒ Object

#

set_right_entry

#


152
153
154
155
156
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 152

def set_right_entry(
    i = @aminoacid_sequence
  )
  right_entry?.set_text(i)
end

#slightly_smaller_font?Boolean

#

slightly_smaller_font?

#

Returns:

  • (Boolean)


388
389
390
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 388

def slightly_smaller_font?
  USE_THIS_SLIGHTLY_SMALLER_FONT
end

#sync_the_entries_back_onto_the_two_main_stringsObject

#

sync_the_entries_back_onto_the_two_main_strings

#


170
171
172
173
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 170

def sync_the_entries_back_onto_the_two_main_strings
  @dna_sequence       = return_the_main_DNA_sequence
  @aminoacid_sequence = right_entry?.text.to_s
end

#update_the_dna_sequence_then_do_the_conversionObject

#

update_the_dna_sequence_then_do_the_conversion

#


335
336
337
338
339
340
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 335

def update_the_dna_sequence_then_do_the_conversion
  set_dna_sequence(
    left_entry?.text.upcase # Upcasing this is more elegant, in my opinion.
  )
  do_the_conversion
end

#update_the_entriesObject

#

update_the_entries

#


144
145
146
147
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 144

def update_the_entries
  set_left_entry
  set_right_entry
end

#update_the_left_entryObject

#

update_the_left_entry

#


270
271
272
# File 'lib/bioroebe/gui/universal_widgets/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 270

def update_the_left_entry
  set_left_entry(@dna_sequence.to_s)
end