Module: Bioroebe::Taxonomy::Shared
Overview
include Bioroebe::Taxonomy::Shared
Constant Summary
Constants included
from Constants
Constants::AA_DIR, Constants::ARRAY_PROJECT_FILES, Constants::Archaea_Taxonomy_ID, Constants::BASE, Constants::BASE_URL, Constants::BE_VERBOSE, Constants::Bacteria_Taxonomy_ID, Constants::CITATIONS, Constants::CURATED_DIR, Constants::DATA_DIR, Constants::DELNODES, Constants::DIVISION, Constants::Eukaryota_Taxonomy_ID, Constants::FILE_USE_THIS_DATABASE, Constants::GEM_DIR, Constants::GENCODE, Constants::INCOMING_DIR, Constants::INFO_DIR, Constants::LAST_INTERACTIVE_COMMAND, Constants::LOCALOME_DIR, Constants::LOCAL_MIRROR, Constants::MERGED, Constants::MODULE_PATH, Constants::NAMES, Constants::NAMES_SQL, Constants::NCBI_BASE, Constants::NODES, Constants::NODES_SQL, Constants::NT_DIR, Constants::POSTGRESQL_QUERY_SIZE, Constants::POSTGRE_LOGIN_COMMAND, Constants::PROJECT_DOC_DIR, Constants::SEQUENCES_DIR, Constants::SHARED_HOME, Constants::TAXONOMY_BROWSER, Constants::TEMP_DIR, Constants::TEST_DIR, Constants::TMP_DIR, Constants::URL1
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Constants
#info_dir?, #work_directory?
Class Method Details
.be_quiet ⇒ Object
#
Taxonomy::Shared.be_quiet
#
154
155
156
|
# File 'lib/bioroebe/taxonomy/shared.rb', line 154
def self.be_quiet
@be_verbose = false
end
|
.be_verbose? ⇒ Boolean
#
Taxonomy::Shared.be_verbose?
Whether we will be verbose or whether we will be silent.
#
147
148
149
|
# File 'lib/bioroebe/taxonomy/shared.rb', line 147
def self.be_verbose?
@be_verbose
end
|
Instance Method Details
#cd(i = File.expand_path('~'), be_verbose = false) ⇒ Object
#
cd (cd tag, change dir tag)
This method allows for some special shortcuts, such as aa.
#
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
|
# File 'lib/bioroebe/taxonomy/shared.rb', line 199
def cd(
i = File.expand_path('~'),
be_verbose = false
)
be_verbose = true if be_verbose == :be_verbose
i = File.expand_path('~') if i.nil?
i = i.to_s
case i when '?',
/^-?-?HELP$/i
e 'You can cd to these special dirs:'
e
e ' '+TEMP_DIR
e ' '+INFO_DIR
e ' '+NT_DIR
e ' '+LOCALOME_DIR
e
return
when /^HOME$/i
i = TEMP_DIR
when 'robert',
'1',
'tmp'
i = TEMP_DIR
when 'aa',
'fasta'
i = AA_DIR
when 'info','i'
i = INFO_DIR
when 'nt',
'dna',
'rna'
i = NT_DIR
when 'local',
'localome',
/^local/,'loc'
i = LOCALOME_DIR
end unless File.exist?(i)
if Dir.exist? i
if be_verbose
e "We will now change directory to #{sdir(i)}."
end
Dir.chdir(i)
else
e "We can not change directory into #{sdir(i)}#{rev} "\
"as this directory does not exist."
end
end
|
#edit_login_file(optional_number = '') ⇒ Object
#
edit_login_file
For this we deliberately use the vim editor.
#
170
171
172
173
174
|
# File 'lib/bioroebe/taxonomy/shared.rb', line 170
def edit_login_file(
optional_number = ''
)
esystem "vim #{return_login_file}#{optional_number.to_s}"
end
|
#eliminate_tabulator(i) ⇒ Object
Also known as:
sanitize_content
#
eliminate_tabulator
As of now, this method will remove âtâ input and '|'.
#
77
78
79
|
# File 'lib/bioroebe/taxonomy/shared.rb', line 77
def eliminate_tabulator(i)
i.gsub(/#{TABULATOR}\|/, '')
end
|
#ensure_that_download_dir_exists(i = ::Bioroebe.taxonomy_download_directory?) ⇒ Object
#
ensure_that_download_dir_exists
#
#ensure_that_temp_dir_exists ⇒ Object
#
ensure_that_temp_dir_exists
#
#mkdir(i) ⇒ Object
#
mkdir (mkdir tag)
Simple wrapper over creating a directory. We use the Array format.
#
190
191
192
|
# File 'lib/bioroebe/taxonomy/shared.rb', line 190
def mkdir(i)
::Bioroebe.mkdir(i)
end
|
#readlines(i = :names) ⇒ Object
#
readlines
The readlines-wrapper uses File.foreach to iterate over the content.
Typically we can find these files at:
/root/taxonomy/names.dmp
#
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
# File 'lib/bioroebe/taxonomy/shared.rb', line 100
def readlines(
i = :names
)
i = i.to_sym case i
when :nodes
if File.exist? NODES
return File.foreach(NODES)
else
e 'Warning - the file at '+sfile(NODES)+' does not exist.'
return []
end
when :names
if File.exist? NAMES
return File.foreach(NAMES)
else
e 'Warning - the file at '+sfile(NODES)+' does not exist.'
return []
end
else
i = i.to_s
if File.exist? i
return File.foreach(i)
else
e 'Do not know what to do with input: '+sfancy(i)
end
end
end
|
#set_pgpassword ⇒ Object
Also known as:
set_password
#
set_pgpassword (password tag)
Set the password for Postgresql here.
#
274
275
276
|
# File 'lib/bioroebe/taxonomy/shared.rb', line 274
def set_pgpassword
::Bioroebe.set_pgpassword
end
|
#show_password ⇒ Object
#
show_password
This shows the password.
#
49
50
51
52
53
54
|
# File 'lib/bioroebe/taxonomy/shared.rb', line 49
def show_password
e 'The current password for the Postgresql login is:'
e
e " #{sfancy(POSTGRE_PASSWORD)}"
e
end
|
#show_time_now ⇒ Object
Also known as:
show_current_time
#
show_time_now
This will show the current time.
#
181
182
183
|
# File 'lib/bioroebe/taxonomy/shared.rb', line 181
def show_time_now
::Bioroebe.show_time_now
end
|
#split_at(i) ⇒ Object
84
85
86
87
88
|
# File 'lib/bioroebe/taxonomy/shared.rb', line 84
def split_at(i)
return i.split(MAIN_DELIMITER).map(&:chomp).map() {|entry|
eliminate_tabulator(entry)
}
end
|
#split_at_tabulator(i) ⇒ Object
68
69
70
|
# File 'lib/bioroebe/taxonomy/shared.rb', line 68
def split_at_tabulator(i)
i.split(FIELD_TERMINATOR) if i.is_a? String
end
|
#tokenize(i) ⇒ Object
#
tokenize
We will split at the given input. Input is expected to be a string.
#
61
62
63
|
# File 'lib/bioroebe/taxonomy/shared.rb', line 61
def tokenize(i)
i.split(TOKEN).map(&:strip)
end
|