bioroebe 0.10.80 → 0.12.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of bioroebe might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +3612 -2781
- data/bin/bioroebe +7 -1
- data/bin/bioroebe_hash +7 -0
- data/bin/codon_to_aminoacid +1 -0
- data/bioroebe.gemspec +3 -3
- data/doc/README.gen +3612 -2742
- data/doc/quality_control/commandline_applications.md +3 -3
- data/doc/todo/bioroebe_java_todo.md +22 -0
- data/doc/todo/bioroebe_todo.md +2059 -2615
- data/lib/bioroebe/aminoacids/aminoacid_substitution.rb +1 -9
- data/lib/bioroebe/aminoacids/codon_percentage.rb +1 -9
- data/lib/bioroebe/aminoacids/deduce_aminoacid_sequence.rb +1 -9
- data/lib/bioroebe/aminoacids/display_aminoacid_table.rb +1 -0
- data/lib/bioroebe/aminoacids/show_hydrophobicity.rb +1 -6
- data/lib/bioroebe/base/colours_for_base/colours_for_base.rb +18 -8
- data/lib/bioroebe/base/commandline_application/commandline_arguments.rb +15 -11
- data/lib/bioroebe/base/commandline_application/misc.rb +66 -49
- data/lib/bioroebe/base/commandline_application/opn.rb +8 -8
- data/lib/bioroebe/base/commandline_application/reset.rb +3 -2
- data/lib/bioroebe/base/misc.rb +35 -0
- data/lib/bioroebe/base/prototype/misc.rb +11 -1
- data/lib/bioroebe/codon_tables/frequencies/parse_frequency_table.rb +2 -10
- data/lib/bioroebe/codons/codons.rb +1 -1
- data/lib/bioroebe/codons/convert_this_codon_to_that_aminoacid.rb +192 -58
- data/lib/bioroebe/codons/possible_codons_for_this_aminoacid.rb +1 -9
- data/lib/bioroebe/codons/show_codon_tables.rb +6 -2
- data/lib/bioroebe/codons/show_codon_usage.rb +15 -4
- data/lib/bioroebe/colours/rev.rb +4 -1
- data/lib/bioroebe/constants/aminoacids_and_proteins.rb +1 -0
- data/lib/bioroebe/constants/database_constants.rb +1 -1
- data/lib/bioroebe/constants/files_and_directories.rb +31 -4
- data/lib/bioroebe/constants/misc.rb +20 -0
- data/lib/bioroebe/conversions/dna_to_aminoacid_sequence.rb +58 -24
- data/lib/bioroebe/count/count_amount_of_aminoacids.rb +3 -2
- data/lib/bioroebe/count/count_amount_of_nucleotides.rb +3 -0
- data/lib/bioroebe/crystal/README.md +2 -0
- data/lib/bioroebe/crystal/to_rna.cr +19 -0
- data/lib/bioroebe/data/README.md +11 -8
- data/lib/bioroebe/data/electron_microscopy/pos_example.pos +396 -0
- data/lib/bioroebe/data/electron_microscopy/test_particles.star +36 -0
- data/lib/bioroebe/data/fasta/human/Homo_sapiens_hemoglobin_subunit_alpha_HBB_mRNA.fasta +9 -0
- data/lib/bioroebe/data/fasta/human/Homo_sapiens_hemoglobin_subunit_beta_HBB_mRNA.fasta +8 -0
- data/lib/bioroebe/data/fasta/human/README.md +2 -0
- data/lib/bioroebe/electron_microscopy/coordinate_analyzer.rb +15 -18
- data/lib/bioroebe/{fasta_and_fastq/parse_fasta/run.rb → electron_microscopy/electron_microscopy_module.rb} +16 -8
- data/lib/bioroebe/electron_microscopy/fix_pos_file.rb +1 -9
- data/lib/bioroebe/electron_microscopy/flipy.rb +83 -0
- data/lib/bioroebe/electron_microscopy/parse_coordinates.rb +2 -10
- data/lib/bioroebe/electron_microscopy/read_file_xmd.rb +1 -9
- data/lib/bioroebe/electron_microscopy/simple_star_file_generator.rb +4 -9
- data/lib/bioroebe/enzymes/has_this_restriction_enzyme.rb +10 -3
- data/lib/bioroebe/enzymes/restriction_enzyme.rb +23 -1
- data/lib/bioroebe/enzymes/restriction_enzymes/statistics.rb +65 -0
- data/lib/bioroebe/fasta_and_fastq/autocorrect_the_name_of_this_fasta_file.rb +1 -9
- data/lib/bioroebe/fasta_and_fastq/compact_fasta_file/compact_fasta_file.rb +7 -9
- data/lib/bioroebe/fasta_and_fastq/fasta_defline/fasta_defline.rb +1 -5
- data/lib/bioroebe/fasta_and_fastq/fasta_to_yaml/fasta_to_yaml.rb +81 -0
- data/lib/bioroebe/fasta_and_fastq/parse_fasta/parse_fasta.rb +1465 -7
- data/lib/bioroebe/fasta_and_fastq/return_fasta_subsection_of_this_file.rb +11 -2
- data/lib/bioroebe/fasta_and_fastq/show_fasta_headers.rb +27 -12
- data/lib/bioroebe/fasta_and_fastq/simplify_fasta_header/simplify_fasta_header.rb +1 -5
- data/lib/bioroebe/fasta_and_fastq/split_this_fasta_file_into_chromosomes/constants.rb +0 -5
- data/lib/bioroebe/genome/README.md +4 -0
- data/lib/bioroebe/genome/genome.rb +67 -0
- data/lib/bioroebe/genomes/genome_pattern.rb +3 -9
- data/lib/bioroebe/gui/gtk +1 -0
- data/lib/bioroebe/gui/gtk3/alignment/alignment.rb +73 -128
- data/lib/bioroebe/gui/gtk3/controller/controller.rb +45 -27
- data/lib/bioroebe/gui/gtk3/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb +76 -50
- data/lib/bioroebe/gui/gtk3/fasta_table_widget/fasta_table_widget.rb +99 -21
- data/lib/bioroebe/gui/gtk3/hamming_distance/hamming_distance.rb +42 -28
- data/lib/bioroebe/gui/gtk3/nucleotide_analyser/nucleotide_analyser.rb +119 -71
- data/lib/bioroebe/gui/gtk3/protein_to_DNA/protein_to_DNA.rb +18 -18
- data/lib/bioroebe/gui/gtk3/random_sequence/random_sequence.rb +19 -11
- data/lib/bioroebe/gui/jruby/alignment/alignment.rb +165 -0
- data/lib/bioroebe/gui/libui/alignment/alignment.rb +3 -1
- data/lib/bioroebe/gui/libui/controller/controller.rb +116 -0
- data/lib/bioroebe/gui/libui/random_sequence/random_sequence.rb +18 -2
- data/lib/bioroebe/gui/libui/show_codon_table/show_codon_table.rb +2 -0
- data/lib/bioroebe/gui/libui/three_to_one/three_to_one.rb +8 -6
- data/lib/bioroebe/gui/shared_code/alignment/alignment_module.rb +102 -0
- data/lib/bioroebe/gui/shared_code/levensthein_distance/levensthein_distance_module.rb +18 -16
- data/lib/bioroebe/gui/shared_code/protein_to_DNA/protein_to_DNA_module.rb +14 -14
- data/lib/bioroebe/gui/swing/three_to_one/ThreeToOne$1.class +0 -0
- data/lib/bioroebe/gui/swing/three_to_one/ThreeToOne$CloseListener.class +0 -0
- data/lib/bioroebe/gui/swing/three_to_one/ThreeToOne.class +0 -0
- data/lib/bioroebe/gui/swing/three_to_one/ThreeToOne.java +141 -0
- data/lib/bioroebe/images/FORWARD_PRIMER.png +0 -0
- data/lib/bioroebe/images/REVERSE_PRIMER.png +0 -0
- data/lib/bioroebe/java/README.md +4 -0
- data/lib/bioroebe/java/bioroebe/Sequence.java +25 -1
- data/lib/bioroebe/java/bioroebe/src/main/java/bioroebe/Base.class +0 -0
- data/lib/bioroebe/java/bioroebe/{Base.java → src/main/java/bioroebe/Base.java} +15 -2
- data/lib/bioroebe/java/bioroebe/{BisulfiteTreatment.class → src/main/java/bioroebe/BisulfiteTreatment.class} +0 -0
- data/lib/bioroebe/java/bioroebe/{Codons.class → src/main/java/bioroebe/Codons.class} +0 -0
- data/lib/bioroebe/java/bioroebe/src/main/java/bioroebe/Codons.java +34 -0
- data/lib/bioroebe/java/bioroebe/src/main/java/bioroebe/Commandline.class +0 -0
- data/lib/bioroebe/java/bioroebe/src/main/java/bioroebe/Commandline.java +101 -0
- data/lib/bioroebe/java/bioroebe/{GenerateRandomDnaSequence.class → src/main/java/bioroebe/GenerateRandomDnaSequence.class} +0 -0
- data/lib/bioroebe/java/bioroebe/{GenerateRandomDnaSequence.java → src/main/java/bioroebe/GenerateRandomDnaSequence.java} +8 -2
- data/lib/bioroebe/java/bioroebe/{IsPalindrome.class → src/main/java/bioroebe/IsPalindrome.class} +0 -0
- data/lib/bioroebe/java/bioroebe/{IsPalindrome.java → src/main/java/bioroebe/IsPalindrome.java} +5 -1
- data/lib/bioroebe/java/bioroebe/src/main/java/bioroebe/PartnerNucleotide.class +0 -0
- data/lib/bioroebe/java/bioroebe/src/main/java/bioroebe/PartnerNucleotide.java +56 -0
- data/lib/bioroebe/java/bioroebe/{RemoveFile.java → src/main/java/bioroebe/RemoveFile.java} +10 -4
- data/lib/bioroebe/java/bioroebe/{RemoveNumbers.class → src/main/java/bioroebe/RemoveNumbers.class} +0 -0
- data/lib/bioroebe/java/bioroebe/{RemoveNumbers.java → src/main/java/bioroebe/RemoveNumbers.java} +1 -0
- data/lib/bioroebe/java/bioroebe/{ToCamelcase.class → src/main/java/bioroebe/ToCamelcase.class} +0 -0
- data/lib/bioroebe/java/bioroebe/{ToCamelcase.java → src/main/java/bioroebe/ToCamelcase.java} +3 -3
- data/lib/bioroebe/java/bioroebe/src/main/java/bioroebe/ToRNA.class +0 -0
- data/lib/bioroebe/java/bioroebe/src/main/java/bioroebe/ToRNA.java +42 -0
- data/lib/bioroebe/java/bioroebe/src/main/java/bioroebe/toplevel_methods/BaseComposition.class +0 -0
- data/lib/bioroebe/java/bioroebe/src/main/java/bioroebe/toplevel_methods/BaseComposition.java +75 -0
- data/lib/bioroebe/misc/ruler.rb +11 -2
- data/lib/bioroebe/nucleotides/most_likely_nucleotide_sequence_for_this_aminoacid_sequence.rb +1 -9
- data/lib/bioroebe/nucleotides/show_nucleotide_sequence.rb +7 -7
- data/lib/bioroebe/parsers/genbank_parser.rb +347 -26
- data/lib/bioroebe/parsers/gff.rb +1 -9
- data/lib/bioroebe/patterns/scan_for_repeat.rb +1 -5
- data/lib/bioroebe/pdb/fetch_fasta_sequence_from_pdb.rb +1 -9
- data/lib/bioroebe/pdb/parse_mmCIF_file.rb +1 -9
- data/lib/bioroebe/pdb/parse_pdb_file.rb +4 -10
- data/lib/bioroebe/project/project.rb +1 -1
- data/lib/bioroebe/python/README.md +1 -0
- data/lib/bioroebe/python/__pycache__/mymodule.cpython-39.pyc +0 -0
- data/lib/bioroebe/python/gui/gtk3/all_in_one.css +4 -0
- data/lib/bioroebe/python/gui/gtk3/all_in_one.py +59 -0
- data/lib/bioroebe/python/gui/gtk3/widget1.py +20 -0
- data/lib/bioroebe/python/gui/tkinter/all_in_one.py +91 -0
- data/lib/bioroebe/python/mymodule.py +8 -0
- data/lib/bioroebe/python/protein_to_dna.py +33 -0
- data/lib/bioroebe/python/shell/shell.py +19 -0
- data/lib/bioroebe/python/to_rna.py +14 -0
- data/lib/bioroebe/python/toplevel_methods/esystem.py +12 -0
- data/lib/bioroebe/python/toplevel_methods/open_in_browser.py +20 -0
- data/lib/bioroebe/python/toplevel_methods/palindromes.py +42 -0
- data/lib/bioroebe/python/toplevel_methods/rds.py +13 -0
- data/lib/bioroebe/python/toplevel_methods/shuffleseq.py +23 -0
- data/lib/bioroebe/python/toplevel_methods/three_delimiter.py +37 -0
- data/lib/bioroebe/python/toplevel_methods/time_and_date.py +43 -0
- data/lib/bioroebe/python/toplevel_methods/to_camelcase.py +21 -0
- data/lib/bioroebe/requires/require_the_bioroebe_project.rb +3 -1
- data/lib/bioroebe/sequence/alignment.rb +14 -4
- data/lib/bioroebe/sequence/dna.rb +1 -0
- data/lib/bioroebe/sequence/nucleotide_module/nucleotide_module.rb +28 -25
- data/lib/bioroebe/sequence/protein.rb +105 -3
- data/lib/bioroebe/sequence/sequence.rb +87 -21
- data/lib/bioroebe/shell/menu.rb +3829 -3714
- data/lib/bioroebe/shell/misc.rb +59 -4307
- data/lib/bioroebe/shell/readline/readline.rb +1 -1
- data/lib/bioroebe/shell/shell.rb +11255 -28
- data/lib/bioroebe/siRNA/siRNA.rb +81 -1
- data/lib/bioroebe/string_matching/find_longest_substring.rb +3 -2
- data/lib/bioroebe/string_matching/hamming_distance.rb +1 -9
- data/lib/bioroebe/taxonomy/class_methods.rb +3 -8
- data/lib/bioroebe/taxonomy/constants.rb +4 -3
- data/lib/bioroebe/taxonomy/edit.rb +2 -1
- data/lib/bioroebe/taxonomy/help/help.rb +10 -10
- data/lib/bioroebe/taxonomy/help/helpline.rb +2 -2
- data/lib/bioroebe/taxonomy/info/check_available.rb +15 -9
- data/lib/bioroebe/taxonomy/info/info.rb +18 -11
- data/lib/bioroebe/taxonomy/info/is_dna.rb +46 -36
- data/lib/bioroebe/taxonomy/interactive.rb +140 -104
- data/lib/bioroebe/taxonomy/menu.rb +27 -18
- data/lib/bioroebe/taxonomy/parse_fasta.rb +3 -1
- data/lib/bioroebe/taxonomy/shared.rb +1 -0
- data/lib/bioroebe/taxonomy/taxonomy.rb +1 -0
- data/lib/bioroebe/toplevel_methods/aminoacids_and_proteins.rb +31 -24
- data/lib/bioroebe/toplevel_methods/colourize_related_methods.rb +164 -0
- data/lib/bioroebe/toplevel_methods/databases.rb +1 -1
- data/lib/bioroebe/toplevel_methods/digest.rb +18 -8
- data/lib/bioroebe/toplevel_methods/fasta_and_fastq.rb +107 -63
- data/lib/bioroebe/toplevel_methods/file_and_directory_related_actions.rb +14 -2
- data/lib/bioroebe/toplevel_methods/frequencies.rb +8 -1
- data/lib/bioroebe/toplevel_methods/misc.rb +142 -12
- data/lib/bioroebe/toplevel_methods/nucleotides.rb +118 -46
- data/lib/bioroebe/toplevel_methods/open_in_browser.rb +2 -0
- data/lib/bioroebe/toplevel_methods/palindromes.rb +1 -2
- data/lib/bioroebe/toplevel_methods/taxonomy.rb +2 -2
- data/lib/bioroebe/toplevel_methods/to_camelcase.rb +5 -0
- data/lib/bioroebe/utility_scripts/align_open_reading_frames.rb +1 -9
- data/lib/bioroebe/utility_scripts/check_for_mismatches/check_for_mismatches.rb +1 -9
- data/lib/bioroebe/utility_scripts/compacter.rb +1 -9
- data/lib/bioroebe/utility_scripts/compseq/compseq.rb +1 -9
- data/lib/bioroebe/utility_scripts/consensus_sequence.rb +6 -6
- data/lib/bioroebe/utility_scripts/create_batch_entrez_file.rb +1 -9
- data/lib/bioroebe/utility_scripts/dot_alignment.rb +1 -9
- data/lib/bioroebe/utility_scripts/move_file_to_its_correct_location.rb +1 -4
- data/lib/bioroebe/utility_scripts/parse_taxonomy.rb +2 -2
- data/lib/bioroebe/utility_scripts/showorf/constants.rb +0 -5
- data/lib/bioroebe/utility_scripts/showorf/reset.rb +1 -4
- data/lib/bioroebe/version/version.rb +2 -2
- data/lib/bioroebe/www/embeddable_interface.rb +103 -54
- data/lib/bioroebe/www/sinatra/sinatra.rb +186 -70
- data/lib/bioroebe/yaml/aminoacids/amino_acids_long_name_to_one_letter.yml +2 -2
- data/lib/bioroebe/yaml/configuration/browser.yml +1 -1
- data/lib/bioroebe/yaml/configuration/temp_dir.yml +1 -1
- data/lib/bioroebe/yaml/genomes/README.md +3 -4
- data/lib/bioroebe/yaml/restriction_enzymes/restriction_enzymes.yml +27 -27
- metadata +81 -64
- data/doc/setup.rb +0 -1655
- data/lib/bioroebe/fasta_and_fastq/parse_fasta/constants.rb +0 -50
- data/lib/bioroebe/fasta_and_fastq/parse_fasta/initialize.rb +0 -86
- data/lib/bioroebe/fasta_and_fastq/parse_fasta/menu.rb +0 -117
- data/lib/bioroebe/fasta_and_fastq/parse_fasta/misc.rb +0 -981
- data/lib/bioroebe/fasta_and_fastq/parse_fasta/report.rb +0 -156
- data/lib/bioroebe/fasta_and_fastq/parse_fasta/reset.rb +0 -128
- data/lib/bioroebe/genbank/genbank_parser.rb +0 -291
- data/lib/bioroebe/java/bioroebe/Base.class +0 -0
- data/lib/bioroebe/java/bioroebe/Codons.java +0 -22
- data/lib/bioroebe/java/bioroebe/PartnerNucleotide.class +0 -0
- data/lib/bioroebe/java/bioroebe/PartnerNucleotide.java +0 -19
- data/lib/bioroebe/java/bioroebe.jar +0 -0
- data/lib/bioroebe/shell/add.rb +0 -108
- data/lib/bioroebe/shell/assign.rb +0 -360
- data/lib/bioroebe/shell/chop_and_cut.rb +0 -281
- data/lib/bioroebe/shell/constants.rb +0 -166
- data/lib/bioroebe/shell/download.rb +0 -335
- data/lib/bioroebe/shell/enable_and_disable.rb +0 -158
- data/lib/bioroebe/shell/enzymes.rb +0 -310
- data/lib/bioroebe/shell/fasta.rb +0 -345
- data/lib/bioroebe/shell/gtk.rb +0 -76
- data/lib/bioroebe/shell/history.rb +0 -132
- data/lib/bioroebe/shell/initialize.rb +0 -217
- data/lib/bioroebe/shell/loop.rb +0 -74
- data/lib/bioroebe/shell/prompt.rb +0 -107
- data/lib/bioroebe/shell/random.rb +0 -289
- data/lib/bioroebe/shell/reset.rb +0 -335
- data/lib/bioroebe/shell/scan_and_parse.rb +0 -135
- data/lib/bioroebe/shell/search.rb +0 -337
- data/lib/bioroebe/shell/sequences.rb +0 -200
- data/lib/bioroebe/shell/show_report_and_display.rb +0 -2901
- data/lib/bioroebe/shell/startup.rb +0 -127
- data/lib/bioroebe/shell/taxonomy.rb +0 -14
- data/lib/bioroebe/shell/tk.rb +0 -23
- data/lib/bioroebe/shell/user_input.rb +0 -88
- data/lib/bioroebe/shell/xorg.rb +0 -45
- /data/lib/bioroebe/java/bioroebe/{BisulfiteTreatment.java → src/main/java/bioroebe/BisulfiteTreatment.java} +0 -0
- /data/lib/bioroebe/java/bioroebe/{Esystem.class → src/main/java/bioroebe/Esystem.class} +0 -0
- /data/lib/bioroebe/java/bioroebe/{Esystem.java → src/main/java/bioroebe/Esystem.java} +0 -0
- /data/lib/bioroebe/java/bioroebe/{RemoveFile.class → src/main/java/bioroebe/RemoveFile.class} +0 -0
@@ -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
|
@@ -11,15 +11,17 @@ module Bioroebe
|
|
11
11
|
#
|
12
12
|
# Usage examples:
|
13
13
|
#
|
14
|
-
# Bioroebe.digest_this_dna(:lambda_genome, with: :EcoRI)
|
15
|
-
# Bioroebe.digest_this_dna("/root/Bioroebe/fasta/NC_001416.1_Enterobacteria_phage_lambda_complete_genome.fasta", with: :EcoRI)
|
14
|
+
# x = Bioroebe.digest_this_dna(:lambda_genome, with: :EcoRI)
|
15
|
+
# x = Bioroebe.digest_this_dna("/root/Bioroebe/fasta/NC_001416.1_Enterobacteria_phage_lambda_complete_genome.fasta", with: :EcoRI)
|
16
|
+
# x = Bioroebe.digest_this_dna("/Depot/j/foobar.fasta", with: :PvuII)
|
16
17
|
#
|
17
18
|
# ========================================================================= #
|
18
19
|
def self.digest_this_dna(
|
19
|
-
this_DNA_sequence,
|
20
|
+
this_DNA_sequence,
|
21
|
+
hash = {}
|
20
22
|
)
|
21
|
-
require 'bioroebe/toplevel_methods/e.rb'
|
22
23
|
require 'bioroebe/constants/files_and_directories.rb'
|
24
|
+
require 'bioroebe/toplevel_methods/e.rb'
|
23
25
|
require 'bioroebe/fasta_and_fastq/parse_fasta/parse_fasta.rb'
|
24
26
|
restriction_enzymes = Bioroebe.load_and_return_the_restriction_enzymes
|
25
27
|
this_restriction_enzyme = nil
|
@@ -46,16 +48,24 @@ module Bioroebe
|
|
46
48
|
target_sequence.chop!
|
47
49
|
target_sequence.strip!
|
48
50
|
end
|
49
|
-
if nucleotide_sequence
|
50
|
-
|
51
|
+
if nucleotide_sequence and
|
52
|
+
nucleotide_sequence.include?(target_sequence)
|
53
|
+
print rev+'Yes, the restriction-sequence '+
|
54
|
+
lightblue(target_sequence)+
|
55
|
+
rev+
|
56
|
+
' is found in the given sequence. '
|
51
57
|
scanned = nucleotide_sequence.scan(
|
52
58
|
/#{target_sequence}/
|
53
59
|
)
|
54
|
-
|
60
|
+
erev "It can be found #{steelblue(scanned.size.to_s)}#{rev} "\
|
61
|
+
"times, at these positions:"
|
62
|
+
e
|
55
63
|
sub_sequences = nucleotide_sequence.split(/#{target_sequence}/)
|
56
64
|
sub_sequences.sort_by {|entry| entry.size }.reverse.each {|sequence|
|
57
|
-
|
65
|
+
erev " #{sequence.size}"
|
58
66
|
}
|
67
|
+
e
|
68
|
+
return sub_sequences
|
59
69
|
else
|
60
70
|
e 'Nothing found.'
|
61
71
|
end
|
@@ -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(
|
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?
|
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.
|
@@ -10,6 +10,7 @@ module Bioroebe
|
|
10
10
|
require 'bioroebe/project/project.rb'
|
11
11
|
require 'bioroebe/toplevel_methods/e.rb'
|
12
12
|
require 'bioroebe/colours/colours.rb'
|
13
|
+
require 'bioroebe/codons/convert_this_codon_to_that_aminoacid.rb'
|
13
14
|
|
14
15
|
# ========================================================================= #
|
15
16
|
# === Bioroebe.calculate_the_frequencies_of_this_species
|
@@ -34,7 +35,7 @@ module Bioroebe
|
|
34
35
|
when :homo_sapiens,
|
35
36
|
:homo,
|
36
37
|
:human
|
37
|
-
i = "#{
|
38
|
+
i = "#{project_base_directory?}"\
|
38
39
|
"codon_tables/frequencies/9606_Homo_sapiens.yml"
|
39
40
|
end
|
40
41
|
hash = YAML.load_file(i)
|
@@ -87,6 +88,12 @@ module Bioroebe
|
|
87
88
|
end
|
88
89
|
|
89
90
|
if __FILE__ == $PROGRAM_NAME
|
91
|
+
alias e puts
|
92
|
+
e
|
90
93
|
Bioroebe.calculate_the_frequencies_of_this_species(ARGV)
|
94
|
+
e
|
95
|
+
e 'Aminoacid frequency:'
|
96
|
+
e; print ' '
|
91
97
|
pp Bioroebe.aminoacid_frequency('MVTDEGAIYFTKDAARNWKAAVEETVSATLNRTVSSGITGASYYTGTFST')
|
98
|
+
e
|
92
99
|
end # calculatethefrequenciesofthisspecies
|
@@ -14,21 +14,58 @@ 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.
|
20
|
+
# === Bioroebe.sequence_based_on_these_restriction_enzymes
|
21
|
+
#
|
22
|
+
# Usage example:
|
23
|
+
#
|
24
|
+
# x = Bioroebe.sequence_based_on_these_restriction_enzymes(%w( EcoRI SacI KpnI XmaI BamHI XbaI SalI )); 'GAATTCGAGCTCGGTACCCCCGGGGGATCCTCTAGAGTCGAC'
|
20
25
|
#
|
21
|
-
# This method is solely a helper-method for Bioroebe.frequency_per_thousand().
|
22
26
|
# ========================================================================= #
|
23
|
-
def self.
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
def self.sequence_based_on_these_restriction_enzymes(*i)
|
28
|
+
require 'bioroebe/enzymes/restriction_enzyme.rb'
|
29
|
+
_ = ''.dup
|
30
|
+
i.flatten.each {|this_restriction_enzyme|
|
31
|
+
_ << ::Bioroebe.restriction_sites?(this_restriction_enzyme)
|
32
|
+
}
|
33
|
+
return _
|
34
|
+
end
|
35
|
+
|
36
|
+
# ========================================================================= #
|
37
|
+
# === Bioroebe.create_jar_archive
|
38
|
+
#
|
39
|
+
# This method will create a .jar file.
|
40
|
+
#
|
41
|
+
# To invoke it from the commandline do:
|
42
|
+
#
|
43
|
+
# bioroebe --jar
|
44
|
+
#
|
45
|
+
# To execute a .jar file do:
|
46
|
+
#
|
47
|
+
# java -jar foobar.jar
|
48
|
+
#
|
49
|
+
# ========================================================================= #
|
50
|
+
def self.create_jar_archive
|
51
|
+
e 'Creating a .jar archive next:'
|
52
|
+
e
|
53
|
+
original_dir = return_pwd
|
54
|
+
cd '/home/x/programming/ruby/src/bioroebe/lib/bioroebe/java/bioroebe/src/main/java/'
|
55
|
+
esystem 'jar cf bioroebe.jar bioroebe/'
|
56
|
+
target_file = File.absolute_path('bioroebe.jar')
|
57
|
+
cd original_dir
|
58
|
+
if File.exist? target_file
|
59
|
+
e 'Moving the created .jar file into the current working '\
|
60
|
+
'directory next.'
|
61
|
+
move_file(target_file, original_dir)
|
62
|
+
e 'It should now be at:'
|
63
|
+
e
|
64
|
+
e sfile(" #{original_dir}#{File.basename(target_file)}")
|
65
|
+
e
|
66
|
+
end
|
67
|
+
# esystem 'jar cfe bioroebe.jar myClass myClass.class'
|
68
|
+
e
|
32
69
|
end
|
33
70
|
|
34
71
|
# ========================================================================= #
|
@@ -86,6 +123,7 @@ EOF
|
|
86
123
|
# Usage example:
|
87
124
|
#
|
88
125
|
# Bioroebe.codon_frequency_of_this_string
|
126
|
+
# Bioroebe.codon_frequency_of_this_string 'ATTCGTACGATCGACTACTACT' # => {"UAC"=>2, "GAC"=>1, "AUC"=>1, "ACG"=>1, "CGU"=>1, "AUU"=>1}
|
89
127
|
#
|
90
128
|
# ========================================================================= #
|
91
129
|
def self.codon_frequency_of_this_string(
|
@@ -107,6 +145,22 @@ EOF
|
|
107
145
|
return sorted_hash
|
108
146
|
end
|
109
147
|
|
148
|
+
# ========================================================================= #
|
149
|
+
# === Bioroebe.thousand_percentage
|
150
|
+
#
|
151
|
+
# This method is solely a helper-method for Bioroebe.frequency_per_thousand().
|
152
|
+
# ========================================================================= #
|
153
|
+
def self.thousand_percentage(
|
154
|
+
this_codon_n_times = 1,
|
155
|
+
total_n_elements = 1000
|
156
|
+
)
|
157
|
+
result = (
|
158
|
+
(this_codon_n_times * 1000.0) / total_n_elements.to_f
|
159
|
+
).round(1)
|
160
|
+
padded_result = result.to_s.rjust(5, ' ')
|
161
|
+
return padded_result
|
162
|
+
end
|
163
|
+
|
110
164
|
# ========================================================================= #
|
111
165
|
# === Bioroebe.align_this_string_via_multiple_sequence_alignment
|
112
166
|
#
|
@@ -314,7 +368,13 @@ EOF
|
|
314
368
|
# ========================================================================= #
|
315
369
|
# === Bioroebe.bisulfite_treatment
|
316
370
|
#
|
317
|
-
# Simply convert all C into U.
|
371
|
+
# Simply convert all C into U. The underlying idea here is that
|
372
|
+
# bilsufite will convert unmethylated Cytosines into Uracil.
|
373
|
+
#
|
374
|
+
# Usage example:
|
375
|
+
#
|
376
|
+
# Bioroebe.bisulfite_treatment('CCCGCAATGCATACCTCGCCG') # => "UUUGUAATGUATAUUTUGUUG"
|
377
|
+
#
|
318
378
|
# ========================================================================= #
|
319
379
|
def self.bisulfite_treatment(i)
|
320
380
|
if i.is_a? Array
|
@@ -420,6 +480,76 @@ EOF
|
|
420
480
|
end; self.instance_eval { alias on_windows? windows_platform? } # === Bioroebe.on_windows?
|
421
481
|
self.instance_eval { alias is_on_windows? windows_platform? } # === Bioroebe.is_on_windows?
|
422
482
|
|
483
|
+
# ========================================================================= #
|
484
|
+
# === Bioroebe.two_dimensional_plot
|
485
|
+
#
|
486
|
+
# This method makes use of gnuplot to draw a 2D plot.
|
487
|
+
#
|
488
|
+
# The first argument should contain your dataset, as a String.
|
489
|
+
# ========================================================================= #
|
490
|
+
def self.two_dimensional_plot(
|
491
|
+
dataset = '6 12
|
492
|
+
8 14
|
493
|
+
10 18
|
494
|
+
12 23
|
495
|
+
14 28
|
496
|
+
16 29
|
497
|
+
18 26
|
498
|
+
20 23
|
499
|
+
22 20',
|
500
|
+
optional_hash = {
|
501
|
+
width: 800,
|
502
|
+
height: 640
|
503
|
+
}
|
504
|
+
)
|
505
|
+
# ======================================================================= #
|
506
|
+
# Provide some generic fall-back values for width and height next:
|
507
|
+
# ======================================================================= #
|
508
|
+
width = 1000
|
509
|
+
height = 800
|
510
|
+
_ = optional_hash
|
511
|
+
if _.is_a? Hash
|
512
|
+
# ===================================================================== #
|
513
|
+
# === :width
|
514
|
+
# ===================================================================== #
|
515
|
+
if _.has_key? :width
|
516
|
+
width = _.delete(:width)
|
517
|
+
end
|
518
|
+
# ===================================================================== #
|
519
|
+
# === :height
|
520
|
+
# ===================================================================== #
|
521
|
+
if _.has_key? :height
|
522
|
+
height = _.delete(:height)
|
523
|
+
end
|
524
|
+
end
|
525
|
+
# ======================================================================= #
|
526
|
+
# Go to a safe base directory.
|
527
|
+
# ======================================================================= #
|
528
|
+
cd :bioroebe_log_directory
|
529
|
+
mkdir 'gnuplot' unless File.directory?('gnuplot')
|
530
|
+
cd 'gnuplot'
|
531
|
+
# ======================================================================= #
|
532
|
+
# First save the dataset into dataset.md:
|
533
|
+
# ======================================================================= #
|
534
|
+
into = File.absolute_path('dataset.md')
|
535
|
+
e 'Storing the dataset into '+sfile(into)+' next.'
|
536
|
+
write_what_into(dataset, into)
|
537
|
+
what = <<-EOF
|
538
|
+
|
539
|
+
set terminal png size #{width},#{height} enhanced font "Helvetica, 18"
|
540
|
+
set output 'fancy_graph.png'
|
541
|
+
plot '#{into}' with linespoints ls 1 notitle
|
542
|
+
|
543
|
+
EOF
|
544
|
+
into = File.absolute_path('gnuplot.file')
|
545
|
+
e 'Storing into '+into+'.'
|
546
|
+
write_what_into(what, into)
|
547
|
+
esystem 'gnuplot '+into
|
548
|
+
if File.exist? 'fancy_graph.png' and is_on_roebe?
|
549
|
+
Open.in_browser('fancy_graph.png')
|
550
|
+
end
|
551
|
+
end
|
552
|
+
|
423
553
|
end
|
424
554
|
|
425
555
|
if __FILE__ == $PROGRAM_NAME
|