Class: Bioroebe::GUI::UniversalWidgets::ParsePdbFile
- Inherits:
-
UniversalWidgets::Base
- Object
- UniversalWidgets::Base
- Bioroebe::GUI::UniversalWidgets::ParsePdbFile
show all
- Includes:
- CommandlineArguments, Bioroebe::GUI
- Defined in:
- lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb
Overview
Constant Summary
collapse
- TITLE =
#
TITLE
Specify which title to use for this widget.
#
' Parse a .pdb file '
- WIDTH =
'75% or 1200px minimum'
- HEIGHT =
'55% or 500px minimum'
- FONT_LARGE =
'Calibri 32'
- MONOSPACED_FONT =
#
MONOSPACED_FONT
When this font is changed, don’t forget to also change the font at SMALLER_FONT.
#
:hack_22
- USE_THIS_FONT =
MONOSPACED_FONT
- USE_THIS_MONOFONT =
MONOSPACED_FONT
- SMALLER_FONT =
:hack_16
- USE_THIS_SLIGHTLY_SMALLER_FONT =
#
USE_THIS_SLIGHTLY_SMALLER_FONT
#
:hack_16
['one-letter abbreviation', 'n times']
- GENERATE_N_AMINOACIDS_BY_DEFAULT =
#
GENERATE_N_AMINOACIDS_BY_DEFAULT
#
15
- COLOUR_FOR_NON_MATCHES =
#
COLOUR_FOR_NON_MATCHES
This is the colour that will be used for non-matching nucleotides.
#
:magenta
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) ⇒ ParsePdbFile
95
96
97
98
99
100
101
102
103
104
105
|
# File 'lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb', line 95
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
436
437
438
|
# File 'lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb', line 436
def self.[](i = ARGV)
new(i)
end
|
.run(i = ARGV) ⇒ Object
#
Bioroebe::GUI::Gtk::ParsePdbFile.run
#
443
444
445
446
447
448
449
450
451
|
# File 'lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb', line 443
def self.run(
i = ARGV
)
r = ::Gtk.runner_factory(
::Bioroebe::GUI::Gtk::ParsePdbFile.new(i)
)
r.background_colour(:white)
return r
end
|
Instance Method Details
#a_new_file_has_been_loaded(i = @file_name.text?) ⇒ Object
#
a_new_file_has_been_loaded
Use this method to indicate that a new file has been loaded.
#
230
231
232
233
234
235
236
237
238
|
# File 'lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb', line 230
def a_new_file_has_been_loaded(
i = @file_name.text?
)
@dataset = ::Bioroebe::ParsePdbFile.new(i) { :be_silent }
update_the_scrolled_window_with_the_current_aminoacid_sequence
update_the_label_protein_contans_n_alpha_helices
update_the_aminoacid_sequence_is_label
update_label_taxid
end
|
#add_how_many_alpha_helices_can_be_found_in_this_protein ⇒ Object
#
add_how_many_alpha_helices_can_be_found_in_this_protein
#
270
271
272
273
274
275
276
277
278
|
# File 'lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb', line 270
def add_how_many_alpha_helices_can_be_found_in_this_protein
_ = create_hbox
@label_protein_contans_n_alpha_helices = left_aligned_text('This protein contains <b>'+
@dataset.n_alpha_helices?.to_s+
'</b> alpha-helices.')
@label_protein_contans_n_alpha_helices.make_selectable
_ << @label_protein_contans_n_alpha_helices
@outer_vbox.minimal(_, 2)
end
|
168
169
170
171
172
173
174
175
176
177
|
# File 'lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb', line 168
def add_information_about_how_many_atom_entries_are_part_of_that_pdb_file
_ = create_hbox
text = left_aligned_text(
"\n<b>#{@dataset.n_atom_entries?.to_s}"\
"</b> ATOM entries were found being part of this file."
)
text.make_selectable
_ << text
@outer_vbox.add(_)
end
|
#add_the_aminoacid_sequence ⇒ Object
#
add_the_aminoacid_sequence
#
399
400
401
402
403
404
405
406
407
408
409
410
|
# File 'lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb', line 399
def add_the_aminoacid_sequence
_ = create_vbox
@text_for_the_aminoacid_sequence = left_aligned_text(
'The aminoacid sequence (<b>'+@dataset.n_aminoacids?.to_s+
'</b> aminoacids) is:'
)
@text_for_the_aminoacid_sequence.make_selectable
_.minimal(@text_for_the_aminoacid_sequence, 10)
update_the_scrolled_window_with_the_current_aminoacid_sequence
_.minimal(@scrolled_window, 15)
@outer_vbox.add(_)
end
|
#add_the_maximum_difference_between_the_atoms ⇒ Object
#
add_the_maximum_difference_between_the_atoms
#
383
384
385
386
387
388
389
390
391
392
393
394
|
# File 'lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb', line 383
def add_the_maximum_difference_between_the_atoms
_ = create_hbox
if @dataset
text = left_aligned_text(
'The maximum difference between the atoms is <b>'+
@dataset.max_distance?.to_s.to_f.round(3).to_s+'</b>.'
)
text.make_selectable
_ << text
end
@outer_vbox.add(_)
end
|
#border_size? ⇒ Boolean
136
137
138
|
# File 'lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb', line 136
def border_size?
25
end
|
#connect_the_skeleton ⇒ Object
#
connect_the_skeleton (connect tag, skeleton tag)
#
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
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
|
# File 'lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb', line 304
def connect_the_skeleton
abort_on_exception
@outer_vbox = create_vbox
@outer_vbox.set_border_width(18)
_ = first_argument?.to_s
if _.start_with? '--'
_ = '' end
if File.exist? _
else
::Bioroebe.no_file_exists_at(_)
end
@dataset = ::Bioroebe::ParsePdbFile.new(_) { :be_silent }
hbox = create_hbox
hbox.minimal(
text('File name: ')
)
@file_name = bold_text(File.absolute_path(_))
@file_name.make_selectable
hbox.minimal(@file_name)
hbox.minimal(return_widget_containing_a_file_open_button, 9)
@outer_vbox.minimal(hbox, 8)
@outer_vbox.minimal(horizontal_spacer, 2)
hbox = create_hbox
@label_the_name_of_the_organism = text(
'The name of the organism (Entry: '+
'<span weight="bold" color="steelblue">ORGANISM_SCIENTIFIC</span>'+
+') is'
)
@label_the_name_of_the_organism.make_selectable
@label_the_name_of_the_organism.do_markify
hbox.minimal(@label_the_name_of_the_organism, 5)
@outer_vbox.add(hbox)
if @dataset
taxid = @dataset.taxid_of_the_species?.to_s
@label_taxid = text(
'<span weight="bold" color="indigo">'+@dataset.name_of_the_species?.to_s+
'</span>'+
' (Taxid: ➡️ '+
'<span weight="bold"><a href="https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?id='+taxid+'">'+
taxid+'</a></span>; '+@dataset.organism_common?.to_s+')'
)
@label_taxid.make_selectable
@label_taxid.do_markify
@outer_vbox.add(hbox(@label_taxid))
end
add_information_about_how_many_atom_entries_are_part_of_that_pdb_file
add_the_aminoacid_sequence
add_how_many_alpha_helices_can_be_found_in_this_protein
add_the_maximum_difference_between_the_atoms
window = runner_widget(nil, width?, height?, title?)
window << @outer_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?)
jump_into_the_first_entry
window.top_left
run_main
end
|
415
416
417
418
419
420
421
422
423
424
|
# File 'lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb', line 415
def create_the_scrolled_window_containing_the_aminoacid_sequence
@text_buffer = create_text_buffer
@text_view = create_text_view(@text_buffer)
@scrolled_window = create_scrolled_window(@text_view) { :left_right }
@scrolled_window.clear_background
@scrolled_window.css_class('royalblue')
@scrolled_window.bblack1
@scrolled_window.width_height(400, 50)
@scrolled_window.set_name('differently_coloured_selection')
end
|
#create_the_skeleton ⇒ Object
#
create_the_skeleton (create tag, skeleton tag)
#
283
284
285
|
# File 'lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb', line 283
def create_the_skeleton
create_the_scrolled_window_containing_the_aminoacid_sequence
end
|
#handle_CSS_rules ⇒ Object
Also known as:
handle_CSS
#
handle_CSS_rules (CSS tag, css tag)
#
157
158
159
160
161
162
163
|
# File 'lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb', line 157
def handle_CSS_rules
use_gtk_paradise_project_css_file
append_project_css_file
add_these_custom_CSS_rules '
'
apply_the_CSS_rules
end
|
#jump_into_the_first_entry ⇒ Object
#
jump_into_the_first_entry
#
376
377
378
|
# File 'lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb', line 376
def jump_into_the_first_entry
entry1?.do_focus
end
|
#main_font? ⇒ Boolean
143
144
145
|
# File 'lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb', line 143
def main_font?
USE_THIS_FONT
end
|
#padding? ⇒ Boolean
129
130
131
|
# File 'lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb', line 129
def padding?
12
end
|
#reset ⇒ Object
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
# File 'lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb', line 110
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?
end
|
#
This is the widget with the “open file” functionality.
#
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
|
# File 'lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb', line 245
def return_widget_containing_a_file_open_button
button_open_file = file_open_button
button_open_file.bblack1
button_open_file.on_click {
create_a_new_file_chooser_dialog(
button_open_file,
'Open file'
) {{
filter_for: '.pdb', additional_directories: Bioroebe.project_log_directory?+'pdb/'
}}
_ = ::Gtk.main_file?
if _ and !_.empty?
@file_name.set_text(
_.to_s
)
a_new_file_has_been_loaded
end
}
return button_open_file
end
|
#run ⇒ Object
290
291
292
|
# File 'lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb', line 290
def run
run_super
end
|
429
430
431
|
# File 'lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb', line 429
def scrolled_window?
@scrolled_window
end
|
#slightly_smaller_font? ⇒ Boolean
#
slightly_smaller_font?
#
150
151
152
|
# File 'lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb', line 150
def slightly_smaller_font?
USE_THIS_SLIGHTLY_SMALLER_FONT
end
|
#smaller_font? ⇒ Boolean
297
298
299
|
# File 'lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb', line 297
def smaller_font?
SMALLER_FONT
end
|
#update_label_taxid ⇒ Object
213
214
215
216
217
218
219
220
221
222
223
|
# File 'lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb', line 213
def update_label_taxid
taxid = @dataset.taxid_of_the_species?.to_s
@label_taxid.set_text(
'<span weight="bold" color="indigo">'+@dataset.name_of_the_species?.to_s+
'</span>'+
' (Taxid: ➡️ '+
'<span weight="bold"><a href="https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?id='+taxid+'">'+
taxid+'</a></span>; '+@dataset.organism_common?.to_s+')'
)
@label_taxid.do_markify
end
|
#update_the_aminoacid_sequence_is_label ⇒ Object
#
update_the_aminoacid_sequence_is_label
#
182
183
184
185
186
187
188
|
# File 'lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb', line 182
def update_the_aminoacid_sequence_is_label
@text_for_the_aminoacid_sequence.set_text(
'The aminoacid sequence (<b>'+@dataset.n_aminoacids?.to_s+
'</b> aminoacids) is:'
)
@text_for_the_aminoacid_sequence.do_markify
end
|
#update_the_label_protein_contans_n_alpha_helices ⇒ Object
#
update_the_label_protein_contans_n_alpha_helices
#
193
194
195
196
197
198
199
|
# File 'lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb', line 193
def update_the_label_protein_contans_n_alpha_helices
_ = 'This protein contains <b>'+
@dataset.n_alpha_helices?.to_s+
'</b> alpha-helices.'
@label_protein_contans_n_alpha_helices.set_text(_)
@label_protein_contans_n_alpha_helices.do_markify
end
|
204
205
206
207
208
|
# File 'lib/bioroebe/gui/universal_widgets/parse_pdb_file/parse_pdb_file.rb', line 204
def update_the_scrolled_window_with_the_current_aminoacid_sequence
@scrolled_window.set_text(
@dataset.aminoacid_sequence?.to_s
)
end
|