Class: Bioroebe::CalculateMeltingTemperatureForMoreThanThirteenNucleotides
- Inherits:
-
Base
- Object
- Base
- Bioroebe::CalculateMeltingTemperatureForMoreThanThirteenNucleotides
show all
- Defined in:
- lib/bioroebe/calculate/calculate_melting_temperature_for_more_than_thirteen_nucleotides.rb
Overview
Constant Summary
collapse
- NAMESPACE =
inspect
- BASE_VALUE =
100.5
Bioroebe::ColoursForBase::ARRAY_HTML_COLOURS_IN_USE
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/bioroebe/calculate/calculate_melting_temperature_for_more_than_thirteen_nucleotides.rb', line 55
def initialize(
i = ARGV,
run_already = true
)
reset
set_nucleotide_sequence(i)
if block_given?
yielded = yield
case yielded
when :do_not_report_anything
@do_report = false
end
end
run if run_already
end
|
Instance Method Details
#calculate_Tm_value ⇒ Object
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
|
# File 'lib/bioroebe/calculate/calculate_melting_temperature_for_more_than_thirteen_nucleotides.rb', line 182
def calculate_Tm_value
result = BASE_VALUE
middle_value1 = ( 41.0 * (n_G?+n_C?) / n_nucleotides_in_total? )
middle_value2 = ( 820.0 / n_nucleotides_in_total? )
result += ( middle_value1 - middle_value2)
log_result = 16.6 * log10(concentration_of_sodium)
result += log_result
@tm_value = result.round(3)
end
|
#concentration_of_sodium ⇒ Object
#
concentration_of_sodium
This reflects [Na+], that is the concentration of sodium.
For now it is hardcoded towards 50.0. In the future this may have to be adjusted.
#
222
223
224
|
# File 'lib/bioroebe/calculate/calculate_melting_temperature_for_more_than_thirteen_nucleotides.rb', line 222
def concentration_of_sodium
@sodium_concentration end
|
#count_frequencies_of_the_nucleotides ⇒ Object
#
count_frequencies_of_the_nucleotides
#
112
113
114
115
116
117
118
|
# File 'lib/bioroebe/calculate/calculate_melting_temperature_for_more_than_thirteen_nucleotides.rb', line 112
def count_frequencies_of_the_nucleotides
_ = @nucleotide_sequence
@n_A = _.count('A')
@n_T = _.count('T')
@n_G = _.count('G')
@n_C = _.count('C')
end
|
#log10(i) ⇒ Object
240
241
242
|
# File 'lib/bioroebe/calculate/calculate_melting_temperature_for_more_than_thirteen_nucleotides.rb', line 240
def log10(i)
Math.log10(i)
end
|
#n_A? ⇒ Boolean
147
148
149
|
# File 'lib/bioroebe/calculate/calculate_melting_temperature_for_more_than_thirteen_nucleotides.rb', line 147
def n_A?
@n_A
end
|
#n_C? ⇒ Boolean
168
169
170
|
# File 'lib/bioroebe/calculate/calculate_melting_temperature_for_more_than_thirteen_nucleotides.rb', line 168
def n_C?
@n_C
end
|
#n_G? ⇒ Boolean
161
162
163
|
# File 'lib/bioroebe/calculate/calculate_melting_temperature_for_more_than_thirteen_nucleotides.rb', line 161
def n_G?
@n_G
end
|
#n_nucleotides_in_total? ⇒ Boolean
#
n_nucleotides_in_total?
#
175
176
177
|
# File 'lib/bioroebe/calculate/calculate_melting_temperature_for_more_than_thirteen_nucleotides.rb', line 175
def n_nucleotides_in_total?
input_sequence?.size
end
|
#n_T? ⇒ Boolean
154
155
156
|
# File 'lib/bioroebe/calculate/calculate_melting_temperature_for_more_than_thirteen_nucleotides.rb', line 154
def n_T?
@n_T
end
|
#nucleotide_sequence? ⇒ Boolean
Also known as:
input_sequence?
123
124
125
|
# File 'lib/bioroebe/calculate/calculate_melting_temperature_for_more_than_thirteen_nucleotides.rb', line 123
def nucleotide_sequence?
@nucleotide_sequence
end
|
#report_results_from_the_frequencies_and_the_size_of_the_sequence_at_hand ⇒ Object
#
report_results_from_the_frequencies_and_the_size_of_the_sequence_at_hand
#
130
131
132
133
134
135
136
137
138
139
140
141
142
|
# File 'lib/bioroebe/calculate/calculate_melting_temperature_for_more_than_thirteen_nucleotides.rb', line 130
def report_results_from_the_frequencies_and_the_size_of_the_sequence_at_hand
if @do_report
erev 'This nucleotide sequence has '+
sfancy(@nucleotide_sequence.size.to_s)+
rev+
' nucleotides. ('+orange(input_sequence?)+rev+')'
erev "The nucleotide-frequencies are: "\
"#{simp(n_A?.to_s+'xA')}#{rev}, "\
"#{simp(n_T?.to_s+'xT')}#{rev}, "\
"#{simp(n_G?.to_s+'xG')}#{rev}, "\
"#{simp(n_C?.to_s+'xC')}#{rev}"
end
end
|
#report_the_tm_value ⇒ Object
Also known as:
report
#
report_the_tm_value (report tag)
#
247
248
249
250
251
252
|
# File 'lib/bioroebe/calculate/calculate_melting_temperature_for_more_than_thirteen_nucleotides.rb', line 247
def report_the_tm_value
if @do_report
erev 'The calculated Tm value (salt-adjusted Tm) '\
'is: '+sfancy(@tm_value)+rev+'°C'
end
end
|
#reset ⇒ Object
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
# File 'lib/bioroebe/calculate/calculate_melting_temperature_for_more_than_thirteen_nucleotides.rb', line 77
def reset
super()
@namespace = NAMESPACE
@nucleotide_sequence = nil
@do_report = true
set_sodium_concentration(:default)
end
|
#run ⇒ Object
257
258
259
260
261
262
263
264
|
# File 'lib/bioroebe/calculate/calculate_melting_temperature_for_more_than_thirteen_nucleotides.rb', line 257
def run
count_frequencies_of_the_nucleotides
e if @do_report
report_results_from_the_frequencies_and_the_size_of_the_sequence_at_hand
calculate_Tm_value
report_the_tm_value
e if @do_report
end
|
#set_nucleotide_sequence(i) ⇒ Object
#
set_nucleotide_sequence
#
100
101
102
103
104
105
106
107
|
# File 'lib/bioroebe/calculate/calculate_melting_temperature_for_more_than_thirteen_nucleotides.rb', line 100
def set_nucleotide_sequence(i)
if i.is_a? Array
i = i.join.strip
end
i = i.dup if i.frozen?
i.delete!(' ')
@nucleotide_sequence = i
end
|
#set_sodium_concentration(i = :default) ⇒ Object
#
set_sodium_concentration
#
229
230
231
232
233
234
235
|
# File 'lib/bioroebe/calculate/calculate_melting_temperature_for_more_than_thirteen_nucleotides.rb', line 229
def set_sodium_concentration(i = :default)
case i
when :default
i = 0.050
end
@sodium_concentration = i
end
|
#tm_value? ⇒ Boolean
210
211
212
|
# File 'lib/bioroebe/calculate/calculate_melting_temperature_for_more_than_thirteen_nucleotides.rb', line 210
def tm_value?
@tm_value
end
|