bioroebe 0.10.80 → 0.12.24
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.
- checksums.yaml +4 -4
- data/README.md +3946 -2817
- data/bin/bioroebe +13 -2
- data/bin/bioroebe_hash +7 -0
- data/bin/codon_to_aminoacid +6 -4
- data/bin/compacter +7 -0
- data/bin/plain_palindrome +7 -0
- data/bioroebe.gemspec +3 -3
- data/doc/README.gen +3918 -2793
- data/doc/quality_control/commandline_applications.md +3 -3
- data/doc/statistics/statistics.md +7 -7
- data/doc/todo/bioroebe_GUI_todo.md +19 -14
- data/doc/todo/bioroebe_java_todo.md +22 -0
- data/doc/todo/bioroebe_todo.md +2075 -2620
- data/lib/bioroebe/C++/DNA.cpp +69 -0
- data/lib/bioroebe/C++/RNA.cpp +58 -0
- data/lib/bioroebe/C++/sequence.cpp +35 -0
- data/lib/bioroebe/abstract/README.md +1 -0
- data/lib/bioroebe/abstract/features.rb +29 -0
- 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/base_module/base_module.rb +36 -0
- data/lib/bioroebe/base/colours_for_base/colours_for_base.rb +18 -8
- data/lib/bioroebe/base/commandline_application/commandline_application.rb +13 -9
- data/lib/bioroebe/base/commandline_application/commandline_arguments.rb +24 -19
- 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 +5 -3
- data/lib/bioroebe/base/internal_hash_module/internal_hash_module.rb +42 -0
- data/lib/bioroebe/base/misc.rb +35 -0
- data/lib/bioroebe/base/prototype/misc.rb +15 -9
- data/lib/bioroebe/base/prototype/reset.rb +10 -0
- data/lib/bioroebe/cleave_and_digest/digestion.rb +10 -2
- data/lib/bioroebe/cleave_and_digest/trypsin.rb +104 -50
- 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 +208 -59
- data/lib/bioroebe/codons/possible_codons_for_this_aminoacid.rb +1 -9
- data/lib/bioroebe/codons/show_codon_tables.rb +8 -3
- 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/constants/nucleotides.rb +7 -0
- data/lib/bioroebe/conversions/dna_to_aminoacid_sequence.rb +109 -39
- 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/cpp +1 -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/dotplots/advanced_dotplot.rb +1 -1
- 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 +1518 -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 +130 -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 +106 -137
- data/lib/bioroebe/gui/gtk3/aminoacid_composition/aminoacid_composition.rb +27 -61
- data/lib/bioroebe/gui/gtk3/aminoacid_composition/customized_dialog.rb +1 -1
- data/lib/bioroebe/gui/gtk3/blosum_matrix_viewer/blosum_matrix_viewer.rb +1 -2
- data/lib/bioroebe/gui/gtk3/calculate_cell_numbers_of_bacteria/calculate_cell_numbers_of_bacteria.rb +1 -2
- data/lib/bioroebe/gui/gtk3/controller/controller.rb +46 -29
- data/lib/bioroebe/gui/gtk3/dna_to_aminoacid_widget/dna_to_aminoacid_widget.rb +77 -52
- data/lib/bioroebe/gui/gtk3/dna_to_reverse_complement_widget/dna_to_reverse_complement_widget.rb +1 -2
- data/lib/bioroebe/gui/gtk3/fasta_table_widget/fasta_table_widget.rb +100 -23
- data/lib/bioroebe/gui/gtk3/format_converter/format_converter.rb +1 -2
- data/lib/bioroebe/gui/gtk3/gene/gene.rb +1 -2
- data/lib/bioroebe/gui/gtk3/hamming_distance/hamming_distance.rb +43 -30
- data/lib/bioroebe/gui/gtk3/levensthein_distance/levensthein_distance.rb +1 -2
- data/lib/bioroebe/gui/gtk3/nucleotide_analyser/nucleotide_analyser.rb +120 -73
- data/lib/bioroebe/gui/gtk3/primer_design_widget/primer_design_widget.rb +1 -2
- data/lib/bioroebe/gui/gtk3/protein_to_DNA/protein_to_DNA.rb +19 -20
- data/lib/bioroebe/gui/gtk3/random_sequence/random_sequence.rb +20 -13
- data/lib/bioroebe/gui/gtk3/restriction_enzymes/restriction_enzymes.rb +1 -2
- data/lib/bioroebe/gui/gtk3/show_codon_table/misc.rb +97 -22
- data/lib/bioroebe/gui/gtk3/show_codon_table/show_codon_table.rb +3 -73
- data/lib/bioroebe/gui/gtk3/show_codon_usage/show_codon_usage.rb +1 -2
- data/lib/bioroebe/gui/gtk3/sizeseq/sizeseq.rb +1 -2
- data/lib/bioroebe/gui/gtk3/three_to_one/three_to_one.rb +1 -2
- data/lib/bioroebe/gui/gtk3/www_finder/www_finder.rb +1 -2
- data/lib/bioroebe/gui/javafx/bioroebe/Bioroebe.class +0 -0
- data/lib/bioroebe/gui/javafx/bioroebe/Bioroebe.java +104 -0
- data/lib/bioroebe/gui/javafx/bioroebe.jar +0 -0
- data/lib/bioroebe/gui/javafx/bioroebe.mf +1 -0
- data/lib/bioroebe/gui/javafx/module-info.class +0 -0
- data/lib/bioroebe/gui/javafx/module-info.java +5 -0
- data/lib/bioroebe/gui/jruby/alignment/alignment.rb +165 -0
- data/lib/bioroebe/gui/jruby/aminoacid_composition/aminoacid_composition.rb +166 -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/aminoacid_composition/aminoacid_composition_module.rb +94 -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/images/images.html +29845 -0
- data/lib/bioroebe/java/README.md +5 -0
- data/lib/bioroebe/java/bioroebe/AllInOne.java +1 -0
- data/lib/bioroebe/java/bioroebe/Base.class +0 -0
- data/lib/bioroebe/java/bioroebe/Base.java +39 -5
- data/lib/bioroebe/java/bioroebe/IsPalindrome.java +23 -5
- data/lib/bioroebe/java/bioroebe/SanitizeNucleotideSequence.java +0 -0
- data/lib/bioroebe/java/bioroebe/Sequence.java +28 -3
- data/lib/bioroebe/java/bioroebe/ToCamelcase.class +0 -0
- data/lib/bioroebe/java/bioroebe/ToCamelcase.java +16 -4
- data/lib/bioroebe/java/bioroebe/ToRNA.java +43 -0
- data/lib/bioroebe/java/bioroebe/ToplevelMethods.java +6 -0
- data/lib/bioroebe/java/bioroebe/{BisulfiteTreatment.class → src/BisulfiteTreatment.class} +0 -0
- data/lib/bioroebe/java/bioroebe/{Codons.class → src/Codons.class} +0 -0
- data/lib/bioroebe/java/bioroebe/src/Codons.java +35 -0
- data/lib/bioroebe/java/bioroebe/src/Commandline.class +0 -0
- data/lib/bioroebe/java/bioroebe/src/Commandline.java +101 -0
- data/lib/bioroebe/java/bioroebe/{Esystem.class → src/Esystem.class} +0 -0
- data/lib/bioroebe/java/bioroebe/{Esystem.java → src/Esystem.java} +6 -1
- data/lib/bioroebe/java/bioroebe/{GenerateRandomDnaSequence.class → src/GenerateRandomDnaSequence.class} +0 -0
- data/lib/bioroebe/java/bioroebe/{GenerateRandomDnaSequence.java → src/GenerateRandomDnaSequence.java} +8 -2
- data/lib/bioroebe/java/bioroebe/src/PartnerNucleotide.class +0 -0
- data/lib/bioroebe/java/bioroebe/src/PartnerNucleotide.java +56 -0
- data/lib/bioroebe/java/bioroebe/{RemoveFile.java → src/RemoveFile.java} +10 -4
- data/lib/bioroebe/java/bioroebe/{RemoveNumbers.class → src/RemoveNumbers.class} +0 -0
- data/lib/bioroebe/java/bioroebe/{RemoveNumbers.java → src/RemoveNumbers.java} +1 -0
- data/lib/bioroebe/java/bioroebe/src/toplevel_methods/BaseComposition.class +0 -0
- data/lib/bioroebe/java/bioroebe/src/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/sanitize_nucleotide_sequence.rb +59 -18
- 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/convert_dna_to_aminoacid_sequence.py +137 -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 +52 -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_cleave_and_digest.rb +3 -1
- 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/rna.rb +220 -0
- data/lib/bioroebe/sequence/sequence.rb +128 -40
- data/lib/bioroebe/shell/menu.rb +3815 -3696
- data/lib/bioroebe/shell/misc.rb +9019 -3133
- data/lib/bioroebe/shell/readline/readline.rb +1 -1
- data/lib/bioroebe/shell/shell.rb +1137 -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 +175 -11
- 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 +75 -47
- data/lib/bioroebe/toplevel_methods/taxonomy.rb +3 -3
- 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/compacter.rb +251 -0
- 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/permutations.rb +36 -9
- 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 +121 -58
- data/lib/bioroebe/www/sinatra/sinatra.rb +186 -71
- data/lib/bioroebe/yaml/aminoacids/amino_acids_long_name_to_one_letter.yml +2 -2
- data/lib/bioroebe/yaml/aminoacids/weight_of_common_proteins.yml +17 -17
- data/lib/bioroebe/yaml/configuration/browser.yml +1 -1
- data/lib/bioroebe/yaml/configuration/temp_dir.yml +1 -1
- data/lib/bioroebe/yaml/consensus_sequences/consensus_sequences.yml +1 -0
- data/lib/bioroebe/yaml/genomes/README.md +3 -4
- data/lib/bioroebe/yaml/nucleotides/nucleotides.yml +5 -0
- data/lib/bioroebe/yaml/restriction_enzymes/restriction_enzymes.yml +57 -57
- data/spec/README.md +6 -0
- data/spec/project_wide_specification/classes.md +5 -0
- metadata +107 -70
- 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/AllInOne.class +0 -0
- data/lib/bioroebe/java/bioroebe/Cat.class +0 -0
- data/lib/bioroebe/java/bioroebe/Codons.java +0 -22
- data/lib/bioroebe/java/bioroebe/IsPalindrome.class +0 -0
- data/lib/bioroebe/java/bioroebe/PartnerNucleotide.class +0 -0
- data/lib/bioroebe/java/bioroebe/PartnerNucleotide.java +0 -19
- data/lib/bioroebe/java/bioroebe/SanitizeNucleotideSequence.class +0 -0
- data/lib/bioroebe/java/bioroebe/ToplevelMethods.class +0 -0
- 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/utility_scripts/compacter.rb +0 -131
- /data/lib/bioroebe/java/bioroebe/{BisulfiteTreatment.java → src/BisulfiteTreatment.java} +0 -0
- /data/lib/bioroebe/java/bioroebe/{RemoveFile.class → src/RemoveFile.class} +0 -0
data/lib/bioroebe/shell/shell.rb
CHANGED
@@ -3,39 +3,1148 @@
|
|
3
3
|
# frozen_string_literal: true
|
4
4
|
# =========================================================================== #
|
5
5
|
# === Bioroebe::Shell
|
6
|
+
#
|
7
|
+
# This shell wraps together all related Bio tasks. It contains
|
8
|
+
# the core-functionality for the Bioroebe::Shell interface.
|
9
|
+
#
|
10
|
+
# To use it in one of your projects, do:
|
11
|
+
#
|
12
|
+
# require 'bioroebe'; Bioroebe::Shell.new(ARGV)
|
13
|
+
#
|
6
14
|
# =========================================================================== #
|
7
|
-
# require 'bioroebe/shell/
|
15
|
+
# require 'bioroebe/shell/shell.rb'
|
8
16
|
# =========================================================================== #
|
9
17
|
require 'bioroebe/base/commandline_application/commandline_application.rb'
|
18
|
+
|
19
|
+
module Bioroebe
|
20
|
+
|
21
|
+
class Shell < ::Bioroebe::CommandlineApplication # === Bioroebe::Shell
|
22
|
+
|
23
|
+
alias ee print
|
24
|
+
|
25
|
+
require 'bioroebe/fasta_and_fastq/parse_fasta/parse_fasta.rb'
|
26
|
+
require 'bioroebe/codons/convert_this_codon_to_that_aminoacid.rb'
|
27
|
+
|
28
|
+
# ========================================================================= #
|
29
|
+
# Various failsave requires will be pulled in next. This includes the
|
30
|
+
# chemistry_paradise gem, if it is available.
|
31
|
+
# ========================================================================= #
|
32
|
+
array_failsave_requires = %w(
|
33
|
+
chemistry_paradise
|
34
|
+
directory_paradise
|
35
|
+
easycompile
|
36
|
+
rcfiles
|
37
|
+
xorg_buffer/module
|
38
|
+
)
|
39
|
+
array_failsave_requires.each {|project|
|
40
|
+
begin
|
41
|
+
require project
|
42
|
+
rescue LoadError; end # Silent rescue.
|
43
|
+
}
|
44
|
+
|
45
|
+
if Bioroebe.is_on_roebe?
|
46
|
+
# ======================================================================= #
|
47
|
+
# Load up support for FtpParadise, but only on roebe-systems.
|
48
|
+
# ======================================================================= #
|
49
|
+
begin
|
50
|
+
require 'ftp_paradise'
|
51
|
+
rescue LoadError; end
|
52
|
+
end
|
53
|
+
|
54
|
+
require 'bioroebe/configuration/configuration.rb'
|
55
|
+
require 'bioroebe/project/project.rb'
|
56
|
+
require 'bioroebe/conversions/dna_to_aminoacid_sequence.rb'
|
57
|
+
require 'bioroebe/constants/files_and_directories.rb'
|
58
|
+
require 'bioroebe/constants/misc.rb'
|
59
|
+
require 'bioroebe/codons/show_codon_usage.rb'
|
60
|
+
require 'bioroebe/codons/show_this_codon_table.rb'
|
61
|
+
require 'bioroebe/calculate/calculate_levensthein_distance.rb'
|
62
|
+
require 'bioroebe/nucleotides/molecular_weight_of_nucleotides.rb'
|
63
|
+
require 'bioroebe/nucleotides/show_nucleotide_sequence.rb'
|
64
|
+
require 'bioroebe/count/count_amount_of_aminoacids.rb'
|
65
|
+
require 'bioroebe/parsers/blosum_parser.rb'
|
66
|
+
require 'bioroebe/sequence/sequence.rb'
|
67
|
+
require 'bioroebe/string_matching/find_longest_substring.rb'
|
68
|
+
require 'bioroebe/enzymes/has_this_restriction_enzyme.rb'
|
69
|
+
require 'bioroebe/enzymes/restriction_enzymes_file.rb'
|
70
|
+
require 'bioroebe/shell/colours/colours.rb'
|
71
|
+
require 'bioroebe/shell/readline/readline.rb' # ← Needed in this file here.
|
72
|
+
require 'bioroebe/shell/menu.rb'
|
73
|
+
require 'bioroebe/shell/misc.rb'
|
74
|
+
# ========================================================================= #
|
75
|
+
# Next, require bioroebe/utility_scripts/ - this is important for the
|
76
|
+
# menu() interface:
|
77
|
+
# ========================================================================= #
|
78
|
+
require 'bioroebe/utility_scripts/display_open_reading_frames/display_open_reading_frames.rb'
|
79
|
+
# ========================================================================= #
|
80
|
+
# Next, batch-require all toplevel_methods/ from the bioroebe project:
|
81
|
+
# ========================================================================= #
|
82
|
+
require 'bioroebe/requires/require_the_toplevel_methods.rb'
|
83
|
+
# require 'bioroebe/toplevel_methods/map_ncbi_entry_to_eutils_id.rb'
|
84
|
+
# require 'bioroebe/toplevel_methods/matches.rb'
|
85
|
+
# require 'bioroebe/toplevel_methods/taxonomy.rb'
|
86
|
+
# require 'bioroebe/toplevel_methods/download_and_fetch_data.rb'
|
87
|
+
|
88
|
+
# ========================================================================= #
|
89
|
+
# === HOME_DIRECTORY_OF_USER_X
|
90
|
+
#
|
91
|
+
# Hardcoded path - only useful on my home setup, though.
|
92
|
+
# ========================================================================= #
|
93
|
+
HOME_DIRECTORY_OF_USER_X = '/home/x/'
|
94
|
+
|
95
|
+
# ========================================================================= #
|
96
|
+
# === RUBY_SRC
|
97
|
+
#
|
98
|
+
# Hardcoded. This is only useful on my home system.
|
99
|
+
# ========================================================================= #
|
100
|
+
if ENV['RSRC']
|
101
|
+
RUBY_SRC = "#{ENV['RSRC']}/"
|
102
|
+
else
|
103
|
+
RUBY_SRC = "#{HOME_DIRECTORY_OF_USER_X}programming/ruby/src/"
|
104
|
+
end
|
105
|
+
|
106
|
+
# ========================================================================= #
|
107
|
+
# === RUBY_BIOROEBE
|
108
|
+
#
|
109
|
+
# This allows a user to designate another home directory.
|
110
|
+
# ========================================================================= #
|
111
|
+
if ENV['RUBY_BIOROEBE']
|
112
|
+
BIOROEBE = ENV['RUBY_BIOROEBE'].to_s
|
113
|
+
else
|
114
|
+
BIOROEBE = ENV['HOME']
|
115
|
+
end
|
116
|
+
|
117
|
+
# ========================================================================= #
|
118
|
+
# === FILE_USE_SILENT_STARTUP
|
119
|
+
# ========================================================================= #
|
120
|
+
FILE_USE_SILENT_STARTUP =
|
121
|
+
"#{::Bioroebe.project_base_directory?}shell/configuration/use_silent_startup.yml"
|
122
|
+
|
123
|
+
# ========================================================================= #
|
124
|
+
# === SHALL_WE_DEBUG
|
125
|
+
# ========================================================================= #
|
126
|
+
SHALL_WE_DEBUG = false
|
127
|
+
|
128
|
+
# ========================================================================= #
|
129
|
+
# === TRUNCATE_AT_N_ELEMENTS
|
130
|
+
#
|
131
|
+
# If we display nucleotide strings, then by default, these may be very
|
132
|
+
# long. So the following constant will act as a threshold.
|
133
|
+
# ========================================================================= #
|
134
|
+
TRUNCATE_AT_N_ELEMENTS = 2000
|
135
|
+
|
136
|
+
# ========================================================================= #
|
137
|
+
# === BIOSHELL_SAVE_FILE
|
138
|
+
#
|
139
|
+
# Designate the default location for the save-file, a markdown file.
|
140
|
+
# ========================================================================= #
|
141
|
+
if Dir.exist? ::Bioroebe.log_dir?
|
142
|
+
BIOSHELL_SAVE_FILE = "#{::Bioroebe.log_dir?}shell_file.md"
|
143
|
+
else
|
144
|
+
BIOSHELL_SAVE_FILE = '/home/Temp/bioroebe/shell_file.md'
|
145
|
+
end
|
146
|
+
|
147
|
+
# ========================================================================= #
|
148
|
+
# === HOME_DIR
|
149
|
+
#
|
150
|
+
# This probably is not used a lot anymore these days.
|
151
|
+
# ========================================================================= #
|
152
|
+
if RUBY_SRC # This is valid at home.
|
153
|
+
HOME_DIR = "#{ENV['RSRC']}/bioroebe/lib/bioroebe/"
|
154
|
+
else
|
155
|
+
begin
|
156
|
+
home_dir = File.expand_path('~')
|
157
|
+
rescue Exception
|
158
|
+
home_dir = '/root/'
|
159
|
+
end
|
160
|
+
HOME_DIR = home_dir+'.gem/gems/bioroebe-'+
|
161
|
+
Bioroebe.version?.to_s+'/lib/bioroebe/'
|
162
|
+
end
|
163
|
+
|
164
|
+
# ========================================================================= #
|
165
|
+
# === DEFAULT_PADDING
|
166
|
+
# ========================================================================= #
|
167
|
+
DEFAULT_PADDING = ' ' # This is left-padding.
|
168
|
+
|
169
|
+
# ========================================================================= #
|
170
|
+
# === MAIN_EDITOR
|
171
|
+
#
|
172
|
+
# Which editor to use.
|
173
|
+
# ========================================================================= #
|
174
|
+
if ENV['IS_ROEBE']
|
175
|
+
MAIN_EDITOR = 'bluefish'
|
176
|
+
else # else assume that we may be on windows.
|
177
|
+
MAIN_EDITOR = 'notepad++.exe'
|
178
|
+
end; MY_EDITOR = MAIN_EDITOR # === MY_EDITOR
|
179
|
+
|
180
|
+
_ = ::Bioroebe.project_yaml_directory?+
|
181
|
+
'default_dna_input.yml' # cat $RUBY_BIO/YAML/default_dna_input.yml
|
182
|
+
# ========================================================================= #
|
183
|
+
# === DEFAULT_DNA_INPUT_YAML_FILE
|
184
|
+
# ========================================================================= #
|
185
|
+
DEFAULT_DNA_INPUT_YAML_FILE = YAML.load_file(_) if File.exist? _
|
186
|
+
|
187
|
+
# ========================================================================= #
|
188
|
+
# === initialize
|
189
|
+
# ========================================================================= #
|
190
|
+
def initialize(
|
191
|
+
commandline_arguments = ARGV
|
192
|
+
)
|
193
|
+
reset
|
194
|
+
set_commandline_arguments(commandline_arguments)
|
195
|
+
# ======================================================================= #
|
196
|
+
# Intercept some important commandline arguments next.
|
197
|
+
# ======================================================================= #
|
198
|
+
case first?
|
199
|
+
# ======================================================================= #
|
200
|
+
# === bioshell --controller
|
201
|
+
# ======================================================================= #
|
202
|
+
when /^-?-?controller$/i
|
203
|
+
require 'bioroebe/gui/gtk3/controller/controller.rb'
|
204
|
+
::Bioroebe.run_gtk_controller
|
205
|
+
exit_program
|
206
|
+
# ======================================================================= #
|
207
|
+
# === bioshell --do-not-create-directories-on-startup
|
208
|
+
# === bioshell --do-not-create-directories
|
209
|
+
#
|
210
|
+
# Do not create directories on startup.
|
211
|
+
#
|
212
|
+
# Invocation example:
|
213
|
+
#
|
214
|
+
# bioshell --do-not-create-directories-on-startup
|
215
|
+
#
|
216
|
+
# ======================================================================= #
|
217
|
+
when /^-?-?do(-|_| )?not(-|_| )?create(-|_| )?directories(-|_| )?on(-|_| )?startup$/i,
|
218
|
+
/^-?-?do(-|_| )?not(-|_| )?create(-|_| )?directories$/i
|
219
|
+
@internal_hash[:create_directories_on_startup_of_the_shell] = false
|
220
|
+
# ======================================================================= #
|
221
|
+
# === bioroebe --protein-to-dna
|
222
|
+
#
|
223
|
+
# This entry point will try to start the ruby-gtk3 protein-to-DNA
|
224
|
+
# converting widget.
|
225
|
+
# ======================================================================= #
|
226
|
+
when /^-?-?protein(-|_| )?to(-|_| )?dna$/i
|
227
|
+
require 'bioroebe/gui/gtk3/protein_to_DNA/protein_to_DNA.rb'
|
228
|
+
::Bioroebe::GUI::Gtk::ProteinToDNA.run_gtk3_widget
|
229
|
+
exit
|
230
|
+
# ======================================================================= #
|
231
|
+
# === bioroebe --help
|
232
|
+
#
|
233
|
+
# This entry-point will quickly show which options are available for
|
234
|
+
# the bioshell.
|
235
|
+
# ======================================================================= #
|
236
|
+
when /^-?-?help$/
|
237
|
+
show_commandline_options
|
238
|
+
# ======================================================================= #
|
239
|
+
# === bioshell --permanently-disable-startup-intro
|
240
|
+
# === bioshell --permanently-disable-startup-notice
|
241
|
+
# === bioshell --permanently-no-startup-intro
|
242
|
+
# === bioshell --permanently-no-startup-info
|
243
|
+
# ======================================================================= #
|
244
|
+
when /^-?-?permanently(-|_)?disable(-|_)?startup(-|_)?intro$/,
|
245
|
+
/^-?-?permanently(-|_)?disable(-|_)?startup(-|_)?notice$/,
|
246
|
+
/^-?-?permanently(-|_)?no(-|_)?startup(-|_)?intro$/,
|
247
|
+
/^-?-?permanently(-|_)?no(-|_)?startup(-|_)?info$/
|
248
|
+
permanently_disable_startup_intro
|
249
|
+
# ======================================================================= #
|
250
|
+
# === :no_commandline_arguments
|
251
|
+
# ======================================================================= #
|
252
|
+
when :no_commandline_arguments
|
253
|
+
# ===================================================================== #
|
254
|
+
# Simply pass through in this case.
|
255
|
+
# ===================================================================== #
|
256
|
+
# ======================================================================= #
|
257
|
+
# === :exit_gracefully
|
258
|
+
# ======================================================================= #
|
259
|
+
when :exit_gracefully
|
260
|
+
set_exit_gracefully
|
261
|
+
# ======================================================================= #
|
262
|
+
# === bioroebe --silent-startup
|
263
|
+
# ======================================================================= #
|
264
|
+
when /^-?-?silent(-|_)?startup$/,
|
265
|
+
/^-?-?silent$/
|
266
|
+
do_a_silent_startup
|
267
|
+
# ======================================================================= #
|
268
|
+
# === bioroebe --random-aminoacids=33
|
269
|
+
# === bioroebe --n-aminoacids=33
|
270
|
+
# ======================================================================= #
|
271
|
+
when /^-?-?random(-|_)?aminoacids=(.+)$/i,
|
272
|
+
/^-?-?n(-|_)?aminoacids=(.+)$/i
|
273
|
+
n_aminoacids = $2.to_s.dup
|
274
|
+
::Bioroebe.create_random_aminoacids(n_aminoacids) { :do_report }
|
275
|
+
exit
|
276
|
+
# ======================================================================= #
|
277
|
+
# === bioroebe --rnafold=cdna.MT.fa
|
278
|
+
# ======================================================================= #
|
279
|
+
when /^-?-?rnafold=(.+)$/
|
280
|
+
try_to_run_rnalfold_on_this_file($1.to_s.dup)
|
281
|
+
exit
|
282
|
+
# ======================================================================= #
|
283
|
+
# === bioroebe --fasta=/Depot/Bioroebe/Arabidopsis_thaliana_chromosome_5_sequence.fasta
|
284
|
+
# ======================================================================= #
|
285
|
+
when /^-?-?fasta=(.+)$/
|
286
|
+
this_fasta_file = $1.to_s.dup
|
287
|
+
if File.exist?
|
288
|
+
handle_fasta(this_fasta_file)
|
289
|
+
else
|
290
|
+
e 'No file could be found at `'+sfile(this_fasta_file)+'`.'
|
291
|
+
end
|
292
|
+
# ======================================================================= #
|
293
|
+
# === bioroebe --n-fasta-entries
|
294
|
+
#
|
295
|
+
# Usage example:
|
296
|
+
#
|
297
|
+
# cd /root/Bioroebe/Downloads/; bioroebe --n-fasta-entries
|
298
|
+
#
|
299
|
+
# ======================================================================= #
|
300
|
+
when /^-?-?n(-|_)?fasta(-|_)?entries$/
|
301
|
+
require 'bioroebe/fasta/display_how_many_fasta_entries_are_in_this_directory.rb'
|
302
|
+
::Bioroebe::DisplayHowManyFastaEntriesAreInThisDirectory.new
|
303
|
+
exit
|
304
|
+
# ======================================================================= #
|
305
|
+
# === bioroebe --split-this-fasta-file-into-chromosomes=Mus_musculus.GRCm38.ncrna.fa
|
306
|
+
# ======================================================================= #
|
307
|
+
when /^-?-?split(-|_)?this(-|_)?fasta(-|_)?file(-|_)?into(-|_)?chromosomes=(.+)$/i # $6
|
308
|
+
_ = $6.to_s.dup
|
309
|
+
require 'bioroebe/fasta/split_this_fasta_file_into_chromosomes/split_this_fasta_file_into_chromosomes.rb'
|
310
|
+
::Bioroebe::SplitThisFastaFileIntoChromosomes.new(_)
|
311
|
+
exit
|
312
|
+
# ======================================================================= #
|
313
|
+
# === bioroebe --stats
|
314
|
+
#
|
315
|
+
# This entry-point will show some simple fasta-statistics, from
|
316
|
+
# the current directory.
|
317
|
+
#
|
318
|
+
# Usage example:
|
319
|
+
#
|
320
|
+
# cd /root/Bioroebe/Downloads/; bioroebe --stats
|
321
|
+
#
|
322
|
+
# ======================================================================= #
|
323
|
+
when /^-?-?stats$/i,
|
324
|
+
/^-?-?statistics$/i,
|
325
|
+
/^-?-?fasta(-|_)?stats$/i
|
326
|
+
require 'bioroebe/fasta/show_fasta_statistics.rb'
|
327
|
+
::Bioroebe.show_fasta_statistics(Dir['*'])
|
328
|
+
exit
|
329
|
+
# ======================================================================= #
|
330
|
+
# === bioroebe --download=ftp://ftp.ensembl.org/pub/release-92/gtf/mus_musculus/
|
331
|
+
#
|
332
|
+
# This entry point allows us to download a remote program.
|
333
|
+
#
|
334
|
+
# Invocation example:
|
335
|
+
#
|
336
|
+
# bioroebe --download=ftp://ftp.ensembl.org/pub/release-92/gtf/mus_musculus/
|
337
|
+
# bioroebe --download ftp://ftp.ensembl.org/pub/release-92/gtf/mus_musculus/
|
338
|
+
#
|
339
|
+
# Note that the second variant currently (April 2020) does not work -
|
340
|
+
# let's see if we need it again in the future.
|
341
|
+
# ======================================================================= #
|
342
|
+
when /^-?-?download=(.+)/
|
343
|
+
::Bioroebe.download($1.to_s.dup)
|
344
|
+
# ======================================================================= #
|
345
|
+
# === bioroebe --sequence=150
|
346
|
+
#
|
347
|
+
# This entry point allows us to use any sequence, on startup.
|
348
|
+
#
|
349
|
+
# Invocation example:
|
350
|
+
#
|
351
|
+
# bioroebe --sequence=1505
|
352
|
+
#
|
353
|
+
# ======================================================================= #
|
354
|
+
when /^-?-?sequence (.+)/,
|
355
|
+
/^-?-?sequence=(.+)/
|
356
|
+
set_dna($1.to_s.dup, :be_quiet) # Be quiet here when doing the assignment.
|
357
|
+
# ======================================================================= #
|
358
|
+
# === bioroebe --show-exon-statistics-for=/tmp/praktikum/Mouse/chromosome_8/parsed/cdna.8.L100.global.gtf
|
359
|
+
# ======================================================================= #
|
360
|
+
when /^-?-?show(-|_)?exon(-|_)?statistics(-|_)?for=(.+)$/ # === $4
|
361
|
+
::Bioroebe.show_exon_statistics($4.to_s.dup)
|
362
|
+
exit
|
363
|
+
# ======================================================================= #
|
364
|
+
# === bioroebe --sinatra
|
365
|
+
# ======================================================================= #
|
366
|
+
when /^-?-?sinatra$/i
|
367
|
+
do_start_the_sinatra_interface
|
368
|
+
return
|
369
|
+
end
|
370
|
+
run
|
371
|
+
end
|
372
|
+
|
373
|
+
# ========================================================================= #
|
374
|
+
# === reset (reset tag)
|
375
|
+
# ========================================================================= #
|
376
|
+
def reset(
|
377
|
+
be_verbose = true
|
378
|
+
)
|
379
|
+
super()
|
380
|
+
infer_the_namespace
|
381
|
+
reset_to_initial_state(be_verbose)
|
382
|
+
# ======================================================================= #
|
383
|
+
# Next, we have to try to enable the configuration.
|
384
|
+
# ======================================================================= #
|
385
|
+
enable_configuration
|
386
|
+
# ======================================================================= #
|
387
|
+
# Make sure that the base directories exist, within reset().
|
388
|
+
# ======================================================================= #
|
389
|
+
ensure_that_the_base_directories_exist
|
390
|
+
set_default_length # Set the default length of 1000 here.
|
391
|
+
if defined? DEFAULT_DNA_INPUT_YAML_FILE # Main DNA string.
|
392
|
+
set_string(DEFAULT_DNA_INPUT_YAML_FILE)
|
393
|
+
end
|
394
|
+
end
|
395
|
+
|
396
|
+
# ========================================================================= #
|
397
|
+
# === reset_to_initial_state
|
398
|
+
# ========================================================================= #
|
399
|
+
def reset_to_initial_state(
|
400
|
+
be_verbose = true
|
401
|
+
)
|
402
|
+
# ======================================================================= #
|
403
|
+
# === @internal_hash
|
404
|
+
#
|
405
|
+
# The internal Hash can be used to store internal behaviour variables
|
406
|
+
# rather than spawn so many different instance variables.
|
407
|
+
#
|
408
|
+
# It should be defined very early in this method.
|
409
|
+
# ======================================================================= #
|
410
|
+
@internal_hash = {}
|
411
|
+
# ======================================================================= #
|
412
|
+
# === :array_rna_sequence
|
413
|
+
#
|
414
|
+
# This can be populated with sequence objects such as:
|
415
|
+
#
|
416
|
+
# Bioroebe::Sequence.new(''.dup, :rna)
|
417
|
+
#
|
418
|
+
# ======================================================================= #
|
419
|
+
@internal_hash[:array_rna_sequences] = []
|
420
|
+
# ======================================================================= #
|
421
|
+
# === :array_dna_sequence
|
422
|
+
# ======================================================================= #
|
423
|
+
@internal_hash[:array_dna_sequences] = []
|
424
|
+
# ======================================================================= #
|
425
|
+
# === :the_main_sequence_is_frozen
|
426
|
+
# ======================================================================= #
|
427
|
+
@internal_hash[:the_main_sequence_is_frozen] = false
|
428
|
+
# ======================================================================= #
|
429
|
+
# === :array_palindromes
|
430
|
+
# ======================================================================= #
|
431
|
+
@internal_hash[:array_palindromes] = []
|
432
|
+
# ======================================================================= #
|
433
|
+
# === :file_dna_string_saved
|
434
|
+
#
|
435
|
+
# Where to store our DNA string by default.
|
436
|
+
# ======================================================================= #
|
437
|
+
@internal_hash[:file_dna_string_saved] = "#{log_dir?}dna_string_saved.yml"
|
438
|
+
# ======================================================================= #
|
439
|
+
# === :array_jumper_directories
|
440
|
+
# ======================================================================= #
|
441
|
+
@internal_hash[:array_jumper_directories] = []
|
442
|
+
# ======================================================================= #
|
443
|
+
# === :array_fasta
|
444
|
+
# ======================================================================= #
|
445
|
+
@internal_hash[:array_fasta] = []
|
446
|
+
# ======================================================================= #
|
447
|
+
# === analyse_the_local_dataset_on_startup
|
448
|
+
#
|
449
|
+
# If this setting is set to true then, on startup, the bioshell
|
450
|
+
# will report some information about the local dataset (FASTA
|
451
|
+
# files and pdb files).
|
452
|
+
# ======================================================================= #
|
453
|
+
@internal_hash[:analyse_the_local_dataset_on_startup] = true
|
454
|
+
# ======================================================================= #
|
455
|
+
# === search_for
|
456
|
+
# ======================================================================= #
|
457
|
+
@internal_hash[:search_for] = nil
|
458
|
+
# ======================================================================= #
|
459
|
+
# === coding_area
|
460
|
+
# ======================================================================= #
|
461
|
+
@internal_hash[:coding_area] = nil # This can keep track of the real coding area.
|
462
|
+
# ======================================================================= #
|
463
|
+
# === misc_sequence
|
464
|
+
# ======================================================================= #
|
465
|
+
@internal_hash[:misc_sequence] = nil # This can store a misc DNA or RNA sequence.
|
466
|
+
# ======================================================================= #
|
467
|
+
# === :array_sequences
|
468
|
+
# ======================================================================= #
|
469
|
+
# @internal_hash[:array_sequences] = []
|
470
|
+
# ======================================================================= #
|
471
|
+
# === :all_arguments
|
472
|
+
# ======================================================================= #
|
473
|
+
@internal_hash[:all_arguments] = []
|
474
|
+
# ======================================================================= #
|
475
|
+
# === :remaining_arguments
|
476
|
+
# ======================================================================= #
|
477
|
+
@internal_hash[:remaining_arguments] = []
|
478
|
+
# ======================================================================= #
|
479
|
+
# === :registered_actions
|
480
|
+
# ======================================================================= #
|
481
|
+
@internal_hash[:registered_actions] = ARRAY_REGISTERED_ACTIONS
|
482
|
+
# ======================================================================= #
|
483
|
+
# === :silent_startup
|
484
|
+
#
|
485
|
+
# This variable keeps track as to whether we will display a welcome
|
486
|
+
# message on startup or whether we will not.
|
487
|
+
# ======================================================================= #
|
488
|
+
@internal_hash[:silent_startup] = false
|
489
|
+
# ======================================================================= #
|
490
|
+
# === :create_directories_on_startup_of_the_shell
|
491
|
+
#
|
492
|
+
# If this variable is set to true then the bio-shell will create
|
493
|
+
# some directories on startup. The user can modify this from
|
494
|
+
# the commandline, though, and specifically disable it.
|
495
|
+
# ======================================================================= #
|
496
|
+
@internal_hash[:create_directories_on_startup_of_the_shell] = true
|
497
|
+
# ======================================================================= #
|
498
|
+
# === array_history
|
499
|
+
#
|
500
|
+
# This array will keep track of the input-history, aka the commands
|
501
|
+
# that the user has used.
|
502
|
+
# ======================================================================= #
|
503
|
+
@internal_hash[:array_history] = []
|
504
|
+
# ======================================================================= #
|
505
|
+
# === remove_last_character_if_it_is_a_question_mark
|
506
|
+
#
|
507
|
+
# If this variable is set to true then we will remove the last
|
508
|
+
# input character - at the least if it is a '?'.
|
509
|
+
# ======================================================================= #
|
510
|
+
@internal_hash[:remove_last_character_if_it_is_a_question_mark] = false
|
511
|
+
# ======================================================================= #
|
512
|
+
# === :first_argument
|
513
|
+
#
|
514
|
+
# This variable refers to the first argument passed into a method,
|
515
|
+
# from the menu.rb file.
|
516
|
+
# ======================================================================= #
|
517
|
+
@internal_hash[:first_argument] = nil
|
518
|
+
# ======================================================================= #
|
519
|
+
# === :array_aminoacid_sequence
|
520
|
+
#
|
521
|
+
# This variable should be an empty Array, aka [], initially, so that we
|
522
|
+
# can distinguish the case when the user has added data onto that
|
523
|
+
# Array.
|
524
|
+
# ======================================================================= #
|
525
|
+
@internal_hash[:array_aminoacid_sequence] = []
|
526
|
+
# ======================================================================= #
|
527
|
+
# === exit_the_shell_how
|
528
|
+
#
|
529
|
+
# The next variable has two valid modes:
|
530
|
+
#
|
531
|
+
# :instantly
|
532
|
+
# :exit_gracefully
|
533
|
+
#
|
534
|
+
# The first is the default; the second can be used if the Bioshell
|
535
|
+
# is embedded into another program.
|
536
|
+
# ======================================================================= #
|
537
|
+
@internal_hash[:exit_the_shell_how] = :instantly
|
538
|
+
# ======================================================================= #
|
539
|
+
# === search_for
|
540
|
+
#
|
541
|
+
# This is the sequence we wish to find, in a given nucleotide sequence.
|
542
|
+
# By default this will be nil.
|
543
|
+
# ======================================================================= #
|
544
|
+
@internal_hash[:search_for] = nil
|
545
|
+
# ======================================================================= #
|
546
|
+
# === show_the_leader
|
547
|
+
# ======================================================================= #
|
548
|
+
@internal_hash[:show_the_leader] = true # Show the 5' leader.
|
549
|
+
# ======================================================================= #
|
550
|
+
# === show_the_trailer
|
551
|
+
# ======================================================================= #
|
552
|
+
@internal_hash[:show_the_trailer] = true # Show the 3' trailer.
|
553
|
+
# ======================================================================= #
|
554
|
+
# === @save_file
|
555
|
+
# ======================================================================= #
|
556
|
+
@internal_hash[:save_file] = BIOSHELL_SAVE_FILE
|
557
|
+
# ======================================================================= #
|
558
|
+
# === @use_working_directory_as_prompt
|
559
|
+
# ======================================================================= #
|
560
|
+
@internal_hash[:use_working_directory_as_prompt] = false
|
561
|
+
# ======================================================================= #
|
562
|
+
# === @debug
|
563
|
+
#
|
564
|
+
# Determine whether we will debug or whether we will not
|
565
|
+
# ======================================================================= #
|
566
|
+
@internal_hash[:debug] = SHALL_WE_DEBUG
|
567
|
+
# ======================================================================= #
|
568
|
+
# === user_input
|
569
|
+
# ======================================================================= #
|
570
|
+
@internal_hash[:user_input] = nil
|
571
|
+
# ======================================================================= #
|
572
|
+
# === prompt_to_use
|
573
|
+
#
|
574
|
+
# This variable keeps track as to which prompt is to be used.
|
575
|
+
# ======================================================================= #
|
576
|
+
@internal_hash[:prompt_to_use] = :default
|
577
|
+
# ======================================================================= #
|
578
|
+
# === :use_xsel
|
579
|
+
#
|
580
|
+
# This method will determine whether we will use the external
|
581
|
+
# program "xsel". By default, at the least on my home system,
|
582
|
+
# I prefer to make use of xsel.
|
583
|
+
# ======================================================================= #
|
584
|
+
@internal_hash[:use_xsel] = true
|
585
|
+
# ======================================================================= #
|
586
|
+
# === @mode
|
587
|
+
#
|
588
|
+
# @mode can be either :dna or :rna or :aminoacid
|
589
|
+
# ======================================================================= #
|
590
|
+
@internal_hash[:mode] = :dna
|
591
|
+
# ======================================================================= #
|
592
|
+
# === @array_these_sequences_were_chopped_away
|
593
|
+
#
|
594
|
+
# Keep an Array that can be used to keep track of which sequences
|
595
|
+
# were chopped away. Whenever we perform a chop-related action we
|
596
|
+
# will store that sequence in an Array.
|
597
|
+
# ======================================================================= #
|
598
|
+
@internal_hash[:array_these_sequences_were_chopped_away] = []
|
599
|
+
# ======================================================================= #
|
600
|
+
# === array_timer_snapshots
|
601
|
+
# ======================================================================= #
|
602
|
+
@internal_hash[:array_timer_snapshots] = [] # This Array keeps track of the time.
|
603
|
+
# ======================================================================= #
|
604
|
+
# === may_we_show_the_startup_information
|
605
|
+
#
|
606
|
+
# This variable determines whether the startup-information may be
|
607
|
+
# shown, on start-up of the bioshell. By default this will be true
|
608
|
+
# typically, but a config-variable may overrule this.
|
609
|
+
# ======================================================================= #
|
610
|
+
@internal_hash[:may_we_show_the_startup_information] = true
|
611
|
+
if @configuration and @configuration.respond_to? :may_we_show_the_startup_information
|
612
|
+
@internal_hash[:may_we_show_the_startup_information] = @configuration.may_we_show_the_startup_information
|
613
|
+
end
|
614
|
+
# ======================================================================= #
|
615
|
+
# === :show_nucleotide_sequence
|
616
|
+
# ======================================================================= #
|
617
|
+
@internal_hash[:show_nucleotide_sequence] = ::Bioroebe::ShowNucleotideSequence.new(
|
618
|
+
'', :do_not_run_yet
|
619
|
+
)
|
620
|
+
# ======================================================================= #
|
621
|
+
# === fasta_file
|
622
|
+
#
|
623
|
+
# This used to be a standalone @hash variable, but during the
|
624
|
+
# rewrite in April 2020 this was integrated into @internal_hash.
|
625
|
+
# ======================================================================= #
|
626
|
+
@internal_hash[:fasta_file] = {}
|
627
|
+
# ======================================================================= #
|
628
|
+
# === @array_all_downloads
|
629
|
+
# ======================================================================= #
|
630
|
+
@internal_hash[:array_all_downloads] = [] # Must be an Array.
|
631
|
+
# ======================================================================= #
|
632
|
+
# === @use_working_directory_as_prompt
|
633
|
+
# ======================================================================= #
|
634
|
+
@internal_hash[:use_working_directory_as_prompt] = true
|
635
|
+
# ======================================================================= #
|
636
|
+
# === :nucleotide_sequence
|
637
|
+
# ======================================================================= #
|
638
|
+
# @internal_hash[:nucleotide_sequence] = ::Bioroebe::Sequence.new
|
639
|
+
# ======================================================================= #
|
640
|
+
# === :sequence
|
641
|
+
#
|
642
|
+
# We set thesequence to a new instance of Bioroebe::Sequence next.
|
643
|
+
# ======================================================================= #
|
644
|
+
reset_string
|
645
|
+
# ======================================================================= #
|
646
|
+
# === @use_colours
|
647
|
+
#
|
648
|
+
# Let's enable the colours.
|
649
|
+
# ======================================================================= #
|
650
|
+
enable_colours(:be_quiet)
|
651
|
+
# ======================================================================= #
|
652
|
+
# === Enable the clipboard next:
|
653
|
+
# ======================================================================= #
|
654
|
+
initialize_clipboard
|
655
|
+
# ======================================================================= #
|
656
|
+
# === Setting towards a default padding
|
657
|
+
#
|
658
|
+
# Next comes left-padding, defaulting to ' '. This should come after
|
659
|
+
# the clipboard has been initialized, and after @internal_hash has
|
660
|
+
# been fully populated.
|
661
|
+
# ======================================================================= #
|
662
|
+
set_padding :default
|
663
|
+
set_sequence_2
|
664
|
+
set_sequence_3
|
665
|
+
set_sequence_4
|
666
|
+
set_sequence_5
|
667
|
+
set_sequence_6
|
668
|
+
::Bioroebe.clear_array_colourize_this_aminoacid
|
669
|
+
# ======================================================================= #
|
670
|
+
# === Determine whether silent startup is active
|
671
|
+
#
|
672
|
+
# Next, determine whether we will show a small startup-message or
|
673
|
+
# whether we shall not show it. By default this should be false -
|
674
|
+
# but if a file called 'use_silent_startup.yml' exists then we
|
675
|
+
# will use that file.
|
676
|
+
# ======================================================================= #
|
677
|
+
if File.exist? FILE_USE_SILENT_STARTUP
|
678
|
+
dataset = YAML.load_file(FILE_USE_SILENT_STARTUP)
|
679
|
+
if dataset.is_a?(Hash) and dataset.has_key?('use_silent_startup')
|
680
|
+
@internal_hash[:silent_startup] = dataset['use_silent_startup']
|
681
|
+
end
|
682
|
+
else # else it is
|
683
|
+
@internal_hash[:silent_startup] = false
|
684
|
+
end
|
685
|
+
end
|
686
|
+
|
687
|
+
# ========================================================================= #
|
688
|
+
# === run
|
689
|
+
# ========================================================================= #
|
690
|
+
def run
|
691
|
+
setup_readline if use_readline?
|
692
|
+
perform_startup_actions # Should come before we show the welcome message or call menu().
|
693
|
+
show_welcome_message # The welcome-message should come after the startup actions.
|
694
|
+
menu(
|
695
|
+
commandline_arguments?,
|
696
|
+
:be_quiet_if_the_input_was_not_found
|
697
|
+
)
|
698
|
+
enter_main_loop # Enter the main user-input loop here.
|
699
|
+
end
|
700
|
+
|
701
|
+
# ========================================================================= #
|
702
|
+
# === freeze_the_main_sequence
|
703
|
+
# ========================================================================= #
|
704
|
+
def freeze_the_main_sequence
|
705
|
+
@internal_hash[:the_main_sequence_is_frozen] = true
|
706
|
+
end
|
707
|
+
|
708
|
+
# ========================================================================= #
|
709
|
+
# === unfreeze_the_main_sequence
|
710
|
+
# ========================================================================= #
|
711
|
+
def unfreeze_the_main_sequence
|
712
|
+
@internal_hash[:the_main_sequence_is_frozen] = false
|
713
|
+
end
|
714
|
+
|
715
|
+
# ========================================================================= #
|
716
|
+
# === is_the_main_sequence_frozen?
|
717
|
+
# ========================================================================= #
|
718
|
+
def is_the_main_sequence_frozen?
|
719
|
+
@internal_hash[:the_main_sequence_is_frozen]
|
720
|
+
end; alias the_main_sequence_is_frozen? is_the_main_sequence_frozen? # === the_main_sequence_is_frozen?
|
721
|
+
|
722
|
+
# ========================================================================= #
|
723
|
+
# === leading_3_prime
|
724
|
+
#
|
725
|
+
# This is when 3' is at the start of an output.
|
726
|
+
# ========================================================================= #
|
727
|
+
def leading_3_prime
|
728
|
+
"3' - "
|
729
|
+
end; alias leading_three_prime leading_3_prime # === leading_three_prime
|
730
|
+
alias leading_3 leading_3_prime # === leading_3
|
731
|
+
|
732
|
+
# ========================================================================= #
|
733
|
+
# === report_n_start_codons
|
734
|
+
#
|
735
|
+
# Use this method to count how many ATG codons we have. We will honour
|
736
|
+
# the default start_codon in use.
|
737
|
+
#
|
738
|
+
# The third argument determines which reading frame is to be used. By
|
739
|
+
# default, the method will use the first reading frame.
|
740
|
+
# ========================================================================= #
|
741
|
+
def report_n_start_codons(
|
742
|
+
this_string = string?,
|
743
|
+
use_this_as_start_codon = :default, # Use the proper start codon.
|
744
|
+
in_which_frame = :frame1
|
745
|
+
)
|
746
|
+
case use_this_as_start_codon
|
747
|
+
# ======================================================================= #
|
748
|
+
# === :default
|
749
|
+
# ======================================================================= #
|
750
|
+
when :default
|
751
|
+
use_this_as_start_codon = ::Bioroebe.start_codon?
|
752
|
+
end
|
753
|
+
# ======================================================================= #
|
754
|
+
# === Handle blocks next
|
755
|
+
# ======================================================================= #
|
756
|
+
if block_given?
|
757
|
+
yielded = yield
|
758
|
+
case yielded
|
759
|
+
when /^frame/
|
760
|
+
in_which_frame = yielded.to_sym
|
761
|
+
end
|
762
|
+
end
|
763
|
+
# ======================================================================= #
|
764
|
+
# The following can be invoked via:
|
765
|
+
# n_ORF? frame1
|
766
|
+
# ======================================================================= #
|
767
|
+
case in_which_frame
|
768
|
+
# ======================================================================= #
|
769
|
+
# === :frame1
|
770
|
+
# ======================================================================= #
|
771
|
+
when :frame1
|
772
|
+
in_which_frame = 'frame 1'
|
773
|
+
# ======================================================================= #
|
774
|
+
# === :frame2
|
775
|
+
# ======================================================================= #
|
776
|
+
when :frame2
|
777
|
+
in_which_frame = 'frame 2'
|
778
|
+
# ======================================================================= #
|
779
|
+
# === :frame3
|
780
|
+
# ======================================================================= #
|
781
|
+
when :frame3
|
782
|
+
in_which_frame = 'frame 3'
|
783
|
+
end
|
784
|
+
n_start_codons = this_string.upcase.scan(
|
785
|
+
/#{use_this_as_start_codon}/
|
786
|
+
).size.to_s
|
787
|
+
# ======================================================================= #
|
788
|
+
# The above is not yet in the proper frame, though.
|
789
|
+
# ======================================================================= #
|
790
|
+
trailing_message = " Initiation Codons "\
|
791
|
+
"(in #{orangered(in_which_frame)}#{rev})."
|
792
|
+
erev "Our main string has #{sfancy(n_start_codons)}#{rev}"\
|
793
|
+
" #{simp(use_this_as_start_codon)}#{rev} ("\
|
794
|
+
"#{use_this_as_start_codon.tr('T','U')})"+
|
795
|
+
trailing_message
|
796
|
+
if coding_area? # This has been user-supplied in that case.
|
797
|
+
erev 'However had, only the nucleotides from position'
|
798
|
+
erev "#{sfancy(coding_area?.to_s.split('..').first.to_s)}#{rev}"\
|
799
|
+
" to position #{sfancy(coding_area?.to_s.split('..').last.to_s)}"\
|
800
|
+
"#{rev} will be colourized."
|
801
|
+
end
|
802
|
+
end
|
803
|
+
|
804
|
+
# ========================================================================= #
|
805
|
+
# === search_sequence_for_open_reading_frames
|
806
|
+
#
|
807
|
+
# Use this method to search for Open Reading Frames (i.e. "AUG" codons).
|
808
|
+
#
|
809
|
+
# Since we use Bioroebe.start_codon?, this may also default to another
|
810
|
+
# start codon.
|
811
|
+
# ========================================================================= #
|
812
|
+
def search_sequence_for_open_reading_frames(
|
813
|
+
i = :default,
|
814
|
+
use_which_frame = :frame1,
|
815
|
+
use_this_start_codon = :default
|
816
|
+
)
|
817
|
+
case use_this_start_codon
|
818
|
+
# ======================================================================= #
|
819
|
+
# === :default
|
820
|
+
# ======================================================================= #
|
821
|
+
when :default
|
822
|
+
use_this_start_codon = ::Bioroebe.start_codon?
|
823
|
+
end
|
824
|
+
case i
|
825
|
+
# ======================================================================= #
|
826
|
+
# === :default
|
827
|
+
# ======================================================================= #
|
828
|
+
when :default
|
829
|
+
i = string?
|
830
|
+
end
|
831
|
+
i.upcase!
|
832
|
+
if i
|
833
|
+
if i.include? use_this_start_codon # This asks whether the string includes 'ATG'.
|
834
|
+
report_n_start_codons # Will report how many Start sequences we have.
|
835
|
+
e
|
836
|
+
erev "These can be found (and will start) at these positions"
|
837
|
+
erev "(later shown via red colour):#{N}#{N}"
|
838
|
+
copy = i.to_s.dup # Work on a copy here.
|
839
|
+
if use_which_frame == :frame2 # Chop off the first entry then.
|
840
|
+
copy[0,1] = ''
|
841
|
+
end
|
842
|
+
# =================================================================== #
|
843
|
+
# We will search for both ATG and AUG though, respectively the
|
844
|
+
# input variants given to us. If the following regex appears to
|
845
|
+
# be complicated to you, here is the old variant for the regex:
|
846
|
+
#
|
847
|
+
# use_this_regex = /(ATG|AUG)/i
|
848
|
+
#
|
849
|
+
# =================================================================== #
|
850
|
+
array_results = []
|
851
|
+
array_results << Bioroebe.return_array_of_sequence_matches(copy, use_this_start_codon)
|
852
|
+
if use_this_start_codon.include? 'T'
|
853
|
+
array_results << Bioroebe.return_array_of_sequence_matches(copy, use_this_start_codon.tr('T','U'))
|
854
|
+
end
|
855
|
+
array_results.flatten!
|
856
|
+
array_results.compact!
|
857
|
+
# =================================================================== #
|
858
|
+
# This will hold data such as:
|
859
|
+
# [16, ["ATG"]]
|
860
|
+
# At the least up until April 2020, before it was changed.
|
861
|
+
# =================================================================== #
|
862
|
+
return array_results
|
863
|
+
else
|
864
|
+
[]
|
865
|
+
end
|
866
|
+
else
|
867
|
+
ewarn 'It seems as if you have not yet assigned a string.'
|
868
|
+
ewarn 'You could run "random" to assign a random string.'
|
869
|
+
end
|
870
|
+
end
|
871
|
+
|
872
|
+
# ========================================================================= #
|
873
|
+
# === report_main_sequence
|
874
|
+
#
|
875
|
+
# We will call dna_with_ends() here in this method. The argument colourize
|
876
|
+
# will determine whether we will colourize the DNA strand or not.
|
877
|
+
#
|
878
|
+
# Invocation examples:
|
879
|
+
#
|
880
|
+
# report_main_sequence(::Bioroebe.start_codon?)
|
881
|
+
# report_main_sequence(:start_codon) # ← is the same as the ^^^ above
|
882
|
+
# report_main_sequence(:stop_codon) # ← Colourize the stop-codons.
|
883
|
+
#
|
884
|
+
# ========================================================================= #
|
885
|
+
def report_main_sequence(
|
886
|
+
input = dna_sequence_as_string?,
|
887
|
+
colourize = nil
|
888
|
+
)
|
889
|
+
case input
|
890
|
+
# ======================================================================= #
|
891
|
+
# === :stop_codon
|
892
|
+
# ======================================================================= #
|
893
|
+
when :stop_codon
|
894
|
+
colourize = stop_codons?
|
895
|
+
input = dna_sequence_as_string?
|
896
|
+
end
|
897
|
+
original_input = input.dup
|
898
|
+
case colourize
|
899
|
+
# ======================================================================= #
|
900
|
+
# === :stop_codon
|
901
|
+
#
|
902
|
+
# We attempt to colourize the stop-codons via this method.
|
903
|
+
# ======================================================================= #
|
904
|
+
when :stop_codon
|
905
|
+
colourize = stop_codons?
|
906
|
+
# ======================================================================= #
|
907
|
+
# === :stop_codon_in_frame1
|
908
|
+
# ======================================================================= #
|
909
|
+
when :stop_codon_in_frame1,
|
910
|
+
:stop_codon_in_frame2,
|
911
|
+
:stop_codon_in_frame3
|
912
|
+
new_string = remove_trailing_escape_code(
|
913
|
+
colour_for_nucleotides(
|
914
|
+
''.dup
|
915
|
+
).dup
|
916
|
+
).dup
|
917
|
+
n_stop_codons_were_found = 0
|
918
|
+
prepend_this = ''.dup
|
919
|
+
input = input.dup # Work on a copy here.
|
920
|
+
case colourize
|
921
|
+
when :stop_codon_in_frame2
|
922
|
+
prepend_this << input[0,1]
|
923
|
+
input[0,1] = ''
|
924
|
+
when :stop_codon_in_frame3
|
925
|
+
prepend_this << input[0,2]
|
926
|
+
input[0,2] = ''
|
927
|
+
end
|
928
|
+
new_string << prepend_this
|
929
|
+
scanned = input.scan(/.../) # Get a group of codons here.
|
930
|
+
scanned.each {|codon|
|
931
|
+
if is_a_stop_codon? codon
|
932
|
+
n_stop_codons_were_found += 1
|
933
|
+
new_string << colour_for_stop_codon(codon.dup).dup+
|
934
|
+
remove_trailing_escape_code(
|
935
|
+
colour_for_nucleotides
|
936
|
+
)
|
937
|
+
else
|
938
|
+
new_string << codon.dup
|
939
|
+
end
|
940
|
+
}
|
941
|
+
case colourize
|
942
|
+
# === :stop_codon_in_frame2
|
943
|
+
when :stop_codon_in_frame2
|
944
|
+
new_string << input[-2,2]
|
945
|
+
# === :stop_codon_in_frame3
|
946
|
+
when :stop_codon_in_frame3
|
947
|
+
new_string << input[-1,1]
|
948
|
+
end
|
949
|
+
|
950
|
+
e "#{padding?}"\
|
951
|
+
"#{rev}"\
|
952
|
+
"#{leading_five_prime}"\
|
953
|
+
"#{new_string}"\
|
954
|
+
"#{rev}"\
|
955
|
+
"#{trailing_three_prime}"
|
956
|
+
erev "#{steelblue(n_stop_codons_were_found)} #{rev}stop "\
|
957
|
+
"codons were found in this sequence of #{original_input.size} "\
|
958
|
+
"nucleotides."
|
959
|
+
return
|
960
|
+
# ======================================================================= #
|
961
|
+
# === :start_codon
|
962
|
+
# ======================================================================= #
|
963
|
+
when :start_codon # Instruction to use a start codon here.
|
964
|
+
colourize = start_codon?
|
965
|
+
# ======================================================================= #
|
966
|
+
# === :start_and_stop_codon
|
967
|
+
# ======================================================================= #
|
968
|
+
when :start_and_stop_codon
|
969
|
+
colourize = [start_codon?, stop_codons?]
|
970
|
+
end
|
971
|
+
# ======================================================================= #
|
972
|
+
# The old code was:
|
973
|
+
#
|
974
|
+
# erev padding?+
|
975
|
+
# dna_with_ends(input, colourize) { :honour_coding_area_if_it_exists } # The dna_with_ends() method can deal with Arrays.
|
976
|
+
#
|
977
|
+
# This is now mostly ported (April 2020), but the :honour_coding_area_if_it_exists
|
978
|
+
# is not yet ported, so the above code will remain as-is, for the time
|
979
|
+
# being.
|
980
|
+
# ======================================================================= #
|
981
|
+
show_nucleotide_sequence?.report_this_sequence(input) {{
|
982
|
+
padding_to_use: padding?,
|
983
|
+
colourize_this_subsequence: colourize
|
984
|
+
}}
|
985
|
+
end; alias show_main_string report_main_sequence # === show_main_string
|
986
|
+
alias show_main_sequence report_main_sequence # === show_main_sequence
|
987
|
+
alias show_colourized_sequence report_main_sequence # === show_colourized_sequence
|
988
|
+
alias show_dna_sequence report_main_sequence # === show_dna_sequence
|
989
|
+
alias show_DNA_sequence report_main_sequence # === show_DNA_sequence
|
990
|
+
|
991
|
+
# ========================================================================= #
|
992
|
+
# === enable_configuration
|
993
|
+
# ========================================================================= #
|
994
|
+
def enable_configuration
|
995
|
+
config_dir = ::Bioroebe.project_yaml_directory?+
|
996
|
+
'/configuration/'
|
997
|
+
unless Object.const_defined?(:Roebe) and
|
998
|
+
Roebe.const_defined?(:Configuration)
|
999
|
+
begin
|
1000
|
+
require 'roebe/configuration/class/configuration.rb'
|
1001
|
+
rescue LoadError; end
|
1002
|
+
end
|
1003
|
+
if Object.const_defined?(:Roebe) and
|
1004
|
+
Roebe.const_defined?(:Configuration)
|
1005
|
+
# ===================================================================== #
|
1006
|
+
# === Initialize @configuration
|
1007
|
+
# ===================================================================== #
|
1008
|
+
@configuration = ::Roebe::Configuration.new(config_dir, :do_not_run_yet)
|
1009
|
+
@configuration.be_verbose if @configuration.respond_to? :be_verbose
|
1010
|
+
@configuration.run
|
1011
|
+
else
|
1012
|
+
@configuration = nil
|
1013
|
+
end
|
1014
|
+
end
|
1015
|
+
|
1016
|
+
# ========================================================================= #
|
1017
|
+
# === find_restriction_sites
|
1018
|
+
#
|
1019
|
+
# Call the parent method in the Bioroebe class.
|
1020
|
+
# ========================================================================= #
|
1021
|
+
def find_restriction_sites(i = string?)
|
1022
|
+
i = string? if i.nil?
|
1023
|
+
Bioroebe.restriction_sites?(i) # bl mybioruby
|
1024
|
+
end
|
1025
|
+
|
1026
|
+
# ========================================================================= #
|
1027
|
+
# === find_complementary_strand
|
1028
|
+
#
|
1029
|
+
# Invoke this via:
|
1030
|
+
#
|
1031
|
+
# 3'-ATGCCTGCC
|
1032
|
+
#
|
1033
|
+
# ========================================================================= #
|
1034
|
+
def find_complementary_strand(i = dna_sequence?)
|
1035
|
+
_ = i.strip # The original input.
|
1036
|
+
if _.include? "3'-" and _.start_with?('3')
|
1037
|
+
_.gsub!(/3'-/,'')
|
1038
|
+
_.gsub!(/-5'/,'')
|
1039
|
+
_.gsub!(/3'-/,'')
|
1040
|
+
erev lpad?+leading_three_prime+
|
1041
|
+
colourize_nucleotide(_, :do_not_add_anything_else)+
|
1042
|
+
trailing_five_prime
|
1043
|
+
end
|
1044
|
+
result = lpad?+
|
1045
|
+
colourize_nucleotide(
|
1046
|
+
return_complement(i.reverse)
|
1047
|
+
)
|
1048
|
+
erev result
|
1049
|
+
return result
|
1050
|
+
end; alias show_complementary_strand find_complementary_strand # === show_complementary_strand
|
1051
|
+
|
1052
|
+
# ========================================================================= #
|
1053
|
+
# === Bioroebe::Shell.menu
|
1054
|
+
#
|
1055
|
+
# To test this, try:
|
1056
|
+
#
|
1057
|
+
# Bioroebe::Shell.menu('ll')
|
1058
|
+
#
|
1059
|
+
# ========================================================================= #
|
1060
|
+
def self.menu(i = ARGV)
|
1061
|
+
new(:no_commandline_arguments).menu(i)
|
1062
|
+
end
|
1063
|
+
|
1064
|
+
# ========================================================================= #
|
1065
|
+
# === Bioroebe::Shell[]
|
1066
|
+
# ========================================================================= #
|
1067
|
+
def self.[](i = ARGV)
|
1068
|
+
new(i)
|
1069
|
+
end
|
1070
|
+
|
1071
|
+
# ========================================================================= #
|
1072
|
+
# === Bioroebe::Shell.upload_this_pdf_file
|
1073
|
+
#
|
1074
|
+
# Use this method to upload the .pdf tutorial or any other .pdf
|
1075
|
+
# file. This is primarily useful on my home system and may have
|
1076
|
+
# very little value to other people.
|
1077
|
+
# ========================================================================= #
|
1078
|
+
def self.upload_this_pdf_file(path)
|
1079
|
+
# ======================================================================= #
|
1080
|
+
# ^^^ This will have generated the .pdf.
|
1081
|
+
# ======================================================================= #
|
1082
|
+
# Hardcoded for now where the .pdf will reside.
|
1083
|
+
# ======================================================================= #
|
1084
|
+
if Object.const_defined? :FtpParadise
|
1085
|
+
ftp = FtpParadise.new(:shevy, :dont_run_yet)
|
1086
|
+
ftp.do_login
|
1087
|
+
ftp.upload_this_binary_file(path)
|
1088
|
+
e 'Finished uploading!'
|
1089
|
+
end
|
1090
|
+
end
|
1091
|
+
|
1092
|
+
# ========================================================================= #
|
1093
|
+
# === Bioroebe::Shell.generate_pdf_tutorial
|
1094
|
+
#
|
1095
|
+
# You can use this method to simply generate a new .pdf file, then
|
1096
|
+
# upload it anyway.
|
1097
|
+
# ========================================================================= #
|
1098
|
+
def self.generate_pdf_tutorial(
|
1099
|
+
also_upload_the_tutorial = true
|
1100
|
+
)
|
1101
|
+
url = ::Bioroebe.try_to_pass_through_beautiful_url('bioroebe_tutorial?pdf')
|
1102
|
+
url = url.first if url.is_a? Array
|
1103
|
+
url.gsub!(/^\/home\/x\/data\//, LOCALHOST) if url.include? HOME_DIRECTORY_OF_USER_X+'data/'
|
1104
|
+
OpenURI.send(:open, url)
|
1105
|
+
# ======================================================================= #
|
1106
|
+
# === Designate where the tutorial can be found locally
|
1107
|
+
# ======================================================================= #
|
1108
|
+
path = FILE_BIOROEBE_TUTORIAL
|
1109
|
+
if also_upload_the_tutorial
|
1110
|
+
if File.exist? path
|
1111
|
+
::Bioroebe.upload_this_pdf_file(path)
|
1112
|
+
else
|
1113
|
+
e "Can not upload from #{sfile(path.to_s)} as this "\
|
1114
|
+
"path does not exist."
|
1115
|
+
end
|
1116
|
+
end
|
1117
|
+
end
|
1118
|
+
|
1119
|
+
end
|
1120
|
+
|
1121
|
+
# =========================================================================== #
|
1122
|
+
# === Bioroebe.upload_this_pdf_file
|
1123
|
+
# =========================================================================== #
|
1124
|
+
def self.upload_this_pdf_file(i)
|
1125
|
+
::Bioroebe::Shell.upload_this_pdf_file(i)
|
1126
|
+
end
|
1127
|
+
|
10
1128
|
# =========================================================================== #
|
11
|
-
#
|
12
|
-
# =========================================================================== #
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
# =========================================================================== #
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
require 'bioroebe/shell/prompt.rb'
|
29
|
-
require 'bioroebe/shell/readline/readline.rb'
|
30
|
-
require 'bioroebe/shell/reset.rb'
|
31
|
-
require 'bioroebe/shell/scan_and_parse.rb'
|
32
|
-
require 'bioroebe/shell/search.rb'
|
33
|
-
require 'bioroebe/shell/sequences.rb'
|
34
|
-
require 'bioroebe/shell/show_report_and_display.rb'
|
35
|
-
require 'bioroebe/shell/startup.rb'
|
36
|
-
require 'bioroebe/shell/taxonomy.rb'
|
37
|
-
require 'bioroebe/shell/user_input.rb'
|
1129
|
+
# === Bioroebe.generate_pdf_tutorial
|
1130
|
+
# =========================================================================== #
|
1131
|
+
def self.generate_pdf_tutorial
|
1132
|
+
::Bioroebe::Shell.generate_pdf_tutorial
|
1133
|
+
end
|
1134
|
+
|
1135
|
+
# =========================================================================== #
|
1136
|
+
# === Bioroebe.shell
|
1137
|
+
#
|
1138
|
+
# This is the main method to instantiate the Shell component of the
|
1139
|
+
# Bioroebe component.
|
1140
|
+
# =========================================================================== #
|
1141
|
+
def self.shell(i = ARGV)
|
1142
|
+
::Bioroebe::Shell.new(i)
|
1143
|
+
end; self.instance_eval { alias start_shell shell } # === Bioroebe.start_shell
|
1144
|
+
|
1145
|
+
end
|
38
1146
|
|
39
1147
|
if __FILE__ == $PROGRAM_NAME
|
40
1148
|
Bioroebe::Shell.new(ARGV)
|
1149
|
+
# Bioroebe::Shell.new.enable_gtk_section_antisensestrand
|
41
1150
|
end
|