Module: Bioroebe::GUI::DnaToReverseComplementWidgetModule
Overview
Constant Summary
collapse
- TITLE =
'DNA to Reverse Complement'
- WIDTH =
'70%'
- HEIGHT =
'20% or minimum 200px'
- USE_THIS_FONT =
:dejavu_condensed_22
ARRAY_ALL_GTK_WIDGETS, FONT_SIZE, OLD_VERBOSE_VALUE, USE_THIS_FONT_FAMILY_FOR_GUI_APPLICATIONS
Instance Method Summary
collapse
#disable_warnings, #enable_warnings, #log_dir?
Instance Method Details
#border_size? ⇒ Boolean
60
61
62
|
# File 'lib/bioroebe/gui/shared_code/dna_to_reverse_complement_widget/dna_to_reverse_complement_widget_module.rb', line 60
def border_size?
0
end
|
81
82
83
84
85
86
87
88
|
# File 'lib/bioroebe/gui/shared_code/dna_to_reverse_complement_widget/dna_to_reverse_complement_widget_module.rb', line 81
def consider_sanitizing_the_left_input_field_for_dna
_ = @left_input_field_dna.text?.dup
if _.include? 'U'
_.tr!('U','T')
end
_.upcase!
set_dna_sequence(_)
end
|
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
|
# File 'lib/bioroebe/gui/shared_code/dna_to_reverse_complement_widget/dna_to_reverse_complement_widget_module.rb', line 222
def create_button_trigger_conversion
@button_trigger_conversion = bold_button('_Trigger Conversion')
@button_trigger_conversion.clear_background
@button_trigger_conversion.lightgreen
@button_trigger_conversion.bblack1
@button_trigger_conversion.set_background_colour :whitesmoke
@button_trigger_conversion.on_hover(:lightblue)
@button_trigger_conversion.on_clicked {
do_sync_fields
}
@button_trigger_conversion.hint =
"Clicking on this button will convert from a <b>DNA</b>\n"\
"<b>sequence</b> to the <b>corresponding reverse "\
"complement sequence</b>.\n\nMake sure you input the DNA sequence "\
"on the left hand side."
end
|
#
This method will combine the two widgets.
#
146
147
148
149
150
151
152
153
154
155
156
|
# File 'lib/bioroebe/gui/shared_code/dna_to_reverse_complement_widget/dna_to_reverse_complement_widget_module.rb', line 146
def create_hbox_containing_the_two_input_fields
@hbox_containing_the_two_input_fields.maximal(@left_input_field_dna)
if use_gtk3?
@hbox_containing_the_two_input_fields.minimal(@event_box_containing_the_right_arrow)
end
@hbox_containing_the_two_input_fields.maximal(@right_input_field_aa)
end
|
#
These are the two input fields, also known as “gtk-entries”.
#
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
|
# File 'lib/bioroebe/gui/shared_code/dna_to_reverse_complement_widget/dna_to_reverse_complement_widget_module.rb', line 250
def create_input_fields
@left_input_field_dna = input_field
@left_input_field_dna.width_height(600, 20)
@left_input_field_dna.very_light_yellowish_background
@left_input_field_dna.hint = 'Input your DNA sequence here. Upon '\
'clicking on the arrow or hitting the <b>enter</b> key, the sequence is '\
'first converted to DNA, and then the reverse complement is '\
'calculated. Afterwards the result is shown on the right input '\
'field.'
@right_input_field_aa = input_field
@right_input_field_aa.very_light_yellowish_background
if @right_input_field_aa.respond_to? :on_click_event
@right_input_field_aa.on_click_event { :highlight_text }
end
end
|
#create_the_top_labels ⇒ Object
#
create_the_top_labels
The two top labels denote which widget is the one for the DNA sequence, and which one is for the aminoacid sequence.
#
207
208
209
210
|
# File 'lib/bioroebe/gui/shared_code/dna_to_reverse_complement_widget/dna_to_reverse_complement_widget_module.rb', line 207
def create_the_top_labels
@dna_sequence_label = return_dna_sequence_label
@reverse_complement_sequence_label = return_reverse_complement_to_that_dna_sequence
end
|
#do_sync_fields ⇒ Object
#
do_sync_fields
This method will sync between the two main widgets - the DNA input field on the left, and the reverse complement on the right side.
#
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
# File 'lib/bioroebe/gui/shared_code/dna_to_reverse_complement_widget/dna_to_reverse_complement_widget_module.rb', line 164
def do_sync_fields
consider_sanitizing_the_left_input_field_for_dna
_ = @left_input_field_dna.text?
if ::Bioroebe.const_defined? :Controller
::Bioroebe::GUI::Controller.set_dna_sequence(_)
end
_ = ::Bioroebe.complement(_)
set_reverse_complement(_.reverse)
n_nucleotides = _.size
@label_n_nucleotides.set_text(
'This DNA sequence contains <b>'+n_nucleotides.to_s+'</b> nucleotides.'
)
@label_n_nucleotides.do_markify
end
|
#favicon? ⇒ Boolean
67
68
69
|
# File 'lib/bioroebe/gui/shared_code/dna_to_reverse_complement_widget/dna_to_reverse_complement_widget_module.rb', line 67
def favicon?
:tabble
end
|
#handle_commandline_arguments ⇒ Object
#
handle_commandline_arguments
#
134
135
136
137
138
139
|
# File 'lib/bioroebe/gui/shared_code/dna_to_reverse_complement_widget/dna_to_reverse_complement_widget_module.rb', line 134
def handle_commandline_arguments
input = input?
if input and !input.empty? and !input.include?('--') set_dna_sequence(input)
end
end
|
127
128
129
|
# File 'lib/bioroebe/gui/shared_code/dna_to_reverse_complement_widget/dna_to_reverse_complement_widget_module.rb', line 127
def input?
@input
end
|
#let_the_left_entry_react_to_enter_events ⇒ Object
#
let_the_left_entry_react_to_enter_events
#
195
196
197
198
199
|
# File 'lib/bioroebe/gui/shared_code/dna_to_reverse_complement_widget/dna_to_reverse_complement_widget_module.rb', line 195
def let_the_left_entry_react_to_enter_events
@left_input_field_dna.on_enter {
do_sync_fields unless @left_input_field_dna.text?.empty?
}
end
|
#padding? ⇒ Boolean
53
54
55
|
# File 'lib/bioroebe/gui/shared_code/dna_to_reverse_complement_widget/dna_to_reverse_complement_widget_module.rb', line 53
def padding?
2
end
|
#reset_shared_module ⇒ Object
46
47
48
|
# File 'lib/bioroebe/gui/shared_code/dna_to_reverse_complement_widget/dna_to_reverse_complement_widget_module.rb', line 46
def reset_shared_module
title_width_height(TITLE, WIDTH, HEIGHT)
end
|
#return_dna_sequence_label ⇒ Object
#
return_dna_sequence_label
#
188
189
190
|
# File 'lib/bioroebe/gui/shared_code/dna_to_reverse_complement_widget/dna_to_reverse_complement_widget_module.rb', line 188
def return_dna_sequence_label
bold_label('DNA sequence')
end
|
#return_reverse_complement_to_that_dna_sequence ⇒ Object
#
return_reverse_complement_to_that_dna_sequence
#
215
216
217
|
# File 'lib/bioroebe/gui/shared_code/dna_to_reverse_complement_widget/dna_to_reverse_complement_widget_module.rb', line 215
def return_reverse_complement_to_that_dna_sequence
bold_label('Reverse complement to that DNA sequence')
end
|
#run ⇒ Object
278
279
280
281
282
|
# File 'lib/bioroebe/gui/shared_code/dna_to_reverse_complement_widget/dna_to_reverse_complement_widget_module.rb', line 278
def run
super()
handle_commandline_arguments let_the_left_entry_react_to_enter_events
end
|
#set_dna_sequence(i = input?
) ⇒ Object
#
set_dna_sequence
This method will set to the input-field on the left hand side.
#
95
96
97
98
99
100
101
102
103
104
|
# File 'lib/bioroebe/gui/shared_code/dna_to_reverse_complement_widget/dna_to_reverse_complement_widget_module.rb', line 95
def set_dna_sequence(
i = input?
)
if i.is_a? Array
i = i.join(' ').strip
end
unless i.include?('--') @left_input_field_dna.set_text(i)
end
end
|
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
# File 'lib/bioroebe/gui/shared_code/dna_to_reverse_complement_widget/dna_to_reverse_complement_widget_module.rb', line 109
def set_input(i = '')
i = i.first if i.is_a? Array
i = i.to_s.dup
case i when 'ubiquitin',
'ubi'
i = ''
set_these_aminoacids(::Bioroebe.return_ubiquitin_sequence)
end
@input = i
end
|
#set_reverse_complement(i) ⇒ Object
#
set_reverse_complement
#
74
75
76
|
# File 'lib/bioroebe/gui/shared_code/dna_to_reverse_complement_widget/dna_to_reverse_complement_widget_module.rb', line 74
def set_reverse_complement(i)
@right_input_field_aa.set_text(i)
end
|