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,107 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # Encoding: UTF-8
3
- # frozen_string_literal: true
4
- # =========================================================================== #
5
- # require 'bioroebe/shell/prompt.rb'
6
- # =========================================================================== #
7
- module Bioroebe
8
-
9
- class Shell < ::Bioroebe::CommandlineApplication
10
-
11
- require 'bioroebe/constants/misc.rb'
12
-
13
- # ========================================================================= #
14
- # === use_which_prompt?
15
- # ========================================================================= #
16
- def use_which_prompt?
17
- @internal_hash[:prompt_to_use]
18
- end
19
-
20
- # ========================================================================= #
21
- # === set_use_this_prompt
22
- #
23
- # This method can be used to set the prompt of the bio-shell.
24
- # ========================================================================= #
25
- def set_use_this_prompt(i = NAME_OF_BIO_SHELL)
26
- case i # case tag
27
- # ======================================================================= #
28
- # === NONE
29
- # ======================================================================= #
30
- when /^NONE$/i,
31
- 'empty',
32
- :empty
33
- i = "\n"
34
- do_not_use_working_directory_as_prompt
35
- # ======================================================================= #
36
- # === pwd
37
- # ======================================================================= #
38
- when 'pwd', :cwd, nil
39
- i = return_default_prompt
40
- do_use_working_directory_as_prompt
41
- # ======================================================================= #
42
- # === REVERT
43
- # ======================================================================= #
44
- when /^REVERT$/i,
45
- /^DEFAULT$/i,
46
- :default
47
- i = NAME_OF_BIO_SHELL
48
- do_not_use_working_directory_as_prompt
49
- end
50
- @internal_hash[:prompt_to_use] = i
51
- end; alias set_prompt set_use_this_prompt # === set_prompt
52
-
53
- # ========================================================================= #
54
- # === return_pwd
55
- # ========================================================================= #
56
- def return_pwd
57
- ("#{Dir.pwd}/").squeeze('/')
58
- end; alias return_default_prompt return_pwd # === return_default_prompt
59
-
60
- # ========================================================================= #
61
- # === obtain_current_prompt
62
- #
63
- # This is essentially a getter-method over the instance variable
64
- # called @internal_hash[:prompt_to_use].
65
- # ========================================================================= #
66
- def obtain_current_prompt
67
- if @internal_hash[:use_working_directory_as_prompt]
68
- @internal_hash[:prompt_to_use] = return_pwd
69
- end
70
- @internal_hash[:prompt_to_use]
71
- end
72
-
73
- # ========================================================================= #
74
- # === obtain_current_prompt_while_honouring_colours
75
- # ========================================================================= #
76
- def obtain_current_prompt_while_honouring_colours
77
- _ = obtain_current_prompt
78
- if _ and use_colours?
79
- _ = "#{Colours::TEAL}#{_}#{rev}"
80
- end
81
- return _
82
- end
83
-
84
- # ========================================================================= #
85
- # === restore_default_prompt
86
- # ========================================================================= #
87
- def restore_default_prompt
88
- set_prompt :default
89
- end
90
-
91
- # ========================================================================= #
92
- # === use_working_directory_as_prompt
93
- #
94
- # Use this method if you wish to use the working-directory as your prompt.
95
- # ========================================================================= #
96
- def do_use_working_directory_as_prompt
97
- @internal_hash[:use_working_directory_as_prompt] = true
98
- end; alias use_working_directory_as_prompt do_use_working_directory_as_prompt # === use_working_directory_as_prompt
99
-
100
- # ========================================================================= #
101
- # === do_not_use_working_directory_as_prompt
102
- # ========================================================================= #
103
- def do_not_use_working_directory_as_prompt
104
- @internal_hash[:use_working_directory_as_prompt] = false
105
- end
106
-
107
- end; end
@@ -1,289 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # Encoding: UTF-8
3
- # frozen_string_literal: true
4
- # =========================================================================== #
5
- # require 'bioroebe/shell/random.rb'
6
- # =========================================================================== #
7
- module Bioroebe
8
-
9
- class Shell < ::Bioroebe::CommandlineApplication
10
-
11
- require 'bioroebe/constants/files_and_directories.rb'
12
-
13
- # ========================================================================= #
14
- # === random (random tag, rand tag)
15
- #
16
- # This will generate a random DNA sequence or a random aminoacid
17
- # sequence.
18
- #
19
- # The first argument tells us how many nucleotides or amino acids
20
- # should be part of that sequence.
21
- #
22
- # If a second argument was given, we will generate AA. Otherwise we
23
- # will generate DNA (which is the default).
24
- #
25
- # Usage examples:
26
- #
27
- # random dna
28
- # random dna 20
29
- # random 2552
30
- # random 2552 aa
31
- #
32
- # ========================================================================= #
33
- def random(
34
- n_elements = default_length?,
35
- dna_or_amino_acid = :dna,
36
- do_report_the_sequence = false
37
- )
38
- # ====================================================================== #
39
- # === First handle Arrays
40
- # ====================================================================== #
41
- if dna_or_amino_acid.is_a? Array
42
- dna_or_amino_acid = dna_or_amino_acid.first
43
- end
44
- case n_elements.to_s
45
- # ====================================================================== #
46
- # === aminoacids
47
- # ====================================================================== #
48
- when 'aminoacids',
49
- /^aa$/i
50
- five_steps_array = [] # An array from 5 to 50, in 5 steps.
51
- 5.step(50, 5) { |entry| five_steps_array << entry }
52
- n_elements = 200+five_steps_array.sample
53
- dna_or_amino_acid = :aminoacids
54
- # ====================================================================== #
55
- # === do_not_show_the_string
56
- # ====================================================================== #
57
- when 'do_not_show_the_string'
58
- dna_or_amino_acid = :dna
59
- n_elements = default_length?
60
- do_report_the_sequence = false
61
- # ====================================================================== #
62
- # === dna
63
- # ====================================================================== #
64
- when 'dna','' # This also handles nil.
65
- n_elements = default_length?
66
- if only_numbers?(dna_or_amino_acid)
67
- n_elements = dna_or_amino_acid.to_i
68
- end
69
- dna_or_amino_acid = :dna
70
- # ====================================================================== #
71
- # === nil
72
- # ====================================================================== #
73
- when nil
74
- n_elements = default_length? # defaults to 1000.
75
- end
76
- # ====================================================================== #
77
- # If input has NOT only numbers alone:
78
- # ====================================================================== #
79
- if n_elements.to_s !~ /^\d+$/
80
- n_elements = default_length?
81
- end
82
- dna_or_amino_acid = dna_or_amino_acid.to_s
83
- # ====================================================================== #
84
- # === Handle DNA or amino acid as input next
85
- # ====================================================================== #
86
- case dna_or_amino_acid
87
- # ====================================================================== #
88
- # === dna
89
- # ====================================================================== #
90
- when 'dna',
91
- 'd',
92
- 'default',
93
- ''
94
- # '' is also the default for this.
95
- erev 'Generating some DNA of length '+
96
- simp(n_elements.to_s)+rev+'.'
97
- if seq_object?.type?.nil?
98
- seq_object?.is_DNA_now
99
- require 'bioroebe/sequence/nucleotide_module/nucleotide_module.rb'
100
- seq_object?.extend(Bioroebe::NucleotideModule)
101
- else
102
- unless seq_object?.respond_to? :n_random_dna
103
- require 'bioroebe/sequence/nucleotide_module/nucleotide_module.rb'
104
- seq_object?.extend(Bioroebe::NucleotideModule)
105
- end
106
- end
107
- sequence = seq_object?.n_random_dna(n_elements)
108
- set_dna_sequence(sequence)
109
- # ====================================================================== #
110
- # === aminoacids
111
- # ====================================================================== #
112
- when 'aminoacids',
113
- 'aminoacid',
114
- 'aa'
115
- e 'Generating some ('+sfancy(n_elements.to_s)+rev+') AminoAcids next.'
116
- _ = set_aminoacids(:generate, n_elements, :be_silent) # We are silent here because we report lateron anyway.
117
- output = _
118
- end
119
- # ======================================================================= #
120
- # Next, show this string if we also wish to report the sequence.
121
- # ======================================================================= #
122
- show_string(output) if do_report_the_sequence
123
- return _ # Last but not least, return it.
124
- end
125
-
126
- # ========================================================================= #
127
- # === generate_random_dna_sequence_with_variable_length_and_variable_composition
128
- #
129
- # This method will generate a random DNA sequence of variable
130
- # length and composition.
131
- # ========================================================================= #
132
- def generate_random_dna_sequence_with_variable_length_and_variable_composition
133
- e 'Input the desired length of your DNA string:'
134
- length = $stdin.gets.chomp.to_i
135
- e 'Input the percentage of Adenine, Thymin, Cytosine and Guanosine. You can'
136
- e 'omit this, in which case we will default to 25% each.'
137
- e 'Use a / as delimiter please, as in '+
138
- orange('30 / 30 / 20 / 20')+rev+'.'
139
- e
140
- print 'Adenine / Thymin / Cytosine / Guanosine: '
141
- composition = $stdin.gets.chomp
142
- if composition.include? '/'
143
- splitted = composition.split('/').
144
- map(&:strip).map(&:to_f)
145
- else
146
- splitted = [25,25,25,25]
147
- end
148
- # ======================================================================= #
149
- # Next, we fill in our pool of nucleotides.
150
- # ======================================================================= #
151
- pool_of_nucleotides = []
152
- # ======================================================================= #
153
- # Next, we must determine how many we will use. The percentage value
154
- # tells us this.
155
- # The entries are e. g. 35%. So we first must calculate how much is
156
- # 1%, then we multiply this.
157
- # ======================================================================= #
158
- n_A = (length.to_f / 100) * splitted[0].to_f
159
- n_T = (length.to_f / 100) * splitted[1].to_f
160
- n_C = (length.to_f / 100) * splitted[2].to_f
161
- n_G = (length.to_f / 100) * splitted[3].to_f
162
- pool_of_nucleotides << (['A'] * n_A)
163
- pool_of_nucleotides << (['T'] * n_T)
164
- pool_of_nucleotides << (['C'] * n_C)
165
- pool_of_nucleotides << (['G'] * n_G)
166
- pool_of_nucleotides.flatten!
167
- _ = ''.dup # This is the return string.
168
- _ << pool_of_nucleotides.shuffle.join
169
- return _
170
- end
171
-
172
- # ========================================================================= #
173
- # === return_random_nucleotide
174
- #
175
- # Here we return a random nucleotide.
176
- # ========================================================================= #
177
- def return_random_nucleotide
178
- Bioroebe.return_random_nucleotide
179
- end; alias add_nucleotide return_random_nucleotide # === add_nucleotide
180
-
181
- # ========================================================================= #
182
- # === random_dna_sequence
183
- #
184
- # Generate a random DNA sequence. Note that this will return a String -
185
- # if you wish to put this onto a Sequence object then you have to
186
- # handle this situation on your own.
187
- #
188
- # The argument shall be how many DNA nucleotides you want to have.
189
- # ========================================================================= #
190
- def random_dna_sequence(
191
- length = 250
192
- )
193
- ::Bioroebe.generate_random_dna_sequence(length)
194
- end
195
-
196
- # ========================================================================= #
197
- # === random_insert
198
- #
199
- # Use this method to do a random insert into your main DNA sequence.
200
- #
201
- # The input should be a nucleotide sequence such as ATGCCA, but it can
202
- # also be a number - see the examples below for that.
203
- #
204
- # Note that this method will insert the given input into ONE random
205
- # position of our main sequence.
206
- #
207
- # To use this, try:
208
- #
209
- # random 15; rinsert ATTGGGCCC
210
- # random 15; rinsert 5
211
- # random 15; rinsert 15
212
- #
213
- # ========================================================================= #
214
- def random_insert(i)
215
- i = i.join if i.is_a? Array
216
- i.delete!(' ')
217
- if i =~ /\d+$/ # If it has at the least one number.
218
- _ = ''
219
- i.to_i.times { _ << return_random_nucleotide }
220
- e "The #{simp(i.to_i.to_s)}#{rev} nucleotides to be added "\
221
- "will be `#{sfancy(_)}#{rev}`."
222
- i = _
223
- end
224
- # ======================================================================= #
225
- # We need to determine the insert position. The insert_position can
226
- # be 0 zoo.
227
- # ======================================================================= #
228
- insert_position = rand(sequence?.size)
229
- n_nucleotides = i.size.to_s
230
- e 'Inserting '+sfancy(n_nucleotides.to_s)+rev+' nucleotides at '\
231
- 'nucleotide position '+simp(insert_position.to_s)+rev+'.'
232
- old_size = @sequence.size
233
- @sequence[insert_position+1, 0] = i
234
- e 'The old size was '+sfancy(old_size.to_s)+rev+'. The new '\
235
- 'size is '+sfancy(@sequence.size.to_s)+rev+'.'
236
- end
237
-
238
- # ========================================================================= #
239
- # === create_n_random_amino_acids
240
- # ========================================================================= #
241
- def create_n_random_amino_acids(n = 1000)
242
- set_aminoacids :random, n, :be_verbose
243
- end
244
-
245
- # ========================================================================= #
246
- # === set_aminoacids
247
- #
248
- # Simply delegate to set_aminoacids.
249
- # ========================================================================= #
250
- def set_random_aminoacids
251
- set_aminoacids :random
252
- end
253
-
254
- # ========================================================================= #
255
- # === generate_random_protein_sequence_with_variable_length_and_variable_composition
256
- #
257
- # Use this method to generate a random protein sequence with variable
258
- # length and variable composition.
259
- # ========================================================================= #
260
- def generate_random_protein_sequence_with_variable_length_and_variable_composition
261
- _ = {} # This is our hash.
262
- e 'You can generate a random protein sequence next. First, input the'
263
- print 'target length of the protein in question: '
264
- length = $stdin.gets.chomp.to_i
265
- e
266
- e 'Next, you have to input the percentage for the respective amino '\
267
- 'acids, separated via the token '+orange('/')+rev+'.'
268
- e
269
- e 'This can be quite tedious though. Unfortunately, there is not a'
270
- e 'much simpler way possible on the commandline, so here we go:'
271
- e
272
- print 'Glycine Alanine Valine: '
273
- glycine_alanine_valine = $stdin.gets.chomp
274
- glycine, alanine, valine = glycine_alanine_valine.split('/').map(&:strip)
275
- _['glycine'] = glycine
276
- _['alanine'] = alanine
277
- _['valine'] = valine
278
- e 'The length of the target protein is '+simp(length.to_s)+'.'
279
- e swarn('!!! THE ABOVE CODE ^^^ IS UNFINISHED !!!!!')+rev
280
- end
281
-
282
- # ========================================================================= #
283
- # === return_random_aminoacid
284
- # ========================================================================= #
285
- def return_random_aminoacid
286
- Bioroebe.return_random_aminoacid
287
- end
288
-
289
- end; end