bioroebe 0.10.80 → 0.11.32

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 (210) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3209 -2618
  3. data/bin/bioroebe +7 -1
  4. data/bioroebe.gemspec +3 -3
  5. data/doc/README.gen +3208 -2617
  6. data/doc/quality_control/commandline_applications.md +3 -3
  7. data/doc/todo/bioroebe_todo.md +2040 -2615
  8. data/lib/bioroebe/aminoacids/aminoacid_substitution.rb +1 -9
  9. data/lib/bioroebe/aminoacids/codon_percentage.rb +1 -9
  10. data/lib/bioroebe/aminoacids/deduce_aminoacid_sequence.rb +1 -9
  11. data/lib/bioroebe/aminoacids/display_aminoacid_table.rb +1 -0
  12. data/lib/bioroebe/aminoacids/show_hydrophobicity.rb +1 -6
  13. data/lib/bioroebe/base/colours_for_base/colours_for_base.rb +18 -8
  14. data/lib/bioroebe/base/commandline_application/commandline_arguments.rb +13 -11
  15. data/lib/bioroebe/base/commandline_application/misc.rb +26 -9
  16. data/lib/bioroebe/base/commandline_application/opn.rb +8 -8
  17. data/lib/bioroebe/base/commandline_application/reset.rb +3 -2
  18. data/lib/bioroebe/base/misc.rb +35 -0
  19. data/lib/bioroebe/base/prototype/misc.rb +11 -1
  20. data/lib/bioroebe/codon_tables/frequencies/parse_frequency_table.rb +2 -10
  21. data/lib/bioroebe/codons/possible_codons_for_this_aminoacid.rb +1 -9
  22. data/lib/bioroebe/codons/show_codon_tables.rb +6 -2
  23. data/lib/bioroebe/codons/show_codon_usage.rb +2 -1
  24. data/lib/bioroebe/constants/aminoacids_and_proteins.rb +1 -0
  25. data/lib/bioroebe/constants/database_constants.rb +1 -1
  26. data/lib/bioroebe/constants/files_and_directories.rb +31 -4
  27. data/lib/bioroebe/constants/misc.rb +20 -0
  28. data/lib/bioroebe/count/count_amount_of_nucleotides.rb +3 -0
  29. data/lib/bioroebe/crystal/README.md +2 -0
  30. data/lib/bioroebe/crystal/to_rna.cr +19 -0
  31. data/lib/bioroebe/data/README.md +11 -8
  32. data/lib/bioroebe/data/electron_microscopy/pos_example.pos +396 -0
  33. data/lib/bioroebe/data/electron_microscopy/test_particles.star +36 -0
  34. data/lib/bioroebe/electron_microscopy/coordinate_analyzer.rb +15 -18
  35. data/lib/bioroebe/{fasta_and_fastq/parse_fasta/run.rb → electron_microscopy/electron_microscopy_module.rb} +16 -8
  36. data/lib/bioroebe/electron_microscopy/fix_pos_file.rb +1 -9
  37. data/lib/bioroebe/electron_microscopy/flipy.rb +83 -0
  38. data/lib/bioroebe/electron_microscopy/parse_coordinates.rb +2 -10
  39. data/lib/bioroebe/electron_microscopy/read_file_xmd.rb +1 -9
  40. data/lib/bioroebe/electron_microscopy/simple_star_file_generator.rb +4 -9
  41. data/lib/bioroebe/fasta_and_fastq/autocorrect_the_name_of_this_fasta_file.rb +1 -9
  42. data/lib/bioroebe/fasta_and_fastq/compact_fasta_file/compact_fasta_file.rb +7 -9
  43. data/lib/bioroebe/fasta_and_fastq/fasta_defline/fasta_defline.rb +1 -5
  44. data/lib/bioroebe/fasta_and_fastq/fasta_to_yaml/fasta_to_yaml.rb +81 -0
  45. data/lib/bioroebe/fasta_and_fastq/parse_fasta/parse_fasta.rb +1460 -7
  46. data/lib/bioroebe/fasta_and_fastq/return_fasta_subsection_of_this_file.rb +11 -2
  47. data/lib/bioroebe/fasta_and_fastq/show_fasta_headers.rb +27 -12
  48. data/lib/bioroebe/fasta_and_fastq/simplify_fasta_header/simplify_fasta_header.rb +1 -5
  49. data/lib/bioroebe/fasta_and_fastq/split_this_fasta_file_into_chromosomes/constants.rb +0 -5
  50. data/lib/bioroebe/genome/README.md +4 -0
  51. data/lib/bioroebe/genome/genome.rb +67 -0
  52. data/lib/bioroebe/genomes/genome_pattern.rb +3 -9
  53. data/lib/bioroebe/gui/gtk +1 -0
  54. data/lib/bioroebe/gui/gtk3/controller/controller.rb +45 -27
  55. data/lib/bioroebe/gui/gtk3/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb +76 -50
  56. data/lib/bioroebe/gui/gtk3/fasta_table_widget/fasta_table_widget.rb +99 -21
  57. data/lib/bioroebe/gui/gtk3/hamming_distance/hamming_distance.rb +42 -28
  58. data/lib/bioroebe/gui/gtk3/nucleotide_analyser/nucleotide_analyser.rb +119 -71
  59. data/lib/bioroebe/gui/gtk3/protein_to_DNA/protein_to_DNA.rb +18 -18
  60. data/lib/bioroebe/gui/gtk3/random_sequence/random_sequence.rb +19 -11
  61. data/lib/bioroebe/gui/libui/three_to_one/three_to_one.rb +8 -6
  62. data/lib/bioroebe/gui/shared_code/protein_to_DNA/protein_to_DNA_module.rb +14 -14
  63. data/lib/bioroebe/gui/swing/three_to_one/ThreeToOne$1.class +0 -0
  64. data/lib/bioroebe/gui/swing/three_to_one/ThreeToOne$CloseListener.class +0 -0
  65. data/lib/bioroebe/gui/swing/three_to_one/ThreeToOne.class +0 -0
  66. data/lib/bioroebe/gui/swing/three_to_one/ThreeToOne.java +141 -0
  67. data/lib/bioroebe/java/README.md +4 -0
  68. data/lib/bioroebe/java/bioroebe/Sequence.java +25 -1
  69. data/lib/bioroebe/java/bioroebe/src/main/java/bioroebe/Base.class +0 -0
  70. data/lib/bioroebe/java/bioroebe/{Base.java → src/main/java/bioroebe/Base.java} +15 -2
  71. data/lib/bioroebe/java/bioroebe/{BisulfiteTreatment.class → src/main/java/bioroebe/BisulfiteTreatment.class} +0 -0
  72. data/lib/bioroebe/java/bioroebe/{BisulfiteTreatment.java → src/main/java/bioroebe/BisulfiteTreatment.java} +0 -0
  73. data/lib/bioroebe/java/bioroebe/{Codons.class → src/main/java/bioroebe/Codons.class} +0 -0
  74. data/lib/bioroebe/java/bioroebe/src/main/java/bioroebe/Codons.java +34 -0
  75. data/lib/bioroebe/java/bioroebe/src/main/java/bioroebe/Commandline.class +0 -0
  76. data/lib/bioroebe/java/bioroebe/src/main/java/bioroebe/Commandline.java +95 -0
  77. data/lib/bioroebe/java/bioroebe/{Esystem.class → src/main/java/bioroebe/Esystem.class} +0 -0
  78. data/lib/bioroebe/java/bioroebe/{Esystem.java → src/main/java/bioroebe/Esystem.java} +0 -0
  79. data/lib/bioroebe/java/bioroebe/{GenerateRandomDnaSequence.class → src/main/java/bioroebe/GenerateRandomDnaSequence.class} +0 -0
  80. data/lib/bioroebe/java/bioroebe/{GenerateRandomDnaSequence.java → src/main/java/bioroebe/GenerateRandomDnaSequence.java} +8 -2
  81. data/lib/bioroebe/java/bioroebe/{IsPalindrome.class → src/main/java/bioroebe/IsPalindrome.class} +0 -0
  82. data/lib/bioroebe/java/bioroebe/{IsPalindrome.java → src/main/java/bioroebe/IsPalindrome.java} +5 -1
  83. data/lib/bioroebe/java/bioroebe/src/main/java/bioroebe/PartnerNucleotide.class +0 -0
  84. data/lib/bioroebe/java/bioroebe/src/main/java/bioroebe/PartnerNucleotide.java +56 -0
  85. data/lib/bioroebe/java/bioroebe/{RemoveFile.class → src/main/java/bioroebe/RemoveFile.class} +0 -0
  86. data/lib/bioroebe/java/bioroebe/{RemoveFile.java → src/main/java/bioroebe/RemoveFile.java} +10 -4
  87. data/lib/bioroebe/java/bioroebe/{RemoveNumbers.class → src/main/java/bioroebe/RemoveNumbers.class} +0 -0
  88. data/lib/bioroebe/java/bioroebe/{RemoveNumbers.java → src/main/java/bioroebe/RemoveNumbers.java} +1 -0
  89. data/lib/bioroebe/java/bioroebe/{ToCamelcase.class → src/main/java/bioroebe/ToCamelcase.class} +0 -0
  90. data/lib/bioroebe/java/bioroebe/{ToCamelcase.java → src/main/java/bioroebe/ToCamelcase.java} +3 -3
  91. data/lib/bioroebe/java/bioroebe/src/main/java/bioroebe/ToRNA.class +0 -0
  92. data/lib/bioroebe/java/bioroebe/src/main/java/bioroebe/ToRNA.java +42 -0
  93. data/lib/bioroebe/java/bioroebe/toplevel_methods/BaseComposition.class +0 -0
  94. data/lib/bioroebe/java/bioroebe/toplevel_methods/BaseComposition.java +73 -0
  95. data/lib/bioroebe/misc/ruler.rb +1 -0
  96. data/lib/bioroebe/nucleotides/most_likely_nucleotide_sequence_for_this_aminoacid_sequence.rb +1 -9
  97. data/lib/bioroebe/nucleotides/show_nucleotide_sequence.rb +7 -7
  98. data/lib/bioroebe/parsers/genbank_parser.rb +347 -26
  99. data/lib/bioroebe/parsers/gff.rb +1 -9
  100. data/lib/bioroebe/patterns/scan_for_repeat.rb +1 -5
  101. data/lib/bioroebe/pdb/fetch_fasta_sequence_from_pdb.rb +1 -9
  102. data/lib/bioroebe/pdb/parse_mmCIF_file.rb +1 -9
  103. data/lib/bioroebe/pdb/parse_pdb_file.rb +1 -9
  104. data/lib/bioroebe/project/project.rb +1 -1
  105. data/lib/bioroebe/python/README.md +1 -0
  106. data/lib/bioroebe/python/__pycache__/mymodule.cpython-39.pyc +0 -0
  107. data/lib/bioroebe/python/gui/gtk3/all_in_one.css +4 -0
  108. data/lib/bioroebe/python/gui/gtk3/all_in_one.py +59 -0
  109. data/lib/bioroebe/python/gui/gtk3/widget1.py +20 -0
  110. data/lib/bioroebe/python/gui/tkinter/all_in_one.py +91 -0
  111. data/lib/bioroebe/python/mymodule.py +8 -0
  112. data/lib/bioroebe/python/protein_to_dna.py +33 -0
  113. data/lib/bioroebe/python/shell/shell.py +19 -0
  114. data/lib/bioroebe/python/to_rna.py +14 -0
  115. data/lib/bioroebe/python/toplevel_methods/esystem.py +12 -0
  116. data/lib/bioroebe/python/toplevel_methods/open_in_browser.py +20 -0
  117. data/lib/bioroebe/python/toplevel_methods/palindromes.py +42 -0
  118. data/lib/bioroebe/python/toplevel_methods/rds.py +13 -0
  119. data/lib/bioroebe/python/toplevel_methods/shuffleseq.py +23 -0
  120. data/lib/bioroebe/python/toplevel_methods/three_delimiter.py +37 -0
  121. data/lib/bioroebe/python/toplevel_methods/time_and_date.py +43 -0
  122. data/lib/bioroebe/python/toplevel_methods/to_camelcase.py +21 -0
  123. data/lib/bioroebe/requires/require_the_bioroebe_project.rb +3 -1
  124. data/lib/bioroebe/sequence/nucleotide_module/nucleotide_module.rb +28 -25
  125. data/lib/bioroebe/sequence/protein.rb +105 -3
  126. data/lib/bioroebe/sequence/sequence.rb +61 -2
  127. data/lib/bioroebe/shell/menu.rb +3819 -3713
  128. data/lib/bioroebe/shell/misc.rb +51 -4311
  129. data/lib/bioroebe/shell/readline/readline.rb +1 -1
  130. data/lib/bioroebe/shell/shell.rb +11250 -28
  131. data/lib/bioroebe/siRNA/siRNA.rb +81 -1
  132. data/lib/bioroebe/string_matching/find_longest_substring.rb +3 -2
  133. data/lib/bioroebe/string_matching/hamming_distance.rb +1 -9
  134. data/lib/bioroebe/taxonomy/class_methods.rb +3 -8
  135. data/lib/bioroebe/taxonomy/constants.rb +4 -3
  136. data/lib/bioroebe/taxonomy/edit.rb +2 -1
  137. data/lib/bioroebe/taxonomy/help/help.rb +10 -10
  138. data/lib/bioroebe/taxonomy/info/check_available.rb +15 -9
  139. data/lib/bioroebe/taxonomy/info/info.rb +18 -11
  140. data/lib/bioroebe/taxonomy/info/is_dna.rb +46 -36
  141. data/lib/bioroebe/taxonomy/interactive.rb +140 -104
  142. data/lib/bioroebe/taxonomy/menu.rb +27 -18
  143. data/lib/bioroebe/taxonomy/parse_fasta.rb +3 -1
  144. data/lib/bioroebe/taxonomy/shared.rb +1 -0
  145. data/lib/bioroebe/taxonomy/taxonomy.rb +1 -0
  146. data/lib/bioroebe/toplevel_methods/aminoacids_and_proteins.rb +31 -24
  147. data/lib/bioroebe/toplevel_methods/colourize_related_methods.rb +164 -0
  148. data/lib/bioroebe/toplevel_methods/databases.rb +1 -1
  149. data/lib/bioroebe/toplevel_methods/fasta_and_fastq.rb +107 -63
  150. data/lib/bioroebe/toplevel_methods/file_and_directory_related_actions.rb +14 -2
  151. data/lib/bioroebe/toplevel_methods/misc.rb +118 -11
  152. data/lib/bioroebe/toplevel_methods/nucleotides.rb +22 -5
  153. data/lib/bioroebe/toplevel_methods/open_in_browser.rb +2 -0
  154. data/lib/bioroebe/toplevel_methods/palindromes.rb +1 -2
  155. data/lib/bioroebe/toplevel_methods/taxonomy.rb +2 -2
  156. data/lib/bioroebe/toplevel_methods/to_camelcase.rb +5 -0
  157. data/lib/bioroebe/utility_scripts/align_open_reading_frames.rb +1 -9
  158. data/lib/bioroebe/utility_scripts/check_for_mismatches/check_for_mismatches.rb +1 -9
  159. data/lib/bioroebe/utility_scripts/compacter.rb +1 -9
  160. data/lib/bioroebe/utility_scripts/compseq/compseq.rb +1 -9
  161. data/lib/bioroebe/utility_scripts/create_batch_entrez_file.rb +1 -9
  162. data/lib/bioroebe/utility_scripts/dot_alignment.rb +1 -9
  163. data/lib/bioroebe/utility_scripts/move_file_to_its_correct_location.rb +1 -4
  164. data/lib/bioroebe/utility_scripts/showorf/constants.rb +0 -5
  165. data/lib/bioroebe/utility_scripts/showorf/reset.rb +1 -4
  166. data/lib/bioroebe/version/version.rb +2 -2
  167. data/lib/bioroebe/www/embeddable_interface.rb +101 -52
  168. data/lib/bioroebe/www/sinatra/sinatra.rb +186 -70
  169. data/lib/bioroebe/yaml/aminoacids/amino_acids_long_name_to_one_letter.yml +2 -2
  170. data/lib/bioroebe/yaml/configuration/browser.yml +1 -1
  171. data/lib/bioroebe/yaml/genomes/README.md +3 -4
  172. data/lib/bioroebe/yaml/restriction_enzymes/restriction_enzymes.yml +3 -3
  173. metadata +69 -64
  174. data/doc/setup.rb +0 -1655
  175. data/lib/bioroebe/fasta_and_fastq/parse_fasta/constants.rb +0 -50
  176. data/lib/bioroebe/fasta_and_fastq/parse_fasta/initialize.rb +0 -86
  177. data/lib/bioroebe/fasta_and_fastq/parse_fasta/menu.rb +0 -117
  178. data/lib/bioroebe/fasta_and_fastq/parse_fasta/misc.rb +0 -981
  179. data/lib/bioroebe/fasta_and_fastq/parse_fasta/report.rb +0 -156
  180. data/lib/bioroebe/fasta_and_fastq/parse_fasta/reset.rb +0 -128
  181. data/lib/bioroebe/genbank/genbank_parser.rb +0 -291
  182. data/lib/bioroebe/java/bioroebe/Base.class +0 -0
  183. data/lib/bioroebe/java/bioroebe/Codons.java +0 -22
  184. data/lib/bioroebe/java/bioroebe/PartnerNucleotide.class +0 -0
  185. data/lib/bioroebe/java/bioroebe/PartnerNucleotide.java +0 -19
  186. data/lib/bioroebe/java/bioroebe.jar +0 -0
  187. data/lib/bioroebe/shell/add.rb +0 -108
  188. data/lib/bioroebe/shell/assign.rb +0 -360
  189. data/lib/bioroebe/shell/chop_and_cut.rb +0 -281
  190. data/lib/bioroebe/shell/constants.rb +0 -166
  191. data/lib/bioroebe/shell/download.rb +0 -335
  192. data/lib/bioroebe/shell/enable_and_disable.rb +0 -158
  193. data/lib/bioroebe/shell/enzymes.rb +0 -310
  194. data/lib/bioroebe/shell/fasta.rb +0 -345
  195. data/lib/bioroebe/shell/gtk.rb +0 -76
  196. data/lib/bioroebe/shell/history.rb +0 -132
  197. data/lib/bioroebe/shell/initialize.rb +0 -217
  198. data/lib/bioroebe/shell/loop.rb +0 -74
  199. data/lib/bioroebe/shell/prompt.rb +0 -107
  200. data/lib/bioroebe/shell/random.rb +0 -289
  201. data/lib/bioroebe/shell/reset.rb +0 -335
  202. data/lib/bioroebe/shell/scan_and_parse.rb +0 -135
  203. data/lib/bioroebe/shell/search.rb +0 -337
  204. data/lib/bioroebe/shell/sequences.rb +0 -200
  205. data/lib/bioroebe/shell/show_report_and_display.rb +0 -2901
  206. data/lib/bioroebe/shell/startup.rb +0 -127
  207. data/lib/bioroebe/shell/taxonomy.rb +0 -14
  208. data/lib/bioroebe/shell/tk.rb +0 -23
  209. data/lib/bioroebe/shell/user_input.rb +0 -88
  210. data/lib/bioroebe/shell/xorg.rb +0 -45
@@ -0,0 +1,164 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === Bioroebe::Colourize
6
+ #
7
+ # This file can be used to colourize a string representing DNA (in fasta
8
+ # format), for use (or display) on a website. HTML colour code and CSS
9
+ # rules will be used.
10
+ #
11
+ # The colour to use can be passed via the second method to four of the
12
+ # module-level methods in this file.
13
+ # =========================================================================== #
14
+ module Bioroebe
15
+
16
+ module Colourize # === Bioroebe::Colourize
17
+
18
+ require 'bioroebe/colours/colours.rb'
19
+ require 'bioroebe/toplevel_methods/e.rb'
20
+ require 'bioroebe/toplevel_methods/file_and_directory_related_actions.rb'
21
+
22
+ # ========================================================================= #
23
+ # === Bioroebe::Colourize.generate_HTML_page_via_this_input
24
+ #
25
+ # This method will generate a .html page, using the default colourization
26
+ # rules defined in this file here.
27
+ # ========================================================================= #
28
+ def self.generate_HTML_page_via_this_input(i)
29
+ if i.is_a? Array
30
+ i = i.join(' ').strip
31
+ end
32
+ what = "<!DOCTYPE html>\n<html lang=\"en\"><head>"\
33
+ "<title>Colourized FASTA Sequence</title><style>\n".dup
34
+ what << "#{return_default_CSS_rules_to_use}\n\n"
35
+ what << "</style>\n</head>\n<body>\n"
36
+ result = colourize_this_FASTA_sequence(i)
37
+ what << "#{result}</body></html>\n"
38
+ # ======================================================================= #
39
+ # The name of the generated file is determined by the input
40
+ # argument given.
41
+ # ======================================================================= #
42
+ into = File.basename(i).delete_suffix(File.extname(i))+
43
+ '.html'
44
+ if File.exist? into
45
+ e 'Can not store into an already existing file.'
46
+ else
47
+ e 'Storing into the file '+::Bioroebe.sfile(into)+' next.'
48
+ ::Bioroebe.write_what_into(what, into)
49
+ end
50
+ end
51
+
52
+ # ========================================================================= #
53
+ # === Bioroebe::Colourize.return_default_CSS_rules_to_use
54
+ # ========================================================================= #
55
+ def self.return_default_CSS_rules_to_use
56
+ return '.lightgreen {
57
+ color: lightgreen;
58
+ }
59
+
60
+ .lightblue {
61
+ color: lightblue;
62
+ }
63
+
64
+ .mediumslateblue {
65
+ color: lightblue;
66
+ }
67
+
68
+ .olivedrab {
69
+ color: olivedrab;
70
+ }
71
+
72
+ body {
73
+ background-color: black;
74
+ color: white;
75
+ font-family: monospace;
76
+ font-size: 2em;
77
+ }'
78
+ end
79
+
80
+ # ========================================================================= #
81
+ # === Bioroebe::Colourize.colourize_this_FASTA_sequence
82
+ # ========================================================================= #
83
+ def self.colourize_this_FASTA_sequence(
84
+ i = ARGV
85
+ )
86
+ if i.is_a? Array
87
+ i = i.join(' ').strip
88
+ end
89
+ if i and File.file?(i)
90
+ # unless Bioroebe.const_defined?(:ParseFasta)
91
+ # require 'bioroebe/fasta_and_fastq/parse_fasta/parse_fasta.rb'
92
+ # end
93
+ # i = Bioroebe::ParseFasta.new(i) { :be_quiet }.sequence?
94
+ i = File.readlines(i).reject {|line|
95
+ line.start_with?('#','>')
96
+ }.join("\n")
97
+ end
98
+ result = colourize_TUG_start_codon(i)
99
+ result = colourize_TAG_stop_codon(result)
100
+ result = colourize_TAA_stop_codon(result)
101
+ result = colourize_TGA_stop_codon(result)
102
+ return result
103
+ end
104
+
105
+ # ========================================================================= #
106
+ # === Bioroebe::Colourize.colourize_TAG_stop_codon
107
+ # ========================================================================= #
108
+ def self.colourize_TAG_stop_codon(
109
+ i = '',
110
+ use_this_colour = :lightblue
111
+ )
112
+ return i.gsub(
113
+ /(TA\n?G)/,
114
+ '<span class="'+use_this_colour.to_s+'">\1</span>'
115
+ )
116
+ end
117
+
118
+ # ========================================================================= #
119
+ # === Bioroebe::Colourize.colourize_TAA_stop_codon
120
+ # ========================================================================= #
121
+ def self.colourize_TAA_stop_codon(
122
+ i = '',
123
+ use_this_colour = :lightgreen
124
+ )
125
+ return i.gsub(
126
+ /(TA\n?A)/,
127
+ '<span class="'+use_this_colour.to_s+'">\1</span>'
128
+ )
129
+ end
130
+
131
+ # ========================================================================= #
132
+ # === Bioroebe::Colourize.colourize_TGA_stop_codon
133
+ # ========================================================================= #
134
+ def self.colourize_TGA_stop_codon(
135
+ i = '',
136
+ use_this_colour = :olivedrab
137
+ )
138
+ return i.gsub(
139
+ /(TG\n?A)/,
140
+ '<span class="'+use_this_colour.to_s+'">\1</span>'
141
+ )
142
+ end
143
+
144
+ # ========================================================================= #
145
+ # === Bioroebe::Colourize.colourize_TUG_start_codon
146
+ # ========================================================================= #
147
+ def self.colourize_TUG_start_codon(
148
+ i = '',
149
+ use_this_colour = :mediumslateblue
150
+ )
151
+ return i.gsub(
152
+ /(TU\n?G)/,
153
+ '<span class="'+use_this_colour.to_s+'">\1</span>'
154
+ )
155
+ end
156
+
157
+ end; end
158
+
159
+
160
+ if __FILE__ == $PROGRAM_NAME
161
+ alias e puts
162
+ # e Bioroebe::Colourize.colourize_this_FASTA_sequence(ARGV)
163
+ Bioroebe::Colourize.generate_HTML_page_via_this_input(ARGV)
164
+ end # colourizerelatedmethods alu_elements.fasta
@@ -15,7 +15,7 @@ module Bioroebe
15
15
  # can pass the password for the postgreSQL database.
16
16
  # ========================================================================= #
17
17
  def self.set_pgpassword(
18
- new_password = POSTGRE_PASSWORD
18
+ new_password = Bioroebe::Postgresql::POSTGRE_PASSWORD
19
19
  )
20
20
  ENV['PGPASSWORD'] = new_password
21
21
  end; self.instance_eval { alias set_password set_pgpassword } # === Bioroebe.set_password
@@ -49,68 +49,6 @@ module Bioroebe
49
49
  end
50
50
  end
51
51
 
52
- # ========================================================================= #
53
- # === Bioroebe.colourize_this_fasta_dna_sequence
54
- #
55
- # This toplevel method can be used to colourize a FASTA (DNA)
56
- # sequence, e. g. "ATGCGCGTATTA" and so forth.
57
- #
58
- # Note that this is intended for the commandline, that is to be
59
- # displayed on e. g. a KDE Konsole terminal.
60
- #
61
- # Usage example:
62
- #
63
- # puts Bioroebe.colourize_this_fasta_dna_sequence('ATGCGCATGCGCGTATTAGTATTAATGCGCGTATTAATGCGCGTATTA')
64
- #
65
- # ========================================================================= #
66
- def self.colourize_this_fasta_dna_sequence(
67
- i = nil
68
- )
69
- if i.nil?
70
- e 'Please provide a valid FASTA sequence as input to '\
71
- 'Bioroebe.colourize_this_fasta_dna_sequence()'
72
- return
73
- end
74
- if i.is_a? Array
75
- # ===================================================================== #
76
- # Arrays will be joined together.
77
- # ===================================================================== #
78
- i = i.join(' ').strip
79
- end
80
- if i.is_a? String
81
- # ===================================================================== #
82
- # The colours are either defined in a file called
83
- # 'colourize_fasta_sequences.yml' or they are simply hardcoded.
84
- #
85
- # The preferred (and thus default) way is to simply make use
86
- # of that .yml file. That works on my home system, so it
87
- # should work for other people as well.
88
- # ===================================================================== #
89
- if use_colours?
90
- i = i.dup if i.frozen?
91
- this_file = FILE_COLOURIZE_FASTA_SEQUENCES
92
- if File.exist? this_file
93
- dataset_for_the_colours = YAML.load_file(this_file)
94
- dataset_for_the_colours.each_pair {|this_nucleotide, this_colour_to_be_used|
95
- i.gsub!(
96
- /#{this_nucleotide}/,
97
- send(this_colour_to_be_used, this_nucleotide)+
98
- rev
99
- )
100
- }
101
- else
102
- i.gsub!(/A/, "#{teal('A')}#{rev}")
103
- i.gsub!(/C/, "#{slateblue('C')}#{rev}")
104
- i.gsub!(/G/, "#{royalblue('G')}#{rev}")
105
- i.gsub!(/T/, "#{steelblue('T')}#{rev}")
106
- i.gsub!(/U/, "#{steelblue('U')}#{rev}") # Uracil is just the same as Thymine.
107
- end
108
- end
109
- end
110
- i
111
- end; self.instance_eval { alias colourize_this_fasta_sequence colourize_this_fasta_dna_sequence } # === Bioroebe.colourize_this_fasta_sequence
112
- self.instance_eval { alias colourized_parse_fasta colourize_this_fasta_dna_sequence } # === Bioroebe.colourized_parse_fasta
113
-
114
52
  # ========================================================================= #
115
53
  # === Bioroebe.calculate_weight_of_the_aminoacids_in_this_fasta_file
116
54
  #
@@ -317,13 +255,119 @@ module Bioroebe
317
255
  end
318
256
  end
319
257
 
258
+ # ========================================================================= #
259
+ # === Bioroebe.colourize_this_fasta_dna_sequence
260
+ #
261
+ # This toplevel method can be used to colourize a FASTA (DNA)
262
+ # sequence, e. g. "ATGCGCGTATTA" and so forth.
263
+ #
264
+ # Note that this is intended for the commandline, that is to be
265
+ # displayed on e. g. a KDE Konsole terminal.
266
+ #
267
+ # Usage examples:
268
+ #
269
+ # puts Bioroebe.colourize_this_fasta_dna_sequence('ATGCGCATGCGCGTATTAGTATTAATGCGCGTATTAATGCGCGTATTA')
270
+ # puts Bioroebe.colourize_this_fasta_dna_sequence('ATGCGCATGCGCGTATTAGTATTAATGCGCGTATTAATGCGCGTATTA') { :with_ruler }
271
+ # puts Bioroebe.colourize_this_fasta_dna_sequence('TGCGCGTATTAGTATTAATGCGCGTATTAATGCGCGTATTA') { :with_ruler_steelblue_colour }
272
+ #
273
+ # ========================================================================= #
274
+ def self.colourize_this_fasta_dna_sequence(
275
+ i = nil,
276
+ &block
277
+ )
278
+ unless ::Bioroebe.respond_to?(:ruler_return_as_string_without_colours)
279
+ require 'bioroebe/misc/ruler.rb'
280
+ end
281
+ if i.nil?
282
+ e 'Please provide a valid FASTA sequence as input to '\
283
+ 'Bioroebe.colourize_this_fasta_dna_sequence()'
284
+ return
285
+ end
286
+ if i.is_a? Array
287
+ # ===================================================================== #
288
+ # Arrays will be joined together.
289
+ # ===================================================================== #
290
+ i = i.join(' ').strip
291
+ end
292
+ # ======================================================================= #
293
+ # Check for existing files next:
294
+ # ======================================================================= #
295
+ if i and File.file?(i)
296
+ i = File.read(i)
297
+ end
298
+ original_input = i.dup
299
+ i = i.dup # Always dup it here.
300
+ if i.is_a? String
301
+ # ===================================================================== #
302
+ # The colours are either defined in a file called
303
+ # 'colourize_fasta_sequences.yml' or they are simply hardcoded.
304
+ #
305
+ # The preferred (and thus default) way is to simply make use
306
+ # of that .yml file. That works on my home system, so it
307
+ # should work for other people as well.
308
+ # ===================================================================== #
309
+ if use_colours?
310
+ this_file = FILE_COLOURIZE_FASTA_SEQUENCES
311
+ if File.exist? this_file
312
+ dataset_for_the_colours = YAML.load_file(this_file)
313
+ dataset_for_the_colours.each_pair {|this_nucleotide, this_colour_to_be_used|
314
+ i.gsub!(
315
+ /#{this_nucleotide}/,
316
+ Colours.send(this_colour_to_be_used, this_nucleotide)+
317
+ rev
318
+ )
319
+ }
320
+ else
321
+ i.gsub!(/A/, "#{teal('A')}#{rev}")
322
+ i.gsub!(/C/, "#{slateblue('C')}#{rev}")
323
+ i.gsub!(/G/, "#{royalblue('G')}#{rev}")
324
+ i.gsub!(/T/, "#{steelblue('T')}#{rev}")
325
+ i.gsub!(/U/, "#{steelblue('U')}#{rev}") # Uracil is just the same as Thymine.
326
+ end
327
+ end
328
+ end
329
+ # ======================================================================= #
330
+ # === Handle blocks next
331
+ # ======================================================================= #
332
+ if block_given?
333
+ yielded = yield
334
+ case yielded
335
+ # ===================================================================== #
336
+ # === with_ruler
337
+ # ===================================================================== #
338
+ when :with_ruler,
339
+ :add_ruler,
340
+ :ruler
341
+ i.prepend(
342
+ ::Bioroebe.ruler_return_as_string_without_colours(original_input)+
343
+ "\n"
344
+ )
345
+ else # Assume something like:
346
+ # :with_ruler_steelblue_colour
347
+ if yielded.to_s.include? 'colo' # This assumes "colour" or "color".
348
+ use_this_colour = yielded.to_s.sub(/_colou?r/,'').
349
+ sub(/with_ruler_/,'')
350
+ this_string = send(use_this_colour,
351
+ ::Bioroebe.ruler_return_as_string_without_colours(original_input)+
352
+ "\n"
353
+ )
354
+ i.prepend(this_string)
355
+ end
356
+ end
357
+ end
358
+ return i
359
+ end; self.instance_eval { alias colourize_this_fasta_sequence colourize_this_fasta_dna_sequence } # === Bioroebe.colourize_this_fasta_sequence
360
+ self.instance_eval { alias colourized_parse_fasta colourize_this_fasta_dna_sequence } # === Bioroebe.colourized_parse_fasta
361
+
320
362
  # ========================================================================= #
321
363
  # === Bioroebe.show_fasta_header
322
364
  #
323
365
  # This ad-hoc method can be used to quickly show the first line of an
324
366
  # assumed .fasta file.
325
367
  # ========================================================================= #
326
- def self.show_fasta_header(of_this_file)
368
+ def self.show_fasta_header(
369
+ of_this_file
370
+ )
327
371
  if of_this_file.is_a? Array
328
372
  of_this_file = of_this_file.first
329
373
  end
@@ -13,6 +13,13 @@ module Bioroebe
13
13
  require 'bioroebe/colours/sfile.rb'
14
14
  require 'bioroebe/colours/sdir.rb'
15
15
 
16
+ # ========================================================================= #
17
+ # === Bioroebe.move_file
18
+ # ========================================================================= #
19
+ def self.move_file(a, b)
20
+ FileUtils.mv(a, b)
21
+ end
22
+
16
23
  # ========================================================================= #
17
24
  # === Bioroebe.pwd (pwd tag)
18
25
  #
@@ -134,6 +141,9 @@ module Bioroebe
134
141
  be_verbose = false
135
142
  )
136
143
  case be_verbose
144
+ # ======================================================================= #
145
+ # === :do_report_current_directory
146
+ # ======================================================================= #
137
147
  when :do_report_current_directory,
138
148
  :be_verbose
139
149
  be_verbose = true
@@ -160,12 +170,14 @@ module Bioroebe
160
170
  # Bioroebe.save_dir? is defined in bioroebe/toplevel_methods/store_here.rb.
161
171
  # ======================================================================= #
162
172
  when 'base',
163
- 'logdir'
173
+ 'logdir',
174
+ :bioroebe_log_directory
164
175
  # ===================================================================== #
165
176
  # Enter the main log dir, unless a file exists with the same name.
166
177
  # ===================================================================== #
167
- i = save_dir? unless File.exist? i
178
+ i = save_dir? unless File.exist?(i.to_s) # .to_s to avoid Symbols here.
168
179
  end
180
+ i = i.dup if i.is_a?(String) and i.frozen?
169
181
  i << '/' unless i.end_with? '/'
170
182
  if File.directory? i
171
183
  e sdir(i) if be_verbose # Also colourize the directory and output it.
@@ -14,21 +14,41 @@ module Bioroebe
14
14
  require 'bioroebe/toplevel_methods/e.rb'
15
15
  require 'bioroebe/toplevel_methods/esystem.rb'
16
16
  require 'bioroebe/toplevel_methods/extract.rb'
17
+ #require 'bioroebe/toplevel_methods/file_and_directory_related_actions.rb'
17
18
 
18
19
  # ========================================================================= #
19
- # === Bioroebe.thousand_percentage
20
+ # === Bioroebe.create_jar_archive
21
+ #
22
+ # This method will create a .jar file.
23
+ #
24
+ # To invoke it from the commandline do:
25
+ #
26
+ # bioroebe --jar
27
+ #
28
+ # To execute a .jar file do:
29
+ #
30
+ # java -jar foobar.jar
20
31
  #
21
- # This method is solely a helper-method for Bioroebe.frequency_per_thousand().
22
32
  # ========================================================================= #
23
- def self.thousand_percentage(
24
- this_codon_n_times = 1,
25
- total_n_elements = 1000
26
- )
27
- result = (
28
- (this_codon_n_times * 1000.0) / total_n_elements.to_f
29
- ).round(1)
30
- padded_result = result.to_s.rjust(5, ' ')
31
- return padded_result
33
+ def self.create_jar_archive
34
+ e 'Creating a .jar archive next:'
35
+ e
36
+ original_dir = return_pwd
37
+ cd '/home/x/programming/ruby/src/bioroebe/lib/bioroebe/java/bioroebe/src/main/java/'
38
+ esystem 'jar cf bioroebe.jar bioroebe/'
39
+ target_file = File.absolute_path('bioroebe.jar')
40
+ cd original_dir
41
+ if File.exist? target_file
42
+ e 'Moving the created .jar file into the current working '\
43
+ 'directory next.'
44
+ move_file(target_file, original_dir)
45
+ e 'It should now be at:'
46
+ e
47
+ e sfile(" #{original_dir}#{File.basename(target_file)}")
48
+ e
49
+ end
50
+ # esystem 'jar cfe bioroebe.jar myClass myClass.class'
51
+ e
32
52
  end
33
53
 
34
54
  # ========================================================================= #
@@ -86,6 +106,7 @@ EOF
86
106
  # Usage example:
87
107
  #
88
108
  # Bioroebe.codon_frequency_of_this_string
109
+ # Bioroebe.codon_frequency_of_this_string 'ATTCGTACGATCGACTACTACT' # => {"UAC"=>2, "GAC"=>1, "AUC"=>1, "ACG"=>1, "CGU"=>1, "AUU"=>1}
89
110
  #
90
111
  # ========================================================================= #
91
112
  def self.codon_frequency_of_this_string(
@@ -107,6 +128,22 @@ EOF
107
128
  return sorted_hash
108
129
  end
109
130
 
131
+ # ========================================================================= #
132
+ # === Bioroebe.thousand_percentage
133
+ #
134
+ # This method is solely a helper-method for Bioroebe.frequency_per_thousand().
135
+ # ========================================================================= #
136
+ def self.thousand_percentage(
137
+ this_codon_n_times = 1,
138
+ total_n_elements = 1000
139
+ )
140
+ result = (
141
+ (this_codon_n_times * 1000.0) / total_n_elements.to_f
142
+ ).round(1)
143
+ padded_result = result.to_s.rjust(5, ' ')
144
+ return padded_result
145
+ end
146
+
110
147
  # ========================================================================= #
111
148
  # === Bioroebe.align_this_string_via_multiple_sequence_alignment
112
149
  #
@@ -420,6 +457,76 @@ EOF
420
457
  end; self.instance_eval { alias on_windows? windows_platform? } # === Bioroebe.on_windows?
421
458
  self.instance_eval { alias is_on_windows? windows_platform? } # === Bioroebe.is_on_windows?
422
459
 
460
+ # ========================================================================= #
461
+ # === Bioroebe.two_dimensional_plot
462
+ #
463
+ # This method makes use of gnuplot to draw a 2D plot.
464
+ #
465
+ # The first argument should contain your dataset, as a String.
466
+ # ========================================================================= #
467
+ def self.two_dimensional_plot(
468
+ dataset = '6 12
469
+ 8 14
470
+ 10 18
471
+ 12 23
472
+ 14 28
473
+ 16 29
474
+ 18 26
475
+ 20 23
476
+ 22 20',
477
+ optional_hash = {
478
+ width: 800,
479
+ height: 640
480
+ }
481
+ )
482
+ # ======================================================================= #
483
+ # Provide some generic fall-back values for width and height next:
484
+ # ======================================================================= #
485
+ width = 1000
486
+ height = 800
487
+ _ = optional_hash
488
+ if _.is_a? Hash
489
+ # ===================================================================== #
490
+ # === :width
491
+ # ===================================================================== #
492
+ if _.has_key? :width
493
+ width = _.delete(:width)
494
+ end
495
+ # ===================================================================== #
496
+ # === :height
497
+ # ===================================================================== #
498
+ if _.has_key? :height
499
+ height = _.delete(:height)
500
+ end
501
+ end
502
+ # ======================================================================= #
503
+ # Go to a safe base directory.
504
+ # ======================================================================= #
505
+ cd :bioroebe_log_directory
506
+ mkdir 'gnuplot' unless File.directory?('gnuplot')
507
+ cd 'gnuplot'
508
+ # ======================================================================= #
509
+ # First save the dataset into dataset.md:
510
+ # ======================================================================= #
511
+ into = File.absolute_path('dataset.md')
512
+ e 'Storing the dataset into '+sfile(into)+' next.'
513
+ write_what_into(dataset, into)
514
+ what = <<-EOF
515
+
516
+ set terminal png size #{width},#{height} enhanced font "Helvetica, 18"
517
+ set output 'fancy_graph.png'
518
+ plot '#{into}' with linespoints ls 1 notitle
519
+
520
+ EOF
521
+ into = File.absolute_path('gnuplot.file')
522
+ e 'Storing into '+into+'.'
523
+ write_what_into(what, into)
524
+ esystem 'gnuplot '+into
525
+ if File.exist? 'fancy_graph.png' and is_on_roebe?
526
+ Open.in_browser('fancy_graph.png')
527
+ end
528
+ end
529
+
423
530
  end
424
531
 
425
532
  if __FILE__ == $PROGRAM_NAME
@@ -270,12 +270,19 @@ module Bioroebe
270
270
  # Bioroebe.random_dna 15 # => "TTGGTAAGCTCTTTA"
271
271
  # Bioroebe.random_dna 25 # => "TTAGCACAAGCATGGACGGACCAGA"
272
272
  # Bioroebe.random_dna(50, { A: 10, T: 10, C: 10, G: 70}) # => "GGGGTGGGGAGGGTATGCGGAGGAAGGGCGGGAAGGGCGGGGGCTGGGCG"
273
+ # Bioroebe.random_dna(20, 'ATGGGGGGGG') # => "TGAGGGGGGGGGTGGGAGGG"
274
+ # Bioroebe.random_dna(20, 'ATGGGGGGGG') # => "GGTAGGGGGGGGTAGGGGGG"
273
275
  #
274
276
  # ========================================================================= #
275
277
  def self.generate_random_dna_sequence(
276
- i = ARGV,
277
- optional_hash_with_the_frequencies = {}
278
+ i = ARGV,
279
+ optional_hash_with_the_frequencies = {} # ← This may be a String too, mind you.
278
280
  )
281
+ # ======================================================================= #
282
+ # First define our result-String. This one will be returned by this
283
+ # method.
284
+ # ======================================================================= #
285
+ result = ''.dup
279
286
  _ = Bioroebe::DNA_NUCLEOTIDES # Get a handle to the four DNA nucleotides.
280
287
  if i.is_a? Array
281
288
  i = i.join.strip
@@ -284,9 +291,19 @@ module Bioroebe
284
291
  when :default
285
292
  i = 250
286
293
  end
287
- i = i.to_i
288
- result = ''.dup
289
- if optional_hash_with_the_frequencies.empty?
294
+ i = i.to_i # This is "n times".
295
+ # ======================================================================= #
296
+ # First handle the case where the user passed a String:
297
+ # ======================================================================= #
298
+ if optional_hash_with_the_frequencies.is_a? String
299
+ pool = optional_hash_with_the_frequencies.dup.chars.shuffle
300
+ i.times {
301
+ if pool.size == 0
302
+ pool = optional_hash_with_the_frequencies.dup.chars.shuffle
303
+ end
304
+ result << pool.pop
305
+ }
306
+ elsif optional_hash_with_the_frequencies.empty?
290
307
  # ===================================================================== #
291
308
  # This is the default clause.
292
309
  # ===================================================================== #
@@ -18,6 +18,8 @@ module Bioroebe
18
18
  # This constant specifies the default browser to use for the
19
19
  # bioroebe-project.
20
20
  # ========================================================================= #
21
+ # /home/x/programming/ruby/src/bioroebe/lib/bioroebe/yaml/configuration/browser.yml
22
+ # ========================================================================= #
21
23
  if File.exist? "#{project_yaml_directory?}browser.yml"
22
24
  USE_THIS_BROWSER = YAML.load_file(FILE_BROWSER)
23
25
  elsif ENV['BROWSER']
@@ -115,8 +115,7 @@ module Bioroebe
115
115
  end
116
116
 
117
117
  if __FILE__ == $PROGRAM_NAME
118
- pp Bioroebe.every_reverse_palindrome_in_this_string(ARGV)
119
- exit
118
+ pp Bioroebe.every_reverse_palindrome_in_this_string(ARGV)
120
119
  if ARGV.empty?
121
120
  p 'GAATTC: '+Bioroebe.is_palindrome?('GAATTC').to_s # => true
122
121
  p 'GAATTCCC: '+Bioroebe.is_palindrome?('GAATTCCC').to_s # => false
@@ -141,8 +141,8 @@ module Taxonomy # === Bioroebe::Taxonomy
141
141
  end
142
142
  end
143
143
  if be_verbose
144
- e 'Now trying to change to the base directory at '+
145
- ::Bioroebe.sdir(this_dir)+'.'
144
+ e "Now trying to change to the base directory at "\
145
+ "#{::Bioroebe.sdir(this_dir)}."
146
146
  end
147
147
  cd this_dir
148
148
  e N+'We will next attempt to download the file `'+
@@ -11,6 +11,11 @@ module Bioroebe
11
11
  # === Bioroebe.to_camelcase
12
12
  #
13
13
  # Convert the given String (the input) into a camelcased variant.
14
+ #
15
+ # Usage example:
16
+ #
17
+ # Bioroebe.to_camelcase('foo_bar') # => "FooBar"
18
+ #
14
19
  # ========================================================================= #
15
20
  def self.to_camelcase(i)
16
21
  if i.is_a? Array
@@ -35,11 +35,6 @@ class AlignOpenReadingFrames < ::Bioroebe::CommandlineApplication # === Bioroebe
35
35
  require 'bioroebe/regexes/regexes.rb'
36
36
  require 'bioroebe/codons/codons.rb'
37
37
 
38
- # ========================================================================= #
39
- # === NAMESPACE
40
- # ========================================================================= #
41
- NAMESPACE = inspect
42
-
43
38
  # ========================================================================= #
44
39
  # === START_CODON
45
40
  # ========================================================================= #
@@ -67,10 +62,7 @@ class AlignOpenReadingFrames < ::Bioroebe::CommandlineApplication # === Bioroebe
67
62
  # ========================================================================= #
68
63
  def reset
69
64
  super()
70
- # ======================================================================= #
71
- # === @namespace
72
- # ======================================================================= #
73
- @namespace = NAMESPACE
65
+ infer_the_namespace
74
66
  end
75
67
 
76
68
  # ========================================================================= #