Class: Bioroebe::SanitizeCodonFrequency
- Inherits:
-
Base
- Object
- Base
- Bioroebe::SanitizeCodonFrequency
show all
- Defined in:
- lib/bioroebe/codons/sanitize_codon_frequency.rb
Overview
Bioroebe::SanitizeCodonFrequency
Constant Summary
collapse
- TEST_STRING =
#
TEST_STRING
This string can be used as our default test-data.
#
'# UUU 26.1(170666) UCU 23.5(153557) UAU 18.8(122728) UGU 8.1( 52903)
# UUC 18.4(120510) UCC 14.2( 92923) UAC 14.8( 96596) UGC 4.8( 31095)
# UUA 26.2(170884) UCA 18.7(122028) UAA 1.1( 6913) UGA 0.7( 4447)
# UUG 27.2(177573) UCG 8.6( 55951) UAG 0.5( 3312) UGG 10.4( 67789)
#
# CUU 12.3( 80076) CCU 13.5( 88263) CAU 13.6( 89007) CGU 6.4( 41791)
# CUC 5.4( 35545) CCC 6.8( 44309) CAC 7.8( 50785) CGC 2.6( 16993)
# CUA 13.4( 87619) CCA 18.3(119641) CAA 27.3(178251) CGA 3.0( 19562)
# CUG 10.5( 68494) CCG 5.3( 34597) CAG 12.1( 79121) CGG 1.7( 11351)
#
# AUU 30.1(196893) ACU 20.3(132522) AAU 35.7(233124) AGU 14.2( 92466)
# AUC 17.2(112176) ACC 12.7( 83207) AAC 24.8(162199) AGC 9.8( 63726)
# AUA 17.8(116254) ACA 17.8(116084) AAA 41.9(273618) AGA 21.3(139081)
# AUG 20.9(136805) ACG 8.0( 52045) AAG 30.8(201361) AGG 9.2( 60289)
#
# GUU 22.1(144243) GCU 21.2(138358) GAU 37.6(245641) GGU 23.9(156109)
# GUC 11.8( 76947) GCC 12.6( 82357) GAC 20.2(132048) GGC 9.8( 63903)
# GUA 11.8( 76927) GCA 16.2(105910) GAA 45.6(297944) GGA 10.9( 71216)
# GUG 10.8( 70337) GCG 6.2( 40358) GAG 19.2(125717) GGG 6.0( 39359)
'
Constants inherited
from Base
Base::NAMESPACE
ColoursForBase::ARRAY_HTML_COLOURS_IN_USE
Class Method Summary
collapse
-
.[](i = '') ⇒ Object
# === Bioroebe::SanitizeCodonFrequency[] ========================================================================= #.
Instance Method Summary
collapse
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
#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?
Constructor Details
#initialize(i = TEST_STRING, run_already = true) ⇒ SanitizeCodonFrequency
57
58
59
60
61
62
63
64
|
# File 'lib/bioroebe/codons/sanitize_codon_frequency.rb', line 57
def initialize(
i = TEST_STRING,
run_already = true
)
reset
set_input(i)
run if run_already
end
|
Class Method Details
.[](i = '') ⇒ Object
#
Bioroebe::SanitizeCodonFrequency[]
#
136
137
138
|
# File 'lib/bioroebe/codons/sanitize_codon_frequency.rb', line 136
def self.[](i = '')
new(i)
end
|
Instance Method Details
86
87
88
|
# File 'lib/bioroebe/codons/sanitize_codon_frequency.rb', line 86
def input?
@input
end
|
#report_result(i = input?)
) ⇒ Object
93
94
95
96
97
98
99
100
|
# File 'lib/bioroebe/codons/sanitize_codon_frequency.rb', line 93
def report_result(i = input?)
i.each {|entry|
splitted = entry.split(' ')
splitted[1] = splitted[1].rjust(4)
entry = splitted.join(' ')
e entry
} if i
end
|
#reset ⇒ Object
69
70
71
|
# File 'lib/bioroebe/codons/sanitize_codon_frequency.rb', line 69
def reset
super()
end
|
#run ⇒ Object
128
129
130
131
|
# File 'lib/bioroebe/codons/sanitize_codon_frequency.rb', line 128
def run
sanitize_input
report_result
end
|
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
# File 'lib/bioroebe/codons/sanitize_codon_frequency.rb', line 105
def sanitize_input
@input = input?.split(N)
input?.map! {|entry| entry.delete('#') } input?.map!(&:strip)
input?.reject!(&:empty?)
input?.map! {|entry| entry.split(')') }
input?.flatten!
input?.map!(&:strip)
input?.map! {|entry|
if entry.include? '('
entry = entry[0..(entry.index('(')-1)]
end
entry.squeeze! ' '
if entry.include? ' '
entry.gsub!(/ /,': ')
end
entry
}
end
|
76
77
78
79
80
81
|
# File 'lib/bioroebe/codons/sanitize_codon_frequency.rb', line 76
def set_input(i = TEST_STRING)
i = i.first if i.is_a? Array
i = TEST_STRING if i.nil?
i = i.to_s.dup
@input = i
end
|