Module: Bioroebe::GUI::ProteinToDNAModule

Includes:
Bioroebe::GUI
Included in:
Gtk::ProteinToDNA, LibUI::ProteinToDNA
Defined in:
lib/bioroebe/gui/shared_code/protein_to_DNA/protein_to_DNA_module.rb

Overview

Bioroebe::GUI::ProteinToDNAModule

Constant Summary collapse

WIDTH =
#

WIDTH

#
'70% or minimum 1020px'
HEIGHT =
#

HEIGHT

#
600
TITLE =
#

USE_THIS_TITLE

#
' Protein-to-DNA conversion '
USE_THIS_TITLE_FOR_THE_MAIN_BUTTON =
#

USE_THIS_TITLE_FOR_THE_MAIN_BUTTON

#
'_Determine the DNA sequence'
USE_THIS_FONT =
#

USE_THIS_FONT

#
:dejavu_condensed_20

Constants included from Bioroebe::GUI

ARRAY_ALL_GTK_WIDGETS, FONT_SIZE, OLD_VERBOSE_VALUE, USE_THIS_FONT_FAMILY_FOR_GUI_APPLICATIONS

Instance Method Summary collapse

Methods included from Bioroebe::GUI

#disable_warnings, #enable_warnings, #log_dir?

Instance Method Details

#aminoacid_sequence?Boolean

#

aminoacid_sequence?

#

Returns:

  • (Boolean)

163
164
165
# File 'lib/bioroebe/gui/shared_code/protein_to_DNA/protein_to_DNA_module.rb', line 163

def aminoacid_sequence?
  left_buffer?.to_s
end

#border_size?Boolean

#

border_size?

#

Returns:

  • (Boolean)

70
71
72
# File 'lib/bioroebe/gui/shared_code/protein_to_DNA/protein_to_DNA_module.rb', line 70

def border_size?
  0
end

#create_buttonsObject

#

create_buttons (buttons tag)

#

104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/bioroebe/gui/shared_code/protein_to_DNA/protein_to_DNA_module.rb', line 104

def create_buttons
  backtrack_button = bold_button(
    USE_THIS_TITLE_FOR_THE_MAIN_BUTTON
  )
  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_clicked {
    do_determine_the_backtrack_sequence
  }
  backtrack_button.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_skeletonObject

#

create_skeleton (skeleton tag)

#

92
93
94
95
96
97
98
99
# File 'lib/bioroebe/gui/shared_code/protein_to_DNA/protein_to_DNA_module.rb', line 92

def create_skeleton
  @main_vbox = vbox
  create_buttons
  create_left_buffer  # Our left buffer.
  create_right_buffer # Our right buffer.
  create_top_hbox
  create_middle_bar_containing_the_arrow_pointing_to_the_right_side
end

#do_determine_the_backtrack_sequenceObject 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.

#

179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/bioroebe/gui/shared_code/protein_to_DNA/protein_to_DNA_module.rb', line 179

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(_)
  # ======================================================================= #
  # Ok, now we can determine the right hand side:
  # ======================================================================= #
  text_for_right_hand_side = ::Bioroebe::ProteinToDNA.new(_, :be_quiet).dna_sequence?
  right_buffer?.set_text(text_for_right_hand_side)
end

#filter_away_invalid_aminoacids_from_the_left_bufferObject

#

filter_away_invalid_aminoacids_from_the_left_buffer

This method is used to “sanitize” the input - invalid aminoacids are flat out removed.

#

138
139
140
141
142
143
144
# File 'lib/bioroebe/gui/shared_code/protein_to_DNA/protein_to_DNA_module.rb', line 138

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

#left_buffer?Boolean Also known as: left?

#

left_buffer?

#

Returns:

  • (Boolean)

170
171
172
# File 'lib/bioroebe/gui/shared_code/protein_to_DNA/protein_to_DNA_module.rb', line 170

def left_buffer?
  @dataset[:left_buffer]
end
#

menu (menu tag)

#

77
78
79
80
81
82
83
84
85
86
87
# File 'lib/bioroebe/gui/shared_code/protein_to_DNA/protein_to_DNA_module.rb', line 77

def menu(i = nil)
  if i
    if i.is_a? Array
      i.each {|entry| menu(entry) }
    else
      case i # case tag
      when ''
      end
    end
  end
end

#padding?Boolean

#

padding?

#

Returns:

  • (Boolean)

63
64
65
# File 'lib/bioroebe/gui/shared_code/protein_to_DNA/protein_to_DNA_module.rb', line 63

def padding?
  2
end

#right_buffer?Boolean Also known as: right?

#

right_buffer?

#

Returns:

  • (Boolean)

149
150
151
# File 'lib/bioroebe/gui/shared_code/protein_to_DNA/protein_to_DNA_module.rb', line 149

def right_buffer?
  @dataset[:right_buffer]
end

#set_aminoacid_sequence(i) ⇒ Object

#

set_aminoacid_sequence

#

156
157
158
# File 'lib/bioroebe/gui/shared_code/protein_to_DNA/protein_to_DNA_module.rb', line 156

def set_aminoacid_sequence(i)
  @dataset[:left_buffer].set_text(i.to_s)
end

#shared_resetObject

#

shared_reset

#

52
53
54
55
56
57
58
# File 'lib/bioroebe/gui/shared_code/protein_to_DNA/protein_to_DNA_module.rb', line 52

def shared_reset
  title_width_height(TITLE, WIDTH, HEIGHT)
  # ======================================================================= #
  # === @dataset
  # ======================================================================= #
  @dataset = {}
end