Class: Bioroebe::Base
Overview
Direct Known Subclasses
AminoacidsMassTable, ColourSchemeDemo, ColourizeHydrophilicAndHydrophobicAminoacids, ColourizeSequence, CommandlineApplication, DetectMinimalCodon, Dotplot, FastaParser, Ncbi, SanitizeCodonFrequency, SanitizeNucleotideSequence
Constant Summary
collapse
- NAMESPACE =
#
Bioroebe::Base::NAMESPACE
#
inspect
ColoursForBase::ARRAY_HTML_COLOURS_IN_USE
Instance Method Summary
collapse
Methods included from BaseModule
#absolute_path, #default_file_read, #file_readlines
#internal_hash?, #reset_the_internal_hash
#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?
#infer_the_namespace, #namespace?
Constructor Details
#initialize ⇒ Base
37
38
39
|
# File 'lib/bioroebe/base/base.rb', line 37
def initialize
reset
end
|
Instance Method Details
#append_what_into(what, into) ⇒ Object
#can_base_pair?(a, b) ⇒ Boolean
#
can_base_pair?
This method will determine whether two nucleotides can base pair to one another, e. g. A=T or A=U and so forth.
A boolean value will be returned.
#
77
78
79
80
81
82
83
84
85
|
# File 'lib/bioroebe/base/base.rb', line 77
def can_base_pair?(a, b)
_ = "#{a}#{b}"
case _
when 'AT','TA','GC','CG','AU','UA'
return true
else
return false
end
end
|
#convert_global_env(i) ⇒ Object
#delete_file(i) ⇒ Object
Also known as:
remove_file, remove
140
141
142
|
# File 'lib/bioroebe/base/prototype/prototype.rb', line 140
def delete_file(i)
File.delete(i) if File.exist? i
end
|
#directory_to_the_codon_tables? ⇒ Boolean
#
directory_to_the_codon_tables?
This method will return the directory to the codon-tables, a directory containing the individual .yml files.
#
93
94
95
|
# File 'lib/bioroebe/base/base.rb', line 93
def directory_to_the_codon_tables?
"#{project_yaml_directory?}codon_tables/"
end
|
#is_on_roebe? ⇒ Boolean
Also known as:
on_roebe?
#is_palindrome?(i) ⇒ Boolean
Also known as:
is_this_sequence_a_palindrome?
#main_encoding? ⇒ Boolean
#
main_encoding?
The main encoding in use. Currently this is hardcoded to UTF-8.
#
89
90
91
|
# File 'lib/bioroebe/base/prototype/prototype.rb', line 89
def main_encoding?
USE_THIS_ENCODING
end
|
#mkdir(i) ⇒ Object
Also known as:
create_directory
53
54
55
|
# File 'lib/bioroebe/base/prototype/prototype.rb', line 53
def mkdir(i)
::Bioroebe.mkdir(i)
end
|
#move_file(this_file, target) ⇒ Object
Also known as:
rename
#
move_file
This method can be used to relocate or rename a file.
#
98
99
100
101
102
103
104
105
106
107
108
109
110
|
# File 'lib/bioroebe/base/prototype/prototype.rb', line 98
def move_file(
this_file, target
)
if File.exist? this_file
begin
FileUtils.mv(this_file, target)
rescue Exception => error
pp error
end
else
e rev+'No file exists at `'+sfile(this_file)+'`.'
end
end
|
#mv(old, new) ⇒ Object
#
mv
Move/Rename a file or directory.
#
133
134
135
|
# File 'lib/bioroebe/base/prototype/prototype.rb', line 133
def mv(old, new)
FileUtils.mv(old, new)
end
|
#no_file_exists_at(i) ⇒ Object
#no_newlines(i) ⇒ Object
#
no_newlines
This method will remove all newlines from a given (input) String.
#
150
151
152
153
|
# File 'lib/bioroebe/base/prototype/prototype.rb', line 150
def no_newlines(i)
i.delete!(N) if i
return i
end
|
#project_yaml_directory? ⇒ Boolean
Also known as:
yaml_directory?
#
project_yaml_directory?
#
#rds(i) ⇒ Object
#
rds
The abbreviation rds stands short for “remove double slashes”.
#
117
118
119
|
# File 'lib/bioroebe/base/prototype/prototype.rb', line 117
def rds(i)
::Bioroebe.rds(i)
end
|
#register_sigint(optional_display_this_message = nil) ⇒ Object
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/bioroebe/base/base.rb', line 58
def register_sigint(
optional_display_this_message = nil
)
Signal.trap('SIGINT') {
if optional_display_this_message
e optional_display_this_message
end
exit
}
end
|
#reset ⇒ Object
60
61
62
63
64
65
|
# File 'lib/bioroebe/base/prototype/prototype.rb', line 60
def reset
@namespace = NAMESPACE end
|
#return_pwd ⇒ Object
Also known as:
return_working_directory
124
125
126
|
# File 'lib/bioroebe/base/prototype/prototype.rb', line 124
def return_pwd
"#{Dir.pwd}/".squeeze('/')
end
|
#return_the_first_line_of_this_file(i) ⇒ Object
#
return_the_first_line_of_this_file
#
70
71
72
73
74
75
|
# File 'lib/bioroebe/base/prototype/prototype.rb', line 70
def return_the_first_line_of_this_file(i)
if File.exist? i
return File.open(i) {|this_file| this_file.readline.strip }
end
return i
end
|
#word_wrap(text, line_width = 80) ⇒ Object
123
124
125
126
127
128
|
# File 'lib/bioroebe/base/base.rb', line 123
def word_wrap(
text,
line_width = 80
)
return text.scan(/\S.{0,#{line_width}}\S(?=\s|$)|\S+/).join(N)
end
|
#write_what_into(what, into) ⇒ Object
Also known as:
save_file
#
write_what_into
This method can be used to write into a (local) file.
#