bioroebe 0.10.80 → 0.11.12

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bioroebe might be problematic. Click here for more details.

Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +507 -310
  3. data/bioroebe.gemspec +3 -3
  4. data/doc/README.gen +506 -309
  5. data/doc/todo/bioroebe_todo.md +29 -40
  6. data/lib/bioroebe/aminoacids/display_aminoacid_table.rb +1 -0
  7. data/lib/bioroebe/base/colours_for_base/colours_for_base.rb +18 -8
  8. data/lib/bioroebe/base/commandline_application/commandline_arguments.rb +13 -11
  9. data/lib/bioroebe/base/commandline_application/misc.rb +18 -8
  10. data/lib/bioroebe/base/prototype/misc.rb +1 -1
  11. data/lib/bioroebe/codons/show_codon_tables.rb +6 -2
  12. data/lib/bioroebe/constants/aminoacids_and_proteins.rb +1 -0
  13. data/lib/bioroebe/constants/files_and_directories.rb +8 -1
  14. data/lib/bioroebe/count/count_amount_of_nucleotides.rb +3 -0
  15. data/lib/bioroebe/gui/gtk3/protein_to_DNA/protein_to_DNA.rb +18 -18
  16. data/lib/bioroebe/gui/shared_code/protein_to_DNA/protein_to_DNA_module.rb +14 -14
  17. data/lib/bioroebe/parsers/genbank_parser.rb +353 -24
  18. data/lib/bioroebe/python/README.md +1 -0
  19. data/lib/bioroebe/python/__pycache__/mymodule.cpython-39.pyc +0 -0
  20. data/lib/bioroebe/python/gui/gtk3/widget1.py +22 -0
  21. data/lib/bioroebe/python/mymodule.py +8 -0
  22. data/lib/bioroebe/python/protein_to_dna.py +30 -0
  23. data/lib/bioroebe/python/shell/shell.py +19 -0
  24. data/lib/bioroebe/python/to_rna.py +14 -0
  25. data/lib/bioroebe/python/toplevel_methods/to_camelcase.py +11 -0
  26. data/lib/bioroebe/sequence/nucleotide_module/nucleotide_module.rb +28 -25
  27. data/lib/bioroebe/sequence/sequence.rb +54 -2
  28. data/lib/bioroebe/shell/menu.rb +3336 -3304
  29. data/lib/bioroebe/shell/readline/readline.rb +1 -1
  30. data/lib/bioroebe/shell/shell.rb +11233 -28
  31. data/lib/bioroebe/siRNA/siRNA.rb +81 -1
  32. data/lib/bioroebe/string_matching/find_longest_substring.rb +3 -2
  33. data/lib/bioroebe/toplevel_methods/aminoacids_and_proteins.rb +31 -24
  34. data/lib/bioroebe/toplevel_methods/nucleotides.rb +22 -5
  35. data/lib/bioroebe/toplevel_methods/open_in_browser.rb +2 -0
  36. data/lib/bioroebe/toplevel_methods/to_camelcase.rb +5 -0
  37. data/lib/bioroebe/version/version.rb +2 -2
  38. data/lib/bioroebe/yaml/configuration/browser.yml +1 -1
  39. data/lib/bioroebe/yaml/restriction_enzymes/restriction_enzymes.yml +3 -3
  40. metadata +17 -36
  41. data/doc/setup.rb +0 -1655
  42. data/lib/bioroebe/genbank/genbank_parser.rb +0 -291
  43. data/lib/bioroebe/shell/add.rb +0 -108
  44. data/lib/bioroebe/shell/assign.rb +0 -360
  45. data/lib/bioroebe/shell/chop_and_cut.rb +0 -281
  46. data/lib/bioroebe/shell/constants.rb +0 -166
  47. data/lib/bioroebe/shell/download.rb +0 -335
  48. data/lib/bioroebe/shell/enable_and_disable.rb +0 -158
  49. data/lib/bioroebe/shell/enzymes.rb +0 -310
  50. data/lib/bioroebe/shell/fasta.rb +0 -345
  51. data/lib/bioroebe/shell/gtk.rb +0 -76
  52. data/lib/bioroebe/shell/history.rb +0 -132
  53. data/lib/bioroebe/shell/initialize.rb +0 -217
  54. data/lib/bioroebe/shell/loop.rb +0 -74
  55. data/lib/bioroebe/shell/misc.rb +0 -4341
  56. data/lib/bioroebe/shell/prompt.rb +0 -107
  57. data/lib/bioroebe/shell/random.rb +0 -289
  58. data/lib/bioroebe/shell/reset.rb +0 -335
  59. data/lib/bioroebe/shell/scan_and_parse.rb +0 -135
  60. data/lib/bioroebe/shell/search.rb +0 -337
  61. data/lib/bioroebe/shell/sequences.rb +0 -200
  62. data/lib/bioroebe/shell/show_report_and_display.rb +0 -2901
  63. data/lib/bioroebe/shell/startup.rb +0 -127
  64. data/lib/bioroebe/shell/taxonomy.rb +0 -14
  65. data/lib/bioroebe/shell/tk.rb +0 -23
  66. data/lib/bioroebe/shell/user_input.rb +0 -88
  67. data/lib/bioroebe/shell/xorg.rb +0 -45
@@ -1,335 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # Encoding: UTF-8
3
- # frozen_string_literal: true
4
- # =========================================================================== #
5
- # require 'bioroebe/shell/reset.rb'
6
- # =========================================================================== #
7
- module Bioroebe
8
-
9
- class Shell < ::Bioroebe::CommandlineApplication
10
-
11
- require 'bioroebe/raw_sequence/raw_sequence.rb'
12
- require 'bioroebe/nucleotides/show_nucleotide_sequence.rb'
13
-
14
- # ========================================================================= #
15
- # === reset (reset tag)
16
- # ========================================================================= #
17
- def reset(
18
- be_verbose = true
19
- )
20
- super()
21
- # ======================================================================= #
22
- # First we try to enable the configuration.
23
- # ======================================================================= #
24
- enable_configuration
25
- reset_to_initial_state(be_verbose)
26
- set_default_length # Set the default length of 1000 here.
27
- # ======================================================================= #
28
- # Make sure that the base directories exist.
29
- # ======================================================================= #
30
- ensure_that_the_base_directories_exist
31
- if defined? DEFAULT_DNA_INPUT_YAML_FILE # Main DNA string.
32
- set_string(DEFAULT_DNA_INPUT_YAML_FILE)
33
- end
34
- end
35
-
36
- require 'bioroebe/sequence/sequence.rb'
37
- # ========================================================================= #
38
- # === initialize_main_sequence
39
- #
40
- # Initialize a Sequence-object on startup. We use the length 150
41
- # for now.
42
- # ========================================================================= #
43
- def initialize_main_sequence
44
- @internal_hash[:array_dna_sequence] << Bioroebe::Sequence.new(250)
45
- end; alias reset_string initialize_main_sequence # === reset_string
46
-
47
- # ========================================================================= #
48
- # === reset_to_initial_state
49
- # ========================================================================= #
50
- def reset_to_initial_state(
51
- be_verbose = true
52
- )
53
- # ======================================================================= #
54
- # === @internal_hash
55
- #
56
- # The internal Hash can be used to store internal behaviour variables
57
- # rather than spawn so many different instance variables.
58
- #
59
- # It should be defined very early in this method.
60
- # ======================================================================= #
61
- @internal_hash = {}
62
- # ======================================================================= #
63
- # === :first_argument
64
- #
65
- # This variable refers to the first argument passed into a method,
66
- # from the menu.rb file.
67
- # ======================================================================= #
68
- @internal_hash[:first_argument] = nil
69
- # ======================================================================= #
70
- # === :show_nucleotide_sequence
71
- # ======================================================================= #
72
- @internal_hash[:show_nucleotide_sequence] = ::Bioroebe::ShowNucleotideSequence.new(
73
- '', :do_not_run_yet
74
- )
75
- # ======================================================================= #
76
- # === :array_aminoacid_sequence
77
- #
78
- # This variable should be an empty Array, aka [], initially, so that we
79
- # can distinguish the case when the user has added data onto that
80
- # Array.
81
- # ======================================================================= #
82
- @internal_hash[:array_aminoacid_sequence] = []
83
- # ======================================================================= #
84
- # === :array_rna_sequence
85
- #
86
- # This can be populated with sequence objects such as:
87
- #
88
- # Bioroebe::Sequence.new(''.dup, :rna)
89
- #
90
- # ======================================================================= #
91
- @internal_hash[:array_rna_sequence] = []
92
- # ======================================================================= #
93
- # === :array_dna_sequence
94
- # ======================================================================= #
95
- @internal_hash[:array_dna_sequence] = []
96
- # ======================================================================= #
97
- # === @use_working_directory_as_prompt
98
- # ======================================================================= #
99
- @internal_hash[:use_working_directory_as_prompt] = false
100
- # ======================================================================= #
101
- # === @debug
102
- #
103
- # Determine whether we will debug or whether we will not
104
- # ======================================================================= #
105
- @internal_hash[:debug] = SHALL_WE_DEBUG
106
- # ======================================================================= #
107
- # === @array_sequences
108
- # ======================================================================= #
109
- @internal_hash[:array_sequences] = []
110
- # ======================================================================= #
111
- # === @all_arguments
112
- # ======================================================================= #
113
- @internal_hash[:all_arguments] = []
114
- # ======================================================================= #
115
- # === :remaining_arguments
116
- # ======================================================================= #
117
- @internal_hash[:remaining_arguments] = []
118
- # ======================================================================= #
119
- # === :registered_actions
120
- # ======================================================================= #
121
- @internal_hash[:registered_actions] = ARRAY_REGISTERED_ACTIONS
122
- # ======================================================================= #
123
- # === :the_main_sequence_is_frozen
124
- # ======================================================================= #
125
- @internal_hash[:the_main_sequence_is_frozen] = false
126
- # ======================================================================= #
127
- # === :file_dna_string_saved
128
- #
129
- # Where to store our DNA string by default.
130
- # ======================================================================= #
131
- @internal_hash[:file_dna_string_saved] = "#{log_dir?}dna_string_saved.yml"
132
- # ======================================================================= #
133
- # === :array_jumper_directories
134
- # ======================================================================= #
135
- @internal_hash[:array_jumper_directories] = []
136
- # ======================================================================= #
137
- # === :array_fasta
138
- # ======================================================================= #
139
- @internal_hash[:array_fasta] = []
140
- # ======================================================================= #
141
- # === :raw_sequence
142
- # ======================================================================= #
143
- @internal_hash[:raw_sequence] = Bioroebe::RawSequence.new
144
- # ======================================================================= #
145
- # === :use_xsel
146
- #
147
- # This method will determine whether we will use the external
148
- # program "xsel". By default, at the least on my home system,
149
- # I prefer to make use of xsel.
150
- # ======================================================================= #
151
- @internal_hash[:use_xsel] = true
152
- # ======================================================================= #
153
- # === :silent_startup
154
- #
155
- # This variable keeps track as to whether we will display a welcome
156
- # message on startup or whether we will not.
157
- # ======================================================================= #
158
- @internal_hash[:silent_startup] = false
159
- # ======================================================================= #
160
- # === exit_the_shell_how
161
- #
162
- # The next variable has two valid modes:
163
- #
164
- # :instantly
165
- # :exit_gracefully
166
- #
167
- # The first is the default; the second can be used if the Bioshell
168
- # is embedded into another program.
169
- # ======================================================================= #
170
- @internal_hash[:exit_the_shell_how] = :instantly
171
- # ======================================================================= #
172
- # === search_for
173
- #
174
- # This is the sequence we wish to find, in a given nucleotide sequence.
175
- # By default this will be nil.
176
- # ======================================================================= #
177
- @internal_hash[:search_for] = nil
178
- # ======================================================================= #
179
- # === analyse_the_local_dataset_on_startup
180
- #
181
- # If this setting is set to true then, on startup, the bioshell
182
- # will report some information about the local dataset (FASTA
183
- # files and pdb files).
184
- # ======================================================================= #
185
- @internal_hash[:analyse_the_local_dataset_on_startup] = true
186
- # ======================================================================= #
187
- # === user_input
188
- # ======================================================================= #
189
- @internal_hash[:user_input] = nil
190
- # ======================================================================= #
191
- # === array_history
192
- #
193
- # This array will keep track of the input-history, aka the commands
194
- # that the user has used.
195
- # ======================================================================= #
196
- @internal_hash[:array_history] = []
197
- # ======================================================================= #
198
- # === remove_last_character_if_it_is_a_question_mark
199
- #
200
- # If this variable is set to true then we will remove the last
201
- # input character - at the least if it is a '?'.
202
- # ======================================================================= #
203
- @internal_hash[:remove_last_character_if_it_is_a_question_mark] = false
204
- # ======================================================================= #
205
- # === prompt_to_use
206
- #
207
- # This variable keeps track as to which prompt is to be used.
208
- # ======================================================================= #
209
- @internal_hash[:prompt_to_use] = :default
210
- # ======================================================================= #
211
- # === use_xsel
212
- # ======================================================================= #
213
- @internal_hash[:use_xsel] = false
214
- # ======================================================================= #
215
- # === search_for
216
- # ======================================================================= #
217
- @internal_hash[:search_for] = nil
218
- # ======================================================================= #
219
- # === coding_area
220
- # ======================================================================= #
221
- @internal_hash[:coding_area] = nil # This can keep track of the real coding area.
222
- # ======================================================================= #
223
- # === misc_sequence
224
- # ======================================================================= #
225
- @internal_hash[:misc_sequence] = nil # This can store a misc DNA or RNA sequence.
226
- # ======================================================================= #
227
- # === fasta_file
228
- #
229
- # This used to be a standalone @hash variable, but during the
230
- # rewrite in April 2020 this was integrated into @internal_hash.
231
- # ======================================================================= #
232
- @internal_hash[:fasta_file] = {}
233
- # ======================================================================= #
234
- # === @array_all_downloads
235
- # ======================================================================= #
236
- @internal_hash[:array_all_downloads] = [] # Must be an Array.
237
- # ======================================================================= #
238
- # === @use_working_directory_as_prompt
239
- # ======================================================================= #
240
- @internal_hash[:use_working_directory_as_prompt] = true
241
- # ======================================================================= #
242
- # === @mode
243
- #
244
- # @mode can be either :dna or :rna or :aminoacid
245
- # ======================================================================= #
246
- @internal_hash[:mode] = :dna
247
- # ======================================================================= #
248
- # === @array_these_sequences_were_chopped_away
249
- #
250
- # Keep an Array that can be used to keep track of which sequences
251
- # were chopped away. Whenever we perform a chop-related action we
252
- # will store that sequence in an Array.
253
- # ======================================================================= #
254
- @internal_hash[:array_these_sequences_were_chopped_away] = []
255
- # ======================================================================= #
256
- # === @save_file
257
- # ======================================================================= #
258
- @internal_hash[:save_file] = BIOSHELL_SAVE_FILE
259
- # ======================================================================= #
260
- # === create_directories_on_startup_of_the_shell
261
- #
262
- # If this variable is set to true then the bio-shell will create
263
- # some directories on startup. The user can modify this from
264
- # the commandline, though, and specifically disable it.
265
- # ======================================================================= #
266
- @internal_hash[:create_directories_on_startup_of_the_shell] = true
267
- # ======================================================================= #
268
- # === show_the_leader
269
- # ======================================================================= #
270
- @internal_hash[:show_the_leader] = true # Show the 5' leader.
271
- # ======================================================================= #
272
- # === show_the_trailer
273
- # ======================================================================= #
274
- @internal_hash[:show_the_trailer] = true # Show the 3' trailer.
275
- # ======================================================================= #
276
- # === array_timer_snapshots
277
- # ======================================================================= #
278
- @internal_hash[:array_timer_snapshots] = [] # This Array keeps track of the time.
279
- # ======================================================================= #
280
- # === may_we_show_the_startup_information
281
- #
282
- # This variable determines whether the startup-information may be
283
- # shown, on start-up of the bioshell. By default this will be true
284
- # typically, but a config-variable may overrule this.
285
- # ======================================================================= #
286
- @internal_hash[:may_we_show_the_startup_information] = true
287
- if @config and @config.respond_to? :may_we_show_the_startup_information
288
- @internal_hash[:may_we_show_the_startup_information] = @config.may_we_show_the_startup_information
289
- end
290
- # ======================================================================= #
291
- # === @use_colours
292
- #
293
- # Let's enable the colours.
294
- # ======================================================================= #
295
- enable_colours(:be_quiet)
296
- initialize_clipboard
297
- # ======================================================================= #
298
- # === @sequence
299
- #
300
- # We set @sequence to a new instance of Bioroebe::Sequence next.
301
- # ======================================================================= #
302
- initialize_main_sequence
303
- # ======================================================================= #
304
- # === Setting towards a default padding
305
- #
306
- # Next comes left-padding, defaulting to ' '. This should come after
307
- # the clipboard has been initialized, and after @internal_hash has
308
- # been populated.
309
- # ======================================================================= #
310
- set_padding :default
311
- set_sequence_2
312
- set_sequence_3
313
- set_sequence_4
314
- set_sequence_5
315
- set_sequence_6
316
- ::Bioroebe.clear_array_colourize_this_aminoacid
317
- # ======================================================================= #
318
- # === Determine whether silent startup is active
319
- #
320
- # Next, determine whether we will show a small startup-message or
321
- # whether we shall not show it. By default this should be false -
322
- # but if a file called 'use_silent_startup.yml' exists then we
323
- # will use that file.
324
- # ======================================================================= #
325
- if File.exist? FILE_USE_SILENT_STARTUP
326
- dataset = YAML.load_file(FILE_USE_SILENT_STARTUP)
327
- if dataset.is_a?(Hash) and dataset.has_key?('use_silent_startup')
328
- @internal_hash[:silent_startup] = dataset['use_silent_startup']
329
- end
330
- else # else it is
331
- @internal_hash[:silent_startup] = false
332
- end
333
- end
334
-
335
- end; end
@@ -1,135 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # Encoding: UTF-8
3
- # frozen_string_literal: true
4
- # =========================================================================== #
5
- # require 'bioroebe/shell/scan_and_parse.rb'
6
- # =========================================================================== #
7
- module Bioroebe
8
-
9
- class Shell < ::Bioroebe::CommandlineApplication
10
-
11
- # ========================================================================= #
12
- # === parse (parse tag)
13
- # ========================================================================= #
14
- def parse(i)
15
- if i.is_a? Array
16
- i = i.join(' ').strip
17
- end
18
- i = i.dup if i.frozen?
19
- i.chop! if i.end_with?('.')
20
- # ======================================================================= #
21
- # We will parse here based on the file-suffix.
22
- # ======================================================================= #
23
- case i
24
- # ======================================================================= #
25
- # === fasta file
26
- # ======================================================================= #
27
- when /\.fasta$/i,
28
- /\.fa$/i
29
- parse_fasta_format(i)
30
- unless array_fasta?.empty?
31
- # =================================================================== #
32
- # Assign this dataset next to become the new main sequence.
33
- # =================================================================== #
34
- opnn; erev "We will now assign this data to #{sfancy('@_')}#{rev}."
35
- set_mode :protein if array_fasta?.last.is_protein?
36
- assign(array_fasta?.last.sequence)
37
- end
38
- # ======================================================================= #
39
- # === pdb file
40
- # ======================================================================= #
41
- when /\.pdb$/i
42
- parse_this_pdb_file(i)
43
- else
44
- erev "Not yet handled: #{steelblue(i)}"
45
- end
46
- end
47
-
48
- # ========================================================================= #
49
- # === scan_for_leucine_zippers
50
- #
51
- # What is a leucine zipper?
52
- #
53
- # https://en.wikipedia.org/wiki/Leucine_zipper
54
- #
55
- # ========================================================================= #
56
- def scan_for_leucine_zippers(
57
- i = amino_acid_sequence?
58
- )
59
- if i.nil?
60
- i = amino_acid_sequence?
61
- end
62
- chars = i.chars
63
- # ======================================================================= #
64
- # We start to count at the first leucine zipper.
65
- # ======================================================================= #
66
- index = chars.index('L')
67
- erev 'The string '+simp(i)+rev+' has these at every 7th step.'
68
- print ' ' # Leading indent.
69
- (index..chars.size).step(7) {|token|
70
- print simp(chars[token]),' '
71
- }; e # And a final newline.
72
- end
73
-
74
- # ========================================================================= #
75
- # === parse_this_gff_file
76
- #
77
- # Use this method if you wish to parse a .gff or .gff3 file.
78
- # ========================================================================= #
79
- def parse_this_gff_file(i)
80
- if i.is_a? Array
81
- i.each {|entry| parse_this_gff_file(entry) }
82
- else
83
- ::Bioroebe::Parser::GFF.new(i)
84
- end
85
- end
86
-
87
- # ========================================================================= #
88
- # === scan_for_gff_files
89
- # ========================================================================= #
90
- def scan_for_gff_files
91
- results_for_gff_files = Dir['*.gff']
92
- results_for_gff3_files = Dir['*.gff3']
93
- unless results_for_gff_files.empty?
94
- erev 'There are '+sfancy(results_for_gff_files.size.to_s)+rev+
95
- ' .gff files in the current directory.'
96
- end
97
- unless results_for_gff3_files.empty?
98
- erev 'There are '+sfancy(results_for_gff3_files.size.to_s)+
99
- ' .gff3 files in the current directory.'
100
- erev 'We will simply pass the first entry there into '\
101
- 'class Bioroebe::Parser::GFF.'
102
- parse_this_gff_file(results_for_gff3_files.first)
103
- end
104
- end
105
-
106
- # ========================================================================= #
107
- # === scan_or_parse_for_this_gff_file_or_any_gff_file
108
- # ========================================================================= #
109
- def scan_or_parse_for_this_gff_file_or_any_gff_file(i)
110
- if i.is_a? Array
111
- i.each {|entry|
112
- if entry.nil?
113
- scan_for_gff_files
114
- else
115
- scan_or_parse_for_this_gff_file_or_any_gff_file(entry)
116
- end
117
- }
118
- else
119
- if File.exist? i.to_s
120
- parse_this_gff_file(i)
121
- else # else scan for any .gff or .gff3 file.
122
- scan_for_gff_files
123
- end
124
- end
125
- end
126
-
127
- require 'bioroebe/pdb/parse_pdb_file.rb'
128
- # ========================================================================= #
129
- # === parse_this_pdb_file
130
- # ========================================================================= #
131
- def parse_this_pdb_file(i)
132
- ParsePdbFile.new(i)
133
- end
134
-
135
- end; end