Class: Bioroebe::GUI::UniversalWidgets::PrimerDesignWidget

Inherits:
UniversalWidgets::Base
  • Object
show all
Includes:
CommandlineArguments, Bioroebe::GUI
Defined in:
lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb

Overview

Bioroebe::GUI::UniversalWidgets::PrimerDesignWidget

Constant Summary collapse

TITLE =
#

TITLE

Specify which title to use for this widget.

#
'Primer Design'
WIDTH =
#

WIDTH

#
'75% or 800px minimum'
HEIGHT =
#

HEIGHT

#
'55% or 500px minimum'
PADDING_OF_THE_WHOLE_WIDGET =
#

PADDING_OF_THE_WHOLE_WIDGET

#
12
HUGE_FONT =
#

HUGE_FONT

#
:hack_25
FONT_LARGE =
#

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 =
#

SMALLER_FONT

#
:hack_16
USE_THIS_SLIGHTLY_SMALLER_FONT =
#

USE_THIS_SLIGHTLY_SMALLER_FONT

#
:hack_16
USE_THIS_HEADER =
#

USE_THIS_HEADER

#
['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

Constants included from Bioroebe::GUI

ARRAY_ALL_GTK_WIDGETS, FONT_SIZE, OLD_VERBOSE_VALUE, Bioroebe::GUI::USE_THIS_FONT_FAMILY_FOR_GUI_APPLICATIONS

Constants included from ColoursForBase

ColoursForBase::ARRAY_HTML_COLOURS_IN_USE

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Bioroebe::GUI

#disable_warnings, #enable_warnings, #log_dir?

Methods included from CommandlineArguments

#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

Methods included from ColoursForBase

#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) ⇒ PrimerDesignWidget

#

initialize

#


105
106
107
108
109
110
111
112
113
114
115
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 105

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

#

Bioroebe::GUI::UniversalWidgets::PrimerDesignWidget[]

#


594
595
596
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 594

def self.[](i = ARGV)
  new(i)
end

.run(i = ARGV) ⇒ Object

#

Bioroebe::GUI::Gtk::PrimerDesignWidget.run

#


601
602
603
604
605
606
607
608
609
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 601

def self.run(
    i = ARGV
  )
  r = ::Gtk.runner_factory(
    ::Bioroebe::GUI::Gtk::PrimerDesignWidget.new(i)
  )
  r.background_colour(:white)
  return r
end

Instance Method Details

#border_size?Boolean

#

border_size?

#

Returns:

  • (Boolean)


161
162
163
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 161

def border_size?
  2
end

#connect_the_skeletonObject

#

connect_the_skeleton (connect tag, skeleton tag)

#


541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 541

def connect_the_skeleton
  abort_on_exception
  
  outer_vbox = create_vbox
  outer_vbox.minimal(return_the_header_bar, 2)
  outer_vbox.minimal(return_the_main_label, 2)
  outer_vbox.minimal(@top_primer, 8)
  outer_vbox.minimal(hspacer)
  outer_vbox.minimal(@top_strand)
  @bottom_strand = bold_label("3'-#{@reverse_sequence}-5'")
  @bottom_strand.darkgreen
  outer_vbox.minimal(@bottom_strand)
  outer_vbox.minimal(hspacer)
  outer_vbox.minimal(@bottom_primer, 8)
  hbox = create_hbox
  hbox.minimal(text('Amplified area:'), 1)
  hbox.minimal(@amplified_area, 1)
  outer_vbox.minimal(hbox, 1)
  # ======================================================================= #
  # === The reverse primer will be added here
  # ======================================================================= #
  hbox = return_widget_containing_the_reverse_primer_information
  outer_vbox.minimal(hbox, 1)
  # ======================================================================= #
  # === The forward primer will be added here
  # ======================================================================= #
  hbox = return_widget_containing_the_forward_primer_information
  outer_vbox.minimal(hbox, 1)
  dragger = add_an_up_and_down_dragger(outer_vbox, @scrolled_window)

  window = runner_widget(nil, width?, height?, title?)
  window << dragger

  ::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?)
  sync_forward_and_reverse_primer
  Thread.new {
    sleep 0.001
    do_startup_related_actions
  }
  window.top_left
  run_main
end

#create_the_bottom_primerObject

#

create_the_bottom_primer

#


402
403
404
405
406
407
408
409
410
411
412
413
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 402

def create_the_bottom_primer
  # ======================================================================= #
  # === @bottom_primer
  # ======================================================================= #
  @bottom_primer = bold_label
  @bottom_primer.make_selectable
  @bottom_primer.tomato
  @bottom_primer.hint = 'This is the forward primer. A '\
    'match will be shown in green colour, whereas a '\
    'non-match will be shown in the '+
    COLOUR_FOR_NON_MATCHES.to_s+'-colour.'
end

#create_the_entriesObject

#

create_the_entries (entries tag, entry tag)

#


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
372
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 332

def create_the_entries
  # ======================================================================= #
  # === @amplified_area
  # ======================================================================= #
  @amplified_area = create_entry
  @amplified_area.set_text('TACGTACG')
  @amplified_area.clear_background
  @amplified_area.lightblue_background
  @amplified_area.bblack1
  @amplified_area.pad5px
  # ======================================================================= #
  # === @reverse_primer
  # ======================================================================= #
  @reverse_primer = create_entry
  @reverse_primer.yellow_background
  @reverse_primer.bblack1
  @reverse_primer.width_height(250, 50)
  @reverse_primer.set_text(@reverse_sequence.reverse[0,3])
  @reverse_primer.hint = ''
  @reverse_primer.on_changed {
    @reverse_primer.set_text(@reverse_primer.text?.upcase)
    sync_the_reverse_primer
    do_calculate_GC_content_for_the_reverse_primer
  }
  # ======================================================================= #
  # === @forward_primer
  # ======================================================================= #
  @forward_primer = create_entry
  @forward_primer.yellow_background
  @forward_primer.bblack1
  @forward_primer.width_height(250, 50)
  @forward_primer.set_text('ATG')
  @forward_primer.on_changed {
    @forward_primer.set_text(@forward_primer.text?.upcase)
    sync_the_forward_primer
    do_calculate_GC_content_for_the_forward_primer
  }
  @forward_primer.hint = "The forward primer is the sequence "\
    "corresponding to the sense strand (5'→3'). It appears "\
    "on the bottom side of the above text."
end

#create_the_header_barObject

#

create_the_header_bar

#


418
419
420
421
422
423
424
425
426
427
428
429
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 418

def create_the_header_bar
  @header_bar = default_header_bar
  @header_bar.pad8px
  @header_bar.bblack1
  event_box = create_event_box(image_information)
  event_box.hint = 'Click on this image to show some information '\
                   'about <b>primer design</b> in a PCR.'
  event_box.on_clicked {
    do_pop_up_the_widget_containing_information_about_primer_design_in_a_PCR
  }
  @header_bar.add_left(event_box)
end

#create_the_scrolled_windowObject

#

create_the_scrolled_window (scrolled tag)

#


238
239
240
241
242
243
244
245
246
247
248
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 238

def create_the_scrolled_window
  @text_buffer = create_text_buffer
  @text_view = create_text_view(@text_buffer)
  # ======================================================================= #
  # === @scrolled_window
  # ======================================================================= #
  @scrolled_window = create_scrolled_window(@text_view) { :always }
  @scrolled_window.bblack1
  @scrolled_window.pad8px
  @scrolled_window.width_height(500, 400)
end

#create_the_skeletonObject

#

create_the_skeleton (create tag, skeleton tag)

#


193
194
195
196
197
198
199
200
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 193

def create_the_skeleton
  create_the_entries
  create_the_header_bar
  create_the_scrolled_window
  create_the_top_primer
  create_the_top_strand
  create_the_bottom_primer
end

#create_the_top_primerObject

#

create_the_top_primer

#


377
378
379
380
381
382
383
384
385
386
387
388
389
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 377

def create_the_top_primer
  # ======================================================================= #
  # === @top_primer
  # ======================================================================= #
  @top_primer = bold_label
  @top_primer.make_selectable
  @top_primer.tomato
  @top_primer.hint =
    'This is the reverse primer. A '\
    'match will be shown in green colour, whereas a '\
    'non-match will be shown in the '+
    COLOUR_FOR_NON_MATCHES.to_s+'-colour.'
end

#create_the_top_strandObject

#

create_the_top_strand

#


230
231
232
233
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 230

def create_the_top_strand
  @top_strand = bold_label("5'-#{@forward_sequence}-3'")
  @top_strand.darkblue
end

#do_calculate_the_GC_content_for_the_forward_primerObject Also known as: do_calculate_GC_content_for_the_forward_primer

#

do_calculate_the_GC_content_for_the_forward_primer

#


626
627
628
629
630
631
632
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 626

def do_calculate_the_GC_content_for_the_forward_primer
  _ = ::Bioroebe.gc_content_of_this_sequence(
    @forward_primer.text?.to_s, 1 # The second number is for how much to round.
  )
  _ = 0 if _ == 'NaN'
  @text_GC_content_for_the_forward_primer_as_percentage.set_text("#{_}%")
end

#do_calculate_the_GC_content_for_the_reverse_primerObject Also known as: do_calculate_GC_content_for_the_reverse_primer

#

do_calculate_the_GC_content_for_the_reverse_primer

#


615
616
617
618
619
620
621
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 615

def do_calculate_the_GC_content_for_the_reverse_primer
  _ = ::Bioroebe.gc_content_of_this_sequence(
    @reverse_primer.text?.to_s, 1 # The second number is for how much to round.
  )
  _ = 0 if _ == 'NaN'
  @text_GC_content_for_the_reverse_primer_as_percentage.set_text("#{_}%")
end

#do_pop_up_the_widget_containing_information_about_primer_design_in_a_PCRObject

#

do_pop_up_the_widget_containing_information_about_primer_design_in_a_PCR

#


434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 434

def do_pop_up_the_widget_containing_information_about_primer_design_in_a_PCR
  vbox = create_vbox
  # ======================================================================= #
  # Style this vbox a bit:
  # ======================================================================= #
  outer_vbox = create_vbox
  outer_vbox.set_border_width(8)
  outer_vbox.pad8px
  outer_vbox.bblack1
  vbox.pad5px
  vbox.use_this_font = :hack_18
  vbox.add_hspacer
  _ = left_aligned_text(
    'Some advice on primer design'
  )
  _.use_this_font = :hack_20
  vbox.minimal(_, 10)
  vbox.add_hspacer
  vbox.add(
    left_aligned_text(
      ' - use a moderate G+C content'
    )
  )
  vbox.add(
    left_aligned_text(
      ' - binding region should be 17-27 bp'
    )
  )
  vbox.add(
    left_aligned_text(
      " - binding region Tm’s in the range of 50 to 65°C"
    )
  )
  vbox.add(
    left_aligned_text(
      ' - avoid repetitive poly-N regions'
    )
  )
  vbox.add(
    left_aligned_text(
      ' - avoid secondary structure (hairpins, '\
      'self dimerization or primer dimer)'
    )
  )
  vbox.add(
    left_aligned_text(
      " - primer pairs should have similar Tm's (±4°C)"
    )
  )
  vbox.add_hspacer
  outer_vbox.maximal(vbox, 2)
  pop_up_widget(
    over_this_widget: main_label?,
    custom_widget:    outer_vbox
  ).popup
end
#
#


322
323
324
325
326
327
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 322

def do_startup_related_actions
  print ' '
  @top_primer.deselect
  do_calculate_the_GC_content_for_the_reverse_primer
  do_calculate_the_GC_content_for_the_forward_primer
end

#establish_the_forward_and_reverse_sequenceObject

#

establish_the_forward_and_reverse_sequence

#


140
141
142
143
144
145
146
147
148
149
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 140

def establish_the_forward_and_reverse_sequence
  # ======================================================================= #
  # === @forward_sequence
  # ======================================================================= #
  @forward_sequence = 'ATGAGGTTTGCAGCG'
  # ======================================================================= #
  # === @reverse_sequence
  # ======================================================================= #
  @reverse_sequence = 'TACTCCAAACGTCGC'
end

#handle_CSS_rulesObject Also known as: handle_CSS

#

handle_CSS_rules (CSS tag, css tag)

#


182
183
184
185
186
187
188
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 182

def handle_CSS_rules
  use_gtk_paradise_project_css_file
  append_project_css_file
  add_these_custom_CSS_rules '
'
  apply_the_CSS_rules
end

#main_font?Boolean

#

main_font?

#

Returns:

  • (Boolean)


168
169
170
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 168

def main_font?
  USE_THIS_FONT
end

#main_label?Boolean

#

main_label?

#

Returns:

  • (Boolean)


308
309
310
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 308

def main_label?
  @main_label
end

#padding?Boolean

#

padding?

#

Returns:

  • (Boolean)


154
155
156
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 154

def padding?
  PADDING_OF_THE_WHOLE_WIDGET
end

#remove_ends(i = "3'-TACGTACGTACGTACG-5'") ⇒ Object

#

remove_ends

#


637
638
639
640
641
642
643
644
645
646
647
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 637

def remove_ends(
    i = "3'-TACGTACGTACGTACG-5'"
  )
  i = i.dup
  i.sub!(/3'-/,'')
  i.sub!(/-5'/,'')
  i.sub!(/5'-/,'')
  i.sub!(/'3-/,'')
  i.sub!(/-'5/,'')
  return i
end

#resetObject

#

reset (reset tag)

#


120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 120

def reset
  super() if respond_to?(:super)
  reset_the_internal_variables
  reset_the_base_module # This must come after reset_the_internal_variables().
  infer_the_namespace
  # ======================================================================= #
  # === @configuration
  # ======================================================================= #
  @configuration = [true, __dir__, namespace?]
  # ======================================================================= #
  # === Set the title, width, height and the font in use.
  # ======================================================================= #
  title_width_height_font(TITLE, WIDTH, HEIGHT, USE_THIS_FONT)
  handle_CSS if use_gtk3?
  establish_the_forward_and_reverse_sequence
end

#return_the_header_barObject

#

return_the_header_bar

#


223
224
225
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 223

def return_the_header_bar
  return @header_bar
end

#return_the_main_labelObject

#

return_the_main_label

#


212
213
214
215
216
217
218
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 212

def return_the_main_label
  @main_label = left_aligned_label(TITLE)
  @main_label.make_bold
  @main_label.use_this_font = HUGE_FONT
  @main_label.make_selectable
  return @main_label
end

#return_widget_containing_the_forward_primer_informationObject

#

return_widget_containing_the_forward_primer_information

#


282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 282

def return_widget_containing_the_forward_primer_information
  hbox = create_hbox
  hbox.minimal(bold_text("Forward primer: 5'-"), 1)
  hbox.minimal(@forward_primer, 1)
  hbox.minimal(bold_text("-3'",1))
  button1 = button('')
  button1.hint = 'Remove the last nucleotide from the primer.'
  button1.bblack1
  button1.on_clicked {
    @forward_primer.try_to_remove_the_last_character
  }
  hbox.minimal(button1)
  text_showing_the_GC_content = left_aligned_text(' GC content:')
  text_showing_the_GC_content.use_this_font = smaller_font?
  text_showing_the_GC_content.make_bold
  hbox.minimal(text_showing_the_GC_content, 5)
  @text_GC_content_for_the_forward_primer_as_percentage = left_aligned_text
  @text_GC_content_for_the_forward_primer_as_percentage.use_this_font = smaller_font?
  @text_GC_content_for_the_forward_primer_as_percentage.make_bold
  hbox.minimal(@text_GC_content_for_the_forward_primer_as_percentage, 5)
  return hbox
end

#return_widget_containing_the_reverse_primer_informationObject

#

return_widget_containing_the_reverse_primer_information

This is the widget that contains the various smaller widgets necessary for the “Reverse primer:” info, close to the bottom of this widget.

#


256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 256

def return_widget_containing_the_reverse_primer_information
  hbox = create_hbox
  hbox.minimal(bold_text("Reverse primer: 5'-"),1)
  hbox.minimal(@reverse_primer,1)
  hbox.minimal(bold_text("-3'",1))
  button2 = button('')
  button2.hint = 'Remove the last nucleotide from the primer.'
  button2.bblack1
  button2.on_clicked {
    @reverse_primer.try_to_remove_the_last_character
  }
  hbox.minimal(button2)
  text_showing_the_GC_content = left_aligned_text(' GC content:')
  text_showing_the_GC_content.use_this_font = smaller_font?
  text_showing_the_GC_content.make_bold
  hbox.minimal(text_showing_the_GC_content, 5)
  @text_GC_content_for_the_reverse_primer_as_percentage = left_aligned_text
  @text_GC_content_for_the_reverse_primer_as_percentage.use_this_font = smaller_font?
  @text_GC_content_for_the_reverse_primer_as_percentage.make_bold
  hbox.minimal(@text_GC_content_for_the_reverse_primer_as_percentage, 5)
  return hbox
end

#runObject

#

run (run tag)

#


205
206
207
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 205

def run
  run_super
end

#slightly_smaller_font?Boolean

#

slightly_smaller_font?

#

Returns:

  • (Boolean)


175
176
177
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 175

def slightly_smaller_font?
  USE_THIS_SLIGHTLY_SMALLER_FONT
end

#smaller_font?Boolean

#

smaller_font?

#

Returns:

  • (Boolean)


315
316
317
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 315

def smaller_font?
  SMALLER_FONT
end

#sync_forward_and_reverse_primerObject

#

sync_forward_and_reverse_primer

#


394
395
396
397
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 394

def sync_forward_and_reverse_primer
  sync_forward_primer
  sync_reverse_primer
end

#sync_forward_primerObject Also known as: sync_the_forward_primer

#

sync_forward_primer

#


494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
# File 'lib/bioroebe/gui/universal_widgets/primer_design_widget/primer_design_widget.rb', line 494

def sync_forward_primer
  _ = @forward_primer.text?
  longer_nucleotide_sequence = remove_ends(@bottom_strand.text?)
  array = ["      5'-", :tomato]
  _.chars.each_with_index {|char, index|
    if char == Bioroebe.should_match_to?(longer_nucleotide_sequence[index])
      # This is a match.
      array << [char, :darkgreen]
    else
      # This is NOT a match.
      array << [char, COLOUR_FOR_NON_MATCHES]
    end
    array.flatten!
  }
  array << ["-3'→".ljust(@forward_sequence.size+(9-_.size)), :tomato]
  array.flatten!
  @bottom_primer.simple_markup(array)
end

#sync_reverse_primerObject Also known as: sync_the_reverse_primer

#

sync_reverse_primer

#


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/primer_design_widget/primer_design_widget.rb', line 516

def sync_reverse_primer
  _ = @reverse_primer.text?
  longer_nucleotide_sequence = remove_ends(@top_strand.text?.reverse)
  @top_primer.set_text(
    _.rjust(@forward_sequence.size+6)
  )
  array = ["←3'-".rjust(33), :tomato]
  _.chars.reverse.each_with_index {|char, index|
    if char == Bioroebe.should_match_to?(longer_nucleotide_sequence[index])
      # This is a match.
      array << [char, :darkgreen]
    else
      # This is NOT a match.
      array << [char, COLOUR_FOR_NON_MATCHES]
    end
    array.flatten!
  }
  array << ["-5'".ljust(@forward_sequence.size+6), :tomato]
  array.flatten!
  @top_primer.simple_markup(array)
end