Class: Bioroebe::DisplayOpenReadingFrames
- Inherits:
-
CommandlineApplication
show all
- Defined in:
- lib/bioroebe/utility_scripts/display_open_reading_frames/menu.rb,
lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb,
lib/bioroebe/utility_scripts/display_open_reading_frames/reset.rb,
lib/bioroebe/utility_scripts/display_open_reading_frames/report.rb,
lib/bioroebe/utility_scripts/display_open_reading_frames/determine.rb,
lib/bioroebe/utility_scripts/display_open_reading_frames/initialize.rb,
lib/bioroebe/utility_scripts/display_open_reading_frames/display_open_reading_frames.rb
Overview
Bioroebe::DisplayOpenReadingFrames
Constant Summary
CommandlineApplication::OLD_VERBOSE_VALUE
ColoursForBase::ARRAY_HTML_COLOURS_IN_USE
Constants inherited
from Base
Base::NAMESPACE
Instance Method Summary
collapse
-
#colourize_dna(i) ⇒ Object
# === colourize_dna ========================================================================= #.
-
#colourize_this_aminoacid_sequence(i) ⇒ Object
# === colourize_this_aminoacid_sequence ========================================================================= #.
-
#colourized_frame1 ⇒ Object
# === colourized_frame1 ========================================================================= #.
-
#colourized_frame2 ⇒ Object
# === colourized_frame2 ========================================================================= #.
-
#colourized_frame3 ⇒ Object
# === colourized_frame3 ========================================================================= #.
-
#colourized_reverse_frame1 ⇒ Object
# === colourized_reverse_frame1 ========================================================================= #.
-
#colourized_reverse_frame2 ⇒ Object
# === colourized_reverse_frame2 ========================================================================= #.
-
#colourized_reverse_frame3 ⇒ Object
# === colourized_reverse_frame3 ========================================================================= #.
-
#determine_all_six_reading_frames(forward_sequence, reverse_dna_strand) ⇒ Object
# === determine_all_six_reading_frames ========================================================================= #.
-
#determine_frame1(i = dna_sequence?) ) ⇒ Object
# === determine_frame1 ========================================================================= #.
-
#determine_frame2(i = dna_sequence?) ) ⇒ Object
# === determine_frame2 ========================================================================= #.
-
#determine_frame3(i = dna_sequence?) ) ⇒ Object
# === determine_frame3 ========================================================================= #.
-
#determine_reverse_frame1(i) ⇒ Object
(also: #determine_frame4)
# === determine_reverse_frame1 ========================================================================= #.
-
#determine_reverse_frame2(i) ⇒ Object
(also: #determine_frame5)
# === determine_reverse_frame2 ========================================================================= #.
-
#determine_reverse_frame3(i) ⇒ Object
(also: #determine_frame6)
# === determine_reverse_frame3 ========================================================================= #.
-
#display_modulo_ten_spacer(sequence_to_use = dna_sequence?, , optional_mode = :normal, use_this_padding = @left_padding) ⇒ Object
# === display_modulo_ten_spacer.
-
#display_reverse_frame1(i = @hash[:reverse_frame1].reverse) ⇒ Object
# === display_reverse_frame1 ========================================================================= #.
-
#display_reverse_frame2(i = @hash[:reverse_frame2].reverse) ⇒ Object
# === display_reverse_frame2 ========================================================================= #.
-
#display_reverse_frame3(i = @hash[:reverse_frame3].reverse) ⇒ Object
# === display_reverse_frame3 ========================================================================= #.
-
#display_separator_in_the_middle(display_n_nucleotides = display_n_nucleotides? ) ⇒ Object
(also: #central_part)
# === display_separator_in_the_middle (middle tag).
-
#display_the_nucleotide_sequence_on_bottom(i = complementary_dna_strand(dna_sequence?)) ⇒ Object
# === display_the_nucleotide_sequence_on_bottom ========================================================================= #.
-
#display_the_nucleotide_sequence_on_top(i = dna_sequence?, , upper_range = display_n_nucleotides_per_line? ) ⇒ Object
(also: #show_top_sequence)
# === display_the_nucleotide_sequence_on_top (top tag).
-
#display_the_three_regular_frames ⇒ Object
# === display_the_three_regular_frames ========================================================================= #.
-
#dna_sequence? ⇒ Boolean
# === dna_sequence? ========================================================================= #.
-
#frame1? ⇒ Boolean
# === frame1? ========================================================================= #.
-
#frame2? ⇒ Boolean
# === frame2? ========================================================================= #.
-
#frame3? ⇒ Boolean
# === frame3? ========================================================================= #.
-
#frame4? ⇒ Boolean
# === frame4? ========================================================================= #.
-
#frame5? ⇒ Boolean
# === frame5? ========================================================================= #.
-
#frame6? ⇒ Boolean
# === frame6? ========================================================================= #.
-
#initialize(i = ARGV, run_already = true) ⇒ DisplayOpenReadingFrames
constructor
# === initialize ========================================================================= #.
-
#left_padding? ⇒ Boolean
(also: #padding_to_use?)
# === left_padding? ========================================================================= #.
-
#menu(i = commandline_arguments_with_two_leading_hyphens) ⇒ Object
-
#replace_this_input_with_modulo_ten(sequence_to_use = dna_sequence?, , i = '-' * n_nucleotides?, , optional_mode = :default) ⇒ Object
-
#report_how_many_ORFs_are_found ⇒ Object
# === report_how_many_ORFs_are_found ========================================================================= #.
-
#report_the_start_codons_and_the_stop_codons_in_use ⇒ Object
# === report_the_start_codons_and_the_stop_codons_in_use ========================================================================= #.
-
#reset ⇒ Object
# === reset ========================================================================= #.
-
#return_n_ORFs_in_this_sequence(i) ⇒ Object
# === return_n_ORFs_in_this_sequence ========================================================================= #.
-
#run ⇒ Object
# === run ========================================================================= #.
-
#set_dna_sequence(i = @commandline_arguments.first) ⇒ Object
# === set_dna_sequence ========================================================================= #.
-
#set_split_at_n_characters(i) ⇒ Object
(also: #set_threshold)
# === set_split_at_n_characters ========================================================================= #.
-
#show_frame1(i = frame1? ) ⇒ Object
# === show_frame1 ========================================================================= #.
-
#show_frame2(i = frame2? ) ⇒ Object
# === show_frame2 ========================================================================= #.
-
#show_frame3(i = frame3? ) ⇒ Object
# === show_frame3 ========================================================================= #.
-
#show_the_intro_for_this_class ⇒ Object
# === show_the_intro_for_this_class ========================================================================= #.
-
#split_at_n_characters? ⇒ Boolean
(also: #display_n_nucleotides_per_line?, #display_n_nucleotides?, #n_nucleotides_per_line?, #n_nucleotides?, #n_nucleotides, #threshold_value?)
# === split_at_n_characters? ========================================================================= #.
-
#two_spaces_padding(i, modify_the_padding_by_this = 0) ⇒ Object
# === two_spaces_padding ========================================================================= #.
-
#two_spaces_padding_last(i, modify_the_padding_by_this = 0) ⇒ Object
# === two_spaces_padding_last ========================================================================= #.
#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, #opne, #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, #set_be_verbose, #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
#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_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?, #file_readlines, #infer_the_namespace, #is_on_roebe?, #is_palindrome?, #main_encoding?, #mkdir, #move_file, #mv, #namespace?, #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
Constructor Details
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/initialize.rb', line 14
def initialize(
i = ARGV,
run_already = true
)
reset
set_commandline_arguments(i)
set_dna_sequence if block_given?
yielded = yield
case yielded
when :show_three_frames
@display_reverse_frames = false
end
end
run if run_already
end
|
Instance Method Details
#colourize_dna(i) ⇒ Object
378
379
380
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 378
def colourize_dna(i)
paleturquoise(i)
end
|
#colourize_this_aminoacid_sequence(i) ⇒ Object
#
colourize_this_aminoacid_sequence
#
175
176
177
178
179
180
181
182
183
184
185
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 175
def colourize_this_aminoacid_sequence(i)
result = olivedrab(i).dup
if @colourize_the_stop_codons
result.gsub!(/\*/, orangered('*')+
::Colours.remove_trailing_ansii_escape_code(
olivedrab('')
)
)
end
result
end
|
#colourized_frame1 ⇒ Object
122
123
124
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 122
def colourized_frame1
orange(' F1 ')
end
|
#colourized_frame2 ⇒ Object
129
130
131
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 129
def colourized_frame2
orange(' F2 ')
end
|
#colourized_frame3 ⇒ Object
136
137
138
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 136
def colourized_frame3
orange(' F3 ')
end
|
#colourized_reverse_frame1 ⇒ Object
#
colourized_reverse_frame1
#
143
144
145
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 143
def colourized_reverse_frame1
orangered(' R1 ')
end
|
#colourized_reverse_frame2 ⇒ Object
#
colourized_reverse_frame2
#
150
151
152
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 150
def colourized_reverse_frame2
orangered(' R2 ')
end
|
#colourized_reverse_frame3 ⇒ Object
#
colourized_reverse_frame3
#
157
158
159
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 157
def colourized_reverse_frame3
orangered(' R3 ')
end
|
#determine_all_six_reading_frames(forward_sequence, reverse_dna_strand) ⇒ Object
#
determine_all_six_reading_frames
#
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/determine.rb', line 62
def determine_all_six_reading_frames(
forward_sequence, reverse_dna_strand
)
determine_frame1(forward_sequence)
determine_frame2(forward_sequence)
determine_frame3(forward_sequence)
determine_reverse_frame1(reverse_dna_strand)
determine_reverse_frame2(reverse_dna_strand)
determine_reverse_frame3(reverse_dna_strand)
end
|
#determine_frame1(i = dna_sequence?)
) ⇒ Object
41
42
43
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/determine.rb', line 41
def determine_frame1(i = dna_sequence?)
@hash[:frame1] = Bioroebe.to_aa(i)
end
|
#determine_frame2(i = dna_sequence?)
) ⇒ Object
48
49
50
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/determine.rb', line 48
def determine_frame2(i = dna_sequence?)
@hash[:frame2] = Bioroebe.to_aa(i) { :frame2 }
end
|
#determine_frame3(i = dna_sequence?)
) ⇒ Object
55
56
57
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/determine.rb', line 55
def determine_frame3(i = dna_sequence?)
@hash[:frame3] = Bioroebe.to_aa(i) { :frame3 }
end
|
#determine_reverse_frame1(i) ⇒ Object
Also known as:
determine_frame4
#
determine_reverse_frame1
#
14
15
16
17
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/determine.rb', line 14
def determine_reverse_frame1(i)
i = i.reverse.dup
@hash[:reverse_frame1] = Bioroebe.to_aa(i)
end
|
#determine_reverse_frame2(i) ⇒ Object
Also known as:
determine_frame5
#
determine_reverse_frame2
#
22
23
24
25
26
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/determine.rb', line 22
def determine_reverse_frame2(i)
i = i.reverse.dup
i[0,1] = ''
@hash[:reverse_frame2] = Bioroebe.to_aa(i)
end
|
#determine_reverse_frame3(i) ⇒ Object
Also known as:
determine_frame6
#
determine_reverse_frame3
#
31
32
33
34
35
36
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/determine.rb', line 31
def determine_reverse_frame3(i)
i = i.reverse.dup
i[0,1] = ''
i[0,1] = ''
@hash[:reverse_frame3] = Bioroebe.to_aa(i)
end
|
#display_modulo_ten_spacer(sequence_to_use = dna_sequence?,
, optional_mode = :normal, use_this_padding = @left_padding) ⇒ Object
#
display_modulo_ten_spacer
This method will display the “ 10 20” spacer. We have to make sure that there are not more of these rulers shown than there are n characters in the sequence that is to be displayed, in order to avoid an overflow.
If the argument is :reverse then this method will count downwards rather than upwards.
#
393
394
395
396
397
398
399
400
401
402
403
404
405
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 393
def display_modulo_ten_spacer(
sequence_to_use = dna_sequence?,
optional_mode = :normal,
use_this_padding = @left_padding
)
spacer = replace_this_input_with_modulo_ten(
sequence_to_use,
'-' * n_nucleotides,
optional_mode
)
result = use_this_padding+spacer
e result
end
|
#display_reverse_frame1(i = @hash[:reverse_frame1].reverse) ⇒ Object
#
display_reverse_frame1
#
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 276
def display_reverse_frame1(i = @hash[:reverse_frame1].reverse)
modify_the_padding = 0
n_characters = i.size * 3
if n_characters < threshold_value?
modify_the_padding = -(threshold_value? - n_characters)
end
result = @left_padding+
colourize_this_aminoacid_sequence(
two_spaces_padding_last(
i.reverse, modify_the_padding
)
).dup
if modify_the_padding < 0
result << ' ' * modify_the_padding.abs
end
e result+
colourized_reverse_frame1
end
|
#display_reverse_frame2(i = @hash[:reverse_frame2].reverse) ⇒ Object
#
display_reverse_frame2
#
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 301
def display_reverse_frame2(i = @hash[:reverse_frame2].reverse)
modify_the_padding = 0
n_characters = i.size * 3
if n_characters < threshold_value?
modify_the_padding = -(threshold_value? - n_characters)
end
_ = two_spaces_padding_last(i, modify_the_padding)
result = @left_padding+
colourize_this_aminoacid_sequence(
_.reverse
).dup
if modify_the_padding < 0
result << ' ' * modify_the_padding.abs
end
e result+
colourized_reverse_frame2
end
|
#display_reverse_frame3(i = @hash[:reverse_frame3].reverse) ⇒ Object
#
display_reverse_frame3
#
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 325
def display_reverse_frame3(i = @hash[:reverse_frame3].reverse)
modify_the_padding = 0
n_characters = (i.size * 3) - 2
if n_characters < threshold_value?
modify_the_padding = -(threshold_value? - n_characters)
end
_ = two_spaces_padding_last(i, modify_the_padding)
result = @left_padding+
colourize_this_aminoacid_sequence(
_.reverse
).dup
if modify_the_padding < 0
result << ' ' * modify_the_padding.abs
end
e result+
colourized_reverse_frame3
end
|
#display_separator_in_the_middle(display_n_nucleotides = display_n_nucleotides?
) ⇒ Object
Also known as:
central_part
#
display_separator_in_the_middle (middle tag)
This method will display the separator in the middle.
#
201
202
203
204
205
206
207
208
209
210
211
212
213
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 201
def display_separator_in_the_middle(
display_n_nucleotides = display_n_nucleotides?
)
_ = ('-' * display_n_nucleotides).dup
_.gsub!(/----------/, '---------|')
_.gsub!(/---------/, seagreen('---------'))
_.gsub!(/\|/, palegreen('|')+
::Colours.remove_trailing_ansii_escape_code(
seagreen('')
)
)
e "#{@left_padding}#{_}"
end
|
#display_the_nucleotide_sequence_on_bottom(i = complementary_dna_strand(dna_sequence?)) ⇒ Object
#
display_the_nucleotide_sequence_on_bottom
#
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/report.rb', line 43
def display_the_nucleotide_sequence_on_bottom(
i = complementary_dna_strand(dna_sequence?)
)
e (@left_padding.chop.chop.chop.chop.chop)+
steelblue('← ')+
paleturquoise(
(display_n_nucleotides_per_line? + 1).to_s
)+
' '+
steelblue(i)+
paleturquoise(' 1')
end
|
#display_the_nucleotide_sequence_on_top(i = dna_sequence?,
, upper_range = display_n_nucleotides_per_line?
) ⇒ Object
Also known as:
show_top_sequence
#
display_the_nucleotide_sequence_on_top (top tag)
The second argument shows at which number this method will stop.
#
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 253
def display_the_nucleotide_sequence_on_top(
i = dna_sequence?,
upper_range = display_n_nucleotides_per_line?
)
min_number = (upper_range - @split_at_n_characters)+1
padding_to_use = @left_padding.dup
(min_number.to_s.size + 1).times { padding_to_use.chop! }
if upper_range > i.size
upper_range = i.size+(min_number-1)
end
e padding_to_use+
paleturquoise(
min_number.to_s+' '
)+
steelblue(i)+ ' '+
paleturquoise(upper_range.to_s)+ steelblue(' →')
end
|
#display_the_three_regular_frames ⇒ Object
#
display_the_three_regular_frames
#
190
191
192
193
194
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 190
def display_the_three_regular_frames
show_frame3
show_frame2
show_frame1
end
|
#dna_sequence? ⇒ Boolean
31
32
33
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 31
def dna_sequence?
@dna_sequence
end
|
#frame1? ⇒ Boolean
80
81
82
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 80
def frame1?
@hash[:frame1]
end
|
#frame2? ⇒ Boolean
87
88
89
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 87
def frame2?
@hash[:frame2]
end
|
#frame3? ⇒ Boolean
115
116
117
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 115
def frame3?
@hash[:frame3]
end
|
#frame4? ⇒ Boolean
94
95
96
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 94
def frame4?
@hash[:reverse_frame1]
end
|
#frame5? ⇒ Boolean
101
102
103
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 101
def frame5?
@hash[:reverse_frame2]
end
|
#frame6? ⇒ Boolean
108
109
110
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 108
def frame6?
@hash[:reverse_frame3]
end
|
#left_padding? ⇒ Boolean
Also known as:
padding_to_use?
371
372
373
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 371
def left_padding?
@left_padding
end
|
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/menu.rb', line 14
def (
i = commandline_arguments_with_two_leading_hyphens
)
if i.is_a? Array
i.each {|entry| (entry) }
else
case i
when /^-?-?codon(-|_)?table=(.+)$/i
_ = $2.to_s.dup.to_sym
Bioroebe.set_use_this_codon_table(_)
when /^-?-?threshold=(.+)$/i
set_threshold($1.to_s.dup)
when /^-?-?no(-|_)?reverse(-|_)?frames$/i
@display_reverse_frames = false
end
end
end
|
422
423
424
425
426
427
428
429
430
431
432
433
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
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 422
def replace_this_input_with_modulo_ten(
sequence_to_use = dna_sequence?,
i = '-' * n_nucleotides?,
optional_mode = :default
)
result = ''.dup
index = 0
max_number = split_at_n_characters?
if max_number > (dna_sequence?.size + 5) max_number = dna_sequence?.size + 5
end
i.chars.each {|this_char| index += 1
unless index > max_number
if (index % 10 == 0)
_ = index
if optional_mode == :reverse
_ = (( max_number + 10 ) - index).to_s
end
result << _.to_s
else
if (index > 10) and (index % 10 == 1)
else
result << ' '
end
end
end
}
case optional_mode
when :reverse
result << (' ' * 10)
end
result = mediumseagreen(result)
return result
end
|
#report_how_many_ORFs_are_found ⇒ Object
#
report_how_many_ORFs_are_found
#
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/report.rb', line 59
def report_how_many_ORFs_are_found
n_ORFs_in_total = 0
n_ORFs_in_total += (n_ORFs_in_frame1 = return_n_ORFs_in_this_sequence(frame1?))
n_ORFs_in_total += (n_ORFs_in_frame2 = return_n_ORFs_in_this_sequence(frame2?))
n_ORFs_in_total += (n_ORFs_in_frame3 = return_n_ORFs_in_this_sequence(frame3?))
n_ORFs_in_total += (n_ORFs_in_frame4 = return_n_ORFs_in_this_sequence(frame4?))
n_ORFs_in_total += (n_ORFs_in_frame5 = return_n_ORFs_in_this_sequence(frame5?))
n_ORFs_in_total += (n_ORFs_in_frame6 = return_n_ORFs_in_this_sequence(frame6?))
e
erev 'Total ORFs in frame 1, frame 2, frame 3: '+
steelblue(
n_ORFs_in_frame1.to_s+', '+
n_ORFs_in_frame2.to_s+', '+
n_ORFs_in_frame3.to_s
)
erev 'Total ORFs in frame 4, frame 5, frame 6: '+
steelblue(
n_ORFs_in_frame4.to_s+', '+
n_ORFs_in_frame5.to_s+', '+
n_ORFs_in_frame6.to_s
)
e
erev 'Total ORFs in that sequence: '+
steelblue(n_ORFs_in_total.to_s)
e
end
|
#report_the_start_codons_and_the_stop_codons_in_use ⇒ Object
#
report_the_start_codons_and_the_stop_codons_in_use
#
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/report.rb', line 89
def report_the_start_codons_and_the_stop_codons_in_use
start_codons_in_use = Bioroebe.start_codons?
if start_codons_in_use.size > 1
_ = 'The start codons in use were: '.ljust(30)
else
_ = 'The start codons in use was: '.ljust(30)
end
erev _+
royalblue(
start_codons_in_use.join(' ')
)
erev 'The stop codons were: '.ljust(30)+
royalblue(
Bioroebe.stop_codons?.join(' ')
)
end
|
#reset ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/reset.rb', line 14
def reset
super()
if ::Bioroebe.stop_codons?.empty?
Bioroebe.initialize_stop_codons
end
@split_at_n_characters = 60
@left_padding = (' ' * 12)
@colourize_the_stop_codons = true
@display_reverse_frames = true
@hash = {}
@hash[:frame1] = nil
@hash[:frame2] = nil
@hash[:frame3] = nil
@hash[:reverse_frame1] = nil
@hash[:reverse_frame2] = nil
@hash[:reverse_frame3] = nil
end
|
#return_n_ORFs_in_this_sequence(i) ⇒ Object
#
return_n_ORFs_in_this_sequence
#
#run ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 38
def run
_ = dna_sequence?
reverse_dna_strand = complementary_dna_strand(_)
determine_all_six_reading_frames(_, reverse_dna_strand)
show_the_intro_for_this_class
e
chunks = dna_sequence?.scan(/.{1,#{n_nucleotides_per_line?}}/)
chunks.each_with_index {|this_sequence, index| index += 1
this_sequence = this_sequence.dup
if this_sequence.size > 2
show_frame3( Bioroebe.to_aa(this_sequence[2 .. -1]) )
show_frame2( Bioroebe.to_aa(this_sequence[1 .. -1]) )
show_frame1( Bioroebe.to_aa(this_sequence) )
end
show_top_sequence(this_sequence, index * @split_at_n_characters)
if this_sequence.size > 2
display_modulo_ten_spacer
central_part(this_sequence.size)
if @display_reverse_frames
display_modulo_ten_spacer(
this_sequence, :reverse, padding_to_use?[0, (padding_to_use?.size - 10)]
)
display_the_nucleotide_sequence_on_bottom(
complementary_dna_strand(this_sequence)
)
display_reverse_frame1(Bioroebe.to_aa(complement(this_sequence).reverse))
display_reverse_frame2(Bioroebe.to_aa(complement(this_sequence).reverse[1..-1]))
display_reverse_frame3(Bioroebe.to_aa(complement(this_sequence).reverse[2..-1]))
end
end
e }
e
report_the_start_codons_and_the_stop_codons_in_use
e
report_how_many_ORFs_are_found
end
|
#set_dna_sequence(i = @commandline_arguments.first) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 14
def set_dna_sequence(
i = @commandline_arguments.first
)
i = i.to_s.dup if i and i.include?('.') and File.file?(i)
i = File.read(i).strip
end
@dna_sequence = i
end
|
#set_split_at_n_characters(i) ⇒ Object
Also known as:
set_threshold
#
set_split_at_n_characters
#
364
365
366
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 364
def set_split_at_n_characters(i)
@split_at_n_characters = i.to_i
end
|
#show_frame1(i = frame1?
) ⇒ Object
240
241
242
243
244
245
246
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 240
def show_frame1(
i = frame1?
)
e @left_padding+
colourize_this_aminoacid_sequence(two_spaces_padding(i))+
colourized_frame1
end
|
#show_frame2(i = frame2?
) ⇒ Object
229
230
231
232
233
234
235
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 229
def show_frame2(
i = frame2?
)
e @left_padding+' '+
colourize_this_aminoacid_sequence(two_spaces_padding(i, -1))+
colourized_frame2
end
|
#show_frame3(i = frame3?
) ⇒ Object
218
219
220
221
222
223
224
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 218
def show_frame3(
i = frame3?
)
e @left_padding+' '+
colourize_this_aminoacid_sequence(two_spaces_padding(i, -2))+
colourized_frame3
end
|
#show_the_intro_for_this_class ⇒ Object
#
show_the_intro_for_this_class
#
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/report.rb', line 14
def show_the_intro_for_this_class
e
erev "Translation of requested code (5' "+
steelblue('→')+
rev+" 3') for "+
colourize_dna(
dna_sequence?.size.to_s
)+
rev+' nucleotides.'
e
e ' '+orange('F1')+rev+', '+orange('F2')+rev+
' and '+orange('F3')+rev+
' designates the three forward reading frames.'
if @display_reverse_frames
e ' '+
orangered('R1')+rev+', '+
orangered('R2')+
rev+
' and '+
orangered('R3')+
rev+
' designates the three reverse reading frames.'
end
e
end
|
#split_at_n_characters? ⇒ Boolean
Also known as:
display_n_nucleotides_per_line?, display_n_nucleotides?, n_nucleotides_per_line?, n_nucleotides?, n_nucleotides, threshold_value?
#
split_at_n_characters?
#
410
411
412
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 410
def split_at_n_characters?
@split_at_n_characters
end
|
#two_spaces_padding(i, modify_the_padding_by_this = 0) ⇒ Object
164
165
166
167
168
169
170
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 164
def two_spaces_padding(i, modify_the_padding_by_this = 0)
padding_to_use = @split_at_n_characters
padding_to_use += modify_the_padding_by_this
splitted = i.split(//)
result = splitted.map {|entry| "#{entry} " }.join.strip.ljust(padding_to_use)
return result
end
|
#two_spaces_padding_last(i, modify_the_padding_by_this = 0) ⇒ Object
#
two_spaces_padding_last
#
349
350
351
352
353
354
355
356
357
358
359
|
# File 'lib/bioroebe/utility_scripts/display_open_reading_frames/misc.rb', line 349
def two_spaces_padding_last(
i, modify_the_padding_by_this = 0
)
padding_to_use = @split_at_n_characters
padding_to_use += modify_the_padding_by_this
splitted = i.split(//)
result = splitted.map {|entry|
" #{entry}"
}.join.strip.rjust(padding_to_use)
return result
end
|