Class: Bioroebe::GUI::UniversalWidgets::AminoacidComposition
- Inherits:
-
UniversalWidgets::Base
- Object
- UniversalWidgets::Base
- Bioroebe::GUI::UniversalWidgets::AminoacidComposition
show all
- Includes:
- CommandlineArguments, Bioroebe::GUI
- Defined in:
- lib/bioroebe/gui/universal_widgets/protein_to_DNA/protein_to_DNA.rb,
lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb
Overview
Constant Summary
collapse
- TITLE =
'Aminoacid Composition'
- WIDTH =
'65% or 500px minimum'
- HEIGHT =
'55% or 300px minimum'
- USE_THIS_FONT =
:hack_26
- 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'
- FONT_FOR_THE_ENTRIES =
#
FONT_FOR_THE_ENTRIES
The entries must use a mono-spaced font.
#
:hack_22
- FILE_MOLECULAR_WEIGHT =
#
FILE_MOLECULAR_WEIGHT
#
Bioroebe.file_molecular_weight
ARRAY_ALL_GTK_WIDGETS, FONT_SIZE, OLD_VERBOSE_VALUE, Bioroebe::GUI::USE_THIS_FONT_FAMILY_FOR_GUI_APPLICATIONS
ColoursForBase::ARRAY_HTML_COLOURS_IN_USE
Class Method Summary
collapse
Instance Method Summary
collapse
#disable_warnings, #enable_warnings, #log_dir?
#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
#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) ⇒ AminoacidComposition
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/bioroebe/gui/universal_widgets/protein_to_DNA/protein_to_DNA.rb', line 67
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
388
389
390
|
# File 'lib/bioroebe/gui/universal_widgets/protein_to_DNA/protein_to_DNA.rb', line 388
def self.[](i = ARGV)
new(i)
end
|
.run(i = ARGV) ⇒ Object
#
Bioroebe::GUI::Gtk::AminoacidComposition.run
#
395
396
397
398
399
400
401
|
# File 'lib/bioroebe/gui/universal_widgets/protein_to_DNA/protein_to_DNA.rb', line 395
def self.run(
i = ARGV
)
::Gtk.runner_factory(
::Bioroebe::GUI::Gtk::ProteinToDNA.new(i)
)
end
|
Instance Method Details
#aminoacid_sequence? ⇒ Boolean
302
303
304
|
# File 'lib/bioroebe/gui/universal_widgets/protein_to_DNA/protein_to_DNA.rb', line 302
def aminoacid_sequence?
left_buffer?.to_s
end
|
#border_size? ⇒ Boolean
237
238
239
|
# File 'lib/bioroebe/gui/universal_widgets/protein_to_DNA/protein_to_DNA.rb', line 237
def border_size?
0
end
|
#calculated_weight?(i) ⇒ Boolean
#
calculated_weight?
This method will calculate the weight.
#
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 112
def calculated_weight?(i)
dataset = YAML.load_file(FILE_MOLECULAR_WEIGHT)
weight = 0
if i.is_a?(String) and !i.empty?
chars = i.chars.sort
chars.each {|this_char|
value = dataset[this_char]
weight += value if value
}
end
weight -= (18.0 * (i.size - 1))
return weight.round(2)
end
|
#connect_the_skeleton ⇒ Object
#
connect_the_skeleton (connect tag, skeleton tag)
#
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
|
# File 'lib/bioroebe/gui/universal_widgets/protein_to_DNA/protein_to_DNA.rb', line 360
def connect_the_skeleton
abort_on_exception
@main_vbox.maximal(top_hbox?, 4)
@main_vbox.maximal(@middle_bar)
button_box = button_box(
@dataset[:backtrack_button],
@dataset[:quit_button]
)
button_box.vertical_layout
@main_vbox.minimal(button_box)
window = runner_widget(nil, width?, height?, title?)
window << @main_vbox
::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.top_left
run_main
end
|
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
|
# File 'lib/bioroebe/gui/universal_widgets/protein_to_DNA/protein_to_DNA.rb', line 244
def create_buttons
backtrack_button = bold_button(
USE_THIS_TITLE_FOR_THE_MAIN_BUTTON, self, :use_mnemonic
) {
:do_determine_the_backtrack_sequence
}
backtrack_button.set_name('button1')
backtrack_button.do_use_underline
backtrack_button.hint =
"On the <b>left hand side</b>, you should input the "\
"Aminoacid sequence.\n\n"\
"On the <b>right hand side</b>, a possible DNA "\
"sequence for this Aminoacid Sequence will "\
"be displayed.\n\n"\
"Invalid amino acids, such as 'U', will be filtered "\
"out, if given.\n\n"\
"Note that this will not necessarily "\
"generate the same sequence, due to several different codons "\
"encoding for the same aminoacid."
backtrack_button.on_hover_lightblue
@dataset[:backtrack_button] = backtrack_button
a_quit_button = quit_button
a_quit_button.set_name('button1')
a_quit_button.make_bold
@dataset[:quit_button] = a_quit_button
end
|
#create_left_buffer ⇒ Object
171
172
173
174
175
176
177
178
|
# File 'lib/bioroebe/gui/universal_widgets/protein_to_DNA/protein_to_DNA.rb', line 171
def create_left_buffer
@dataset[:left_buffer] = create_text_view @dataset[:left_buffer].bblack1
@dataset[:left_buffer].do_wrap_properly
end
|
#create_middle_bar_containing_the_arrow_pointing_to_the_right_side ⇒ Object
#
create_middle_bar_containing_the_arrow_pointing_to_the_right_side
#
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
# File 'lib/bioroebe/gui/universal_widgets/protein_to_DNA/protein_to_DNA.rb', line 122
def create_middle_bar_containing_the_arrow_pointing_to_the_right_side
@middle_bar = create_vbox
event_box = create_eventbox(
create_label(:arrow_right)
)
event_box.hint =
'This arrow can be clicked, to convert from the aminoacid sequence '\
'to (one likely) possible DNA sequence.'
event_box.on_clicked {
do_determine_the_backtrack_sequence
}
@middle_bar.minimal(
event_box
)
end
|
#create_right_buffer ⇒ Object
110
111
112
113
114
115
116
117
|
# File 'lib/bioroebe/gui/universal_widgets/protein_to_DNA/protein_to_DNA.rb', line 110
def create_right_buffer
@dataset[:right_buffer] = create_text_view @dataset[:right_buffer].bblack1
@dataset[:right_buffer].do_wrap_properly
end
|
#create_the_boxes ⇒ Object
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
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 628
def create_the_boxes
@hbox1 = create_hbox(
bold_text('n bacteria (start)'),
@entry_point_start_with_n_bacteria
)
@hbox2 = create_hbox(
bold_text('n doubling times'),
@entry_point_use_n_divisions
)
@hbox3 = create_hbox(
bold_text('n bacteria (end)'),
@entry_point_n_cells
)
end
|
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 435
def create_the_button_to_calculate_how_many_bacteria_will_exist
@button_to_calculate_how_many_bacteria_will_exist = bold_button(
'_Calculate how many bacteria will exist after n rounds',
self,
:use_mnemonic
) {
:do_the_calculation
}
@button_to_calculate_how_many_bacteria_will_exist.clear_background
@button_to_calculate_how_many_bacteria_will_exist.bblack2
@button_to_calculate_how_many_bacteria_will_exist.hint =
"Click on this button in order to do the calculation\n"\
"e. g. <b>how many bacteria we will have</b> "\
"based on the above parameters."
@button_to_calculate_how_many_bacteria_will_exist.on_hover(:powderblue)
end
|
421
422
423
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 421
def create_the_buttons
create_the_button_to_calculate_how_many_bacteria_will_exist
end
|
#create_the_entries ⇒ Object
#
create_the_entries (entry tag, entries tag)
#
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
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
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 567
def create_the_entries
@entry_point_start_with_n_bacteria = create_entry
@entry_point_start_with_n_bacteria.default = 10
@entry_point_start_with_n_bacteria.bblack1
@entry_point_start_with_n_bacteria.on_click_select_all
@entry_point_start_with_n_bacteria.do_center
@entry_point_start_with_n_bacteria.on_key_press_event { |widget, event|
if use_gtk3?
do_the_calculation if Gdk::Keyval.to_name(event.keyval) == 'Return'
else
do_the_calculation
end
}
@entry_point_start_with_n_bacteria.hint =
'Input a <b>number</b> here, denoting how many bacteria '\
'exist at the start.'
@entry_point_use_n_divisions = create_entry
@entry_point_use_n_divisions.default = 10
@entry_point_use_n_divisions.bblack1
@entry_point_use_n_divisions.on_click_select_all
@entry_point_use_n_divisions.do_center
@entry_point_use_n_divisions.on_key_press_event { |widget, event|
if use_gtk3?
do_the_calculation if Gdk::Keyval.to_name(event.keyval) == 'Return'
else
do_the_calculation
end
}
@entry_point_use_n_divisions.hint =
'Input a <b>number</b> here, denoting how many cell '\
'divisions the bacteria will undergo.'
@entry_point_n_cells = create_entry
@entry_point_n_cells.default = 0
@entry_point_n_cells.bblack1
@entry_point_n_cells.do_center
@entry_point_n_cells.on_key_press_event { |widget, event|
if use_gtk3?
do_the_calculation if Gdk::Keyval.to_name(event.keyval) == 'Return'
else
do_the_calculation
end
}
@entry_point_n_cells.hint =
'The number here will be <b>the amount of bacteria '\
'after n cell divisions</b>.'
end
|
#create_the_hspacer ⇒ Object
657
658
659
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 657
def create_the_hspacer
@a_hspacer = create_hspacer
end
|
255
256
257
258
259
260
261
262
263
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 255
def create_the_scrolled_window
@scrolled_window = create_scrolled_window(@text_view)
@scrolled_window.width_height(300, 400)
@scrolled_window.pad4px
@scrolled_window.bblack2
end
|
#create_the_single_treeview ⇒ Object
#
create_the_single_treeview
#
458
459
460
461
462
463
464
465
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 458
def create_the_single_treeview
@treeview = create_tree_view(@list_store) { :clickable_headers }
@treeview.set_name('custom_treeview')
@treeview.('Aminoacid','n times')
@treeview.
@treeview.set_enable_search(true)
@treeview.set_reorderable(true)
end
|
#create_the_skeleton ⇒ Object
#
create_the_skeleton (create tag, skeleton tag)
#
334
335
336
337
338
339
340
341
|
# File 'lib/bioroebe/gui/universal_widgets/protein_to_DNA/protein_to_DNA.rb', line 334
def create_the_skeleton
@main_vbox = vbox
create_buttons
create_left_buffer create_right_buffer create_top_hbox create_middle_bar_containing_the_arrow_pointing_to_the_right_side
end
|
#create_the_text_buffer_and_the_text_view ⇒ Object
#
create_the_text_buffer_and_the_text_view
#
234
235
236
237
238
239
240
241
242
243
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 234
def create_the_text_buffer_and_the_text_view
@text_buffer = create_text_buffer
@text_view = create_text_view(@text_buffer)
end
|
#create_the_treeviews ⇒ Object
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 399
def create_the_treeviews
@list_store = create_liststore(String, String)
@list_store.set_sort_func(1) { |_model, iter1, iter2|
iter2[1].to_i <=> iter1[1].to_i
}
create_the_single_treeview
columns = @treeview.columns?
columns[0].allow_resizing
columns[1].allow_resizing
columns[0].sortable_based_on(0)
columns[1].sortable_based_on(1)
end
|
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 344
def
require 'bioroebe/gui/universal_widgets/aminoacid_composition/customized_dialog.rb'
=
label_description = text(TITLE)
label_description.make_bold
.set_custom_title(label_description)
.spacing = 10
.bblack1
button = button_themed_icon('edit-paste-symbolic.symbolic')
button.hint = 'Click this button to show more information '\
'about this application.'
content = <<-EOF
This widget will operate via the following <b>aminoacid weights</b>,
in Dalton, without the weight of a H₂O water molecule (18g/mol):
EOF
content = content.dup
YAML.load_file(Bioroebe.file_molecular_weight).each_pair {|key, value|
content << " <b>#{key}</b>: "\
"<span color=\"steelblue\">#{value.to_s.rjust(6)}</span>\n"
}
content << "
Compare with this URL:\n
<a href=\"https://www.selleckchem.com/peptide-calculator.html\" title=\"Another useful resource\">https://www.selleckchem.com/peptide-calculator.html</a>
"
text_widget = left_aligned_text(content)
text_widget.use_this_font = :hack_18
button.on_clicked {
::Bioroebe::GUI::Gtk::CustomizedDialog.new(text_widget)
}
.pack_start(button)
minimal(, 2)
end
|
#create_top_hbox ⇒ Object
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
# File 'lib/bioroebe/gui/universal_widgets/protein_to_DNA/protein_to_DNA.rb', line 141
def create_top_hbox
scrolled_window_right = scrolled_window(right_buffer?)
scrolled_window_right.clear_background
scrolled_window_right.width_height(300, 300)
scrolled_window_right.bblack1
scrolled_window_right.mar2px
scrolled_window_left = scrolled_window(left_buffer?)
scrolled_window_left.clear_background
scrolled_window_left.width_height(300, 300)
scrolled_window_left.bblack1
scrolled_window_left.mar2px
top_hpaned = gtk_hpaned(
scrolled_window_left,
scrolled_window_right
) {{ border_width: 10 }}
this_position = (width?.to_f / 1.5).to_i
top_hpaned.set_position(this_position)
top_hpaned.show_all
@dataset[:top_hbox] = top_hpaned
end
|
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 301
def create_user_input
@entry_input_sequence = create_entry
@entry_input_sequence.hint =
"Input your aminoacid sequence here, then hit the enter-key to "\
"evaluate the given input. Invalid entries (aka <b>non-aminoacids</b>) "\
"will be filtered away, so do not be surprised if the sequence may "\
"be modified (== <b>sanitized</b>).\n\n"\
"The cursor-position will indicate at which aminoacid "\
"position we are at.\n"
@entry_input_sequence.yellow_background
@entry_input_sequence.css_class('pad4px')
@entry_input_sequence.signal_connect(:event) {|widget, event|
if is_mouse_button_release_event?(event)
update_information_deduced_from_the_aminoacid_sequence
end
}
end
|
#do_create_a_new_fasta_file ⇒ Object
#
do_create_a_new_fasta_file
#
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 512
def do_create_a_new_fasta_file
what = @entry_input_sequence.text?.dup
what.prepend(
"> Random aminoacid sequence generated via a ruby-gtk3 "\
"GUI (#{what.size} aminoacids)\n"
)
into = path_to_the_fasta_file?
::Bioroebe.write_what_into(what, into)
vbox1 = gtk_vbox
use_this_as_the_label = text(
"Created a new file at:\n"
)
vbox1.minimal(use_this_as_the_label, 5)
vbox1.width_height(600, 400)
entry1 = gtk_bold_entry(into)
entry1.deselect
entry1.width_height(300, 30)
entry1.light_yellowish_background
vbox1.minimal(entry1, 5)
use_this_as_the_label.deselect
(
@event_box1,
vbox1
).
end
|
#do_determine_the_backtrack_sequence ⇒ Object
Also known as:
do_determine_the_DNA_sequence
#
do_determine_the_backtrack_sequence (click tag)
This will do what is necessary to find the backtrack sequence.
#
318
319
320
321
322
323
324
325
326
327
328
329
|
# File 'lib/bioroebe/gui/universal_widgets/protein_to_DNA/protein_to_DNA.rb', line 318
def do_determine_the_backtrack_sequence
filter_away_invalid_aminoacids_from_the_left_buffer
_ = left_buffer?.text?.to_s
_.upcase!
_ = ::Bioroebe.remove_invalid_aminoacids(_)
left_buffer?.set_text(_)
text_for_right_hand_side = ::Bioroebe::ProteinToDNA.new(_, :be_quiet).dna_sequence?
right_buffer?.set_text(text_for_right_hand_side)
end
|
#do_open_a_local_FASTA_file(this_widget = @parent_widget) ⇒ Object
#
do_open_a_local_FASTA_file
#
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 664
def do_open_a_local_FASTA_file(
this_widget = @parent_widget
)
require 'gtk_paradise/widgets/gtk3/select_file/select_file.rb'
widget = ::Gtk::SelectFile.new(this_widget) {{
filter_for_these_file_types: '.fasta',
current_folder: ::Bioroebe.log_dir?+'fasta/'
}}
this_file = widget.do_pick_file.text.to_s
if File.exist?(this_file) and File.file?(this_file) require 'bioroebe/fasta_and_fastq/parse_fasta/parse_fasta.rb'
dataset = File.read(this_file)
_ = Bioroebe::ParseFasta.new
unless dataset.start_with?('--')
_.set_data(dataset) _.split_into_proper_sections
set_main_entry(_.body?)
fill_with_this(_.body?)
do_update_the_widget_on_the_right_side
end
end
return this_file
end
|
#do_the_calculation ⇒ Object
#
do_the_calculation
This method will do the actual calculation part.
#
290
291
292
293
294
295
296
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 290
def do_the_calculation
result = ::Bioroebe.calculate_exponential_growth(
number_of_cells = @entry_point_start_with_n_bacteria.text?,
number_of_divisions = @entry_point_use_n_divisions.text?
)
@entry_point_n_cells.set_text(result.to_s)
end
|
#fill_the_table_data_with_this_sequence(i = @entry_input_sequence.text?) ⇒ Object
Also known as:
fill_with_this
#
fill_the_table_data_with_this_sequence
#
332
333
334
335
336
337
338
339
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 332
def fill_the_table_data_with_this_sequence(
i = @entry_input_sequence.text?
)
@list_store.clear
hash = Bioroebe.return_composition_from_this_aminoacid_sequence(i)
array = hash.to_a.map {|inner_array| inner_array.map {|entry| entry.to_s }}
::Gtk.populate_this_liststore(@list_store, array) if use_gtk3?
end
|
#filter_away_invalid_aminoacids(i) ⇒ Object
#
filter_away_invalid_aminoacids
#
#filter_away_invalid_aminoacids_from_the_left_buffer ⇒ Object
#
filter_away_invalid_aminoacids_from_the_left_buffer
This method is used to “sanitize” the input - invalid aminoacids are flat out removed.
#
277
278
279
280
281
282
283
|
# File 'lib/bioroebe/gui/universal_widgets/protein_to_DNA/protein_to_DNA.rb', line 277
def filter_away_invalid_aminoacids_from_the_left_buffer
_ = left_buffer?.text?.to_s
possible_new_text = Bioroebe.strict_filter_away_invalid_aminoacids(_)
unless _ == possible_new_text
left_buffer?.set_text(possible_new_text)
end
end
|
#handle_CSS_rules ⇒ Object
Also known as:
handle_CSS
#
handle_CSS_rules (CSS tag, css tag)
#
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
# File 'lib/bioroebe/gui/universal_widgets/protein_to_DNA/protein_to_DNA.rb', line 197
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_buffer? ⇒ Boolean
Also known as:
left?
309
310
311
|
# File 'lib/bioroebe/gui/universal_widgets/protein_to_DNA/protein_to_DNA.rb', line 309
def left_buffer?
@dataset[:left_buffer]
end
|
#main_font? ⇒ Boolean
183
184
185
|
# File 'lib/bioroebe/gui/universal_widgets/protein_to_DNA/protein_to_DNA.rb', line 183
def main_font?
USE_THIS_FONT
end
|
215
216
217
218
219
220
221
222
223
224
225
|
# File 'lib/bioroebe/gui/universal_widgets/protein_to_DNA/protein_to_DNA.rb', line 215
def (i = nil)
if i
if i.is_a? Array
i.each {|entry| (entry) }
else
case i when ''
end
end
end
end
|
#padding? ⇒ Boolean
230
231
232
|
# File 'lib/bioroebe/gui/universal_widgets/protein_to_DNA/protein_to_DNA.rb', line 230
def padding?
2
end
|
#path_to_the_fasta_file? ⇒ Boolean
#
path_to_the_fasta_file?
#
383
384
385
386
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 383
def path_to_the_fasta_file?
::Bioroebe.log_dir?+
'fasta/aminoacid_sequence.fasta'
end
|
#reset ⇒ Object
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
# File 'lib/bioroebe/gui/universal_widgets/protein_to_DNA/protein_to_DNA.rb', line 82
def reset
super() if respond_to?(:super)
reset_the_internal_variables
reset_the_base_module infer_the_namespace
@configuration = [true, __dir__, namespace?]
title_width_height_font(TITLE, WIDTH, HEIGHT, USE_THIS_FONT)
handle_CSS if use_gtk3?
set_label_widget(
create_label.set_markup(
%Q(<span foreground="#000000" weight="bold">#{TITLE}</span>)
)
) if respond_to?(:set_label_widget) and use_gtk3? @dataset = {}
end
|
#return_how_many_aminoacids_are_in_the_sequence(i = @entry_user_input) ⇒ Object
#
return_how_many_aminoacids_are_in_the_sequence
#
154
155
156
157
158
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 154
def return_how_many_aminoacids_are_in_the_sequence(
i = @entry_user_input
)
return 'This sequence has '+i.text?.to_s.size.to_s+' aminoacids.'
end
|
#return_the_first_row ⇒ Object
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 209
def return_the_first_row
_ = create_hbox
top_label = left_aligned_label(
TEXT_INPUT_THE_SEQUENCES
)
top_label.make_selectable
top_label.center
_.minimal(top_label)
use_this_image = image_document_open
if use_this_image
event_box = event_box(use_this_image)
if event_box
event_box.hint = 'Click on this icon to open a local file.'
event_box.on_clicked {
do_open_and_assign_a_local_file
}
_.pack_end(event_box)
end
end
return _
end
|
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 493
def return_widget_containing_the_toolbox_images
hbox = create_hbox
@event_box1 = create_event_box(
image_folder_visiting_symbolic
)
@event_box1.hint =
"Click on this image to create a new local "\
".fasta file with that sequence.\n\nThe location will be "\
"at: <b>#{path_to_the_fasta_file?}</b>"
@event_box1.on_clicked {
do_create_a_new_fasta_file
}
hbox.minimal(@event_box1, 4)
return hbox
end
|
#right_buffer? ⇒ Boolean
Also known as:
right?
288
289
290
|
# File 'lib/bioroebe/gui/universal_widgets/protein_to_DNA/protein_to_DNA.rb', line 288
def right_buffer?
@dataset[:right_buffer]
end
|
#run ⇒ Object
346
347
348
|
# File 'lib/bioroebe/gui/universal_widgets/protein_to_DNA/protein_to_DNA.rb', line 346
def run
run_super
end
|
#set_aminoacid_sequence(i) ⇒ Object
#
set_aminoacid_sequence
#
295
296
297
|
# File 'lib/bioroebe/gui/universal_widgets/protein_to_DNA/protein_to_DNA.rb', line 295
def set_aminoacid_sequence(i)
@dataset[:left_buffer].set_text(i.to_s)
end
|
#set_main_entry(i) ⇒ Object
Also known as:
set_main_input_sequence
177
178
179
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 177
def set_main_entry(i)
@entry_input_sequence.set_text(i.to_s)
end
|
#set_main_input_sequence_and_evaluate_it(i) ⇒ Object
#
set_main_input_sequence_and_evaluate_it
#
184
185
186
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 184
def set_main_input_sequence_and_evaluate_it(i)
simulate_enter_click(i)
end
|
325
326
327
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 325
def set_parent_widget(i)
@parent_widget = i
end
|
#simulate_enter_click(_ = @entry_input_sequence.text?) ⇒ Object
Also known as:
update_information_deduced_from_the_aminoacid_sequence, do_update_the_widget_on_the_right_side
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 541
def simulate_enter_click(
_ = @entry_input_sequence.text?
)
_.upcase!
_ = filter_away_invalid_aminoacids(_)
@entry_input_sequence.set_text(_)
fill_the_table_data_with_this_sequence(_)
@label_n_aminoacids.set_text(
"This sequence has <b>#{_.size}</b> aminoacids."
)
@label_n_aminoacids.do_markify
@label_molecular_weight.set_text(
'The molecular weight of these aminoacids is: <b>'+
calculated_weight?(_).to_s+'</b> Dalton'
)
@label_molecular_weight.do_markify
update_label_cursor_position
end
|
#slightly_smaller_font? ⇒ Boolean
#
slightly_smaller_font?
#
190
191
192
|
# File 'lib/bioroebe/gui/universal_widgets/protein_to_DNA/protein_to_DNA.rb', line 190
def slightly_smaller_font?
USE_THIS_SLIGHTLY_SMALLER_FONT
end
|
#smaller_font? ⇒ Boolean
282
283
284
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 282
def smaller_font?
SMALLER_FONT
end
|
#textview? ⇒ Boolean
248
249
250
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 248
def textview?
@text_view
end
|
#top_hbox? ⇒ Boolean
353
354
355
|
# File 'lib/bioroebe/gui/universal_widgets/protein_to_DNA/protein_to_DNA.rb', line 353
def top_hbox?
@dataset[:top_hbox]
end
|
#update_label_cursor_position ⇒ Object
#
update_label_cursor_position
#
132
133
134
135
136
137
138
139
140
141
142
|
# File 'lib/bioroebe/gui/universal_widgets/aminoacid_composition/aminoacid_composition.rb', line 132
def update_label_cursor_position
cursor_position = @entry_input_sequence.cursor_position
character = @entry_input_sequence.text?[cursor_position, 1].to_s
unless character.empty?
_ = 'The aminoacid at position <b>'+
(cursor_position+1).to_s+
'</b> is: <b>'+character.to_s+'</b>.'
@label_cursor_position.set_text(_)
@label_cursor_position.do_markify
end
end
|