Class: Bioroebe::GUI::Gtk::Alignment
- Inherits:
-
Gtk::Box
- Object
- Gtk::Box
- Bioroebe::GUI::Gtk::Alignment
show all
- Includes:
- Bioroebe::GUI, Gtk::BaseModule
- Defined in:
- lib/bioroebe/gui/gtk3/alignment/alignment.rb
Overview
Bioroebe::GUI::Gtk::Alignment
Constant Summary
collapse
- NAMESPACE =
inspect
- TITLE =
'Alignment'
- WIDTH =
'60%'
- HEIGHT =
'50%'
- USE_THIS_FONT =
:dejavu_condensed_22
- FONT_FOR_THE_ENTRIES =
#
FONT_FOR_THE_ENTRIES
The entries must use a mono-spaced font.
#
:hack_20
ARRAY_ALL_GTK_WIDGETS, FONT_SIZE, OLD_VERBOSE_VALUE, USE_THIS_FONT_FAMILY_FOR_GUI_APPLICATIONS
Class Method Summary
collapse
-
.run(i = ARGV) ⇒ Object
# === Bioroebe::GUI::Gtk::Alignment.run ========================================================================= #.
Instance Method Summary
collapse
#disable_warnings, #enable_warnings, #log_dir?
Constructor Details
#initialize(commandline_arguments = ARGV, run_already = true) ⇒ Alignment
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/bioroebe/gui/gtk3/alignment/alignment.rb', line 65
def initialize(
commandline_arguments = ARGV,
run_already = true
)
super(:vertical)
reset
set_commandline_arguments(
commandline_arguments
)
run if run_already
end
|
Class Method Details
.run(i = ARGV) ⇒ Object
#
Bioroebe::GUI::Gtk::Alignment.run
#
300
301
302
303
304
305
306
307
308
309
|
# File 'lib/bioroebe/gui/gtk3/alignment/alignment.rb', line 300
def self.run(
i = ARGV
)
require 'gtk_paradise/run'
_ = ::Bioroebe::GUI::Gtk::Alignment.new(i)
r = ::Gtk.run
r << _
r.automatic_size_then_automatic_title
r.top_left_then_run
end
|
Instance Method Details
#border_size? ⇒ Boolean
106
107
108
|
# File 'lib/bioroebe/gui/gtk3/alignment/alignment.rb', line 106
def border_size?
6
end
|
#connect_skeleton ⇒ Object
#
connect_skeleton (connect tag)
#
212
213
214
215
216
217
218
219
|
# File 'lib/bioroebe/gui/gtk3/alignment/alignment.rb', line 212
def connect_skeleton
abort_on_exception
minimal(return_the_first_row, 5)
minimal(@scrolled_window, 2)
minimal(@button_do_analyse, 2)
minimal(@entry_consensus_sequence, 2)
minimal(@entry_numbers, 2)
end
|
#create_skeleton ⇒ Object
#
create_skeleton (create tag)
#
245
246
247
248
249
250
|
# File 'lib/bioroebe/gui/gtk3/alignment/alignment.rb', line 245
def create_skeleton
create_the_entries
create_the_buttons
create_the_text_buffer_and_the_text_view
create_the_scrolled_window
end
|
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
|
# File 'lib/bioroebe/gui/gtk3/alignment/alignment.rb', line 271
def create_the_buttons
@button_do_analyse = bold_button('_Do analyse')
@button_do_analyse.bblack1
@button_do_analyse.on_hover(:lightblue)
@button_do_analyse.hint = 'Click on this button to '\
'analyse the given sequence. Make sure to use '\
'newlines in order to split the sequence at hand.'
@button_do_analyse.on_clicked {
do_analyse
realign_the_numbers_showing_how_long_the_consensus_sequence_is
update_the_hint_for_the_entry_consequences_sequence(
(
"This entry will contain the consensus sequence, "\
"derived from the above "+
(@text_buffer.text?.count("\n")+1).to_s+" sequences.\n\nNote "\
"that only the minimal length will be compared - "\
"superfluous nucleotides will NOT be considered unless "\
"they can be aligned to other sequences."
).squeeze(' ')
)
}
end
|
#create_the_entries ⇒ Object
#
create_the_entries (entry tag, entries tag)
#
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
# File 'lib/bioroebe/gui/gtk3/alignment/alignment.rb', line 166
def create_the_entries
@entry_consensus_sequence = entry
@entry_consensus_sequence.bblack1
@entry_consensus_sequence.center
@entry_consensus_sequence.use_this_font = FONT_FOR_THE_ENTRIES
@entry_consensus_sequence.yellow_background
update_the_hint_for_the_entry_consequences_sequence(
'This entry will contain the consensus sequence, '\
'derived from the above sequences.'
)
@entry_numbers = gtk_entry
@entry_numbers.use_this_font = FONT_FOR_THE_ENTRIES
@entry_numbers.hint = 'This area may indicate the numbers for '\
'the alignment shown right above.'
end
|
113
114
115
116
117
118
119
120
121
|
# File 'lib/bioroebe/gui/gtk3/alignment/alignment.rb', line 113
def create_the_scrolled_window
@scrolled_window = gtk_scrolled_window(@text_view)
@scrolled_window.width_height(300, 400)
@scrolled_window.css_class('pad4px')
@scrolled_window.bblack1
end
|
#create_the_text_buffer_and_the_text_view ⇒ Object
#
create_the_text_buffer_and_the_text_view
#
126
127
128
129
130
131
132
133
134
135
|
# File 'lib/bioroebe/gui/gtk3/alignment/alignment.rb', line 126
def create_the_text_buffer_and_the_text_view
@text_buffer = gtk_text_buffer
@text_view = gtk_text_view(@text_buffer)
end
|
#do_analyse(_ = @text_buffer.text?) ⇒ Object
Also known as:
do_analyse_again
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
# File 'lib/bioroebe/gui/gtk3/alignment/alignment.rb', line 147
def do_analyse(
_ = @text_buffer.text?
)
if _ and !_.empty?
_.strip!
@alignment.use_this_as_input(_)
consensus_sequence = @alignment.consensus_sequence?
@entry_consensus_sequence.set_text(consensus_sequence)
else
pop_up_widget(
over_this_widget: text_view_widget?,
text: 'Please assign a sequence first.'
)
end
end
|
#do_open_and_assign_a_local_file ⇒ Object
#
do_open_and_assign_a_local_file
#
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
|
# File 'lib/bioroebe/gui/gtk3/alignment/alignment.rb', line 314
def do_open_and_assign_a_local_file
open_local_file {{
start_directory: log_dir?,
additional_folders: [
log_dir?,
'/Depot/j/',
'/Depot/jj/',
'/Depot/jjj/',
'/Depot/jjjj/'
]
}}
_ = main_file?
if _ and File.exist?(_)
dataset = File.read(_)
@text_buffer.set_text(dataset)
do_analyse_again
end
end
|
#padding? ⇒ Boolean
99
100
101
|
# File 'lib/bioroebe/gui/gtk3/alignment/alignment.rb', line 99
def padding?
12
end
|
#realign_the_numbers_showing_how_long_the_consensus_sequence_is ⇒ Object
#
realign_the_numbers_showing_how_long_the_consensus_sequence_is
#
191
192
193
194
195
|
# File 'lib/bioroebe/gui/gtk3/alignment/alignment.rb', line 191
def realign_the_numbers_showing_how_long_the_consensus_sequence_is
@entry_numbers.center
n_characters = @entry_consensus_sequence.text?.size
@entry_numbers.set_text(return_fill_up_to(n_characters))
end
|
#reset ⇒ Object
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
# File 'lib/bioroebe/gui/gtk3/alignment/alignment.rb', line 80
def reset
reset_the_internal_variables
@configuration = [true, __dir__, NAMESPACE]
title_width_height_font(TITLE, WIDTH, HEIGHT, USE_THIS_FONT)
use_gtk_paradise_project_css_file
append_project_CSS_file
infer_the_size_automatically
@alignment = Bioroebe::Alignment.new(nil, :do_not_run_yet)
end
|
#return_fill_up_to(i) ⇒ Object
200
201
202
203
204
205
206
207
|
# File 'lib/bioroebe/gui/gtk3/alignment/alignment.rb', line 200
def return_fill_up_to(i)
_ = ''.dup
i.times {|counter|
counter = (counter+1) % 10
_ << counter.to_s
}
return _
end
|
#return_the_first_row ⇒ Object
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
|
# File 'lib/bioroebe/gui/gtk3/alignment/alignment.rb', line 224
def return_the_first_row
_ = gtk_hbox
top_label = gtk_left_aligned_label(
'Input the sequences that you wish to compare to one another'
)
top_label.center
_.minimal(top_label)
event_box = gtk_event_box(
image_document_open
)
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)
return _
end
|
#run ⇒ Object
264
265
266
|
# File 'lib/bioroebe/gui/gtk3/alignment/alignment.rb', line 264
def run
create_skeleton_then_connect_skeleton
end
|
#text_view_widget? ⇒ Boolean
140
141
142
|
# File 'lib/bioroebe/gui/gtk3/alignment/alignment.rb', line 140
def text_view_widget?
@text_view
end
|
#update_the_hint_for_the_entry_consequences_sequence(i = '') ⇒ Object
#
update_the_hint_for_the_entry_consequences_sequence
#
255
256
257
258
259
|
# File 'lib/bioroebe/gui/gtk3/alignment/alignment.rb', line 255
def update_the_hint_for_the_entry_consequences_sequence(
i = ''
)
@entry_consensus_sequence.hint = i
end
|