Module: Bioroebe::GUI::LibUI::DnaToAminoacidWidget
- Includes:
- LibuiParadise::Extensions
- Defined in:
- lib/bioroebe/gui/libui/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb
Class Method Summary collapse
-
.run ⇒ Object
# === Bioroebe::GUI::LibUI::DnaToAminoacidWidget.run ========================================================================= #.
Instance Method Summary collapse
-
#create_skeleton ⇒ Object
# === create_skeleton ========================================================================= #.
-
#create_the_entries ⇒ Object
# === create_the_entries ========================================================================= #.
-
#do_trigger_a_conversion(entry1 = @entry1, entry2 = @entry2, entry_for_the_codon_table = @entry_for_the_codon_table) ⇒ Object
# === do_trigger_a_conversion (trigger tag) ========================================================================= #.
-
#entry_for_the_codon_table? ⇒ Boolean
# === entry_for_the_codon_table? ========================================================================= #.
-
#initialize(run_already = true) ⇒ Object
# === initialize ========================================================================= #.
-
#reset ⇒ Object
# === reset (reset tag) ========================================================================= #.
-
#run ⇒ Object
# === run ========================================================================= #.
-
#run_everything ⇒ Object
# === run_everything ========================================================================= #.
Class Method Details
.run ⇒ Object
#
Bioroebe::GUI::LibUI::DnaToAminoacidWidget.run
#
151 152 153 154 155 |
# File 'lib/bioroebe/gui/libui/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 151 def self.run object = Object.new object.extend(DnaToAminoacidWidget) object.run_everything end |
Instance Method Details
#create_skeleton ⇒ Object
#
create_skeleton
#
84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/bioroebe/gui/libui/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 84 def create_skeleton create_the_entries # ======================================================================= # # === @combo_box # ======================================================================= # @combo_box = ui_combo_box(@array_available_codons) combobox_selected_callback = proc { |ptr| _ = UI.combobox_selected(ptr) result = @array_available_codons[_].to_s entry_for_the_codon_table?.set_text(result) nil } UI.combobox_on_selected(@combo_box, combobox_selected_callback, nil) end |
#create_the_entries ⇒ Object
#
create_the_entries
#
77 78 79 |
# File 'lib/bioroebe/gui/libui/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 77 def create_the_entries @entry_for_the_codon_table = ui_entry('Standard (Eukaryote)') end |
#do_trigger_a_conversion(entry1 = @entry1, entry2 = @entry2, entry_for_the_codon_table = @entry_for_the_codon_table) ⇒ Object
#
do_trigger_a_conversion (trigger tag)
#
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/bioroebe/gui/libui/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 58 def do_trigger_a_conversion( entry1 = @entry1, entry2 = @entry2, entry_for_the_codon_table = @entry_for_the_codon_table ) text1 = text?(entry1) aminoacid_sequence = ::Bioroebe.convert_dna_to_protein_sequence( text1, :default, Bioroebe::CodonTable.by_name( entry_for_the_codon_table.text? ) ) entry2.set_text(aminoacid_sequence.to_s) end |
#entry_for_the_codon_table? ⇒ Boolean
#
entry_for_the_codon_table?
#
102 103 104 |
# File 'lib/bioroebe/gui/libui/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 102 def entry_for_the_codon_table? @entry_for_the_codon_table end |
#initialize(run_already = true) ⇒ Object
#
initialize
#
30 31 32 33 34 35 |
# File 'lib/bioroebe/gui/libui/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 30 def initialize( run_already = true ) reset run if run_already end |
#reset ⇒ Object
#
reset (reset tag)
#
48 49 50 51 52 53 |
# File 'lib/bioroebe/gui/libui/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 48 def reset # ======================================================================= # # === @array_available_codons # ======================================================================= # @array_available_codons = Bioroebe.available_codon_tables? end |
#run ⇒ Object
#
run
#
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/bioroebe/gui/libui/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 109 def run create_skeleton main_window = ui_margined_window('DNA to Aminoacid converter', 1200, 200, 15) outer_vbox = ui_vbox hbox = ui_hbox hbox.add(text('DNA sequence'), 1) hbox.add(text('Aminoacid sequence'), 1) outer_vbox.maximal(hbox) hbox = ui_hbox @entry1 = ui_entry @entry2 = ui_entry hbox.maximal(@entry1) hbox.maximal(@entry2) outer_vbox.add(hbox, 1) = ('Trigger conversion') .on_clicked { do_trigger_a_conversion( @entry1, @entry2, @entry_for_the_codon_table ) 0 } outer_vbox.maximal() hbox = ui_hbox hbox.maximal(text('Codon table in use: ')) hbox.maximal(@entry_for_the_codon_table) hbox.maximal(@combo_box) outer_vbox.maximal(hbox) main_window.child = outer_vbox main_window.control_show main_window.elegant_exit end |
#run_everything ⇒ Object
#
run_everything
#
40 41 42 43 |
# File 'lib/bioroebe/gui/libui/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb', line 40 def run_everything reset run end |