Class: Bioroebe::PossibleCodonsForThisAminoacid
Overview
Bioroebe::PossibleCodonsForThisAminoacid
Constant Summary
collapse
- SHOW_ADDITIONAL_HINTS =
#
SHOW_ADDITIONAL_HINTS
If this constant is set to true, then we will additionally give some hints for the user about grouping purines and pyrimidines.
#
true
- CODON_TABLE =
::Bioroebe.codon_table?
- ARRAY_PURINES =
%w( A G )
- ARRAY_PYRIMIDINES =
%w( T C )
- TRY_TO_IDENTIFY_PURINES_AND_PYRIMIDINES =
#
TRY_TO_IDENTIFY_PURINES_AND_PYRIMIDINES
If this constant is set to true then we will attempt to group purines and pyrimidines.
#
true
CommandlineApplication::OLD_VERBOSE_VALUE
ColoursForBase::ARRAY_HTML_COLOURS_IN_USE
Constants inherited
from Base
Base::NAMESPACE
Class Method Summary
collapse
Instance Method Summary
collapse
#all_aminoacids?, #append_what_into, #at_home?, #be_silent, #be_verbose?, #cat, #ccliner, #change_directory, #cliner, #codon_table_dataset?, #codon_to_aminoacid, #codons_for?, #colourize_this_dna_sequence, #complement, #cp, #disable_warnings, #download_dir?, #editor?, #enable_warnings, #ensure_that_the_base_directories_exist, #esystem, #extract, #is_this_a_start_codon?, #is_this_a_stop_codon?, #leading_five_prime, #load_bioroebe_yaml_file, #log_directory?, #one_letter_to_long_name, #one_to_three, #only_numbers?, #open_in_browser, #opnerev, #opnn, #pad_with_double_quotes, #pad_with_single_quotes, #partner_nucleotide, #remove_numbers, #remove_trailing_ansii_escape_code, #return_all_possible_start_codons, #return_array_of_one_letter_aminoacids, #return_cheerful_person, #return_chunked_display, #return_ubiquitin_sequence, #runmode?, #set_be_verbose, #set_runmode, #start_codon?, #stop_codons?, #strict_filter_away_invalid_aminoacids, #taxonomy_download_directory?, #three_to_one, #to_rna, #trailing_three_prime, #use_opn?, #verbose_truth, #was_or_were, #without_extname, #write_what_into
Methods included from BaseModule
#absolute_path, #default_file_read, #file_readlines
#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?
Methods inherited from Base
#append_what_into, #can_base_pair?, #convert_global_env, #delete_file, #directory_to_the_codon_tables?, #is_on_roebe?, #is_palindrome?, #main_encoding?, #mkdir, #move_file, #mv, #no_file_exists_at, #no_newlines, #project_yaml_directory?, #rds, #register_sigint, #return_pwd, #return_the_first_line_of_this_file, #word_wrap, #write_what_into
#internal_hash?, #reset_the_internal_hash
#infer_the_namespace, #namespace?
Constructor Details
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/bioroebe/codons/possible_codons_for_this_aminoacid.rb', line 64
def initialize(
i = nil,
run_already = true
)
reset
set_input(i)
if block_given?
yielded = yield
case yielded
when :do_not_simplify_purines_and_pyrimidines
do_not_simplify_purines_and_pyrimidines
end
end
run if run_already
end
|
Class Method Details
.[](i = '', replace_purines_and_pyrimidines = true) ⇒ Object
#
Bioroebe::PossibleCodonsForThisAminoacid[]
#
306
307
308
309
310
311
312
313
314
315
316
317
|
# File 'lib/bioroebe/codons/possible_codons_for_this_aminoacid.rb', line 306
def self.[](i = '', replace_purines_and_pyrimidines = true)
_ = new(i, :do_not_run_yet)
case replace_purines_and_pyrimidines
when :use_only_the_four_standard_nucleotide_letters
replace_purines_and_pyrimidine = false
end
unless replace_purines_and_pyrimidine
_.set_try_to_identify_purines_and_pyrimidines false
end
_.run
return _.keys
end
|
.translate(i) ⇒ Object
#
Bioroebe::PossibleCodonsForThisAminoacid.translate
This method will conveniently return the Array that has the corresponding codons.
#
299
300
301
|
# File 'lib/bioroebe/codons/possible_codons_for_this_aminoacid.rb', line 299
def self.translate(i)
new(i).possible_codons?
end
|
Instance Method Details
#array_like_result? ⇒ Boolean
Also known as:
pretty_result
#
array_like_result?
This method will report in an array-like manner.
#
241
242
243
|
# File 'lib/bioroebe/codons/possible_codons_for_this_aminoacid.rb', line 241
def array_like_result?
"[#{result?}]"
end
|
#do_not_simplify_purines_and_pyrimidines ⇒ Object
#
do_not_simplify_purines_and_pyrimidines
#
166
167
168
|
# File 'lib/bioroebe/codons/possible_codons_for_this_aminoacid.rb', line 166
def do_not_simplify_purines_and_pyrimidines
set_try_to_identify_purines_and_pyrimidines(false)
end
|
138
139
140
|
# File 'lib/bioroebe/codons/possible_codons_for_this_aminoacid.rb', line 138
def input?
@input
end
|
#is_purin?(i) ⇒ Boolean
Also known as:
is_purine?
152
153
154
|
# File 'lib/bioroebe/codons/possible_codons_for_this_aminoacid.rb', line 152
def is_purin?(i)
ARRAY_PURINES.include? i
end
|
#is_pyrimidin?(i) ⇒ Boolean
Also known as:
is_pyrimidine?
145
146
147
|
# File 'lib/bioroebe/codons/possible_codons_for_this_aminoacid.rb', line 145
def is_pyrimidin?(i)
ARRAY_PYRIMIDINES.include? i
end
|
#one_letter_to_full_name(i) ⇒ Object
#
one_letter_to_full_name
#
102
103
104
|
# File 'lib/bioroebe/codons/possible_codons_for_this_aminoacid.rb', line 102
def original_input?
@original_input
end
|
#possible_codons? ⇒ Boolean
Also known as:
keys?, keys, results?, array_as_result
229
230
231
|
# File 'lib/bioroebe/codons/possible_codons_for_this_aminoacid.rb', line 229
def possible_codons?
@possible_codons
end
|
#report_result ⇒ Object
Also known as:
report
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
# File 'lib/bioroebe/codons/possible_codons_for_this_aminoacid.rb', line 173
def report_result
codon_singular_or_plural = 'codon'.dup
codon_singular_or_plural << 's' if keys?.size > 1
one_letter_to_full_name = steelblue("#{one_letter_to_full_name(original_input?).capitalize}")+
rev
result = "#{rev}The aminoacid #{simp(original_input?)}#{rev} "\
"(#{one_letter_to_full_name}) "\
"may be encoded by ".dup
if keys?.size > 1
result << 'these'
else
result << 'this'
end
result << rev+
' '+
royalblue(keys?.size.to_s)+
rev+
' nucleotide '+codon_singular_or_plural+
":\n\n"
result << " #{sfancy(array_like_result?)}#{rev}\n\n"
e result
if SHOW_ADDITIONAL_HINTS
if result?.include? 'Y'
e '(Note that pyrimidines are denoted by the letter "Y").'
elsif result?.include? 'R'
e '(Note that purines are denoted by the letter "R").'
end
end
end
|
#reset ⇒ Object
89
90
91
92
93
94
95
96
97
|
# File 'lib/bioroebe/codons/possible_codons_for_this_aminoacid.rb', line 89
def reset
super()
infer_the_namespace
@try_to_identify_purines_and_pyrimidines =
TRY_TO_IDENTIFY_PURINES_AND_PYRIMIDINES
end
|
#result? ⇒ Boolean
220
221
222
223
224
|
# File 'lib/bioroebe/codons/possible_codons_for_this_aminoacid.rb', line 220
def result?
_ = keys?.join(',')
_.chop! if _.end_with? ','
_
end
|
#run ⇒ Object
283
284
285
286
287
288
289
290
291
|
# File 'lib/bioroebe/codons/possible_codons_for_this_aminoacid.rb', line 283
def run
possible_codons = Bioroebe.codon_table_dataset?.select {|key, value|
key if value == input?
}
set_possible_codons(possible_codons.keys)
end
|
#set_possible_codons(i = nil) ⇒ Object
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
|
# File 'lib/bioroebe/codons/possible_codons_for_this_aminoacid.rb', line 248
def set_possible_codons(i = nil)
if @try_to_identify_purines_and_pyrimidines
i.map! {|entry| entry.to_s.dup }
last_characters = i.map {|entry| entry.chars.last }
if last_characters.all? {|entry| is_purin?(entry) }
i.map! {|entry|
entry[-1,1] = 'R' entry
}
elsif last_characters.all? {|entry| is_pyrimidin?(entry) }
i.map! {|entry|
entry[-1,1] = 'Y' entry
}
end
end
i.uniq!
@possible_codons = i
end
|
#set_try_to_identify_purines_and_pyrimidines(i) ⇒ Object
#
set_try_to_identify_purines_and_pyrimidines
#
159
160
161
|
# File 'lib/bioroebe/codons/possible_codons_for_this_aminoacid.rb', line 159
def set_try_to_identify_purines_and_pyrimidines(i)
@try_to_identify_purines_and_pyrimidines = i
end
|