Class: Bioroebe::Shell
- Inherits:
-
CommandlineApplication
- Object
- Base
- CommandlineApplication
- Bioroebe::Shell
- Defined in:
- lib/bioroebe/shell/menu.rb,
lib/bioroebe/shell/misc.rb,
lib/bioroebe/shell/shell.rb,
lib/bioroebe/shell/help/help.rb,
lib/bioroebe/shell/help/class.rb,
lib/bioroebe/shell/colours/colours.rb,
lib/bioroebe/shell/readline/readline.rb
Overview
Bioroebe::Shell
Defined Under Namespace
Classes: Help
Constant Summary collapse
- HOME_DIRECTORY_OF_USER_X =
#
HOME_DIRECTORY_OF_USER_X
Hardcoded path - only useful on my home setup, though.
#
'/home/x/'
- RUBY_SRC =
"#{HOME_DIRECTORY_OF_USER_X}programming/ruby/src/"
- BIOROEBE =
ENV['HOME']
- FILE_USE_SILENT_STARTUP =
#
FILE_USE_SILENT_STARTUP
#
"#{::Bioroebe.project_base_directory?}shell/configuration/use_silent_startup.yml"
- SHALL_WE_DEBUG =
#
SHALL_WE_DEBUG
#
false
- TRUNCATE_AT_N_ELEMENTS =
#
TRUNCATE_AT_N_ELEMENTS
If we display nucleotide strings, then by default, these may be very long. So the following constant will act as a threshold.
#
2000
- BIOSHELL_SAVE_FILE =
'/home/Temp/bioroebe/shell_file.md'
- HOME_DIR =
This is valid at home.
home_dir+'.gem/gems/bioroebe-'+ Bioroebe.version?.to_s+'/lib/bioroebe/'
- DEFAULT_PADDING =
#
DEFAULT_PADDING
#
' '
- MAIN_EDITOR =
else assume that we may be on windows.
'notepad++.exe'
- MY_EDITOR =
MY_EDITOR
MAIN_EDITOR
- COMPLETION_PROC =
#
COMPLETION_PROC
#
proc { |s| (ARRAY_WITH_COMPLETIONS.grep(/^#{Regexp.escape(s.to_s)}/)+ self.return_entries_in_the_current_directory.map {|entry| (entry+'/').squeeze('/') }).flatten }
Constants inherited from CommandlineApplication
CommandlineApplication::OLD_VERBOSE_VALUE
Constants included from ColoursForBase
ColoursForBase::ARRAY_HTML_COLOURS_IN_USE
Constants inherited from Base
Class Method Summary collapse
-
.[](i = ARGV) ⇒ Object
# === Bioroebe::Shell[] ========================================================================= #.
-
.colour? ⇒ Boolean
# === Bioroebe::Shell.colour? ========================================================================= #.
-
.generate_pdf_tutorial(also_upload_the_tutorial = true) ⇒ Object
# === Bioroebe::Shell.generate_pdf_tutorial.
-
.menu(i = ARGV) ⇒ Object
# === Bioroebe::Shell.menu.
-
.return_entries_in_the_current_directory ⇒ Object
# === Bioroebe::Shell.return_entries_in_the_current_directory ========================================================================= #.
-
.set_colour(i) ⇒ Object
# === Bioroebe::Shell.set_colour.
-
.upload_this_pdf_file(path) ⇒ Object
# === Bioroebe::Shell.upload_this_pdf_file.
Instance Method Summary collapse
-
#aa_to_dna(i) ⇒ Object
# === aa_to_dna ========================================================================= #.
-
#add_his_tag(i = 'add 6 random his tags') ⇒ Object
# === add_his_tag.
-
#add_n_nucleotides ⇒ Object
# === add_to_start.
-
#add_poly_a_sequence ⇒ Object
# === add_poly_a_sequence.
-
#add_the_current_user_input_to_the_history ⇒ Object
# === add_the_current_user_input_to_the_history ========================================================================= #.
-
#add_timer_snapshot ⇒ Object
# === add_timer_snapshot ========================================================================= #.
-
#add_to_end(i) ⇒ Object
(also: #add)
# === add_to_end.
-
#add_to_history(i = user_input?) ) ⇒ Object
# === add_to_history.
-
#add_to_start(i) ⇒ Object
(also: #left_add)
# === add_to_start ========================================================================= #.
-
#add_to_start_or_end(i = '', append_or_prepend = :append) ⇒ Object
# === add_to_start_or_end.
-
#add_vertical_barrier_to_sequence(i = dna_sequence? ) ⇒ Object
# === add_vertical_barrier_to_sequence.
-
#adenin? ⇒ Boolean
# === adenin?.
-
#align_ORFS(i = dna_string? ) ⇒ Object
# === align_ORFS.
-
#all_arguments? ⇒ Boolean
(also: #a?)
# === all_arguments? (a? tag) ========================================================================= #.
-
#all_upcase?(i) ⇒ Boolean
(also: #is_all_upcase?)
# === all_upcase?.
-
#analyze(i = sequence? ) ⇒ Object
# === analyze (analyze tag).
-
#analyze_dna_string(i = dna_string? ) ⇒ Object
# === analyze_dna_string.
-
#annotate_this_file(i) ⇒ Object
# === annotate_this_file ========================================================================= #.
-
#append(i) ⇒ Object
# === append (append tag).
-
#array_fasta? ⇒ Boolean
# === array_fasta? ========================================================================= #.
-
#array_history? ⇒ Boolean
# === array_history?.
-
#array_timer_snapshots? ⇒ Boolean
# === array_timer_snapshots? ========================================================================= #.
-
#assign_sequence2(i) ⇒ Object
# === assign_sequence2 ========================================================================= #.
-
#assume_what_type_this_is(i) ⇒ Object
# === assume_what_type_this_is.
-
#attempt_to_discover_dna_A_boxes ⇒ Object
# === attempt_to_discover_dna_A_boxes ========================================================================= #.
-
#automatically_rename_this_fasta_file(i) ⇒ Object
# === automatically_rename_this_fasta_file ========================================================================= #.
-
#backtranseq(i = aminoacid_sequence?, , output_as_dna_or_rna = :dna) ⇒ Object
(also: #translate_aminoacids_into_dna)
# === backtranseq.
-
#bioshell_log_dir? ⇒ Boolean
# === bioshell_log_dir?.
-
#bisulfite(i) ⇒ Object
# === bisulfite ========================================================================= #.
-
#calculate_atp_cost_for(i = aminoacid_sequence?) ) ⇒ Object
# === calculate_atp_cost_for.
-
#calculate_exponential_growth(a, b) ⇒ Object
# === calculate_exponential_growth ========================================================================= #.
-
#calculate_hamming_distance_of(i) ⇒ Object
# === calculate_hamming_distance_of.
-
#calculate_melting_temperature(i) ⇒ Object
# === calculate_melting_temperature.
-
#calculate_time_difference ⇒ Object
# === calculate_time_difference ========================================================================= #.
-
#calculcate_at_content(i = dna_sequence? ) ⇒ Object
# === calculcate_at_content.
-
#calculcate_gc_content(i = dna_sequence_as_string? ) ⇒ Object
# === calculcate_gc_content.
-
#change_first_nucleotide_to(i = dna_sequence? ) ⇒ Object
# === change_first_nucleotide_to.
-
#chdir(i = :default) ⇒ Object
(also: #cd)
# === chdir (cd tag) ========================================================================= #.
-
#check_for_local_vectors ⇒ Object
# === check_for_local_vectors ========================================================================= #.
-
#check_for_mismatches ⇒ Object
# === check_for_mismatches ========================================================================= #.
-
#chop(i = 1, chop_from_left_or_right_hand_side = :default) ⇒ Object
(also: #remove_n_nucleotides)
# === chop (chop tag).
-
#chop_to(i) ⇒ Object
# === chop_to.
-
#chunked_display(i = dna_sequence? ) ⇒ Object
# === chunked_display.
-
#clear(i) ⇒ Object
# === clear.
-
#coding_area? ⇒ Boolean
# === coding_area?.
-
#codon(i = sequence? ) ⇒ Object
(also: #codons, #codon?, #codons?)
# === codon.
-
#codon_to_aminoacid(i) ⇒ Object
# === codon_to_aminoacid.
-
#colour_for_nucleotide(i = '') ⇒ Object
(also: #colour_for_nucleotides)
# === colour_for_nucleotide ========================================================================= #.
-
#colour_for_stop_codon(i) ⇒ Object
# === colour_for_stop_codon ========================================================================= #.
-
#colour_scheme_demo(use_this_sequence = 'ATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGC') ⇒ Object
# === colour_scheme_demo ========================================================================= #.
-
#colour_scheme_for_aminoacids(i = aminoacid_sequence? ) ⇒ Object
# === colour_scheme_for_aminoacids.
-
#colour_scheme_for_nucleotides(i = dna_sequence?) ) ⇒ Object
# === colour_scheme_for_nucleotides.
-
#colourize_fasta_file(i) ⇒ Object
# === colourize_fasta_file.
-
#colourize_nucleotide(i, add_leading_five_and_trailing_three_primes = true) ⇒ Object
(also: #colourize_nucleotide_sequence)
# === colourize_nucleotide.
-
#colourize_this_aminoacid(i) ⇒ Object
# === colourize_this_aminoacid.
-
#compact_file(this_file = nil) ⇒ Object
# === compact_file.
-
#compare_two_files(file_a, file_b) ⇒ Object
# === compare_two_files.
-
#compare_two_strings_as_alignment(string1 = nil, string2 = nil) ⇒ Object
# === compare_two_strings_as_alignment.
-
#compseq(i = dna_sequence?) ) ⇒ Object
# === compseq.
-
#config? ⇒ Boolean
(also: #configuration?)
# === config? ========================================================================= #.
-
#consider_analysing_the_local_dataset_on_startup ⇒ Object
# === consider_analysing_the_local_dataset_on_startup.
-
#considering_changing_the_title_of_the_kde_konsole_tab(to_this_title = 'BioRoebe') ⇒ Object
# === considering_changing_the_title_of_the_kde_konsole_tab ========================================================================= #.
-
#convert_five_prime_dna_into_five_prime_mrna(this_string = sequence? ) ⇒ Object
# === convert_five_prime_dna_into_five_prime_mrna (DNA to mRNA).
-
#copy_bioroebe_shell_before_quitting ⇒ Object
# === copy_bioroebe_shell_before_quitting.
-
#could_this_be_an_amino_acid?(i) ⇒ Boolean
# === could_this_be_an_amino_acid?.
-
#count_amount_of_aminoacids(i) ⇒ Object
# === count_amount_of_aminoacids ========================================================================= #.
-
#create_balanced_composition(i = nil) ⇒ Object
# === create_balanced_composition.
-
#create_fasta_file ⇒ Object
# === create_fasta_file ========================================================================= #.
-
#create_n_random_amino_acids(n = 1000) ⇒ Object
# === create_n_random_amino_acids ========================================================================= #.
-
#cut(i) ⇒ Object
# === cut (cut tag).
-
#cut_at(this_sequence = 'GAATTC', be_verbose = true) ⇒ Object
# === cut_at.
-
#cut_sequence_in_slices_of(threshold = '9') ⇒ Object
# === cut_sequence_in_slices_of.
-
#cut_with_enzyme(i) ⇒ Object
# === cut_with_enzyme ========================================================================= #.
-
#cutseq(i = [1,3]) ⇒ Object
# === cutseq.
-
#cytosin? ⇒ Boolean
# === cytosin? ========================================================================= #.
-
#dalton(i) ⇒ Object
# === dalton.
-
#deduce_this_aminoacid_sequence(i = 'Lys-Ser-Pro-Ser-Leu-Asn-Ala-Ala-Lys', show_the_rna_sequence = true) ⇒ Object
# === deduce_this_aminoacid_sequence.
-
#default_length? ⇒ Boolean
# === default_length? ========================================================================= #.
-
#design_polylinker(optional_length_of_polylinker = nil, be_verbose = true) ⇒ Object
# === design_polylinker.
-
#designate_this_input_as_coding_entry(i) ⇒ Object
# === designate_this_input_as_coding_entry.
-
#determine_and_report_all_stop_codons ⇒ Object
# === determine_and_report_all_stop_codons ========================================================================= #.
-
#disable(i) ⇒ Object
# === disable (disable tag) ========================================================================= #.
-
#disable_colours ⇒ Object
# === disable_colours (disable tag) ========================================================================= #.
-
#disable_truncate ⇒ Object
# === disable_truncate ========================================================================= #.
-
#disable_xsel ⇒ Object
# === disable_xsel ========================================================================= #.
-
#discover_all_palindromes(i = dna_sequence?, , min = 4, max = 10) ⇒ Object
# === discover_all_palindromes.
-
#display_all_aminoacids ⇒ Object
# === display_all_aminoacids.
-
#display_glycolysis_pathway ⇒ Object
# === display_glycolysis_pathway.
-
#display_nucleotide_sequence(this_sequence = dna_sequence_object?, , &block) ⇒ Object
(also: #display_this_nucleotide_sequence, #display_this_sequence, #show_this_sequence)
# === display_nucleotide_sequence.
-
#display_open_reading_frames(i = dna_sequence_object?, , &block) ⇒ Object
# === display_open_reading_frames.
-
#dna_padding(this_sequence, get_rid_of_spaces = false) ⇒ Object
(also: #properly_spaced_dna, #properly_padded_dna_string)
# === dna_padding (dna_padding tag).
-
#dna_sequences? ⇒ Boolean
(also: #array_sequences?)
# === dna_sequences? ========================================================================= #.
-
#dna_to_aminoacid_sequence(i = dna_sequence?) ) ⇒ Object
# === dna_to_aminoacid_sequence.
-
#dna_translate(i) ⇒ Object
# === dna_translate ========================================================================= #.
-
#dna_with_ends(i = dna_sequence_as_string?, , optional_colourize = nil, colourize_everything = true) ⇒ Object
# === dna_with_ends.
-
#do_a_silent_startup ⇒ Object
(also: #do_silent_startup)
# === do_a_silent_startup.
-
#do_action(*i) ⇒ Object
# === do_action.
-
#do_analyze_sequence(i = sequence? ) ⇒ Object
# === do_analyze_sequence.
-
#do_mutate_dna_sequence_at_this_nucleotide_position(this_nucleotide_position = 1, new_nucleotide = nil, old_sequence = dna_sequence? ) ⇒ Object
# === do_mutate_dna_sequence_at_this_nucleotide_position.
-
#do_not_show_the_leader(be_verbose = true) ⇒ Object
# === do_not_show_the_leader ========================================================================= #.
-
#do_not_show_the_trailer(be_verbose = true) ⇒ Object
# === do_not_show_the_trailer ========================================================================= #.
-
#do_not_truncate ⇒ Object
# === do_not_truncate ========================================================================= #.
-
#do_not_use_working_directory_as_prompt ⇒ Object
# === do_not_use_working_directory_as_prompt ========================================================================= #.
-
#do_open(i) ⇒ Object
# === do_open.
-
#do_quit(determine_what_to_do = exit_the_shell_how? ) ⇒ Object
# === do_quit (exit tag, quit tag).
-
#do_start_the_sinatra_interface ⇒ Object
# === do_start_the_sinatra_interface ========================================================================= #.
-
#do_toggle_debug_value ⇒ Object
# === do_toggle_debug_value ========================================================================= #.
-
#do_truncate? ⇒ Boolean
# === do_truncate? ========================================================================= #.
-
#do_use_working_directory_as_prompt ⇒ Object
(also: #use_working_directory_as_prompt)
# === use_working_directory_as_prompt.
-
#does_this_remote_file_exist?(i) ⇒ Boolean
# === does_this_remote_file_exist?.
-
#downcase_main_string ⇒ Object
# === downcase_main_string (downcase tag, dcase tag).
-
#download(i) ⇒ Object
# === download (download tag).
-
#download_fasta(i = nil) ⇒ Object
# === download_fasta.
-
#download_this_pdb_file(i = '3O30') ⇒ Object
# === download_this_pdb_file.
-
#dump(optional_arguments = nil) ⇒ Object
# === dump.
-
#efetch(i) ⇒ Object
# === efetch.
-
#enable(i) ⇒ Object
(also: #use)
# === enable (enable tag).
-
#enable_colours(be_verbose = true) ⇒ Object
# === enable_colours (enable tag).
-
#enable_configuration ⇒ Object
# === enable_configuration ========================================================================= #.
-
#enable_gtk ⇒ Object
# === enable_gtk.
-
#enable_gtk_section_antisensestrand ⇒ Object
# === enable_gtk_section_antisensestrand ========================================================================= #.
-
#enable_xsel ⇒ Object
# === enable_xsel ========================================================================= #.
-
#ensure_that_the_bioshell_log_directory_exists ⇒ Object
# === ensure_that_the_bioshell_log_directory_exists ========================================================================= #.
-
#enter_base_directory ⇒ Object
# === enter_base_directory.
-
#enter_main_loop ⇒ Object
(also: #loop_get_user_input)
# === enter_main_loop (loop tag).
-
#ereturn(i = '') ⇒ Object
# === ereturn ========================================================================= #.
-
#erev(i = '') ⇒ Object
# === erev (erev tag).
-
#exit_the_shell_how? ⇒ Boolean
# === exit_the_shell_how? ========================================================================= #.
-
#extract_sequence_from_this_file(i) ⇒ Object
(also: #extract_sequence)
# === extract_sequence_from_this_file.
-
#f? ⇒ Boolean
(also: #f, #first_argument?)
# === f? ========================================================================= #.
-
#fasta? ⇒ Boolean
(also: #last_fasta?, #last_fasta_entry?)
# === fasta?.
-
#fasta_file?(i = :fasta_file) ⇒ Boolean
# === fasta_file? ========================================================================= #.
-
#feedback_version ⇒ Object
# === feedback_version ========================================================================= #.
-
#feedback_where_files_are_kept_locally ⇒ Object
# === feedback_where_files_are_kept_locally.
-
#feedback_whether_we_are_in_debug_mode ⇒ Object
# === feedback_whether_we_are_in_debug_mode ========================================================================= #.
-
#feedback_whether_we_will_also_set_the_xorg_buffer ⇒ Object
# === feedback_whether_we_will_also_set_the_xorg_buffer ========================================================================= #.
-
#fetch_from_pdb(i) ⇒ Object
# === fetch_from_pdb.
-
#file_dna_string_saved? ⇒ Boolean
# === file_dna_string_saved? ========================================================================= #.
-
#find_all_orfs(i = dna_sequence? ) ⇒ Object
# === find_all_orfs.
-
#find_complementary_strand(i = dna_sequence?) ) ⇒ Object
(also: #show_complementary_strand)
# === find_complementary_strand.
-
#find_gene(i = :default) ⇒ Object
# === find_gene.
-
#find_kdel_sequence ⇒ Object
# === find_kdel_sequence ========================================================================= #.
-
#find_longest_substring(i = dna_string?) ) ⇒ Object
# === find_longest_substring ========================================================================= #.
-
#find_longest_substring_via_LCS(i) ⇒ Object
# === find_longest_substring_via_LCS.
-
#find_restriction_enzymes_that_cut_at(i) ⇒ Object
# === find_restriction_enzymes_that_cut_at.
-
#find_restriction_sites(i = string?) ) ⇒ Object
# === find_restriction_sites.
-
#find_shine_dalgarno_sequence(i = dna_sequence_as_string? ) ⇒ Object
# === find_shine_dalgarno_sequence.
-
#first(i) ⇒ Object
# === first ========================================================================= #.
-
#format_this_nucleotide_sequence(i, &block) ⇒ Object
# === format_this_nucleotide_sequence.
-
#freeze_the_main_sequence ⇒ Object
# === freeze_the_main_sequence ========================================================================= #.
-
#generate_palindrome(i) ⇒ Object
# === generate_palindrome.
-
#generate_pdf_tutorial ⇒ Object
# === generate_pdf_tutorial.
-
#generate_random_dna_sequence_with_variable_length_and_variable_composition ⇒ Object
# === generate_random_dna_sequence_with_variable_length_and_variable_composition.
-
#generate_random_protein_sequence_with_variable_length_and_variable_composition ⇒ Object
# === generate_random_protein_sequence_with_variable_length_and_variable_composition.
-
#generate_single_sequence_repeats ⇒ Object
# === generate_single_sequence_repeats.
-
#get_long_name_of_amino_acid(i) ⇒ Object
# === get_long_name_of_amino_acid ========================================================================= #.
-
#guanin? ⇒ Boolean
# === guanin? ========================================================================= #.
-
#handle_fasta(i) ⇒ Object
(also: #assign_fasta, #handle_this_fasta_file)
# === handle_fasta.
-
#handle_pdb_files(i) ⇒ Object
# === handle_pdb_files.
-
#handle_this_file(this_file) ⇒ Object
# === handle_this_file.
-
#highlight_colour? ⇒ Boolean
(also: #yellow)
# === highlight_colour?.
-
#identify_aminoacid(i) ⇒ Object
# === identify_aminoacid.
-
#include?(i) ⇒ Boolean
# === include?.
-
#index_this_fasta_file(i) ⇒ Object
# === index_this_fasta_file.
-
#initialize(commandline_arguments = ARGV) ⇒ Shell
constructor
# === initialize ========================================================================= #.
-
#initialize_clipboard ⇒ Object
# === initialize_clipboard ========================================================================= #.
-
#initialize_main_sequence(n_nucleotides = 250) ⇒ Object
(also: #reset_string)
# === initialize_main_sequence.
-
#install(i) ⇒ Object
# === install (install tag) ========================================================================= #.
-
#interactive_colour_menu ⇒ Object
# === interactive_colour_menu ========================================================================= #.
-
#interactive_use_of_levensthein(i = all_arguments? ) ⇒ Object
# === interactive_use_of_levensthein ========================================================================= #.
-
#interactively_pick_colour ⇒ Object
# === interactively_pick_colour.
-
#is_a_registered_compound?(i) ⇒ Boolean
# === is_a_registered_compound? ========================================================================= #.
-
#is_a_stop_codon?(i) ⇒ Boolean
# === is_a_stop_codon? ========================================================================= #.
-
#is_any_nucleotide_assigned? ⇒ Boolean
# === is_any_nucleotide_assigned? ========================================================================= #.
-
#is_dna? ⇒ Boolean
# === is_dna? ========================================================================= #.
-
#is_palindrome?(i) ⇒ Boolean
# === is_palindrome? ========================================================================= #.
-
#is_the_main_sequence_frozen? ⇒ Boolean
(also: #the_main_sequence_is_frozen?)
# === is_the_main_sequence_frozen? ========================================================================= #.
-
#is_this_a_cd_alias?(i) ⇒ Boolean
# === is_this_a_cd_alias?.
-
#is_this_a_valid_codon?(i) ⇒ Boolean
# === is_this_a_valid_codon?.
-
#last_inputted_command? ⇒ Boolean
# === last_inputted_command?.
-
#leading_3_prime ⇒ Object
(also: #leading_three_prime, #leading_3)
# === leading_3_prime.
-
#leading_5_prime(get_rid_of_spaces = false) ⇒ Object
(also: #five_prime, #leading_five_prime, #leader, #lead_five_prime, #return_five_prime_header, #leading_five)
# === leading_5_prime.
-
#left_chop(i) ⇒ Object
# === left_chop ========================================================================= #.
-
#list(i = nil) ⇒ Object
# === list ========================================================================= #.
-
#load(i = file_dna_string_saved? ) ⇒ Object
(also: #load_dataset_from)
# === load (load tag).
-
#load_dna ⇒ Object
# === load_dna.
-
#load_gtk ⇒ Object
# === load_gtk.
-
#load_gtk3_component_aminoacid_composition ⇒ Object
# === load_gtk3_component_aminoacid_composition ========================================================================= #.
-
#load_my_file ⇒ Object
# === load_my_file (load tag).
-
#log_user_input? ⇒ Boolean
# === log_user_input?.
-
#main_colour ⇒ Object
(also: #main_col)
# === main_colour ========================================================================= #.
-
#mass_weight(i = aminoacids?, , be_verbose = true) ⇒ Object
# === mass_weight (mass_weight tag).
-
#may_we_show_the_startup_information? ⇒ Boolean
# === may_we_show_the_startup_information? ========================================================================= #.
-
#menu(i = return_commandline_arguments_as_string, report_if_we_did_not_find_the_command = true) ⇒ Object
# === menu (menu tag) ========================================================================= #.
-
#mirror_repeat(i = dna_sequence? ) ⇒ Object
# === mirror_repeat ========================================================================= #.
-
#mode? ⇒ Boolean
# === mode? ========================================================================= #.
-
#molecular_mass_of(i = aminoacids?, , optional_round_here = nil) ⇒ Object
# === molecular_mass_of.
-
#molecular_mass_of_amino_acids_in_the_sequence(i = aminoacid_sequence? ) ⇒ Object
(also: #molecular_mass_of_amino_acids_in_this_sequence)
# === molecular_mass_of_amino_acids_in_the_sequence.
-
#move_file_to_its_correct_location(i) ⇒ Object
# === move_file_to_its_correct_location ========================================================================= #.
-
#mutate_aminoacid_position(this_position = 1) ⇒ Object
# === mutate_aminoacid_position.
-
#mutate_dna_sequence(n_times = 1, old_sequence = dna_sequence? ) ⇒ Object
# === mutate_dna_sequence.
-
#mutate_position(nucleotide_position, mutate_to_this_nucleotide = return_random_nucleotide) ⇒ Object
# === mutate_position.
-
#n_uracil? ⇒ Boolean
# === n_uracil? ========================================================================= #.
-
#name_of_gene? ⇒ Boolean
# === name_of_gene? ========================================================================= #.
-
#ncbi_nucleotide_search_for(i = '') ⇒ Object
# === ncbi_nucleotide_search_for ========================================================================= #.
-
#no_newlines(this_file) ⇒ Object
# === no_newlines.
-
#notify_the_user_as_to_how_findgene_works ⇒ Object
# === notify_the_user_as_to_how_findgene_works ========================================================================= #.
-
#nucleotide_sequence? ⇒ Boolean
(also: #dna_sequence?, #dna_string?, #dna_seq?, #string?, #main_string?, #seq?, #sequence_1, #seq1, #seq1?)
# === nucleotide_sequence? (string? tag).
-
#nucleotides_or_aminoacids? ⇒ Boolean
# === nucleotides_or_aminoacids? ========================================================================= #.
-
#obtain_current_prompt ⇒ Object
# === obtain_current_prompt.
-
#obtain_current_prompt_while_honouring_colours ⇒ Object
# === obtain_current_prompt_while_honouring_colours ========================================================================= #.
-
#obtain_multiline_fasta ⇒ Object
# === obtain_multiline_fasta.
-
#obtain_url_for(i) ⇒ Object
# === obtain_url_for ========================================================================= #.
-
#only_nucleotides?(i) ⇒ Boolean
require 'bioroebe/toplevel_methods/nucleotides.rb' ========================================================================= # === only_nucleotides?.
-
#only_valid_nucleotides?(i) ⇒ Boolean
(also: #only_valid_dna_nucleotides?)
# === only_valid_nucleotides?.
-
#open_1igt_in_the_browser ⇒ Object
# === open_1igt_in_the_browser ========================================================================= #.
-
#open_blast_webpage ⇒ Object
# === open_blast_webpage ========================================================================= #.
-
#open_expasy(i = all_arguments?) ) ⇒ Object
# === open_expasy ========================================================================= #.
-
#open_in_uniprot(i = 'A1XPA3') ⇒ Object
# === open_in_uniprot.
-
#open_my_files ⇒ Object
# === open_my_files (open tag, files tag).
-
#open_this_file_in_editor(file) ⇒ Object
# === open_this_file_in_editor (editor tag) ========================================================================= #.
-
#open_this_ncbi_page(i) ⇒ Object
# === open_this_ncbi_page.
-
#padding? ⇒ Boolean
(also: #pad, #pad?, #lpad?, #left_pad?, #left_padding?, #default_padding)
# === padding? (padding tag).
-
#parse(i) ⇒ Object
# === parse (parse tag) ========================================================================= #.
-
#parse_fasta_format(i = nil) ⇒ Object
(also: #parse_this_fasta_file)
# === parse_fasta_format.
-
#parse_this_fasta_sequence(i) ⇒ Object
# === parse_this_fasta_sequence ========================================================================= #.
-
#parse_this_gff_file(i) ⇒ Object
# === parse_this_gff_file.
-
#parse_this_pdb_file(i) ⇒ Object
# === parse_this_pdb_file ========================================================================= #.
-
#perform_a_pubmed_search(i) ⇒ Object
# === perform_a_pubmed_search ========================================================================= #.
-
#perform_frameshift_action(i) ⇒ Object
# === perform_frameshift_action.
-
#perform_startup_actions ⇒ Object
# === perform_startup_actions (startup tag).
-
#permanently_disable_startup_intro ⇒ Object
# === permanently_disable_startup_intro.
-
#prepend(i) ⇒ Object
# === prepend.
-
#primer(i) ⇒ Object
# === primer? ========================================================================= #.
-
#print_aa_table(optional_arguments = all_arguments?) ) ⇒ Object
# === print_aa_table.
-
#print_aminoacid_information_table ⇒ Object
# === print_aminoacid_information_table.
-
#print_rev ⇒ Object
# === print_rev ========================================================================= #.
-
#protein_stats ⇒ Object
# === protein_stats ========================================================================= #.
-
#pubmed(number = 125512) ⇒ Object
# === pubmed.
-
#punnet(i) ⇒ Object
# === punnet.
-
#purge(i) ⇒ Object
# === purge.
-
#random(n_elements = default_length?, , dna_or_amino_acid = :dna, do_report_the_sequence = false) ⇒ Object
# === random (random tag, rand tag).
-
#random_dna_sequence(length = 250) ⇒ Object
# === random_dna_sequence.
-
#random_insert(i) ⇒ Object
# === random_insert.
-
#raw_aminoacid_sequence? ⇒ Boolean
(also: #aminoacids?, #amino_acid_sequence?, #aminoacid_sequence?, #aa_sequence?, #aa?)
# === raw_aminoacid_sequence?.
-
#read_user_input ⇒ Object
(also: #get_user_input)
# === read_user_input (input tag).
-
#readline_is_available? ⇒ Boolean
(also: #use_readline?, #has_readline?)
# === readline_is_available? ========================================================================= #.
-
#register_this_download(i) ⇒ Object
# === register_this_download.
-
#remaining_arguments? ⇒ Boolean
# === remaining_arguments? ========================================================================= #.
-
#remove_question_mark? ⇒ Boolean
# === remove_question_mark? ========================================================================= #.
-
#remove_sequence(i) ⇒ Object
(also: #remove)
# === remove_sequence.
-
#remove_trailing_escape_code(i) ⇒ Object
# === remove_trailing_escape_code ========================================================================= #.
-
#replay(i = nil) ⇒ Object
# === replay ========================================================================= #.
-
#report_all_stop_codons(i = dna_sequence_object? ) ⇒ Object
# === report_all_stop_codons.
-
#report_colourized_sequence(colourize_what = :start_and_stop_codon) ⇒ Object
# === report_colourized_sequence.
-
#report_current_genbank_version(optional_arguments = nil) ⇒ Object
# === report_current_genbank_version.
-
#report_current_working_directory ⇒ Object
# === report_current_working_directory ========================================================================= #.
-
#report_everything_about_this_amino_acid(i) ⇒ Object
# === report_everything_about_this_amino_acid.
-
#report_five_prime_three_prime(i) ⇒ Object
# === report_five_prime_three_prime ========================================================================= #.
-
#report_how_many_aminoacids_we_have ⇒ Object
# === report_how_many_aminoacids_we_have.
-
#report_main_sequence(input = dna_sequence_as_string?, , colourize = nil) ⇒ Object
(also: #show_main_string, #show_main_sequence, #show_colourized_sequence, #show_dna_sequence, #show_DNA_sequence)
# === report_main_sequence.
-
#report_mode ⇒ Object
# === report_mode ========================================================================= #.
-
#report_n_proteins_registered_in_swiss_prot ⇒ Object
# === report_n_proteins_registered_in_swiss_prot.
-
#report_n_start_codons(this_string = string?, , use_this_as_start_codon = :default, in_which_frame = :frame1) ⇒ Object
# === report_n_start_codons.
-
#report_size_of(i = nil) ⇒ Object
# === report_size_of ========================================================================= #.
-
#report_size_of_main_string(i = dna_sequence_object?, , type_of_string = 'main ') ⇒ Object
(also: #report_length_of_the_dna_string, #report_size_of_this_sequence)
# === report_size_of_main_string ========================================================================= #.
-
#report_syntax_help_for_frameshift_action ⇒ Object
# === report_syntax_help_for_frameshift_action ========================================================================= #.
-
#report_that_a_string_must_be_assigned_first ⇒ Object
# === report_that_a_string_must_be_assigned_first ========================================================================= #.
-
#report_that_the_main_sequence_is_frozen ⇒ Object
# === report_that_the_main_sequence_is_frozen ========================================================================= #.
-
#report_the_first_atg ⇒ Object
# === report_the_first_atg.
-
#report_the_protein_weight ⇒ Object
# === report_the_protein_weight ========================================================================= #.
-
#report_this_dna_sequence_with_proper_trailer_and_leader(i) ⇒ Object
# === report_this_dna_sequence_with_proper_trailer_and_leader ========================================================================= #.
-
#report_this_input_was_not_found(i = '') ⇒ Object
# === report_this_input_was_not_found.
-
#report_useful_packages_installed ⇒ Object
# === report_useful_packages_installed.
-
#report_when_the_bioroebe_project_was_last_updated ⇒ Object
# === report_when_the_bioroebe_project_was_last_updated ========================================================================= #.
-
#report_where_the_home_directory_can_be_found(i = log_dir? ) ⇒ Object
# === report_where_the_home_directory_can_be_found ========================================================================= #.
-
#report_where_the_pdf_tutorial_can_be_found ⇒ Object
# === report_where_the_pdf_tutorial_can_be_found.
-
#report_where_we_store ⇒ Object
# === report_where_we_store ========================================================================= #.
-
#report_whether_readline_is_available ⇒ Object
# === report_whether_readline_is_available ========================================================================= #.
-
#report_whether_we_will_make_use_of_expand_cd_aliases ⇒ Object
# === report_whether_we_will_make_use_of_expand_cd_aliases ========================================================================= #.
-
#report_which_yaml_engine_is_in_use ⇒ Object
# === report_which_yaml_engine_is_in_use ========================================================================= #.
-
#reset(be_verbose = true) ⇒ Object
# === reset (reset tag) ========================================================================= #.
-
#reset_to_initial_state(be_verbose = true) ⇒ Object
# === reset_to_initial_state ========================================================================= #.
-
#restore_default_prompt ⇒ Object
# === restore_default_prompt ========================================================================= #.
-
#restore_the_last_chop_operation ⇒ Object
# === restore_the_last_chop_operation.
-
#restriction_enzyme_digest(split_at = nil) ⇒ Object
(also: #digest)
# === restriction_enzyme_digest.
-
#restriction_enzymes_run ⇒ Object
# === restriction_enzymes_run ========================================================================= #.
-
#return_a_random_sequence_of_n_nucleotides(i = 250) ⇒ Object
# === return_a_random_sequence_of_n_nucleotides ========================================================================= #.
-
#return_all_genes ⇒ Object
# === return_all_genes ========================================================================= #.
-
#return_available_vectors ⇒ Object
# === return_available_vectors ========================================================================= #.
-
#return_complement(i = dna_sequence? ) ⇒ Object
(also: #complement, #complement_sequence?, #reverse)
# === return_complement.
-
#return_default_GFP_sequence(path_to_the_file = FILE_GFP_SEQUENCE) ⇒ Object
# === return_default_GFP_sequence ========================================================================= #.
-
#return_dna_nucleotides ⇒ Object
# === return_dna_nucleotides.
-
#return_dna_sequence_as_sequence_object ⇒ Object
(also: #main_sequence?, #dna_sequence_object?, #sequence_object?, #sequence?, #seq_object?, #sequence, #seq_obj?, #last_nucleotide_sequence?)
# === return_dna_sequence_as_sequence_object.
-
#return_fasta_files_in_the_log_directory ⇒ Object
# === return_fasta_files_in_the_log_directory ========================================================================= #.
-
#return_pwd ⇒ Object
(also: #return_default_prompt)
# === return_pwd ========================================================================= #.
-
#return_random_aminoacid ⇒ Object
# === return_random_aminoacid ========================================================================= #.
-
#return_random_nucleotide ⇒ Object
(also: #add_nucleotide)
# === return_random_nucleotide.
-
#return_random_restriction_enzyme(be_verbose = false) ⇒ Object
# === return_random_restriction_enzyme.
-
#return_reverse_dna_string ⇒ Object
# === return_reverse_dna_string ========================================================================= #.
-
#return_sequence_from_this_number(i = 1) ⇒ Object
# === return_sequence_from_this_number ========================================================================= #.
-
#reverse_complement(i = sequence?) ) ⇒ Object
# === reverse_complement (reverse complement tag).
-
#run ⇒ Object
# === run ========================================================================= #.
-
#run_nls_search ⇒ Object
# === run_nls_search.
-
#run_sizeseq ⇒ Object
# === run_sizeseq.
-
#run_sql_query(i, be_verbose = true, optional_append_this = '') ⇒ Object
(also: #sql_query, #run_query, #run_sql)
# === run_sql_query ========================================================================= #.
-
#run_this_user_input ⇒ Object
# === menu (menu tag) ========================================================================= # === run_this_user_input().
-
#salt_adjusted_tm(i) ⇒ Object
# === salt_adjusted_tm ========================================================================= #.
-
#sanitize_input(i) ⇒ Object
# === sanitize_input.
-
#sanitize_nucleotide_sequence(i) ⇒ Object
# === sanitize_nucleotide_sequence.
-
#save_file? ⇒ Boolean
# === save_file? ========================================================================= #.
-
#save_history_to_file(dataset = array_history?[0..-2]) ⇒ Object
# === save_history_to_file.
-
#save_my_file(&block) ⇒ Object
# === save_my_file (save tag).
-
#say_goodbye ⇒ Object
# === say_goodbye ========================================================================= #.
-
#scan_for_gff_files ⇒ Object
# === scan_for_gff_files ========================================================================= #.
-
#scan_for_leucine_zippers(i = amino_acid_sequence? ) ⇒ Object
# === scan_for_leucine_zippers.
-
#scan_or_parse_for_this_gff_file_or_any_gff_file(i) ⇒ Object
# === scan_or_parse_for_this_gff_file_or_any_gff_file ========================================================================= #.
-
#search_for(i, be_verbose = true) ⇒ Object
# === search_for (search_for tag).
-
#search_for? ⇒ Boolean
# === search_for?.
-
#search_for_known_promoters ⇒ Object
# === search_for_known_promoters.
-
#search_for_nucleotide_sequence(i) ⇒ Object
# === search_for_nucleotide_sequence.
-
#search_for_tata_consensus_sequence ⇒ Object
# === search_for_tata_consensus_sequence.
-
#search_sequence_for_open_reading_frames(i = :default, use_which_frame = :frame1, use_this_start_codon = :default) ⇒ Object
# === search_sequence_for_open_reading_frames.
-
#second_argument? ⇒ Boolean
(also: #second_argument)
# === second_argument? ========================================================================= #.
-
#sequence_2 ⇒ Object
(also: #seq2, #seq2?)
# === sequence2 ========================================================================= #.
-
#sequence_3 ⇒ Object
(also: #seq3, #seq3?)
# === sequence3 ========================================================================= #.
-
#sequence_4 ⇒ Object
(also: #seq4, #seq4?)
# === sequence4 ========================================================================= #.
-
#sequence_5 ⇒ Object
(also: #seq5, #seq5?)
# === sequence5 ========================================================================= #.
-
#sequence_6 ⇒ Object
(also: #seq6, #seq6?)
# === sequence6 ========================================================================= #.
-
#set_aminoacids(i = :random, how_many_to_generate = :default, be_verbose = true) ⇒ Object
(also: #assign_aminoacid_sequence, #assign_protein_sequence, #set_aminoacid_sequence)
# === set_aminoacids (assign protein tag, set aminoacids tag).
-
#set_codon_table(i) ⇒ Object
# === set_codon_table.
-
#set_default_highlight_colour ⇒ Object
# === set_default_highlight_colour ========================================================================= #.
-
#set_default_length(i = DEFAULT_LENGTH_FOR_DNA, be_verbose = false) ⇒ Object
(also: #set_maxlength)
# === set_default_length ========================================================================= #.
-
#set_download_directory(i = ::Bioroebe.log_dir?) ⇒ Object
# === set_download_directory ========================================================================= #.
-
#set_exit_gracefully ⇒ Object
# === set_exit_gracefully ========================================================================= #.
-
#set_highlight_colour(i = :violet, be_verbose = false) ⇒ Object
# === set_highlight_colour.
-
#set_highlight_colour_or_search_for_this_sequence(i, be_verbose = false) ⇒ Object
# === set_highlight_colour_or_search_for_this_sequence ========================================================================= #.
-
#set_jumper_directory(i) ⇒ Object
# === set_jumper_directory ========================================================================= #.
-
#set_locus(i) ⇒ Object
# === set_locus ========================================================================= #.
-
#set_log_dir(i = first_argument? ) ⇒ Object
# === set_log_dir ========================================================================= #.
-
#set_mode(i = :dna) ⇒ Object
# === set_mode ========================================================================= #.
-
#set_name_of_gene(i = '', be_verbose = :be_verbose) ⇒ Object
# === set_name_of_gene.
-
#set_nucleotide_sequence(i = nil, be_verbose = false, do_upcase = :check_for_config_value_here, &block) ⇒ Object
(also: #set_dna_sequence, #set_DNA_sequence, #assign_sequence, #set_sequence, #assign_dna_sequence, #assign_this_dna_sequence, #assign, #set_dna_string, #set_string, #set_main_sequence, #set_dna, #set_assign, #set_raw_sequence)
# === set_nucleotide_sequence (assign tag, assigning tag).
-
#set_padding(i = DEFAULT_PADDING, be_verbose = :be_quiet) ⇒ Object
# === set_padding.
-
#set_random_aminoacids ⇒ Object
# === set_random_aminoacids.
-
#set_save_file(i = :default) ⇒ Object
# === set_save_file ========================================================================= #.
-
#set_search_for(i, be_verbose = true) ⇒ Object
(also: #set_search_string)
# === set_search_for.
-
#set_sequence_2(i = '') ⇒ Object
# === set_sequence_2 ========================================================================= #.
-
#set_sequence_3(i = '') ⇒ Object
# === set_sequence_3 ========================================================================= #.
-
#set_sequence_4(i = '') ⇒ Object
# === set_sequence_4 ========================================================================= #.
-
#set_sequence_5(i = '') ⇒ Object
# === set_sequence_5 ========================================================================= #.
-
#set_sequence_6(i = '') ⇒ Object
# === set_sequence_6 ========================================================================= #.
-
#set_start_codon(i = nil) ⇒ Object
# === set_start_codon.
-
#set_use_this_prompt(i = NAME_OF_BIO_SHELL) ⇒ Object
(also: #set_prompt)
# === set_use_this_prompt.
-
#set_xclip(i = dna_string? ) ⇒ Object
# === set_xclip (xclip tag, xorg tag, buffer tag).
-
#setup_readline ⇒ Object
# === setup_readline.
-
#sfancy(i = '') ⇒ Object
# === sfancy ========================================================================= #.
-
#sfile(i = '') ⇒ Object
# === sfile ========================================================================= #.
-
#shorten_aminoacid(these_aminoacids = aminoacid_sequence? ) ⇒ Object
# === shorten_aminoacid.
-
#show(i) ⇒ Object
# === show (show tag).
-
#show_2D_dotplot(string1 = nil, string2 = nil) ⇒ Object
# === show_2D_dotplot ========================================================================= #.
-
#show_agarose_table ⇒ Object
# === show_agarose_table.
-
#show_all_codon_tables(show_what = :everything) ⇒ Object
# === show_all_codon_tables.
-
#show_all_deducible_aminoacid_sequences(i = dna_sequence_as_string?, , also_show_numbers = true, show_translations_aligned = true) ⇒ Object
# === show_all_deducible_aminoacid_sequences.
-
#show_all_dmp_files ⇒ Object
# === show_all_dmp_files.
-
#show_all_pathways ⇒ Object
# === show_all_pathways.
-
#show_all_yaml_files ⇒ Object
# === show_all_yaml_files.
-
#show_alu_sequence ⇒ Object
# === show_alu_sequence.
-
#show_aminoacid_sequence ⇒ Object
# === show_aminoacid_sequence.
-
#show_aminoacids_mass_table ⇒ Object
(also: #aminoacid_table_overview)
# === show_aminoacids_mass_table.
-
#show_aminoacids_residues ⇒ Object
# === show_aminoacids_residues ========================================================================= #.
-
#show_and_calculate_weight_of_dna_string(i = dna_sequence_object? ) ⇒ Object
# === show_and_calculate_weight_of_dna_string ========================================================================= #.
-
#show_and_calculate_weight_of_dna_string_or_aminoacid_sequence(i = dna_sequence_object? ) ⇒ Object
# === show_and_calculate_weight_of_dna_string_or_aminoacid_sequence ========================================================================= #.
-
#show_available_vectors ⇒ Object
# === show_available_vectors ========================================================================= #.
-
#show_average_weight_of_a_nucleotide ⇒ Object
# === show_average_weight_of_a_nucleotide.
-
#show_average_weight_of_an_aminoacid ⇒ Object
# === show_average_weight_of_an_aminoacid.
-
#show_blosum_matrix ⇒ Object
# === show_blosum_matrix.
-
#show_both_dna_strands ⇒ Object
(also: #show_double_strand)
# === show_double_strand ========================================================================= #.
-
#show_ccaat_sites(search_for_this_sequence = 'CCAAT') ⇒ Object
(also: #show_CCAAT_sites)
# === show_ccaat_sites.
-
#show_chromosome_table ⇒ Object
# === show_chromosome_table ========================================================================= #.
-
#show_codon_piped_sequence ⇒ Object
# === show_codon_piped_sequence ========================================================================= #.
-
#show_codon_table(i = nil) ⇒ Object
# === show_codon_table ========================================================================= #.
-
#show_codon_usage(i = dna_sequence_as_string? ) ⇒ Object
# === show_codon_usage.
-
#show_codons_of_this_aminoacid_or_show_kazusa_codon(i = nil) ⇒ Object
# === show_codons_of_this_aminoacid_or_show_kazusa_codon.
-
#show_commandline_options ⇒ Object
# === show_commandline_options.
-
#show_complement(i = dna_string?, , also_include_prime_ends = false) ⇒ Object
# === show_complement.
-
#show_composition(i = dna_string? ) ⇒ Object
# === show_composition.
-
#show_config_dir ⇒ Object
# === show_config_dir.
-
#show_copyright_clause ⇒ Object
# === show_copyright_clause.
-
#show_cpg_islands ⇒ Object
# === show_cpg_islands.
-
#show_date ⇒ Object
# === show_date ========================================================================= #.
-
#show_directory_content(of_this_dir = '*') ⇒ Object
# === show_directory_content ========================================================================= #.
-
#show_disulfides ⇒ Object
# === show_disulfides.
-
#show_dna_string(this_string = dna_string?, , truncate_too_long_result = do_truncate? ) ⇒ Object
(also: #report_sequence, #show_sequence, #show_main_dna_sequence, #show_string)
# === show_dna_string (show string tag, show tag).
-
#show_download_dir ⇒ Object
# === show_download_dir ========================================================================= #.
-
#show_editor_in_use ⇒ Object
# === show_editor_in_use ========================================================================= #.
-
#show_fasta_headers(i) ⇒ Object
# === show_fasta_headers.
-
#show_fastq_quality_score_table(_ = Bioroebe.file_fastq_quality_schemes) ⇒ Object
# === show_fastq_quality_score_table.
-
#show_file_listing(from_this_directory = Dir.pwd) ⇒ Object
# === show_file_listing.
-
#show_first_orf(of_this_sequence = dna_sequence_object? ) ⇒ Object
# === show_first_orf.
-
#show_GFP_sequence ⇒ Object
# === show_GFP_sequence (gfp tag).
-
#show_header_of(i) ⇒ Object
# === show_header_of ========================================================================= #.
-
#show_header_of_this_pdb_file(i) ⇒ Object
# === show_header_of_this_pdb_file ========================================================================= #.
-
#show_help(optional_arguments = nil) ⇒ Object
# === show_help (help tag, he tag).
-
#show_hint_how_to_use_the_local_sequences ⇒ Object
# === show_hint_how_to_use_the_local_sequences.
-
#show_histone_table ⇒ Object
# === show_histone_table ========================================================================= #.
-
#show_history ⇒ Object
# === show_history (history tag).
-
#show_html_colours ⇒ Object
# === show_html_colours ========================================================================= #.
-
#show_human_genome_version ⇒ Object
# === show_human_genome_version.
-
#show_hydropathy_table ⇒ Object
# === show_hydropathy_table.
-
#show_information_about_the_gff_format ⇒ Object
# === show_information_about_the_gff_format ========================================================================= #.
-
#show_jumper_directories ⇒ Object
# === show_jumper_directories ========================================================================= #.
-
#show_known_nls_sequences ⇒ Object
# === show_known_nls_sequences.
-
#show_last_downloaded_file ⇒ Object
# === show_last_downloaded_file ========================================================================= #.
-
#show_last_input ⇒ Object
# === show_last_input.
-
#show_length_of_alpha_helix(i) ⇒ Object
# === show_length_of_alpha_helix ========================================================================= #.
-
#show_local_sequences ⇒ Object
# === show_local_sequences.
-
#show_log_dir ⇒ Object
# === show_log_dir ========================================================================= #.
-
#show_mnemo ⇒ Object
# === show_mnemo.
-
#show_molweight(use_cliner = true) ⇒ Object
# === show_molweight ========================================================================= #.
-
#show_my_fasta_file ⇒ Object
# === show_my_fasta_file ========================================================================= #.
-
#show_name_of_the_gene ⇒ Object
# === show_name_of_the_gene ========================================================================= #.
-
#show_nucleotide_sequence? ⇒ Boolean
(also: #display_nucleotide_object?)
# === show_nucleotide_sequence? ========================================================================= #.
-
#show_nucleotides_table ⇒ Object
# === show_nucleotides_table.
-
#show_numbered_nucleotide_positions ⇒ Object
# === show_numbered_nucleotide_positions.
-
#show_oligo_length_three(sequence = dna_sequence_object? ) ⇒ Object
# === show_oligo_length_three.
-
#show_oligo_length_two(string = string? ) ⇒ Object
# === show_oligo_length_two.
-
#show_ori_sequences ⇒ Object
# === show_ori_sequences.
-
#show_position_for_the_main_sequence ⇒ Object
# === show_position_for_the_main_sequence ========================================================================= #.
-
#show_position_of_sequence(i = aa_sequence?, , chunk_size = 10) ⇒ Object
# === show_position_of_sequence.
-
#show_possible_codons_for_this_aminoacid(i) ⇒ Object
# === show_possible_codons_for_this_aminoacid ========================================================================= #.
-
#show_possible_phosphorylation_sites(i = aminoacid_sequence?) ) ⇒ Object
# === show_possible_phosphorylation_sites.
-
#show_protein_composition(i) ⇒ Object
# === show_protein_composition.
-
#show_readline_completions ⇒ Object
# === show_readline_completions ========================================================================= #.
-
#show_resources_about_the_horseradish_peroxidase ⇒ Object
# === show_resources_about_the_horseradish_peroxidase ========================================================================= #.
-
#show_reste ⇒ Object
# === show_reste.
-
#show_restriction_enzymes(optional_input = nil) ⇒ Object
# === show_restriction_enzymes.
-
#show_restriction_table ⇒ Object
# === show_restriction_table.
-
#show_reverse_dna_string ⇒ Object
# === show_reverse_dna_string.
-
#show_rna_sequence(i = sequence_object?.to_rna) ⇒ Object
# === show_rna_sequence.
-
#show_save_file ⇒ Object
# === show_save_file ========================================================================= #.
-
#show_segments ⇒ Object
# === show_segments.
-
#show_seq_1(i = seq1?) ) ⇒ Object
# === show_seq_1 ========================================================================= #.
-
#show_seq_2(i = seq2?) ) ⇒ Object
# === show_seq_2 ========================================================================= #.
-
#show_seq_3(i = seq3?) ) ⇒ Object
# === show_seq_3 ========================================================================= #.
-
#show_seq_4 ⇒ Object
# === show_seq_4 ========================================================================= #.
-
#show_seq_5 ⇒ Object
# === show_seq_5 ========================================================================= #.
-
#show_seq_6 ⇒ Object
# === show_seq_6 ========================================================================= #.
-
#show_sequence_in_splitted_form(how_many = 3, use_this_token_for_rejoining = ' ') ⇒ Object
# === show_sequence_in_splitted_form.
-
#show_sequence_with_a_ruler(group_together_n_nucleotides = :default, use_this_sequence = main_sequence?, , type = type? ) ⇒ Object
# === show_sequence_with_a_ruler.
-
#show_sigma_tutorial ⇒ Object
# === show_sigma_tutorial.
-
#show_sixpack_alignment(i = dna_sequence_object? ) ⇒ Object
# === show_sixpack_alignment.
-
#show_start_and_stop_codons ⇒ Object
# === show_start_and_stop_codons.
-
#show_startup_information ⇒ Object
# === show_startup_information.
-
#show_t_phages ⇒ Object
# === show_t_phages ========================================================================= #.
-
#show_taxid(id = 9606) ⇒ Object
# === show_taxid.
-
#show_the_aminoacids_frequencies ⇒ Object
# === show_the_aminoacids_frequencies ========================================================================= #.
-
#show_the_leader? ⇒ Boolean
# === show_the_leader? ========================================================================= #.
-
#show_the_trailer? ⇒ Boolean
# === show_the_trailer? ========================================================================= #.
-
#show_the_weight_of_some_common_proteins(use_this_file = FILE_WEIGHT_OF_COMMON_PROTEINS) ⇒ Object
# === show_the_weight_of_some_common_proteins ========================================================================= #.
-
#show_the_weight_of_the_four_individual_nucleotides ⇒ Object
# === show_the_weight_of_the_four_individual_nucleotides ========================================================================= #.
-
#show_this_sequence_padded(i = dna_sequence_object? ) ⇒ Object
# === show_this_sequence_padded.
-
#show_this_subsequence(start_position = 1, end_position = 10, work_on_this_sequence = dna_sequence_object? ) ⇒ Object
# === show_this_subsequence.
-
#show_todo_file ⇒ Object
# === show_todo_file ========================================================================= #.
-
#show_useful_URLs ⇒ Object
# === show_useful_URLs.
-
#show_weight_of_this_nucleotide(i) ⇒ Object
# === show_weight_of_this_nucleotide.
-
#show_welcome_message ⇒ Object
# === show_welcome_message.
-
#show_xorg_buffer ⇒ Object
# === show_xorg_buffer ========================================================================= #.
-
#showorf(i = dna_sequence_object?, , show_how_many_frames = :show_three_frames) ⇒ Object
# === showorf (showorf tag).
-
#shuffle_main_string ⇒ Object
# === shuffle_main_string.
-
#silent_startup? ⇒ Boolean
# === silent_startup? ========================================================================= #.
-
#simp(i = '') ⇒ Object
# === simp ========================================================================= #.
-
#start_clipboard(i = '"') ⇒ Object
# === start_clipboard.
-
#start_codon? ⇒ Boolean
# === start_codon? ========================================================================= #.
-
#start_gtk_controller ⇒ Object
# === start_gtk_controller ========================================================================= #.
-
#start_search(be_verbose = true) ⇒ Object
# === start_search (start_search tag).
-
#stop_codons? ⇒ Boolean
# === stop_codons? ========================================================================= #.
-
#store_here? ⇒ Boolean
# === store_here?.
-
#swarn(i = '') ⇒ Object
# === swarn ========================================================================= #.
-
#three_to_one(i) ⇒ Object
# === three_to_one.
-
#thymin? ⇒ Boolean
# === thymin? ========================================================================= #.
-
#tk_start_three_to_one ⇒ Object
# === start_three_to_one.
-
#to_dna(i = sequence?) ) ⇒ Object
# === to_dna ========================================================================= #.
-
#to_fasta(i = dna_sequence? ) ⇒ Object
# === to_fasta.
-
#to_genbank(this_sequence = dna_sequence_as_string? ) ⇒ Object
# === to_genbank.
-
#to_rna(i = seq_object?) ) ⇒ Object
# === to_rna ========================================================================= #.
-
#to_talen(i = dna_sequence? ) ⇒ Object
# === to_talen ========================================================================= #.
-
#toggle_mode ⇒ Object
# === toggle_mode ========================================================================= #.
-
#toggle_truncate ⇒ Object
# === toggle_truncate ========================================================================= #.
-
#toggle_xorg_buffer ⇒ Object
# === toggle_xorg_buffer ========================================================================= #.
-
#trailing_3_prime(get_rid_of_spaces = false) ⇒ Object
(also: #three_trailer, #trailer, #three_prime, #trailing_three_prime, #trail_three_prime, #trail_three, #trailing_three)
# === trailing_3_prime.
-
#trailing_five_prime ⇒ Object
(also: #trailing_5_prime, #five_prime_trailer)
# === trailing_five_prime ========================================================================= #.
-
#translate(i, be_verbose = true) ⇒ Object
# === translate.
-
#translate_aminoacid(these_aminoacids = string?, , be_verbose = true) ⇒ Object
# === translate_aminoacid.
-
#translate_dna_into_aminoacid(i = dna_sequence?, , frame = 1) ⇒ Object
(also: #translate_dna_into_aminoacid_frame1)
# === translate_dna_into_aminoacid.
-
#translate_dna_into_aminoacid_frame2(i = nil) ⇒ Object
# === translate_dna_into_aminoacid_frame2 ========================================================================= #.
-
#translate_dna_into_aminoacid_frame3(i = nil) ⇒ Object
# === translate_dna_into_aminoacid_frame3 ========================================================================= #.
-
#try_to_compare_these_two_sequences_for_equality(i) ⇒ Object
# === try_to_compare_these_two_sequences_for_equality.
-
#try_to_display_this_fasta_entry(i) ⇒ Object
# === try_to_display_this_fasta_entry ========================================================================= #.
-
#try_to_find_restriction_enzymes_for(i) ⇒ Object
(also: #find_this_sequence, #find_in_main_sequence)
# === try_to_find_restriction_enzymes_for.
-
#try_to_find_this_restriction_enzyme(i) ⇒ Object
# === try_to_find_this_restriction_enzyme.
-
#try_to_report_the_version_of_bedtools ⇒ Object
# === try_to_report_the_version_of_bedtools ========================================================================= #.
-
#try_to_report_the_version_of_viennarna ⇒ Object
# === try_to_report_the_version_of_viennarna.
-
#try_to_run_rnalfold_on_this_file(i) ⇒ Object
# === try_to_run_rnalfold_on_this_file ========================================================================= #.
-
#try_to_show_the_configuration ⇒ Object
# === try_to_show_the_configuration ========================================================================= #.
-
#type? ⇒ Boolean
# === type? ========================================================================= #.
-
#uncolourize_this_aminoacid(i) ⇒ Object
# === uncolourize_this_aminoacid ========================================================================= #.
-
#unfreeze_the_main_sequence ⇒ Object
# === unfreeze_the_main_sequence ========================================================================= #.
-
#uniprot_fetch(i = 'P12345') ⇒ Object
# === uniprot_fetch.
-
#upcase_main_string ⇒ Object
# === upcase_main_string.
-
#use_colours? ⇒ Boolean
# === use_colours?.
-
#use_expand_cd_aliases? ⇒ Boolean
# === use_expand_cd_aliases? ========================================================================= #.
-
#use_this_fasta_file(at_position = 1) ⇒ Object
# === use_this_fasta_file.
-
#use_which_prompt? ⇒ Boolean
# === use_which_prompt? ========================================================================= #.
-
#use_xsel? ⇒ Boolean
# === use_xsel? ========================================================================= #.
-
#user_input? ⇒ Boolean
# === user_input? ========================================================================= #.
-
#verbose_handle_this_sys_command(i, arguments = a? ) ⇒ Object
# === verbose_handle_this_sys_command ========================================================================= #.
-
#verbose_report_numbered_amino_acid_sequence(i, which_frame = '1') ⇒ Object
# === verbose_report_numbered_amino_acid_sequence.
-
#verbose_save_history_to_file ⇒ Object
# === verbose_save_history_to_file ========================================================================= #.
-
#version? ⇒ Boolean
# === version? ========================================================================= #.
-
#weight_of_adenin? ⇒ Boolean
# === weight_of_adenin? ========================================================================= #.
-
#weight_of_cytosin? ⇒ Boolean
# === weight_of_cytosin? ========================================================================= #.
-
#weight_of_guanin? ⇒ Boolean
# === weight_of_guanin? ========================================================================= #.
-
#weight_of_thymin? ⇒ Boolean
# === weight_of_thymin? ========================================================================= #.
-
#wget(i) ⇒ Object
# === wget (wget tag).
-
#what_sequence_is_this?(i = dna_sequence? ) ⇒ Boolean
# === what_sequence_is_this?.
-
#will_we_truncate? ⇒ Boolean
# === will_we_truncate? ========================================================================= #.
-
#will_we_use_colours? ⇒ Boolean
# === will_we_use_colours? ========================================================================= #.
-
#www_finder_run ⇒ Object
# === www_finder_run ========================================================================= #.
Methods inherited from CommandlineApplication
#all_aminoacids?, #append_what_into, #at_home?, #be_silent, #be_verbose?, #cat, #ccliner, #change_directory, #cliner, #codon_table_dataset?, #codons_for?, #colourize_this_dna_sequence, #cp, #disable_warnings, #download_dir?, #editor?, #enable_warnings, #ensure_that_the_base_directories_exist, #esystem, #extract, #is_this_a_start_codon?, #is_this_a_stop_codon?, #load_bioroebe_yaml_file, #log_directory?, #one_letter_to_long_name, #one_to_three, #only_numbers?, #open_in_browser, #opne, #opnn, #pad_with_double_quotes, #pad_with_single_quotes, #partner_nucleotide, #remove_numbers, #remove_trailing_ansii_escape_code, #return_all_possible_start_codons, #return_array_of_one_letter_aminoacids, #return_cheerful_person, #return_chunked_display, #return_ubiquitin_sequence, #set_be_verbose, #strict_filter_away_invalid_aminoacids, #taxonomy_download_directory?, #use_opn?, #verbose_truth, #was_or_were, #without_extname, #write_what_into
Methods included from CommandlineArguments
#commandline_arguments?, #commandline_arguments_that_are_files?, #e, #first?, #first_non_hyphen_argument?, #remove_hyphens_from_the_commandline_arguments, #return_commandline_arguments_as_string, #return_commandline_arguments_that_are_not_files, #return_entries_without_two_leading_hyphens, #select_commandline_arguments, #select_entries_starting_with_two_hyphens, #set_commandline_arguments
Methods included from ColoursForBase
#colourize_this_aminoacid_sequence_for_the_commandline, #colourize_this_nucleotide_sequence, #ecomment, #efancy, #egold, #eorange, #eparse, #red, #remove_trailing_escape_part, #return_colour_for_nucleotides, #rev, #sdir, #set_use_colours, #use_colours_within_the_bioroebe_namespace?
Methods inherited from Base
#append_what_into, #can_base_pair?, #convert_global_env, #delete_file, #directory_to_the_codon_tables?, #file_readlines, #infer_the_namespace, #is_on_roebe?, #main_encoding?, #mkdir, #move_file, #mv, #namespace?, #no_file_exists_at, #project_yaml_directory?, #rds, #register_sigint, #return_the_first_line_of_this_file, #word_wrap, #write_what_into
Constructor Details
#initialize(commandline_arguments = ARGV) ⇒ Shell
#
initialize
#
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
# File 'lib/bioroebe/shell/shell.rb', line 189 def initialize( commandline_arguments = ARGV ) reset set_commandline_arguments(commandline_arguments) # ======================================================================= # # Intercept some important commandline arguments next. # ======================================================================= # case first? # ======================================================================= # # === bioshell --controller # ======================================================================= # when /^-?-?controller$/i require 'bioroebe/gui/gtk3/controller/controller.rb' ::Bioroebe.run_gtk_controller exit_program # ======================================================================= # # === bioshell --do-not-create-directories-on-startup # === bioshell --do-not-create-directories # # Do not create directories on startup. # # Invocation example: # # bioshell --do-not-create-directories-on-startup # # ======================================================================= # when /^-?-?do(-|_| )?not(-|_| )?create(-|_| )?directories(-|_| )?on(-|_| )?startup$/i, /^-?-?do(-|_| )?not(-|_| )?create(-|_| )?directories$/i @internal_hash[:create_directories_on_startup_of_the_shell] = false # ======================================================================= # # === bioroebe --protein-to-dna # # This entry point will try to start the ruby-gtk3 protein-to-DNA # converting widget. # ======================================================================= # when /^-?-?protein(-|_| )?to(-|_| )?dna$/i require 'bioroebe/gui/gtk3/protein_to_DNA/protein_to_DNA.rb' ::Bioroebe::GUI::Gtk::ProteinToDNA. exit # ======================================================================= # # === bioroebe --help # # This entry-point will quickly show which options are available for # the bioshell. # ======================================================================= # when /^-?-?help$/ # ======================================================================= # # === bioshell --permanently-disable-startup-intro # === bioshell --permanently-disable-startup-notice # === bioshell --permanently-no-startup-intro # === bioshell --permanently-no-startup-info # ======================================================================= # when /^-?-?permanently(-|_)?disable(-|_)?startup(-|_)?intro$/, /^-?-?permanently(-|_)?disable(-|_)?startup(-|_)?notice$/, /^-?-?permanently(-|_)?no(-|_)?startup(-|_)?intro$/, /^-?-?permanently(-|_)?no(-|_)?startup(-|_)?info$/ permanently_disable_startup_intro # ======================================================================= # # === :no_commandline_arguments # ======================================================================= # when :no_commandline_arguments # ===================================================================== # # Simply pass through in this case. # ===================================================================== # # ======================================================================= # # === :exit_gracefully # ======================================================================= # when :exit_gracefully set_exit_gracefully # ======================================================================= # # === bioroebe --silent-startup # ======================================================================= # when /^-?-?silent(-|_)?startup$/, /^-?-?silent$/ do_a_silent_startup # ======================================================================= # # === bioroebe --random-aminoacids=33 # === bioroebe --n-aminoacids=33 # ======================================================================= # when /^-?-?random(-|_)?aminoacids=(.+)$/i, /^-?-?n(-|_)?aminoacids=(.+)$/i n_aminoacids = $2.to_s.dup ::Bioroebe.create_random_aminoacids(n_aminoacids) { :do_report } exit # ======================================================================= # # === bioroebe --rnafold=cdna.MT.fa # ======================================================================= # when /^-?-?rnafold=(.+)$/ try_to_run_rnalfold_on_this_file($1.to_s.dup) exit # ======================================================================= # # === bioroebe --fasta=/Depot/Bioroebe/Arabidopsis_thaliana_chromosome_5_sequence.fasta # ======================================================================= # when /^-?-?fasta=(.+)$/ this_fasta_file = $1.to_s.dup if File.exist? handle_fasta(this_fasta_file) else e 'No file could be found at `'+sfile(this_fasta_file)+'`.' end # ======================================================================= # # === bioroebe --n-fasta-entries # # Usage example: # # cd /root/Bioroebe/Downloads/; bioroebe --n-fasta-entries # # ======================================================================= # when /^-?-?n(-|_)?fasta(-|_)?entries$/ require 'bioroebe/fasta/display_how_many_fasta_entries_are_in_this_directory.rb' ::Bioroebe::DisplayHowManyFastaEntriesAreInThisDirectory.new exit # ======================================================================= # # === bioroebe --split-this-fasta-file-into-chromosomes=Mus_musculus.GRCm38.ncrna.fa # ======================================================================= # when /^-?-?split(-|_)?this(-|_)?fasta(-|_)?file(-|_)?into(-|_)?chromosomes=(.+)$/i # $6 _ = $6.to_s.dup require 'bioroebe/fasta/split_this_fasta_file_into_chromosomes/split_this_fasta_file_into_chromosomes.rb' ::Bioroebe::SplitThisFastaFileIntoChromosomes.new(_) exit # ======================================================================= # # === bioroebe --stats # # This entry-point will show some simple fasta-statistics, from # the current directory. # # Usage example: # # cd /root/Bioroebe/Downloads/; bioroebe --stats # # ======================================================================= # when /^-?-?stats$/i, /^-?-?statistics$/i, /^-?-?fasta(-|_)?stats$/i require 'bioroebe/fasta/show_fasta_statistics.rb' ::Bioroebe.show_fasta_statistics(Dir['*']) exit # ======================================================================= # # === bioroebe --download=ftp://ftp.ensembl.org/pub/release-92/gtf/mus_musculus/ # # This entry point allows us to download a remote program. # # Invocation example: # # bioroebe --download=ftp://ftp.ensembl.org/pub/release-92/gtf/mus_musculus/ # bioroebe --download ftp://ftp.ensembl.org/pub/release-92/gtf/mus_musculus/ # # Note that the second variant currently (April 2020) does not work - # let's see if we need it again in the future. # ======================================================================= # when /^-?-?download=(.+)/ ::Bioroebe.download($1.to_s.dup) # ======================================================================= # # === bioroebe --sequence=150 # # This entry point allows us to use any sequence, on startup. # # Invocation example: # # bioroebe --sequence=1505 # # ======================================================================= # when /^-?-?sequence (.+)/, /^-?-?sequence=(.+)/ set_dna($1.to_s.dup, :be_quiet) # Be quiet here when doing the assignment. # ======================================================================= # # === bioroebe --show-exon-statistics-for=/tmp/praktikum/Mouse/chromosome_8/parsed/cdna.8.L100.global.gtf # ======================================================================= # when /^-?-?show(-|_)?exon(-|_)?statistics(-|_)?for=(.+)$/ # === $4 ::Bioroebe.show_exon_statistics($4.to_s.dup) exit # ======================================================================= # # === bioroebe --sinatra # ======================================================================= # when /^-?-?sinatra$/i do_start_the_sinatra_interface return end run end |
Class Method Details
.[](i = ARGV) ⇒ Object
#
Bioroebe::Shell[]
#
11180 11181 11182 |
# File 'lib/bioroebe/shell/shell.rb', line 11180 def self.[](i = ARGV) new(i) end |
.colour? ⇒ Boolean
#
Bioroebe::Shell.colour?
#
57 58 59 |
# File 'lib/bioroebe/shell/colours/colours.rb', line 57 def self.colour? @default_colour end |
.generate_pdf_tutorial(also_upload_the_tutorial = true) ⇒ Object
#
Bioroebe::Shell.generate_pdf_tutorial
You can use this method to simply generate a new .pdf file, then upload it anyway.
#
11211 11212 11213 11214 11215 11216 11217 11218 11219 11220 11221 11222 11223 11224 11225 11226 11227 11228 11229 11230 |
# File 'lib/bioroebe/shell/shell.rb', line 11211 def self.generate_pdf_tutorial( also_upload_the_tutorial = true ) url = ::Bioroebe.try_to_pass_through_beautiful_url('bioroebe_tutorial?pdf') url = url.first if url.is_a? Array url.gsub!(/^\/home\/x\/DATA\//, LOCALHOST) if url.include? HOME_DIRECTORY_OF_USER_X+'DATA/' OpenURI.send(:open, url) # ======================================================================= # # === Designate where the tutorial can be found locally # ======================================================================= # path = FILE_BIOROEBE_TUTORIAL if also_upload_the_tutorial if File.exist? path ::Bioroebe.upload_this_pdf_file(path) else e "Can not upload from #{sfile(path.to_s)} as this "\ "path does not exist." end end end |
.menu(i = ARGV) ⇒ Object
11173 11174 11175 |
# File 'lib/bioroebe/shell/shell.rb', line 11173 def self.(i = ARGV) new(:no_commandline_arguments).(i) end |
.return_entries_in_the_current_directory ⇒ Object
#
Bioroebe::Shell.return_entries_in_the_current_directory
#
48 49 50 |
# File 'lib/bioroebe/shell/readline/readline.rb', line 48 def self.return_entries_in_the_current_directory Dir['*'] end |
.set_colour(i) ⇒ Object
#
Bioroebe::Shell.set_colour
Set the default colour here.
#
30 31 32 |
# File 'lib/bioroebe/shell/colours/colours.rb', line 30 def self.set_colour(i) @default_colour = i end |
.upload_this_pdf_file(path) ⇒ Object
#
Bioroebe::Shell.upload_this_pdf_file
Use this method to upload the .pdf tutorial or any other .pdf file. This is primarily useful on my home system and may have very little value to other people.
#
11191 11192 11193 11194 11195 11196 11197 11198 11199 11200 11201 11202 11203 |
# File 'lib/bioroebe/shell/shell.rb', line 11191 def self.upload_this_pdf_file(path) # ======================================================================= # # ^^^ This will have generated the .pdf. # ======================================================================= # # Hardcoded for now where the .pdf will reside. # ======================================================================= # if Object.const_defined? :FtpParadise ftp = FtpParadise.new(:shevy, :dont_run_yet) ftp.do_login ftp.upload_this_binary_file(path) e 'Finished uploading!' end end |
Instance Method Details
#aa_to_dna(i) ⇒ Object
#
aa_to_dna
#
7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 |
# File 'lib/bioroebe/shell/shell.rb', line 7447 def aa_to_dna(i) if i.is_a? Array i = i.join.strip end i = ::Bioroebe.aa_to_dna(i) if i.is_a? Array i = i.join.strip end e i end |
#add_his_tag(i = 'add 6 random his tags') ⇒ Object
#
add_his_tag
This method can be used to add a his tag. By default we will add 6 Histidin tags in succession. This pattern is commonly found in expression vectors.
These histidin tags will be randomly placed within the DNA sequence, by default. Note that CAT and CAC code for Histidin. In most vectors, there is an alternation between these codons.
#
6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 |
# File 'lib/bioroebe/shell/shell.rb', line 6197 def add_his_tag(i = 'add 6 random his tags') = i.scan(/\d+/).first position = rand(main_sequence?.size)+1 e 'Next adding '+sfancy()+rev+ ' Histidin tags to our main sequence at nucleotide '\ 'position '+sfancy(position.to_s)+rev+'.' _ = main_sequence? _.insert_at_this_position( position+1, 'CAC|CAT|CAC|CAT|CAC|CAT' # Insert the His tag here. ) assign_this_dna_sequence(_.to_str) end |
#add_n_nucleotides ⇒ Object
#
add_to_start
Use this method to add to the start of a nucleotide sequence. In other words, to prepend to the main nucleotide sequence.
#
add_n_nucleotides
3551 3552 3553 |
# File 'lib/bioroebe/shell/shell.rb', line 3551 def add_to_start(i) add_to_start_or_end(i, :to_start) end |
#add_poly_a_sequence ⇒ Object
#
add_poly_a_sequence
Use this method to tag a PolyA sequence to the 3' end of a mRNA.
First, the mRNA will be cleaved by the enzyme CPSF, usually at the sequence AAUAAA (most common one, but variants exist). AAUAAA is found in 90% of all sequenced polyadenylation elements.
#
8740 8741 8742 8743 |
# File 'lib/bioroebe/shell/shell.rb', line 8740 def add_poly_a_sequence this_sequence = 'A' * 250 @internal_hash[:rna].append(this_sequence) end |
#add_the_current_user_input_to_the_history ⇒ Object
#
add_the_current_user_input_to_the_history
#
855 856 857 858 859 860 861 862 |
# File 'lib/bioroebe/shell/shell.rb', line 855 def add_the_current_user_input_to_the_history # ======================================================================= # # And add the user-input to the array that keeps track of it. This # has to be done through a specific method, which can do additional # checks before adding the user-input onto the history. # ======================================================================= # add_to_history(user_input?) end |
#add_timer_snapshot ⇒ Object
#
add_timer_snapshot
#
6125 6126 6127 |
# File 'lib/bioroebe/shell/shell.rb', line 6125 def add_timer_snapshot array_timer_snapshots? << Time.now end |
#add_to_end(i) ⇒ Object Also known as: add
#
add_to_end
This method will invoke append() if something has to be appended.
#
5230 5231 5232 |
# File 'lib/bioroebe/shell/shell.rb', line 5230 def add_to_end(i) add_to_start_or_end(i, :end) end |
#add_to_history(i = user_input?) ) ⇒ Object
#
add_to_history
This method should be used consistently whenever content is added onto the history of the bioshell. Content in this context refers primarily to user-submitted input.
#
8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 |
# File 'lib/bioroebe/shell/shell.rb', line 8369 def add_to_history(i = user_input?) if i.is_a? Array i.each {|entry| add_to_history(entry) } else i = i.to_s.chomp unless i.empty? if array_history? and array_history?.respond_to?(:last) last_history_element = array_history?.last # <- On startup there is no history, hence this check as safeguard. if last_history_element unless (last_history_element.strip == i.strip) # Only add if it is new input. array_history? << i if log_user_input? what = "#{i}#{N}" into = "#{bioshell_log_dir?}input_history.yml" append_what_into(what, into) end end else # This clause is valid for new entries. array_history? << i end end end end end |
#add_to_start(i) ⇒ Object Also known as: left_add
#
add_to_start
#
3549 3550 3551 |
# File 'lib/bioroebe/shell/shell.rb', line 3549 def add_to_start(i) add_to_start_or_end(i, :to_start) end |
#add_to_start_or_end(i = '', append_or_prepend = :append) ⇒ Object
#
add_to_start_or_end
This method can either add to the start or to the end.
The default is to append to the nucleotide sequence.
We can input a number - in this case, we simply add these many nucleotides onto the main string.
#
5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 |
# File 'lib/bioroebe/shell/shell.rb', line 5501 def add_to_start_or_end( i = '', append_or_prepend = :append ) if the_main_sequence_is_frozen? report_that_the_main_sequence_is_frozen return end i = i.join('') if i.is_a? Array i = i.dup old_length = i.size case i.to_s # Easier start/stop entries. # ======================================================================= # # === Add a start codon. # ======================================================================= # when 'start', 'START', /ORF/i, ':start' i = ::Bioroebe.start_codon? # Used to be hardcoded -> 'ATG' # ======================================================================= # # === Add a stop codon. # ======================================================================= # when /^stop$/i, ':stop' i = ::Bioroebe.stop_codons?.sample end i = i.dup if i.frozen? i.upcase! case append_or_prepend # ======================================================================= # # === :prepend # ======================================================================= # when :prepend, :to_start, :start if i =~ /^\d+$/ # If input is only numbers. erev 'Only numbers were given: Prepending '+ sfancy(i.to_s)+rev+ ' random nucleotides to the main string now.' i.to_i.times { prepend(add_nucleotide) } else erev "Prepending #{sfancy(i)}#{rev} to the main string." prepend(i) end # ======================================================================= # # === :append # ======================================================================= # when :append, :to_end, :end if i =~ /^\d+$/ # If input is only numbers. erev "Only numbers were given: Adding #{sfancy(i.to_s)}#{rev}"\ " random nucleotides to the main string now." i.to_i.times { append(return_random_nucleotide) } else if only_nucleotides?(i) msg = "Adding #{sfancy(i)}#{rev}" msg = msg.dup if msg.frozen? if ::Bioroebe.is_a_stop_codon? i msg << ' (a stop codon)' end msg << ' to the main string.' erev msg end append(i) end end new_length = string?.size.to_s unless new_length.to_i == old_length.to_i erev "The new length of the main string is now: "\ "#{simp(new_length)}#{rev}." end show_dna_sequence end |
#add_vertical_barrier_to_sequence(i = dna_sequence? ) ⇒ Object
#
add_vertical_barrier_to_sequence
This will turn a sequence such as “ATGCCC” into “ATG|CCC”.
Invocation example:
ATGCCC
#
10235 10236 10237 10238 10239 10240 10241 10242 10243 |
# File 'lib/bioroebe/shell/shell.rb', line 10235 def ( i = dna_sequence? ) i = i.join if i.is_a? Array i = dna_sequence? if i.nil? splitted = i.scan(/.../) joined = splitted.join('|') e joined end |
#adenin? ⇒ Boolean
#
adenin?
This will return e. g. “C5H5N5”.
#
10276 10277 10278 |
# File 'lib/bioroebe/shell/shell.rb', line 10276 def adenin? YAML.load_file(FILE_NUCLEOTIDES)['Adenin'] end |
#align_ORFS(i = dna_string? ) ⇒ Object
#
align_ORFS
This method is used to align all intrinsic ORFs of agiven sequence.
We delegate into class AlignOpenReadingFrames for the output.
#
4110 4111 4112 4113 4114 4115 |
# File 'lib/bioroebe/shell/shell.rb', line 4110 def align_ORFS( i = dna_string? ) i = dna_string? if i.nil? ::Bioroebe::AlignOpenReadingFrames.new(i) # bl $BIOROEBE/align_open_reading_frames.rb end |
#all_arguments? ⇒ Boolean Also known as: a?
#
all_arguments? (a? tag)
#
7974 7975 7976 |
# File 'lib/bioroebe/shell/shell.rb', line 7974 def all_arguments? @internal_hash[:all_arguments] end |
#all_upcase?(i) ⇒ Boolean Also known as: is_all_upcase?
#
all_upcase?
Return true if the input is all upcased.
#
7305 7306 7307 7308 |
# File 'lib/bioroebe/shell/shell.rb', line 7305 def all_upcase?(i) return true if i.upcase == i return false end |
#analyze(i = sequence? ) ⇒ Object
#
analyze (analyze tag)
The input to this method should be the DNA or aminoacid sequence.
#
7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 |
# File 'lib/bioroebe/shell/shell.rb', line 7247 def analyze( i = sequence? ) if i.is_a? Array i << sequence? if i.empty? i = i.join end # ======================================================================= # # We require a String past this point. # ======================================================================= # i = i.to_s if File.exist? i # Assume that we have a .pdb file here for now. parse_this_pdb_file(i) else if block_given? yielded = yield case yielded when :dna # Handle DNA "input" here. analyze_dna_string(i) else do_analyze_sequence(i) end else # Default case without block. do_analyze_sequence(i) end end end |
#analyze_dna_string(i = dna_string? ) ⇒ Object
#
analyze_dna_string
This method presently only counts the amount of nucleotides found in the given DNA string at hand.
We use the class Bioroebe::CountAmountOfNucleotides, in bl count_amount_of_nucleotides.rb
#
6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 |
# File 'lib/bioroebe/shell/shell.rb', line 6793 def analyze_dna_string( i = dna_string? ) # ======================================================================= # # Set some default values: # ======================================================================= # i = dna_string? if i.nil? if i.is_a? Array and i.empty? i = dna_string? end ::Bioroebe::CountAmountOfNucleotides.new( i, :use_cliner ) {{ use_colours: use_colours? }} # bl $BIOROEBE/count_amount_of_nucleotides.rb end |
#annotate_this_file(i) ⇒ Object
#
annotate_this_file
#
5107 5108 5109 |
# File 'lib/bioroebe/shell/shell.rb', line 5107 def annotate_this_file(i) ::Bioroebe::CreateAnnotationFormat.new(i) end |
#append(i) ⇒ Object
#
append (append tag)
You can use this to simply append to the main string.
#
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/bioroebe/shell/misc.rb', line 19 def append(i) i = i.join.strip if i.is_a? Array i = i.to_s # ======================================================================= # # First check whether the main sequence is frozen: # ======================================================================= # if is_the_main_sequence_frozen? report_that_the_main_sequence_is_frozen else case i # case tag # ===================================================================== # # === start # ===================================================================== # when 'start' i = ::Bioroebe.start_codon? erev 'We will append the START codon '+sfancy(i)+rev+' next.' # ===================================================================== # # === stop # # Add a random stop-codon in this case. # ===================================================================== # when 'stop' i = ::Bioroebe.stop_codons?.sample erev 'We will append the STOP codon '+sfancy(i)+rev+' next.' when 'shine' i = 'AGGAGGT' # Can only add nucleotides to the main sequence. erev 'We will append the '+mediumslateblue('Shine Dalgarno')+ rev+' (SD) sequence '+sfancy("#{i}-3")+rev+' next.' end if i =~ /^\d+$/ # If input is only numbers. erev "Only numbers were given: Adding #{sfancy(i.to_s)}#{rev}"\ " random nucleotides to the main string next." new_string = ''.dup i.to_i.times { new_string << return_random_nucleotide } i = new_string end # ===================================================================== # # === Check that we add only DNA or RNA nucleotides past this point # ===================================================================== # if only_nucleotides?(i) erev "Now appending #{simp(i)}#{rev}." sequence_object? << i # Next, append to the sequence object here. show_DNA_sequence else # ===================================================================== # # The user may also wish to append a restriction site, such # as via add EcoRI. We need to enable this here. # ===================================================================== # _ = ::Bioroebe.return_sequence_that_is_cut_via_restriction_enzyme(i, :no_colours) if _ _.tr!('|','') erev "Now appending #{simp(_)}#{rev}." sequence_object? << _ # Next, append to the sequence object here. show_dna_sequence else erev 'Can not add the sequence '+simp(i)+rev+' because there '\ 'are non-nucleotides in it.' end end end end |
#array_fasta? ⇒ Boolean
#
array_fasta?
#
9152 9153 9154 |
# File 'lib/bioroebe/shell/shell.rb', line 9152 def array_fasta? @internal_hash[:array_fasta] end |
#array_history? ⇒ Boolean
#
array_history?
Access the input-history of the bioshell.
#
7736 7737 7738 |
# File 'lib/bioroebe/shell/shell.rb', line 7736 def array_history? @internal_hash[:array_history] end |
#array_timer_snapshots? ⇒ Boolean
#
array_timer_snapshots?
#
6132 6133 6134 |
# File 'lib/bioroebe/shell/shell.rb', line 6132 def array_timer_snapshots? @internal_hash[:array_timer_snapshots] end |
#assign_sequence2(i) ⇒ Object
#
assign_sequence2
#
6589 6590 6591 6592 |
# File 'lib/bioroebe/shell/shell.rb', line 6589 def assign_sequence2(i) i = i.join(' ') if i.is_a? Array @internal_hash[:sequence2] = Bioroebe::Sequence.new(i) end |
#assume_what_type_this_is(i) ⇒ Object
#
assume_what_type_this_is
Determine what type the given input is.
Note that this currently has limitations in that it does not use a statistical way to determine whether we really have DNA/RNA/Aminoacids here.
Eventually we will write a replacement for it but for now, it has to suffice.
To test this method interactively, do this in the shell:
assume ATCG
assume AUCG
assume NNNLMMLLAAA
#
7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 |
# File 'lib/bioroebe/shell/shell.rb', line 7930 def assume_what_type_this_is(i) if i.is_a? Array i = i.join end if i chars = i.chars if chars.all? {|entry| POSSIBLE_DNA_NUCLEOTIDES.include? entry } erev 'This must be a DNA sequence.' elsif chars.all? {|entry| POSSIBLE_RNA_NUCLEOTIDES.include? entry } erev 'This must be a RNA sequence.' elsif chars.all? {|entry| POSSIBLE_AMINO_ACIDS.include? entry } erev 'This must be an amino acid sequence.' else erev 'This can not be a valid sequence ('+ simp('DNA/RNA/Proteins')+rev+').' end else erev 'Missing an input such as '+sfancy('ATCG')+rev+'.' end end |
#attempt_to_discover_dna_A_boxes ⇒ Object
#
attempt_to_discover_dna_A_boxes
#
8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 |
# File 'lib/bioroebe/shell/shell.rb', line 8195 def attempt_to_discover_dna_A_boxes dna_A_box_sequence = 'TTATCCACA' erev 'The dnaA box in E. coli has this consensus sequence:' e efancy " #{dna_A_box_sequence}#{rev}" e unless string?.empty? results = string?.scan(/#{dna_A_box_sequence}/) if results.empty? erev 'The given DNA sequence does not contain any dnaA sequence elements.' else erev 'This sequence can be found '+simp(results.size.to_s)+rev+' times.' pp results end end if dna_sequence? end |
#automatically_rename_this_fasta_file(i) ⇒ Object
#
automatically_rename_this_fasta_file
#
7372 7373 7374 7375 7376 |
# File 'lib/bioroebe/shell/shell.rb', line 7372 def automatically_rename_this_fasta_file(i) [i].flatten.compact.each {|this_fasta_file| Bioroebe.automatically_rename_this_fasta_file(this_fasta_file) } end |
#backtranseq(i = aminoacid_sequence?, , output_as_dna_or_rna = :dna) ⇒ Object Also known as: translate_aminoacids_into_dna
#
backtranseq
Translate an Aminoacid Sequence back into the most likely DNA sequence that would code for this sequence/protein. Thus, this method translates from Aminoacids to DNA sequence - in other words it does a “reverse-lookup”.
Currently, we hardcode to the homo sapiens frequency codon table, but at a later time, we will probably change to a more flexible layout, to allow a backtranseq for more organisms.
#
6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 |
# File 'lib/bioroebe/shell/shell.rb', line 6821 def backtranseq( i = aminoacid_sequence?, output_as_dna_or_rna = :dna ) sequence = ConvertAminoacidToDNA[i].to_str.delete('-') erev lpad?+ leading_five_prime+ sfancy(sequence)+ rev+ trailing_three_prime erev 'Note that we have also assigned the above to be the new DNA sequence.' assign_sequence(sequence, :be_silent) end |
#bioshell_log_dir? ⇒ Boolean
#
bioshell_log_dir?
This method will return where the bioshell/ log dir is kept.
#
7014 7015 7016 |
# File 'lib/bioroebe/shell/shell.rb', line 7014 def bioshell_log_dir? "#{log_dir?}bioshell/" end |
#bisulfite(i) ⇒ Object
#
bisulfite
#
9993 9994 9995 |
# File 'lib/bioroebe/shell/shell.rb', line 9993 def bisulfite(i) return ::Bioroebe.bisulfite_treatment(i) end |
#calculate_atp_cost_for(i = aminoacid_sequence?) ) ⇒ Object
#
calculate_atp_cost_for
This method can be used to calculate the ATP cost in order to synthesize a protein.
#
7957 7958 7959 7960 7961 7962 |
# File 'lib/bioroebe/shell/shell.rb', line 7957 def calculate_atp_cost_for(i = aminoacid_sequence?) i = i.join.strip if i.is_a? Array if i.nil? i = aminoacid_sequence? end end |
#calculate_exponential_growth(a, b) ⇒ Object
#
calculate_exponential_growth
#
9685 9686 9687 |
# File 'lib/bioroebe/shell/shell.rb', line 9685 def calculate_exponential_growth(a, b) erev ::Bioroebe.calculate_exponential_growth(a,b) end |
#calculate_hamming_distance_of(i) ⇒ Object
#
calculate_hamming_distance_of
We will delegate into class HammingDistance here.
The argument to this method should ideally be an Array.
To test this method, do:
hamming AGUUCGAUGG AGUCCGGUCG
hamming AGUUCGAUGGGGGGGTTT AGUCCGGUCGGGG
random 100; setseq2 hamming 1 2
#
10121 10122 10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 |
# File 'lib/bioroebe/shell/shell.rb', line 10121 def calculate_hamming_distance_of(i) if i.is_a? String if i.include? ' ' and i =~ /^\d+/ # The String could be "1 3" here, for instance. splitted = i.split(' ').map(&:strip) case splitted.size when 2 # If we have at least 2 entries. splitted[-1] = return_sequence_from_this_number(splitted[-1]) splitted[0] = return_sequence_from_this_number(splitted[0]) i = splitted.join(' ') end end end ::Bioroebe::HammingDistance[i] # bl $BIOROEBE/hamming*rb end |
#calculate_melting_temperature(i) ⇒ Object
#
calculate_melting_temperature
This method just delegates towards class CalculateMeltungTemperature.
#
5205 5206 5207 5208 5209 5210 5211 5212 |
# File 'lib/bioroebe/shell/shell.rb', line 5205 def calculate_melting_temperature(i) i = string? if i.nil? if i == :show_formulas CalculateMeltingTemperature.show_formulas # bl $BIOROEBE/calculate_melting_temperature.rb else @_.calculate_melting_temperature(i) end end |
#calculate_time_difference ⇒ Object
#
calculate_time_difference
#
6139 6140 6141 |
# File 'lib/bioroebe/shell/shell.rb', line 6139 def calculate_time_difference (@internal_hash[:array_timer_snapshots][-2] - @internal_hash[:array_timer_snapshots][-1]) end |
#calculcate_at_content(i = dna_sequence? ) ⇒ Object
#
calculcate_at_content
Calculate the AT content of a DNA or RNA sequence.
Usage example:
set_dna ATGCGCGCGCGAACGATGCATGACTGCTAGTCGACA; calc_at_content
#
1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 |
# File 'lib/bioroebe/shell/shell.rb', line 1595 def calculcate_at_content( i = dna_sequence? ) if i.is_a? Array i = i.first end i = dna_sequence? if i.nil? i.upcase! total = i.size n_A = i.count('A') n_T = i.count('T') result = ( (n_A + n_T) * 100 ) / total erev 'The AT content of this sequence is '+ simp(result.to_s)+rev+' %.' end |
#calculcate_gc_content(i = dna_sequence_as_string? ) ⇒ Object
#
calculcate_gc_content
Use this method to calculate the GC content of a DNA sequence.
If you need the number, you can use this piece of code:
CalculateGCContent.gc_percentage(i) # Will return the percentage number.
#
7434 7435 7436 7437 7438 7439 7440 7441 |
# File 'lib/bioroebe/shell/shell.rb', line 7434 def calculcate_gc_content( i = dna_sequence_as_string? ) if i.nil? or i.empty? # The second check also checks for empty Arrays. i = dna_sequence_as_string? # bl $BIOROEBE/calculate/calculate_gc_content.rb end CalculateGCContent.new(i) end |
#change_first_nucleotide_to(i = dna_sequence? ) ⇒ Object
#
change_first_nucleotide_to
This will only work if we had already assigned a DNA sequence prior to running it.
#
3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 |
# File 'lib/bioroebe/shell/shell.rb', line 3531 def change_first_nucleotide_to( i = dna_sequence? ) i = i.join(' ').strip if i.is_a? Array unless i.empty? i = i.upcase erev "Now changing the first nucleotide to `#{simp(i)}`." sequence?.first_nucleotide = i show_string end end |
#chdir(i = :default) ⇒ Object Also known as: cd
#
chdir (cd tag)
#
9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 |
# File 'lib/bioroebe/shell/shell.rb', line 9253 def chdir( i = :default ) if i and i.start_with?('cd ') i[0,3] = '' end case i # ======================================================================= # # === :home # ======================================================================= # when :home, ':home' i = log_dir? # ======================================================================= # # === :default # ======================================================================= # when :default, nil i = File.('~').to_s end if File.directory? i ::Bioroebe.change_directory(i) else e "No directory at #{sdir(File.absolute_path(i))}#{rev} "\ "appears to exist." end end |
#check_for_local_vectors ⇒ Object
#
check_for_local_vectors
#
8860 8861 8862 8863 8864 8865 |
# File 'lib/bioroebe/shell/shell.rb', line 8860 def check_for_local_vectors _ = return_available_vectors unless _.empty? # Silent assignment comes next. set_sequence_2(::Bioroebe::Sequence.sequence_from_file(_.first)) end end |
#check_for_mismatches ⇒ Object
#
check_for_mismatches
#
7990 7991 7992 |
# File 'lib/bioroebe/shell/shell.rb', line 7990 def check_for_mismatches CheckForMismatches.new end |
#chop(i = 1, chop_from_left_or_right_hand_side = :default) ⇒ Object Also known as: remove_n_nucleotides
#
chop (chop tag)
We use this method to get rid of some nucleotides, from the 3' end of a nucleotide sequence (aka the “right hand side” of it) by default.
The first argument to this method tells us how many nucleotides are to be removed.
The second argument determines whether to chop from the right side (the 3' side) or from the left side (the 5' side).
#
5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 |
# File 'lib/bioroebe/shell/shell.rb', line 5590 def chop( i = 1, chop_from_left_or_right_hand_side = :default # The default is the 3' end. ) # Default will be to chop off one nucleotide. if is_the_main_sequence_frozen? report_that_the_main_sequence_is_frozen return end i = i.first if i.is_a? Array if i == '?' e 'chop allows us to remove nucleotides from the main sequence.' return end i = 1 if i.nil? # Assign to the default then. i = i.to_i # Need a number past this point. if i == 0 erev 'Please add a number, such as 1, or any other value.' else case chop_from_left_or_right_hand_side # ===================================================================== # # === :right # ===================================================================== # when :right, :default which_end = "3'" # ===================================================================== # # === :left # ===================================================================== # when :left which_end = "5'" end if dna_sequence_object?.size > 0 erev "We will now remove some characters (#{simp(i.to_s)}#{rev}"\ ") from the #{which_end} end of our main string." end if dna_sequence_object?.size == 0 erev 'Can not remove anything as the sequence is empty.' elsif i > dna_sequence_object?.size erev 'We can not remove that many characters, thus we will' erev 'simply remove all characters now.' reset_string else # =================================================================== # # Finally do the manipulation. We need to honour from which # side we will be operating on. # =================================================================== # case chop_from_left_or_right_hand_side # =================================================================== # # === :default # =================================================================== # when :default, :right # ================================================================= # # We also store the chopped-away sequence, but we have to be # mindful here since the sequence-object counts the nucleotides # differently than ruby counts Arrays. # ================================================================= # @internal_hash[:array_these_sequences_were_chopped_away] << seq_object?[(-i)+1, i-1].dup seq_object?[-i, i] = '' # =================================================================== # # === :left # =================================================================== # when :left @internal_hash[:array_these_sequences_were_chopped_away] << seq_object?[0, i].dup seq_object?[0, i+1] = '' end end unless dna_sequence_object?.size == 0 erev "#{rev}The new length of the main string is now: "\ "#{simp(dna_sequence_object?.size.to_s)}#{rev}." end show_dna_sequence end end |
#chop_to(i) ⇒ Object
#
chop_to
This method will chop up to the first occurence of the given input sequence.
If the given input sequence can not be found, no change is made.
#
726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 |
# File 'lib/bioroebe/shell/shell.rb', line 726 def chop_to(i) if i.is_a? Array i = i.first end i = i.to_s if i.is_a? Symbol # For instance: chop_to :ATG i.delete!(':') if i.include? ':' case i when 'start' i = 'ATG' end _ = nucleotide_sequence? if i.include? 'U' # ===================================================================== # # Convert Uracil to Thymine next. # ===================================================================== # erev "The given input sequence includes at the least one "\ "#{sfancy('U')}#{rev}, which we will convert to #{sfancy('T')}#{rev}." i.tr!('U','T') end if _.include? i # ===================================================================== # # Ok, we found the search sequence, so now we can chop off the # unnecessary sequences. # ===================================================================== # position = _.index(i) erev "Chopping away #{sfancy(position.to_s)}#{rev} nucleotides from "\ "the left-hand side (5' end) next." @internal_hash[:array_these_sequences_were_chopped_away] << seq_object?[0, position+1] seq_object?[0, position+1] = '' show_dna_sequence else erev 'No modification can be made as our target nucleotide sequence' erev "does not include the given search string #{sfancy(i)}." end end |
#chunked_display(i = dna_sequence? ) ⇒ Object
#
chunked_display
This method will show a “chunked” display of the nucleotides that is similar to the FASTA display at NCBI.
Invoke via:
cdisplay
#
7359 7360 7361 7362 7363 7364 7365 7366 |
# File 'lib/bioroebe/shell/shell.rb', line 7359 def chunked_display( i = dna_sequence? ) i = i.join if i.is_a? Array i = dna_sequence? if i.nil? i = dna_sequence? if i.empty? ::Bioroebe::GenbankFlatFileFormatGenerator.new(i) # bl $BIOROEBE/genbank/genbank_flat_file_format_generator.rb end |
#clear(i) ⇒ Object
#
clear
Functionality that is associated with clearing something, can be stored here.
Usage example:
clear highlighting
#
6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 |
# File 'lib/bioroebe/shell/shell.rb', line 6326 def clear(i) if i.is_a? Array i = i.join(' ').strip end case i when /^highlight/ e 'Clearing all highlighting next.' set_highlight_colour nil end end |
#coding_area? ⇒ Boolean
#
coding_area?
Query method over the “coding area” that we will focus on. So for example, if we have 100 nucleotides, but the coding area says 3-34, then we will only care for the nucleotides starting at position 3 and ending at position 34.
#
6182 6183 6184 |
# File 'lib/bioroebe/shell/shell.rb', line 6182 def coding_area? @internal_hash[:coding_area] end |
#codon(i = sequence? ) ⇒ Object Also known as: codons, codon?, codons?
#
codon
This method will identify codons.
Usage example from within the Shell:
codon AAAGUCCAU
#
10568 10569 10570 10571 10572 10573 10574 10575 10576 10577 10578 10579 10580 10581 10582 10583 |
# File 'lib/bioroebe/shell/shell.rb', line 10568 def codon( i = sequence? ) if i.is_a? Array # We don't want Arrays here. i = i.join.strip end if i.nil? i = sequence? else if i.is_a? String i = sequence? if i.empty? end end _ = nucleotides_to_aminoacid(i) erev _ end |
#codon_to_aminoacid(i) ⇒ Object
#
codon_to_aminoacid
Translate a codon into an aminoacid through this method.
#
1686 1687 1688 |
# File 'lib/bioroebe/shell/shell.rb', line 1686 def codon_to_aminoacid(i) Bioroebe.codon_to_aminoacid(i) end |
#colour_for_nucleotide(i = '') ⇒ Object Also known as: colour_for_nucleotides
#
colour_for_nucleotide
#
2633 2634 2635 |
# File 'lib/bioroebe/shell/shell.rb', line 2633 def colour_for_nucleotide(i = '') royalblue(i) end |
#colour_for_stop_codon(i) ⇒ Object
#
colour_for_stop_codon
#
2626 2627 2628 |
# File 'lib/bioroebe/shell/shell.rb', line 2626 def colour_for_stop_codon(i) orange(i) end |
#colour_scheme_demo(use_this_sequence = 'ATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGC') ⇒ Object
#
colour_scheme_demo
#
9807 9808 9809 9810 9811 9812 9813 9814 |
# File 'lib/bioroebe/shell/shell.rb', line 9807 def colour_scheme_demo( use_this_sequence = 'ATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGC' ) ColourSchemeDemo.new(use_this_sequence) file = ::Bioroebe::ColourSchemeDemo.create_demo_file.to_s erev file open_in_browser(file) if File.exist? file end |
#colour_scheme_for_aminoacids(i = aminoacid_sequence? ) ⇒ Object
#
colour_scheme_for_aminoacids
Invocation example:
caa TTTHGHGHGIHIHRGGGGAATTTTHGHGHGIHIHRGGGGAATTHGHGHGIHIHRGGGGAAATTT
#
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/bioroebe/shell/colours/colours.rb', line 193 def colour_scheme_for_aminoacids( i = aminoacid_sequence? ) i = aminoacid_sequence? if i.nil? hash = ::Bioroebe::ColourScheme::Taylor.colours? tokens = i if tokens.is_a? String tokens = tokens.chars tokens = tokens.each_slice(80).to_a end # ======================================================================= # # Get it in chunks of 30. # ======================================================================= # n_chunks = 30 chunks = tokens.each_slice(n_chunks).to_a e; chunks.each {|array| array.each {|entry| chars = entry.chars chars.each {|aminoacid| if hash.has_key? aminoacid value = hash[aminoacid] array = HexToRGB[value] # Obtain the R,G,B Array from here. ::Colours.rgb_print(array, aminoacid) else erev "The hash does not include the key #{simp(aminoacid)}#{rev}." end } } e }; e end |
#colour_scheme_for_nucleotides(i = dna_sequence?) ) ⇒ Object
#
colour_scheme_for_nucleotides
This method can eventually be used to display the colour codes for the nucleotides.
#
7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 |
# File 'lib/bioroebe/shell/shell.rb', line 7562 def colour_scheme_for_nucleotides(i = dna_sequence?) begin require 'roebe/classes/hex_to_rgb.rb' rescue LoadError; end if Object.const_defined?(:Roebe) and Roebe.const_defined?(:HexToRGB) i = dna_sequence? if i.nil? i = i.first if i.is_a? Array hash = ::Bioroebe::ColourScheme::Nucleotide.colours? tokens = i.chars # ===================================================================== # # Get it in chunks of 80. # ===================================================================== # chunks = tokens.each_slice(80).to_a e; chunks.each {|array| array.each {|char| if hash.has_key? char value = hash[char] array = Roebe::HexToRGB[value] # Obtain the R,G,B Array from here. ::Colours.rgb_print(array, char) end } e }; e else erev 'Please install the gem hex_to_rgb, in order '\ 'to use this method.' end end |
#colourize_fasta_file(i) ⇒ Object
#
colourize_fasta_file
Invocation example:
colourize_fasta_file /Depot/Temp/bioroebe/sequence.fasta
#
6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 |
# File 'lib/bioroebe/shell/shell.rb', line 6389 def colourize_fasta_file(i) if i.is_a? Array i.each {|entry| colourize_fasta_file(entry) } else # ===================================================================== # # First, get the raw content of the fasta sequence here. # ===================================================================== # if File.exist? i sequence = ::Bioroebe.parse_fasta_file(i).sequence? # =================================================================== # # Now that we have the sequence, colourize it. # =================================================================== # cliner { ColourSchemeDemo.new(sequence) } end end end |
#colourize_nucleotide(i, add_leading_five_and_trailing_three_primes = true) ⇒ Object Also known as: colourize_nucleotide_sequence
#
colourize_nucleotide
Assemble 5'-sequence-3', with colours.
#
10334 10335 10336 10337 10338 10339 10340 10341 10342 10343 10344 10345 10346 10347 10348 10349 10350 10351 10352 10353 10354 10355 |
# File 'lib/bioroebe/shell/shell.rb', line 10334 def colourize_nucleotide( i, add_leading_five_and_trailing_three_primes = true ) case add_leading_five_and_trailing_three_primes # ======================================================================= # # === :do_not_add_anything_else # ======================================================================= # when :do_not_add_anything_else, :make_no_modifications add_leading_five_and_trailing_three_primes = false end if add_leading_five_and_trailing_three_primes leading_5_prime+ sfancy(i)+ rev+ trailing_3_prime else sfancy(i)+ rev end end |
#colourize_this_aminoacid(i) ⇒ Object
#
colourize_this_aminoacid
Use this method to colourize any particular aminoacid.
This should make it easier to detect special aminoacids.
#
10213 10214 10215 10216 10217 10218 10219 10220 10221 10222 10223 |
# File 'lib/bioroebe/shell/shell.rb', line 10213 def colourize_this_aminoacid(i) if i.nil? erev 'Please supply an argument, an aminoacid. Either one letter, '\ 'such as A for Alanine, or the full name.' return end unless ::Bioroebe.array_colourize_this_aminoacid.include? i erev 'We will now colourize the aminoacid `'+swarn(i)+'`.' ::Bioroebe.array_colourize_this_aminoacid << i end end |
#compact_file(this_file = nil) ⇒ Object
#
compact_file
Delegate into class Bioroebe::Compacter.
#
6687 6688 6689 |
# File 'lib/bioroebe/shell/shell.rb', line 6687 def compact_file(this_file = nil) ::Bioroebe::Compacter.new(this_file) end |
#compare_two_files(file_a, file_b) ⇒ Object
#
compare_two_files
We will here compare whether two files are identical.
First argument is the first file, second argument is the second file.
#
2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 |
# File 'lib/bioroebe/shell/shell.rb', line 2170 def compare_two_files(file_a, file_b) if File.exist? file_a file_a = File.read(file_a) else erev file_a+' does not exist.' end if File.exist? file_b file_b = File.read(file_b) else erev file_b+' does not exist.' end erev (file_a == file_b) end |
#compare_two_strings_as_alignment(string1 = nil, string2 = nil) ⇒ Object
#
compare_two_strings_as_alignment
This allows us to interactively compare two strings.
#
6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 |
# File 'lib/bioroebe/shell/shell.rb', line 6282 def compare_two_strings_as_alignment( string1 = nil, string2 = nil ) if string1 and string2 # Simply pass through in this case. else erev 'You desire to compare two strings.' e erev 'Please input the '+palegreen('first')+rev+' string/sequence now:' print ' ' if has_readline? string1 = Readline.readline else string1 = $stdin.gets.chomp end erev 'Please input the '+palegreen('second')+rev+' string now:' print ' ' if has_readline? string2 = Readline.readline else string2 = $stdin.gets.chomp end end # ======================================================================= # # Delegate into class SimpleStringComparer next. # ======================================================================= # _ = ::Bioroebe::SimpleStringComparer.new(:dont_run_yet) { :use_vertical_bar } # bl $BIOROEBE/string_matching/simple_string_comparer.rb _.string1 = string1 _.string2 = string2 _.compare end |
#compseq(i = dna_sequence?) ) ⇒ Object
#
compseq
Analyze a given sequence via compseq.
#
10003 10004 10005 10006 |
# File 'lib/bioroebe/shell/shell.rb', line 10003 def compseq(i = dna_sequence?) i = dna_sequence? if i.nil? ::Bioroebe::Compseq.new(i) # bl $BIOROEBE/compseq.rb end |
#config? ⇒ Boolean Also known as: configuration?
#
config?
#
6981 6982 6983 |
# File 'lib/bioroebe/shell/shell.rb', line 6981 def config? @configuration end |
#consider_analysing_the_local_dataset_on_startup ⇒ Object
#
consider_analysing_the_local_dataset_on_startup
This method will analyse the local dataset (should it exist), and then display some information to the user about it.
#
8519 8520 8521 8522 8523 8524 8525 |
# File 'lib/bioroebe/shell/shell.rb', line 8519 def consider_analysing_the_local_dataset_on_startup if @internal_hash and @internal_hash.has_key?(:analyse_the_local_dataset_on_startup) and @internal_hash[:analyse_the_local_dataset_on_startup] Bioroebe::AnalyseLocalDataset.new end end |
#considering_changing_the_title_of_the_kde_konsole_tab(to_this_title = 'BioRoebe') ⇒ Object
#
considering_changing_the_title_of_the_kde_konsole_tab
#
8672 8673 8674 8675 8676 8677 8678 8679 8680 |
# File 'lib/bioroebe/shell/shell.rb', line 8672 def considering_changing_the_title_of_the_kde_konsole_tab( to_this_title = 'BioRoebe' ) if ::Bioroebe.try_to_rename_kde_konsole? and Object.const_defined? :Roebe # For project roebe. require 'roebe/classes/kde/kde_konsole/kde_konsole.rb' Roebe.change_konsole_tab_title(to_this_title, :be_silent) end end |
#convert_five_prime_dna_into_five_prime_mrna(this_string = sequence? ) ⇒ Object
#
convert_five_prime_dna_into_five_prime_mrna (DNA to mRNA)
This method will translate the 5'-DNA into 5'-mRNA.
#
6515 6516 6517 6518 6519 6520 6521 |
# File 'lib/bioroebe/shell/shell.rb', line 6515 def convert_five_prime_dna_into_five_prime_mrna( this_string = sequence? ) erev padding?+leading_5_prime+ sfancy(this_string.upcase.tr('T','U'))+ rev+trailing_3_prime end |
#copy_bioroebe_shell_before_quitting ⇒ Object
#
copy_bioroebe_shell_before_quitting
Use this method to copy the Bioroebe shell before quitting.
We will make use of class InstallRubyProject for this.
This was disabled as of Jan 2016. The reason is that it confuses me too much, seriously. Perhaps I will re-enable it again at a later time.
#
10753 10754 10755 10756 10757 10758 10759 10760 10761 10762 10763 10764 10765 10766 10767 |
# File 'lib/bioroebe/shell/shell.rb', line 10753 def copy_bioroebe_shell_before_quitting _ = RUBY_SRC+'bioroebe/' begin require 'roebe/classes/install_ruby_project.rb' rescue LoadError; end if Object.const_defined? :Roebe irp = Roebe::InstallRubyProject.new(_, false) irp.run elsif on_roebe? erev 'The project custom_methods/install_ruby_project is not available.' erev 'We will install it now.' cd '$RSRC/roebe/' Easycompile.rinstall2 if Object.const_defined? :Easycompile end if false # Disabled it here. Not sure if I will re-enable it. end |
#could_this_be_an_amino_acid?(i) ⇒ Boolean
#
could_this_be_an_amino_acid?
If the input is an amino acid, we return true for this method here.
Characters such as '?' will be removed.
Invocation examples:
phenylalanine
glycin
glycine
#
7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 |
# File 'lib/bioroebe/shell/shell.rb', line 7324 def could_this_be_an_amino_acid?(i) i = i.to_s.downcase i.delete!('?') if i.include? '?' # Get rid of '?' tokens. return_value = false unless i.empty? # ===================================================================== # # First, we check here for german names. These names are kept in # the file called # 'amino_acids_long_name_to_one_letter.yml' # ===================================================================== # unless AMINO_ACIDS_RESTE.has_key?(i) if AMINO_ACIDS_LONG_NAME_TO_ONE_LETTER.has_key?(i) i = AMINO_ACIDS_LONG_NAME_TO_ONE_LETTER[i] i = AMINO_ACIDS_ENGLISH[i].downcase end end if AMINO_ACIDS_RESTE.has_key?(i) return_value = true end end return return_value end |
#count_amount_of_aminoacids(i) ⇒ Object
#
count_amount_of_aminoacids
#
8702 8703 8704 |
# File 'lib/bioroebe/shell/shell.rb', line 8702 def count_amount_of_aminoacids(i) ::Bioroebe::CountAmountOfAminoacids.new(i) end |
#create_balanced_composition(i = nil) ⇒ Object
#
create_balanced_composition
This method will create a balanced nucleotide-composition.
In other words, we can do a DNA string with 25% A, G, C, T each.
#
1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 |
# File 'lib/bioroebe/shell/shell.rb', line 1820 def create_balanced_composition(i = nil) string = ''.dup # The return string. if i.nil? n_nucleotides_to_be_generated = 1000 # Default. # In this case, go interactive. erev 'Please enter the percentage of each nucleotide next.' ee 'A: ' a = $stdin.gets.chomp.to_i ee 'T: ' t = $stdin.gets.chomp.to_i ee 'C: ' c = $stdin.gets.chomp.to_i erev 'G is automatically calculated.' g = 100 - (a + t + c) ee 'G: ' # The following is not yet finished. string << ('A' * a)+('T' * t)+('C' * c)+('G' * g) else i = 1000 if i.nil? or (i.is_a?(Array) and i.empty?) # The default. n_nucleotides_to_be_generated = i # ===================================================================== # # Otherwise, we assume it to be 25% for each nucleotide. The following # code will ensure that. # ===================================================================== # n_times = n_nucleotides_to_be_generated.to_i / 4 n_times.times { _ = return_dna_nucleotides # Get all four entries first. _.shuffle.each {|nucleotide| string << nucleotide } } end erev "Note: we will assume the target size will "\ "be #{n_nucleotides_to_be_generated.to_s} nucleotides." return string # The nucleotide-string to be returned. end |
#create_fasta_file ⇒ Object
#
create_fasta_file
#
6439 6440 6441 6442 6443 6444 6445 |
# File 'lib/bioroebe/shell/shell.rb', line 6439 def create_fasta_file set_save_file :default_fasta e 'Now creating a new fasta file. Will store into `'+sfile(@save_file)+'`.' _ = '>gi|12345|pir|TVHGG| some unknown protein'+N _ << string? save_file(_, @internal_hash[:save_file]) end |
#create_n_random_amino_acids(n = 1000) ⇒ Object
#
create_n_random_amino_acids
#
3979 3980 3981 |
# File 'lib/bioroebe/shell/shell.rb', line 3979 def create_n_random_amino_acids(n = 1000) set_aminoacids :random, n, :be_verbose end |
#cut(i) ⇒ Object
#
cut (cut tag)
This method will cut away some part from the DNA string.
#
4968 4969 4970 4971 4972 |
# File 'lib/bioroebe/shell/shell.rb', line 4968 def cut(i) i = i.to_i sequence?[-i,i] = '' show_dna_sequence end |
#cut_at(this_sequence = 'GAATTC', be_verbose = true) ⇒ Object
#
cut_at
Use this method to chop off or rather cut at a DNA sequence.
#
5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 |
# File 'lib/bioroebe/shell/shell.rb', line 5677 def cut_at( this_sequence = 'GAATTC', be_verbose = true ) main_sequence = dna_sequence_object? this_sequence = this_sequence.join.strip if this_sequence.is_a? Array if be_verbose erev "We will chop away (at) the sequence #{simp(this_sequence)}#{rev}." erev 'Note that the sequences all originated from the larger '\ 'parent sequence.' end results = main_sequence.split(/#{this_sequence}/) results.each {|sequence| _ = properly_spaced_dna(sequence) _ << (' ('+sequence.size.to_s+' nucleotides)').rjust(110 - sequence.size) erev _ } end |
#cut_sequence_in_slices_of(threshold = '9') ⇒ Object
#
cut_sequence_in_slices_of
This method cuts the sequence into slices of n, where n is the argument to this method.
So if you input 10 as argument, then we will put the nucleotides into chunks of 10 nucleotides per row.
Usage examples:
cut_sequence_in_slices_of 5
cut_sequence_in_slices_of 6
cut_sequence_in_slices_of 7
#
6635 6636 6637 6638 6639 6640 6641 6642 6643 |
# File 'lib/bioroebe/shell/shell.rb', line 6635 def cut_sequence_in_slices_of( threshold = '9' ) _ = dna_sequence_object? matches = _.scan(/.{#{threshold}}/) matches.each {|entry| erev " #{entry}" } end |
#cut_with_enzyme(i) ⇒ Object
#
cut_with_enzyme
#
5019 5020 5021 5022 |
# File 'lib/bioroebe/shell/shell.rb', line 5019 def cut_with_enzyme(i) i = i.join(' ').strip if i.is_a? Array pp sequence_object?.cut_with_enzyme(i) end |
#cutseq(i = [1,3]) ⇒ Object
#
cutseq
This can be used to modify the sequence object. It will cut some segment out from the nucleotide.
Usage examples:
random 30; cutseq 5 8
random 30; cutseq 5-8
#
4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 |
# File 'lib/bioroebe/shell/shell.rb', line 4986 def cutseq(i = [1,3]) if i.is_a? Array if i.size == 1 and i.first.is_a? String and i.first.include?('-') i = [i.first.split('-')].flatten end if i.empty? # In this case we will ask the user for input. erev 'No argument was provided. Please input the start nucleotide position next:' start_position = $stdin.gets.chomp.to_i erev 'Next, input the end nucleotide position:' end_position = $stdin.gets.chomp elsif i.size > 1 start_position = i.first end_position = i.last end end # ======================================================================= # # === Handle +3 relational position given # ======================================================================= # if end_position.is_a? String and end_position.include?('+') end_position = start_position + end_position.delete('+').to_i end n_nucleotides_will_be_deleted = (end_position.to_i - start_position.to_i)+1 # ======================================================================= # # Notify the user what we will do next. # ======================================================================= # erev 'Next cutting away '+simp(n_nucleotides_will_be_deleted.to_s)+ rev+' nucleotides.' sequence_object?[start_position, end_position] = '' end |
#cytosin? ⇒ Boolean
#
cytosin?
#
10290 10291 10292 |
# File 'lib/bioroebe/shell/shell.rb', line 10290 def cytosin? YAML.load_file(FILE_NUCLEOTIDES)['Cytosin'] end |
#dalton(i) ⇒ Object
#
dalton
This method will calculate the weight of several aminoacids, in Dalton. We assume that each aminoacid will have a weight of 110 Dalton.
#
7236 7237 7238 7239 7240 |
# File 'lib/bioroebe/shell/shell.rb', line 7236 def dalton(i) n_dalton = i.to_f * 110 e sfancy(i.to_s)+rev+' aminoacids have a molecular weight of '+ simp(n_dalton.to_s)+rev+' Dalton ('+(n_dalton/1000.0).to_s+' kDa).' end |
#deduce_this_aminoacid_sequence(i = 'Lys-Ser-Pro-Ser-Leu-Asn-Ala-Ala-Lys', show_the_rna_sequence = true) ⇒ Object
#
deduce_this_aminoacid_sequence
Thi method will show the possible codons for an aminoacid sequence.
It will display the result in an ASCII table, on the commandline.
Trigger this like so:
sof
sof Lys-Ser-Pro-Ser-Leu-Asn-Ala-Ala-Lys
sof Thr Thr Glu Ala Val Glu Ser Thr Val Ala Thr Leu Glu Asp Ser
sof T-T-G-A-V-G-S-T-V
#
3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 |
# File 'lib/bioroebe/shell/shell.rb', line 3027 def deduce_this_aminoacid_sequence( i = 'Lys-Ser-Pro-Ser-Leu-Asn-Ala-Ala-Lys', show_the_rna_sequence = true ) if i.nil? # This is the default. if aminoacid_sequence? i = aminoacid_sequence? else i = 'Lys-Ser-Pro-Ser-Leu-Asn-Ala-Ala-Lys' end end DeduceAminoacidSequence.new(i, show_rna: show_the_rna_sequence) # bl DeduceAminoacidSequence end |
#default_length? ⇒ Boolean
#
default_length?
#
8508 8509 8510 |
# File 'lib/bioroebe/shell/shell.rb', line 8508 def default_length? @internal_hash[:default_length] end |
#design_polylinker(optional_length_of_polylinker = nil, be_verbose = true) ⇒ Object
#
design_polylinker
This method will design a polylinker from 3-8 random restriction enzymes sites.
You can pass a first argument to this method.
Example:
design_polylinker 100
#
1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 |
# File 'lib/bioroebe/shell/shell.rb', line 1734 def design_polylinker( optional_length_of_polylinker = nil, be_verbose = true ) if optional_length_of_polylinker.is_a? Array optional_length_of_polylinker = optional_length_of_polylinker[0] end if optional_length_of_polylinker.nil? optional_length_of_polylinker = 20 end optional_length_of_polylinker = optional_length_of_polylinker.to_i full_sequence = '' n_restriction_sites = rand(6)+3 n_restriction_sites.times { full_sequence << return_random_restriction_enzyme(be_verbose) } if full_sequence.size < optional_length_of_polylinker loop { full_sequence << return_random_restriction_enzyme(be_verbose) break if full_sequence.size > optional_length_of_polylinker } end erev 'Our generated polylinker has '+sfancy(n_restriction_sites.to_s)+ ' sites for restriction enzymes available (DNA Sequence '+ 'length is: '+full_sequence.size.to_s+').' erev 'We will also assign this sequence as the new DNA sequence.' assign_dna_sequence(full_sequence, :be_quiet) return full_sequence end |
#designate_this_input_as_coding_entry(i) ⇒ Object
#
designate_this_input_as_coding_entry
Invocation example:
coding_entry 51..3251
#
5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 |
# File 'lib/bioroebe/shell/shell.rb', line 5178 def designate_this_input_as_coding_entry(i) if i.is_a? Array i = i.first end if i.include? '..' # ===================================================================== # # Assume Range-behaviour here. # ===================================================================== # @internal_hash[:coding_area] = i end erev "Using the coding-area #{sfancy(i)}#{rev}." erev 'You can test this by e. g. invoking '+sfancy('ORF?')+rev+'.' end |
#determine_and_report_all_stop_codons ⇒ Object
#
determine_and_report_all_stop_codons
#
3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 |
# File 'lib/bioroebe/shell/shell.rb', line 3449 def determine_and_report_all_stop_codons dna_sequence = dna_sequence_object? erev 'Because 3 different stop codons exist, we have '\ 'to do '+slateblue('3 runs')+rev+'.' stop_codons?.each {|this_stop_codon| array_matches = ::Bioroebe.return_all_substring_matches( dna_sequence, this_stop_codon ) if array_matches.empty? erev 'No match has been found.' else start_position = array_matches.last.first erev 'For the stop codon '+sfancy(this_stop_codon)+rev+' the last codon' erev 'occurrs at position '+simp(start_position.to_s)+rev+'.' end } end |
#disable(i) ⇒ Object
#
disable (disable tag)
#
7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 |
# File 'lib/bioroebe/shell/shell.rb', line 7021 def disable(i) if i.is_a? Array i = i.join(' ').strip end case i.to_s # case tag # ======================================================================= # # === disable :cd_aliases # ======================================================================= # when /^-?-?cd(-|_)?aliases$/i erev 'We will no longer use class Rcfiles::DirectoryAliases' ::Bioroebe::Configuration. # ======================================================================= # # === truncate # ======================================================================= # when /^truncate$/i disable_truncate # ======================================================================= # # === prompt # ======================================================================= # when 'prompt' set_prompt :empty # This means to use an empty prompt. # ======================================================================= # # === padding # ======================================================================= # when 'padding' set_padding 0, :be_verbose # ======================================================================= # # === disable colours # ======================================================================= # when 'colours', 'colors', /^col/ disable_colours # ======================================================================= # # === disable xsel # ======================================================================= # when 'xsel' disable_xsel else erev "No such disable-action could be found (#{sfancy(i)}#{rev})" end end |
#disable_colours ⇒ Object
#
disable_colours (disable tag)
#
123 124 125 126 127 128 |
# File 'lib/bioroebe/shell/colours/colours.rb', line 123 def disable_colours ::Bioroebe.disable_colours @use_colours = false @highlight_colour = '' # Use this colour to highlight important sequences. set_prompt end |
#disable_truncate ⇒ Object
#
disable_truncate
#
5723 5724 5725 |
# File 'lib/bioroebe/shell/shell.rb', line 5723 def disable_truncate do_not_truncate end |
#disable_xsel ⇒ Object
#
disable_xsel
#
5730 5731 5732 5733 5734 5735 5736 5737 |
# File 'lib/bioroebe/shell/shell.rb', line 5730 def disable_xsel if use_xsel? e 'Now disabling xsel.' @internal_hash[:use_xsel] = false else e 'xsel is already disabled.' end end |
#discover_all_palindromes(i = dna_sequence?, , min = 4, max = 10) ⇒ Object
#
discover_all_palindromes
We need to discover all palindromes. For this, we need a min and a max value.
#
4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 |
# File 'lib/bioroebe/shell/shell.rb', line 4033 def discover_all_palindromes( i = dna_sequence?, min = 4, max = 10 ) i = dna_sequence? unless i case i # case tag when 'default', ':default' i = dna_sequence? end @internal_hash[:array_palindromes] = [] # We store the Palindromes in this Array. n_times = i.size min.upto(max) {|length| # ===================================================================== # # First, iterate by starting over the min value. # ===================================================================== # n_times.times {|counter| possible_palindrome_sequence = i[counter, length] counter += 1 # Adding +1 because nucleotides start at 1, not 0. if ::Bioroebe.is_palindrome?(possible_palindrome_sequence) and (possible_palindrome_sequence.size >= length) @internal_hash[:array_palindromes] << [possible_palindrome_sequence, counter] end } } e; e 'Starting nucleotide | Palindrome sequence'; e @internal_hash[:array_palindromes].each {|array| index_position = array.last nucleotides = array.first erev ' '+index_position.to_s.rjust(3)+' '+ nucleotides+' ('+swarn(nucleotides.size.to_s)+rev+')' }; e end |
#display_all_aminoacids ⇒ Object
#
display_all_aminoacids
This method will display all Aminoacids.
Invocation example:
daminoacids
#
5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 |
# File 'lib/bioroebe/shell/shell.rb', line 5121 def display_all_aminoacids e erev 'Aminoacids Shortnames:' erev # Newline here is ok. aa = ::Bioroebe::AMINO_ACIDS # Is a hash. aa.keys.sort.each {|key| result = aa[key].select {|inner_key, value| inner_key.size == 3 }.values.first erev ' '+key+': '+sfancy(result) }; e # Trailing newline. end |
#display_glycolysis_pathway ⇒ Object
#
display_glycolysis_pathway
This method will show the glycolysis Pathway.
#
9542 9543 9544 9545 9546 9547 9548 9549 |
# File 'lib/bioroebe/shell/shell.rb', line 9542 def display_glycolysis_pathway array = Pathways.glycolysis_pathway # Obtain the glyclosis pathway, as Array. if Object.const_defined? :Display Display.display(array, ')') else array.each {|entry| e ' - '+entry } end end |
#display_nucleotide_sequence(this_sequence = dna_sequence_object?, , &block) ⇒ Object Also known as: display_this_nucleotide_sequence, display_this_sequence, show_this_sequence
#
display_nucleotide_sequence
Consistently use this method whenever you wish to display a nucleotide sequence.
#
2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 |
# File 'lib/bioroebe/shell/shell.rb', line 2838 def display_nucleotide_sequence( this_sequence = dna_sequence_object?, &block ) case this_sequence when :default this_sequence = dna_sequence_object? end do_show_piped_output = false if block_given? yielded = yield case yielded when :piped, :show_piped do_show_piped_output = true end end hash = { padding_to_use: padding?, show_piped_output: do_show_piped_output } show_nucleotide_sequence?.report_this_sequence(this_sequence) { hash } end |
#display_open_reading_frames(i = dna_sequence_object?, , &block) ⇒ Object
#
display_open_reading_frames
Invocation example:
display_open_reading_frames ATGAGCAAGGCCGACTACGAGAAG
#
4754 4755 4756 4757 4758 4759 4760 4761 4762 |
# File 'lib/bioroebe/shell/shell.rb', line 4754 def display_open_reading_frames( i = dna_sequence_object?, &block ) i = i.first if i.is_a? Array i = dna_sequence_object? if i.nil? i = dna_sequence_object? if i.empty? require 'bioroebe/utility_scripts/display_open_reading_frames/display_open_reading_frames.rb' ::Bioroebe::DisplayOpenReadingFrames.new(i, &block) end |
#dna_padding(this_sequence, get_rid_of_spaces = false) ⇒ Object Also known as: properly_spaced_dna, properly_padded_dna_string
#
dna_padding (dna_padding tag)
This method will properly pad a DNA string (with leading 5' and trailing 3'). That string will be returned.
First argument should be the string (sequence) that you wish to modify.
#
5074 5075 5076 5077 5078 5079 5080 5081 5082 |
# File 'lib/bioroebe/shell/shell.rb', line 5074 def dna_padding( this_sequence, get_rid_of_spaces = false ) return left_pad?+ five_prime(get_rid_of_spaces)+rev+ sfancy(this_sequence)+rev+ trailer(get_rid_of_spaces) end |
#dna_sequences? ⇒ Boolean Also known as: array_sequences?
#
dna_sequences?
#
1630 1631 1632 |
# File 'lib/bioroebe/shell/shell.rb', line 1630 def dna_sequences? @internal_hash[:array_dna_sequences] end |
#dna_to_aminoacid_sequence(i = dna_sequence?) ) ⇒ Object
#
dna_to_aminoacid_sequence
Convert a DNA sequence into the corresponding aminoacid sequence.
#
5219 5220 5221 5222 5223 |
# File 'lib/bioroebe/shell/shell.rb', line 5219 def dna_to_aminoacid_sequence(i = dna_sequence?) i = dna_sequence? if i.nil? i = dna_sequence? if i.empty? ::Bioroebe::DnaToAminoacidSequence.new(i) end |
#dna_translate(i) ⇒ Object
#
dna_translate
#
7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 |
# File 'lib/bioroebe/shell/shell.rb', line 7496 def dna_translate(i) i = i.join(' ').strip if i.is_a? Array if i.nil? or i.empty? if dna_sequence_as_string? i = dna_sequence_as_string? erev 'Using the current DNA sequence (size: '+ i.size.to_s+' nucleotides)' # =================================================================== # # assign_dna_sequence(i, :be_verbose) # First assign # ^^^ Why would we want to re-assign here? Makes no sense, thus it # was disabled as of December 2021. # =================================================================== # end end # ======================================================================= # # Find and display the complement to this DNA sequence: # ======================================================================= # erev "The #{orange('complementary DNA Strand')}#{rev} is:" e show_nucleotide_sequence?.display(i) { :complementary_strand } e end |
#dna_with_ends(i = dna_sequence_as_string?, , optional_colourize = nil, colourize_everything = true) ⇒ Object
#
dna_with_ends
Display DNA with proper ends.
The first argument should be the string that we will colourize.
If the second argument is given (`optional_colourize`), then this method will colourize the sequence at certain positions. This can be useful to display, for instance, restriction-sites.
#
7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 |
# File 'lib/bioroebe/shell/shell.rb', line 7147 def dna_with_ends( i = dna_sequence_as_string?, optional_colourize = nil, colourize_everything = true ) i.upcase! if config?.respond_to?(:upcase_nucleotides) and config?.upcase_nucleotides if optional_colourize.is_a? String optional_colourize = [optional_colourize] end if block_given? yielded = yield case yielded # ===================================================================== # # === :honour_coding_area_if_it_exists # ===================================================================== # when :honour_coding_area_if_it_exists if optional_colourize and @internal_hash[:coding_area] # ================================================================= # # We will colourize based on the coding area that was designated. # ================================================================= # _ = @internal_hash[:coding_area] # ================================================================= # # We deduct 1 because ruby Arrays start at 0. # ================================================================= # start_position = _.split('..').first.to_i - 1 end_position = _.split('..').last.to_i - 1 internal_segment = i[start_position .. end_position] use_this_as_return_string = '' use_this_as_return_string << i[0..(start_position-1)] optional_colourize.each {|inner_entry| internal_segment.gsub!(inner_entry, yellow+inner_entry+rev) } use_this_as_return_string << internal_segment use_this_as_return_string << i[(end_position+1) .. -1] i = use_this_as_return_string elsif optional_colourize # ================================================================= # # Apply all entries given in the Array. # ================================================================= # if optional_colourize.is_a? Array optional_colourize.flatten.each {|inner_entry| i.gsub!( inner_entry, colour_for_stop_codon(inner_entry)+rev ) # Colourize in yellow. } else # =================================================================== # # Make sure that we have a String past this point. # =================================================================== # optional_colourize = optional_colourize.to_s if colourize_everything == true i.gsub!(optional_colourize, colour_for_stop_codon(optional_colourize)+rev) else if colourize_everything == 1 i.sub!(optional_colourize, colour_for_stop_codon(optional_colourize)+rev) end end end end end else i = "#{sfancy(i)}#{rev}" end # ======================================================================= # # We will report the DNA sequence with leading 5' prime and # trailing 3' prime. # ======================================================================= # return "#{leading_five_prime}#{i}#{trailing_three_prime}" end |
#do_a_silent_startup ⇒ Object Also known as: do_silent_startup
#
do_a_silent_startup
Use this method when you want to perform a silent startup.
#
8065 8066 8067 |
# File 'lib/bioroebe/shell/shell.rb', line 8065 def do_a_silent_startup @internal_hash[:silent_startup] = true end |
#do_action(*i) ⇒ Object
#
do_action
Usage example:
do not truncate
#
7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 |
# File 'lib/bioroebe/shell/shell.rb', line 7884 def do_action(*i) if i.is_a? Array i.flatten! end first_argument = i[0] second_argument = i[1] case second_argument when 'truncate' do_not_truncate if first_argument == 'not' end end |
#do_analyze_sequence(i = sequence? ) ⇒ Object
#
do_analyze_sequence
Use this method to find unique sequences.
#
6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 |
# File 'lib/bioroebe/shell/shell.rb', line 6840 def do_analyze_sequence( i = sequence? ) if i.is_a?(Array) and i.empty? i = sequence? end if i.empty? and (!aminoacid_sequence?) erev 'Please first assign a sequence.' elsif aminoacid_sequence? aminoacid_sequence = aminoacid_sequence? show_protein_composition(aminoacid_sequence) # ===================================================================== # # Also show the molecular mass. # ===================================================================== # molecular_mass_of_amino_acids_in_this_sequence(aminoacid_sequence) else erev 'Searching for '+steelblue('NLS sequences')+rev+' first:' run_nls_search end end |
#do_mutate_dna_sequence_at_this_nucleotide_position(this_nucleotide_position = 1, new_nucleotide = nil, old_sequence = dna_sequence? ) ⇒ Object
#
do_mutate_dna_sequence_at_this_nucleotide_position
You can use this method to mutate a DNA sequence at a given position.
The first argument should be the specific nucleotide position that you wish to modify. Keep in mind that in BioRoebe we will start to count at nucleotide position 1; in ruby Arrays, we would start to count at position 0 but DNA sequences don't have a nucleotide called 0 by definition, hence why we use a more (bio)logical way that makes more sense.
Usage example:
random 15; mutate 1
#
6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 |
# File 'lib/bioroebe/shell/shell.rb', line 6888 def do_mutate_dna_sequence_at_this_nucleotide_position( this_nucleotide_position = 1, new_nucleotide = nil, old_sequence = dna_sequence? ) if this_nucleotide_position.is_a? Array new_nucleotide = this_nucleotide_position[1] if this_nucleotide_position.size > 1 this_nucleotide_position = this_nucleotide_position.first end # ======================================================================= # # === this_nucleotide_position must be a Fixnum past that point # ======================================================================= # this_nucleotide_position = this_nucleotide_position.to_i if this_nucleotide_position < 1 this_nucleotide_position = 1 # 1 is minimum. end old_nucleotide = old_sequence[this_nucleotide_position-1, 1] unless new_nucleotide # Enter this clause if new_nucleotide is nil. new_nucleotide = (DNA_NUCLEOTIDES - [old_nucleotide]).sample # Obtain a random but different nucleotide. end erev 'At nucleotide position '+sfancy(this_nucleotide_position.to_s)+ rev+' we will replace '+simp(old_nucleotide)+rev+' with '+ simp(new_nucleotide)+rev+'.' old_sequence[this_nucleotide_position-1, 1] = new_nucleotide set_dna_sequence(old_sequence) # We'll also assign this. end |
#do_not_show_the_leader(be_verbose = true) ⇒ Object
#
do_not_show_the_leader
#
10098 10099 10100 10101 10102 10103 10104 10105 |
# File 'lib/bioroebe/shell/shell.rb', line 10098 def do_not_show_the_leader( be_verbose = true ) if be_verbose e "The 3'-trailer of nucleotide sequences will not be shown." end @internal_hash[:show_the_leader] = false end |
#do_not_show_the_trailer(be_verbose = true) ⇒ Object
#
do_not_show_the_trailer
#
10086 10087 10088 10089 10090 10091 10092 10093 |
# File 'lib/bioroebe/shell/shell.rb', line 10086 def do_not_show_the_trailer( be_verbose = true ) if be_verbose e "The 3'-trailer of nucleotide sequences will not be shown." end @internal_hash[:show_the_trailer] = false end |
#do_not_truncate ⇒ Object
#
do_not_truncate
#
5165 5166 5167 5168 |
# File 'lib/bioroebe/shell/shell.rb', line 5165 def do_not_truncate ::Bioroebe.do_not_truncate erev 'We will no longer truncate too-long output.' end |
#do_not_use_working_directory_as_prompt ⇒ Object
#
do_not_use_working_directory_as_prompt
#
7692 7693 7694 |
# File 'lib/bioroebe/shell/shell.rb', line 7692 def do_not_use_working_directory_as_prompt @internal_hash[:use_working_directory_as_prompt] = false end |
#do_open(i) ⇒ Object
#
do_open
Open an URL - via browser.
#
5302 5303 5304 5305 5306 5307 5308 5309 |
# File 'lib/bioroebe/shell/shell.rb', line 5302 def do_open(i) case i when 'all','ALL' open_my_files else # Default. open_in_browser(i) end end |
#do_quit(determine_what_to_do = exit_the_shell_how? ) ⇒ Object
#
do_quit (exit tag, quit tag)
Consistently use this method when quitting from the shell. No exception!
On quitting, we may copy the bioroebe-files.
We may either return a symbol, or we may simply call exit.
#
8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 |
# File 'lib/bioroebe/shell/shell.rb', line 8585 def do_quit( # ===================================================================== # # The variable that comes next is usually a Symbol. # ===================================================================== # determine_what_to_do = exit_the_shell_how? ) # ======================================================================= # # We can also copy the content of the Bioroebe-Project - but I am # not sure if this is worth the trade-off, so it was disabled again. # ======================================================================= # # copy_bioroebe_shell_before_quitting # ======================================================================= # considering_changing_the_title_of_the_kde_konsole_tab('') case determine_what_to_do when :instantly, nil :break else # This is valid for :exit_gracefully. return determine_what_to_do # Allo a graceful exit. end end |
#do_start_the_sinatra_interface ⇒ Object
#
do_start_the_sinatra_interface
#
10499 10500 10501 10502 |
# File 'lib/bioroebe/shell/shell.rb', line 10499 def do_start_the_sinatra_interface require 'bioroebe/requires/require_the_bioroebe_sinatra_components.rb' ::Bioroebe.start_sinatra_interface end |
#do_toggle_debug_value ⇒ Object
#
do_toggle_debug_value
#
5237 5238 5239 5240 5241 5242 5243 |
# File 'lib/bioroebe/shell/shell.rb', line 5237 def do_toggle_debug_value if @internal_hash[:debug] @internal_hash[:debug] = false else @internal_hash[:debug] = true end end |
#do_truncate? ⇒ Boolean
#
do_truncate?
#
5147 5148 5149 |
# File 'lib/bioroebe/shell/shell.rb', line 5147 def do_truncate? ::Bioroebe.do_truncate? end |
#do_use_working_directory_as_prompt ⇒ Object Also known as: use_working_directory_as_prompt
#
use_working_directory_as_prompt
Use this method if you wish to use the working-directory as your prompt.
#
5036 5037 5038 |
# File 'lib/bioroebe/shell/shell.rb', line 5036 def do_use_working_directory_as_prompt @internal_hash[:use_working_directory_as_prompt] = true end |
#does_this_remote_file_exist?(i) ⇒ Boolean
#
does_this_remote_file_exist?
This method determines, based on wget, whether a remote file exists or whether it does not.
#
5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 |
# File 'lib/bioroebe/shell/shell.rb', line 5474 def does_this_remote_file_exist?(i) remote_file_exists = false # ======================================================================= # # Use wget --spider to check if the remote file exists. # ======================================================================= # _ = "wget --spider -v #{i} 2>&1" result = `#{_}` if result.include?('Remote file exists') or # Yes, the remote file exists. result =~ /File '.+' exists./ remote_file_exists = true end if result.include? '/404' remote_file_exists = false end return remote_file_exists end |
#downcase_main_string ⇒ Object
#
downcase_main_string (downcase tag, dcase tag)
Use this method to downcase the main sequence.
#
3558 3559 3560 3561 3562 3563 |
# File 'lib/bioroebe/shell/shell.rb', line 3558 def downcase_main_string downcased_sequence = seq?.downcase set_sequence( downcased_sequence ) end |
#download(i) ⇒ Object
#
download (download tag)
General download handler. Some sequences will be changed, such as lambda (for the phage called lambda), to the corresponding entry at NCBI.
#
4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 |
# File 'lib/bioroebe/shell/shell.rb', line 4301 def download(i) if i.is_a? Array i.each {|entry| download(entry) } else case i.to_s # ===================================================================== # # === The lambda phage sequence # # Download the lambda-sequence, via: # # download lambda # # ===================================================================== # when 'lambda', /^-?-?lambda(_|-)?genome$/i i = ::Bioroebe.map_ncbi_entry_to_eutils_id('NC_001416.1.fasta')+ '.fasta' # ===================================================================== # # === Download the cytochrome c sequence (of humans) # # This should be equivalent to: # # https://www.ncbi.nlm.nih.gov/protein/XP_011521207.1?report=fasta # # ===================================================================== # when /cytochrome_c_protein_sequence/ return Bioroebe::Ncbi.efetch_by_url('NP_061820.1') # ===================================================================== # # === P1 # ===================================================================== # when 'P1' i = ::Bioroebe.map_ncbi_entry_to_eutils_id('NC_005856.1.fasta')+ '.fasta' # ===================================================================== # # === P2 # # The P2 phage, from E. coli, a temperate phage. # ===================================================================== # when 'P2' i = ::Bioroebe.map_ncbi_entry_to_eutils_id('NC_041848.1.fasta')+ '.fasta' # ===================================================================== # # === T12 # # This is the Streptococcus phage T12. # ===================================================================== # when 'T12' i = ::Bioroebe.map_ncbi_entry_to_eutils_id('NC_028700.1.fasta')+ '.fasta' # ===================================================================== # # === T2 # # This is the phage T2. # ===================================================================== # when 'T2' i = ::Bioroebe.map_ncbi_entry_to_eutils_id('AP018813.1.fasta')+ '.fasta' # ===================================================================== # # === T4 # # This is the phage T4. # ===================================================================== # when 'T4' i = ::Bioroebe.map_ncbi_entry_to_eutils_id('NC_000866.4.fasta')+ '.fasta' # ===================================================================== # # === T6 # # This is the phage T6. # ===================================================================== # when 'T6' i = ::Bioroebe.map_ncbi_entry_to_eutils_id('MH550421.1.fasta')+ '.fasta' # ===================================================================== # # === rhinovirus # ===================================================================== # when /^-?-?rhinovirus/i i = ::Bioroebe.map_ncbi_entry_to_eutils_id('NC_038311')+ '.fasta' # ===================================================================== # # === Handle .pdb files here # ===================================================================== # when /\.pdb$/ cd :download_directory wget i register_this_download(i) parse_this_pdb_file(File.basename(i)) end # ===================================================================== # # === Handle Fasta files next # ===================================================================== # if i.end_with? '.fa' or i.end_with? '.fasta' i = i.dup if i.frozen? unless File.exist? i _ = Bioroebe::Ncbi.efetch_by_url( i.delete_suffix('.fasta') ) if File.exist? _ erev "The file is now available at `#{sfile(_)}`." end else # ================================================================= # # The above download_fasta() makes use of NCBI. We need to rewrite # this eventually. For now, we will do another, simpler approach # here. # ================================================================= # what = URI.open(i).read into = log_dir?+File.basename(i) erev "Storing into `#{sfile(into)}#{rev}`." write_what_into(what, into) return into # This will also return the local path. end else # erev 'Unsure what to do with '+sfancy(i) esystem "wget #{i}" end end end |
#download_fasta(i = nil) ⇒ Object
#
download_fasta
Use this to download a fasta sequence.
#
5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 |
# File 'lib/bioroebe/shell/shell.rb', line 5424 def download_fasta(i = nil) if i.is_a? Array i.each {|entry| download_fasta(entry) } else # ===================================================================== # # Delegate to a special class here. # ===================================================================== # stored_here = ::Bioroebe.download_fasta(i) # bl $BIOROEBE/download_fasta.rb if stored_here if File.exist? stored_here assign_sequence(stored_here) end return stored_here else e crimson('No result could be found for ')+sfancy(i)+rev end end end |
#download_this_pdb_file(i = '3O30') ⇒ Object
#
download_this_pdb_file
Use this method to download a .pdb file.
There seem to be at least two major methods how to use the PDB database:
(1) http://www.rcsb.org/pdb/files/3O30.pdb
(2) http://www.rcsb.org/pdb/explore.do?structureId=1QRI
The files/ URI seems to redirect you directly to the .pdb file in question, so I think it is the preferred way. However had, the explore.do query gives additional information.
Other useful URLs are:
http://www.rcsb.org/pdb/explore.do?structureId=1ZAA
http://dx.doi.org/10.2210/pdb1gi5/pdb
Usage example:
download_this_pdb_file http://www.rcsb.org/pdb/files/3O30.pdb
#
3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 |
# File 'lib/bioroebe/shell/shell.rb', line 3663 def download_this_pdb_file( i = '3O30' ) i = ['3O30'] if i.nil? # If nil, use a default value. if i.is_a? Array i = ['3O30'] if i.empty? i.each {|entry| download_this_pdb_file(entry) } else i = i.to_s.dup unless i.end_with? '.pdb' i << '.pdb' end unless i.start_with? 'http://www.rcsb.org/pdb/files/' i[0,0] = 'https://www.rcsb.org/pdb/files/' end target_dir = download_dir? cd target_dir # ===================================================================== # # http://www.rcsb.org/pdb/files/3O30.pdb # ===================================================================== # download_this = "#{i.to_s}" erev "Checking for the availability of "\ "#{olivedrab(download_this)}#{rev} next ..." if does_this_remote_file_exist?(download_this) erev 'Next downloading '+sfancy(download_this)+ rev+' into '+sfancy(target_dir)+'.' esystem "wget #{download_this}" # We will just use wget for now. _ = ::Bioroebe.pdb_directory? if File.directory? _ new_target = _+File.basename(download_this) erev 'Moving into '+sfancy(new_target)+rev+', where '\ '.pdb files are kept by default.' mv( target_dir+File.basename(download_this), new_target ) end register_this_download(download_this) else erev "The remote file at #{sfile(download_this)} does not exist." erev 'Hence, we can not download it.' end end end |
#dump(optional_arguments = nil) ⇒ Object
#
dump
This method can be used to save the main DNA string into a file.
You can also store RNA of course; simply pass the argument “rna” or “to_rna” to this method.
#
2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 |
# File 'lib/bioroebe/shell/shell.rb', line 2260 def dump(optional_arguments = nil) what = dna_string? if optional_arguments.is_a? Array optional_arguments = optional_arguments.join(' ').strip end case optional_arguments when 'rna',/to_?rna/ what = ::Bioroebe.to_rna(what) end into = file_dna_string_saved? erev 'Storing into `'+sfile(into)+'`.' write_what_into(what, into) end |
#efetch(i) ⇒ Object
#
efetch
Invocation example:
efetch https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nuccore&id=189458859&rettype=fasta&retmode=text
#
3573 3574 3575 3576 3577 3578 3579 |
# File 'lib/bioroebe/shell/shell.rb', line 3573 def efetch(i) if i.is_a? Array i.each {|entry| efetch(entry) } else ::Bioroebe::Ncbi.efetch_by_url(i) end end |
#enable(i) ⇒ Object Also known as: use
#
enable (enable tag)
Enable-functionality can be passed through this method here.
Invocation example from within the bioshell:
enable colours
#
4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 |
# File 'lib/bioroebe/shell/shell.rb', line 4915 def enable(i) if i.is_a? Array i = i.join.strip end case i.to_s # case tag # ======================================================================= # # === enable cd_aliases # # This variant will be verbose. # ======================================================================= # when /^-?-?cd(-|_)?aliases$/ erev 'class '+ steelblue('Rcfiles::DirectoryAliases')+rev+' will be '\ 'enabled next, allowing' erev 'you to navigate the local filesystem '\ 'more easily so.' ::Bioroebe::Configuration. # ======================================================================= # # === use colours # ======================================================================= # when /^colou?rs$/ enable_colours # ======================================================================= # # === use xsel # ======================================================================= # when 'xsel' enable_xsel end end |
#enable_colours(be_verbose = true) ⇒ Object
#
enable_colours (enable tag)
We bundle all colour stuff here. Right now we use only the colour yellow.
#
107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/bioroebe/shell/colours/colours.rb', line 107 def enable_colours( be_verbose = true ) case be_verbose when :be_quiet, :be_silent be_verbose = false end e 'Enabling colours.' if be_verbose ::Bioroebe.enable_colours @use_colours = true set_default_highlight_colour end |
#enable_configuration ⇒ Object
#
enable_configuration
#
6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 |
# File 'lib/bioroebe/shell/shell.rb', line 6597 def enable_configuration config_dir = ::Bioroebe.project_yaml_directory?+ '/configuration/' unless Object.const_defined?(:Roebe) and Roebe.const_defined?(:Configuration) begin require 'roebe/configuration/class/configuration.rb' rescue LoadError; end end if Object.const_defined?(:Roebe) and Roebe.const_defined?(:Configuration) # ===================================================================== # # === Initialize @configuration # ===================================================================== # @configuration = ::Roebe::Configuration.new(config_dir, :do_not_run_yet) @configuration.be_verbose if @configuration.respond_to? :be_verbose @configuration.run else @configuration = nil end end |
#enable_gtk ⇒ Object
#
enable_gtk
This enables gtk.
#
2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 |
# File 'lib/bioroebe/shell/shell.rb', line 2129 def enable_gtk begin if ENV['IS_ROEBE'].to_s load_gtk # =================================================================== # # Pulling in the controller.rb file is enough to also require the # other GTK-GUI components of the Bioroebe project. # =================================================================== # require 'bioroebe/gui/gtk3/controller/controller.rb' end return ::Bioroebe.controller # This will instantiate a new GTK widget. rescue LoadError => error e 'Failed to load GTK-related files. Showing the specific error next:' pp error end end |
#enable_gtk_section_antisensestrand ⇒ Object
#
enable_gtk_section_antisensestrand
#
2157 2158 2159 2160 2161 |
# File 'lib/bioroebe/shell/shell.rb', line 2157 def enable_gtk_section_antisensestrand require 'bioroebe/gui/gtk3/anti_sense_strand/anti_sense_strand.rb' e 'Starting AntiSenseStrand ...' Bioroebe::GUI::Gtk::AntiSenseStrand.start_gui_application end |
#enable_xsel ⇒ Object
#
enable_xsel
#
5742 5743 5744 5745 5746 5747 5748 5749 |
# File 'lib/bioroebe/shell/shell.rb', line 5742 def enable_xsel if @internal_hash[:use_xsel] e 'xsel is already enabled.' else e 'Now enabling xsel.' @internal_hash[:use_xsel] = true end end |
#ensure_that_the_bioshell_log_directory_exists ⇒ Object
#
ensure_that_the_bioshell_log_directory_exists
#
8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 |
# File 'lib/bioroebe/shell/shell.rb', line 8530 def ensure_that_the_bioshell_log_directory_exists # ======================================================================= # # We must check whether we really wish to create directories on startup # or not. # ======================================================================= # if @internal_hash and @internal_hash.has_key?(:create_directories_on_startup_of_the_shell) and @internal_hash[:create_directories_on_startup_of_the_shell] _ = bioshell_log_dir? unless File.directory? _ unless @internal_hash[:silent_startup] erev "Next creating the directory #{sdir(_)}#{rev}." end mkdir(_) end # ===================================================================== # # Determine the path of the .yml file. # ===================================================================== # yaml_file = ::Bioroebe.project_yaml_directory?+ 'create_these_directories_on_startup/'\ 'create_these_directories_on_startup.yml' if File.exist? yaml_file YAML.load_file(yaml_file).each {|entry| # ================================================================= # # Create all specified subdirectories next. # ================================================================= # _ = "#{log_dir?}#{entry}/" unless File.directory? _ unless @internal_hash[:silent_startup] erev "Next creating the directory #{sdir(rds(_))}#{rev}." end mkdir(_) end } end end end |
#enter_base_directory ⇒ Object
#
enter_base_directory
Use this method to enter the base directory.
#
6487 6488 6489 |
# File 'lib/bioroebe/shell/shell.rb', line 6487 def enter_base_directory cd ::Bioroebe.log_dir? end |
#enter_main_loop ⇒ Object Also known as: loop_get_user_input
#
enter_main_loop (loop tag)
This is the main-loop of the shell.
#
10379 10380 10381 10382 10383 10384 10385 10386 10387 10388 10389 10390 10391 10392 10393 10394 10395 10396 10397 10398 10399 10400 10401 10402 10403 10404 10405 10406 10407 10408 10409 10410 10411 10412 10413 10414 10415 10416 10417 10418 10419 10420 10421 10422 10423 10424 10425 10426 10427 10428 10429 10430 10431 10432 10433 10434 10435 |
# File 'lib/bioroebe/shell/shell.rb', line 10379 def enter_main_loop exit_from_the_main_loop = false loop { begin read_user_input add_the_current_user_input_to_the_history if @internal_hash[:user_input] unless @internal_hash[:user_input].empty? # =============================================================== # # Pass the user input into the menu next. We will use an # Array for this, as user input such as "ls; random 20" should # also be valid. # =============================================================== # user_input = [ @internal_hash[:user_input] ].flatten user_input.each {|use_this_as_user_input| = ( use_this_as_user_input ) case when :exit_gracefully say_goodbye exit_from_the_main_loop = true # =============================================================== # # === :break # =============================================================== # when :break case exit_the_shell_how? # ============================================================= # # === :exit_gracefully # ============================================================= # when :exit_gracefully # User wants to exit here. say_goodbye exit_from_the_main_loop = true # ============================================================= # # === :instantly # ============================================================= # when :instantly exit_from_the_main_loop = true end exit_from_the_main_loop = true else end } @internal_hash[:user_input] = nil # And clear it here again. end end # ===================================================================== # # Rescue sigints (aka ctrl-c) and SystemExit. # ===================================================================== # rescue Interrupt, SystemExit e end if exit_from_the_main_loop == true break end } end |
#ereturn(i = '') ⇒ Object
#
ereturn
#
9225 9226 9227 9228 |
# File 'lib/bioroebe/shell/shell.rb', line 9225 def ereturn(i = '') e i return end |
#erev(i = '') ⇒ Object
#
erev (erev tag)
Easier wrapper over output that has rev().
#
5061 5062 5063 |
# File 'lib/bioroebe/shell/shell.rb', line 5061 def erev(i = '') e "#{rev}#{i}" end |
#exit_the_shell_how? ⇒ Boolean
#
exit_the_shell_how?
#
8571 8572 8573 |
# File 'lib/bioroebe/shell/shell.rb', line 8571 def exit_the_shell_how? @internal_hash[:exit_the_shell_how] end |
#extract_sequence_from_this_file(i) ⇒ Object Also known as: extract_sequence
#
extract_sequence_from_this_file
Use this method to extract a DNA sequence from the given file.
The given input should thus, logically, be an existing (local) file.
Currently this works via genbank .gb files but in the future, other formats may well be supported too.
#
6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 |
# File 'lib/bioroebe/shell/shell.rb', line 6154 def extract_sequence_from_this_file(i) if i.is_a? Array i.each {|entry| extract_sequence_from_this_file(entry) } else if File.exist? i extname = File.extname(i).delete('.') case extname when 'gb' # =================================================================== # # Handle genbank .gb files here. # =================================================================== # _ = ::Bioroebe::GenbankParser.new(i) { :do_not_report_anything } assign_sequence(_.sequence?) end else no_file_exists_at(i) end end end |
#f? ⇒ Boolean Also known as: f, first_argument?
#
f?
#
8719 8720 8721 |
# File 'lib/bioroebe/shell/shell.rb', line 8719 def f? @internal_hash[:first_argument] end |
#fasta? ⇒ Boolean Also known as: last_fasta?, last_fasta_entry?
#
fasta?
We need a query method over the main fasta object, IF it was set.
Since we already have an Array that keeps track of these objects, we can simply grab the last one from that collection.
#
6376 6377 6378 |
# File 'lib/bioroebe/shell/shell.rb', line 6376 def fasta? array_fasta?.last end |
#fasta_file?(i = :fasta_file) ⇒ Boolean
#
fasta_file?
#
6428 6429 6430 6431 6432 6433 6434 |
# File 'lib/bioroebe/shell/shell.rb', line 6428 def fasta_file?(i = :fasta_file) if @internal_hash[:fasta_file].has_key?(i) @internal_hash[:fasta_file].fetch(i) else erev 'We could not find the key called `'+simp(i.to_s)+rev+'`.' end end |
#feedback_version ⇒ Object
#
feedback_version
#
6704 6705 6706 |
# File 'lib/bioroebe/shell/shell.rb', line 6704 def feedback_version erev version? end |
#feedback_where_files_are_kept_locally ⇒ Object
#
feedback_where_files_are_kept_locally
We feedback where some files are kept, like the restriction enzymes.
#
8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 |
# File 'lib/bioroebe/shell/shell.rb', line 8687 def feedback_where_files_are_kept_locally erev 'The restriction enzymes are kept here:' e e " #{sfile(::Bioroebe.restriction_enzymes_file)}" e erev 'The files with the mass table of the amino acids is kept here:' e e " #{sfile(::Bioroebe::FILE_AMINO_ACIDS_MASS_TABLE)}" e report_where_we_store end |
#feedback_whether_we_are_in_debug_mode ⇒ Object
#
feedback_whether_we_are_in_debug_mode
#
1895 1896 1897 |
# File 'lib/bioroebe/shell/shell.rb', line 1895 def feedback_whether_we_are_in_debug_mode erev 'Are we in debug mode? '+simp(debug?.to_s)+rev end |
#feedback_whether_we_will_also_set_the_xorg_buffer ⇒ Object
#
feedback_whether_we_will_also_set_the_xorg_buffer
#
5051 5052 5053 5054 |
# File 'lib/bioroebe/shell/shell.rb', line 5051 def feedback_whether_we_will_also_set_the_xorg_buffer erev "Will we also set the Xorg buffer? "\ "#{sfancy(vt(configuration?.additionally_set_xorg_buffer.to_s))}" end |
#fetch_from_pdb(i) ⇒ Object
#
fetch_from_pdb
This method can obtain a .pdb file from the pdb website.
It can also return the aminoacid sequence.
A URL for the .pdb may be available like this:
https://files.rcsb.org/view/2BTS.pdb
https://files.rcsb.org/view/355D.pdb
For the FASTA sequence, try:
https://www.rcsb.org/fasta/entry/2BTS/display
#
10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 10044 10045 10046 10047 10048 10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 10060 10061 10062 10063 10064 10065 10066 10067 10068 10069 10070 10071 10072 |
# File 'lib/bioroebe/shell/shell.rb', line 10034 def fetch_from_pdb(i) if i.is_a? Array i = i.join(' ').strip end i.upcase! remote_url = 'https://www.rcsb.org/structure/'+i erev 'Looking for the protein called '+steelblue(i)+rev+ 'at pdb next. (URL: '+royalblue(remote_url)+rev+')' e open_in_browser(remote_url) e remote_url_to_the_pdb_file = "https://files.rcsb.org/view/#{i}.pdb" esystem "wget #{remote_url_to_the_pdb_file}" e begin erev 'The fasta sequence, obtained from '+remote_url+', is:' e result = ::Bioroebe.return_fasta_sequence_from_this_pdb_file(remote_url) e result e set_aminoacid_sequence(result) # And assign it as well. rescue Exception => error pp error end # ======================================================================= # # The file may be without a .pdb entry, so rename it in that case. # ======================================================================= # target = File.basename(remote_url_to_the_pdb_file) if File.exist? target unless target.end_with? '.pdb' unless File.exist? target+'.pdb' new_location = target rename_file(i, new_location) unless File.exist?(new_location) target = new_location end end move_file_to_its_correct_location(target) end end |
#file_dna_string_saved? ⇒ Boolean
#
file_dna_string_saved?
#
7474 7475 7476 |
# File 'lib/bioroebe/shell/shell.rb', line 7474 def file_dna_string_saved? @internal_hash[:file_dna_string_saved] end |
#find_all_orfs(i = dna_sequence? ) ⇒ Object
#
find_all_orfs
This method will return all ORFs within the target sequence.
It will return an Array, and then we will display these ORFs, starting with the LONGEST ORF first.
#
5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 |
# File 'lib/bioroebe/shell/shell.rb', line 5319 def find_all_orfs( i = dna_sequence? ) all_start_codons = i.to_enum(:scan, /#{::Bioroebe.start_codon?}/i).map { |match| [$`.size] # [$`.size, match] } all_stop_codons = i.to_enum(:scan, /(TGA|TAG|TAA)/i).map { |match| [$`.size] } array_with_the_proper_matches = [] current_match = nil all_start_codons.each {|start_codon_position| start_codon_position = start_codon_position.first # ===================================================================== # # Find the nearest stop codon position. # ===================================================================== # all_stop_codons.reverse.each {|stop_codon_position| stop_codon_position = stop_codon_position.first length = stop_codon_position - start_codon_position next if length < 1 current_match = [start_codon_position, length] if current_match # Must be a smaller match. if length < current_match[1] # [1] refers to the length. unless length < 3 current_match = [start_codon_position, length] end end end } array_with_the_proper_matches << current_match } cliner token: '-' pp array_with_the_proper_matches cliner token: '-' _ = dna_sequence? array_with_the_proper_matches.each {|start, stop| subsequence = _[start.to_i .. stop.to_i] erev subsequence unless subsequence.empty? } end |
#find_complementary_strand(i = dna_sequence?) ) ⇒ Object Also known as: show_complementary_strand
#
find_complementary_strand
Invoke this via:
3'-ATGCCTGCC
#
11147 11148 11149 11150 11151 11152 11153 11154 11155 11156 11157 11158 11159 11160 11161 11162 11163 |
# File 'lib/bioroebe/shell/shell.rb', line 11147 def find_complementary_strand(i = dna_sequence?) _ = i.strip # The original input. if _.include? "3'-" and _.start_with?('3') _.gsub!(/3'-/,'') _.gsub!(/-5'/,'') _.gsub!(/3'-/,'') erev lpad?+leading_three_prime+ colourize_nucleotide(_, :do_not_add_anything_else)+ trailing_five_prime end result = lpad?+ colourize_nucleotide( return_complement(i.reverse) ) erev result return result end |
#find_gene(i = :default) ⇒ Object
#
find_gene
Wrapper towards class Bioroebe::FindGene.
#
1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 |
# File 'lib/bioroebe/shell/shell.rb', line 1926 def find_gene(i = :default) case i when :default, nil i = dna_sequence? end if i.empty? report_that_a_string_must_be_assigned_first else ::Bioroebe::FindGene.new(i.upcase) # bl $BIOROEBE/find_gene.rb end end |
#find_kdel_sequence ⇒ Object
#
find_kdel_sequence
#
1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 |
# File 'lib/bioroebe/shell/shell.rb', line 1471 def find_kdel_sequence # ======================================================================= # # We must operate on the aminoacid-sequence next. # ======================================================================= # aminoacid_sequence = aminoacid_sequence?.to_s scan_result = aminoacid_sequence.scan(/KDEL/) has_kdel = scan_result.empty? if has_kdel erev 'This sequence has at the least '+ steelblue('one')+' KDEL sequence. '\ '(Has '+scan_result.size.to_s+')' else erev 'This sequence does not have any KDEL sequence.' end end |
#find_longest_substring(i = dna_string?) ) ⇒ Object
#
find_longest_substring
#
6579 6580 6581 6582 6583 6584 |
# File 'lib/bioroebe/shell/shell.rb', line 6579 def find_longest_substring(i = dna_string?) if i.is_a? String and i.include? ' ' i = i.split(' ') end ::Bioroebe::FindLongestSubstring.new(i.first, i.last) end |
#find_longest_substring_via_LCS(i) ⇒ Object
#
find_longest_substring_via_LCS
To invoke this, try:
longest_substring? ATTATTGTT | ATTATTCTT
#
2985 2986 2987 2988 |
# File 'lib/bioroebe/shell/shell.rb', line 2985 def find_longest_substring_via_LCS(i) i = i.join(' | ') if i.is_a? Array ::Bioroebe::FindLongestSubstringViaLCSalgorithm.new(i) { :do_also_show_the_two_sequences } end |
#find_restriction_enzymes_that_cut_at(i) ⇒ Object
#
find_restriction_enzymes_that_cut_at
A wrapper over find_restriction_sites().
#
5774 5775 5776 5777 5778 5779 5780 5781 |
# File 'lib/bioroebe/shell/shell.rb', line 5774 def find_restriction_enzymes_that_cut_at(i) erev 'Trying to find restriction enzymes that '\ 'cut at `'+sfancy(i)+rev+'`.' result = find_restriction_sites(i) unless result erev 'Found no result for this sequence.' end end |
#find_restriction_sites(i = string?) ) ⇒ Object
#
find_restriction_sites
Call the parent method in the Bioroebe class.
#
6866 6867 6868 6869 |
# File 'lib/bioroebe/shell/shell.rb', line 6866 def find_restriction_sites(i = string?) i = string? if i.nil? Bioroebe.restriction_sites?(i) # bl mybioruby end |
#find_shine_dalgarno_sequence(i = dna_sequence_as_string? ) ⇒ Object
#
find_shine_dalgarno_sequence
Use this method to attempt to try and find a SD-sequence.
#
10614 10615 10616 10617 10618 10619 10620 10621 10622 10623 10624 10625 10626 10627 10628 10629 10630 10631 10632 10633 10634 10635 10636 10637 10638 10639 10640 10641 10642 10643 10644 10645 10646 10647 10648 10649 10650 10651 10652 |
# File 'lib/bioroebe/shell/shell.rb', line 10614 def find_shine_dalgarno_sequence( i = dna_sequence_as_string? ) i.upcase! # Need to ensure upcased input. pure_sd_sequence = 'AGGAGGU'.dup if is_dna? pure_sd_sequence.tr!('U','T') end if i.nil? report_that_a_string_must_be_assigned_first else sd_sequence = steelblue( dna_padding(pure_sd_sequence, :no_spaces).lstrip ) if i.include? 'T' # Assume that we have a DNA string rather than RNA. pure_sd_sequence = 'AGGAGGT' sd_sequence = steelblue( dna_padding(pure_sd_sequence, :no_spaces).lstrip ) end if i.include? pure_sd_sequence erev "Yes, our string contains at least one Shine Dalgarno "\ "(#{sd_sequence}#{rev}) sequence." n_sd_sequences = i.scan(/#{pure_sd_sequence}/).size.to_s erev 'We have found '+sfancy(n_sd_sequences)+rev+' instance(s) of '\ 'Shine Dalgarno ('+sd_sequence+rev+') Sites.' erev 'We will next show the particular sequence in '\ 'question ('+simp(pure_sd_sequence)+rev+').' # =================================================================== # # Next, try to find restriction enzymes that cut at the # Shine-Dalgarno site. # =================================================================== # try_to_find_restriction_enzymes_for(:shine_dalgarno) else erev "We did not find a Shine Dalgarno ("\ "#{simp(sd_sequence)}#{rev}) sequence." end end end |
#first(i) ⇒ Object
#
first
#
8183 8184 8185 8186 8187 8188 8189 8190 |
# File 'lib/bioroebe/shell/shell.rb', line 8183 def first(i) if i.to_s =~ /^\d+$/ # If the input is only numbers erev 'Obtaining the first '+simp(i).to_s+rev+' nucleotides next:' erev simp(seq?[0,i.to_i]) else # Else change the first nucleotide. change_first_nucleotide_to(f) end end |
#format_this_nucleotide_sequence(i, &block) ⇒ Object
#
format_this_nucleotide_sequence
This method will properly format the passed-in nucleotide sequence, by making use of class ShowNucleotideSequence.
It will return the formatted String.
#
6478 6479 6480 |
# File 'lib/bioroebe/shell/shell.rb', line 6478 def format_this_nucleotide_sequence(i, &block) ::Bioroebe.format_this_nucleotide_sequence(i) { block } end |
#freeze_the_main_sequence ⇒ Object
#
freeze_the_main_sequence
#
10854 10855 10856 |
# File 'lib/bioroebe/shell/shell.rb', line 10854 def freeze_the_main_sequence @internal_hash[:the_main_sequence_is_frozen] = true end |
#generate_palindrome(i) ⇒ Object
#
generate_palindrome
This method will generate a Palindrome sequence.
#
3586 3587 3588 3589 |
# File 'lib/bioroebe/shell/shell.rb', line 3586 def generate_palindrome(i) i = i.join.strip if i.is_a? Array ::Bioroebe::PalindromeGenerator.new(i).report end |
#generate_pdf_tutorial ⇒ Object
#
generate_pdf_tutorial
Easier wrapper to generate the .pdf Tutorial.
#
5259 5260 5261 |
# File 'lib/bioroebe/shell/shell.rb', line 5259 def generate_pdf_tutorial ::Bioroebe.generate_pdf_tutorial end |
#generate_random_dna_sequence_with_variable_length_and_variable_composition ⇒ Object
#
generate_random_dna_sequence_with_variable_length_and_variable_composition
This method will generate a random DNA sequence of variable length and composition.
#
2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 |
# File 'lib/bioroebe/shell/shell.rb', line 2065 def generate_random_dna_sequence_with_variable_length_and_variable_composition e 'Input the desired length of your DNA string:' length = $stdin.gets.chomp.to_i e 'Input the percentage of Adenine, Thymin, Cytosine and Guanosine. You can' e 'omit this, in which case we will default to 25% each.' e 'Use a / as delimiter please, as in '+ orange('30 / 30 / 20 / 20')+rev+'.' e print 'Adenine / Thymin / Cytosine / Guanosine: ' composition = $stdin.gets.chomp if composition.include? '/' splitted = composition.split('/'). map(&:strip).map(&:to_f) else splitted = [25,25,25,25] end # ======================================================================= # # Next, we fill in our pool of nucleotides. # ======================================================================= # pool_of_nucleotides = [] # ======================================================================= # # Next, we must determine how many we will use. The percentage value # tells us this. # The entries are e. g. 35%. So we first must calculate how much is # 1%, then we multiply this. # ======================================================================= # n_A = (length.to_f / 100) * splitted[0].to_f n_T = (length.to_f / 100) * splitted[1].to_f n_C = (length.to_f / 100) * splitted[2].to_f n_G = (length.to_f / 100) * splitted[3].to_f pool_of_nucleotides << (['A'] * n_A) pool_of_nucleotides << (['T'] * n_T) pool_of_nucleotides << (['C'] * n_C) pool_of_nucleotides << (['G'] * n_G) pool_of_nucleotides.flatten! _ = ''.dup # This is the return string. _ << pool_of_nucleotides.shuffle.join return _ end |
#generate_random_protein_sequence_with_variable_length_and_variable_composition ⇒ Object
#
generate_random_protein_sequence_with_variable_length_and_variable_composition
Use this method to generate a random protein sequence with variable length and variable composition.
#
3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 |
# File 'lib/bioroebe/shell/shell.rb', line 3998 def generate_random_protein_sequence_with_variable_length_and_variable_composition _ = {} # This is our hash. e 'You can generate a random protein sequence next. First, input the' print 'target length of the protein in question: ' length = $stdin.gets.chomp.to_i e e 'Next, you have to input the percentage for the respective amino '\ 'acids, separated via the token '+orange('/')+rev+'.' e e 'This can be quite tedious though. Unfortunately, there is not a' e 'much simpler way possible on the commandline, so here we go:' e print 'Glycine Alanine Valine: ' glycine_alanine_valine = $stdin.gets.chomp glycine, alanine, valine = glycine_alanine_valine.split('/').map(&:strip) _['glycine'] = glycine _['alanine'] = alanine _['valine'] = valine e 'The length of the target protein is '+simp(length.to_s)+'.' e swarn('!!! THE ABOVE CODE ^^^ IS UNFINISHED !!!!!')+rev end |
#generate_single_sequence_repeats ⇒ Object
#
generate_single_sequence_repeats
This method can be used to generate SSR sequences.
#
3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 |
# File 'lib/bioroebe/shell/shell.rb', line 3514 def generate_single_sequence_repeats _ = ''.dup length_of_the_SSR_sequence = 2+rand(4) # 2-5 length_of_the_SSR_sequence.times { _ << return_random_nucleotide } n_repeats = 9+rand(22) # 9-30 result = _ * n_repeats return result end |
#get_long_name_of_amino_acid(i) ⇒ Object
#
get_long_name_of_amino_acid
#
10139 10140 10141 10142 10143 10144 10145 10146 10147 |
# File 'lib/bioroebe/shell/shell.rb', line 10139 def get_long_name_of_amino_acid(i) amino_acids_table = AMINO_ACIDS if amino_acids_table.has_key? i _ = amino_acids_table[i] key = _.keys.select {|inner_key| inner_key.size == 3 }[0] i = _[key].to_s end return i end |
#guanin? ⇒ Boolean
#
guanin?
#
10297 10298 10299 |
# File 'lib/bioroebe/shell/shell.rb', line 10297 def guanin? YAML.load_file(FILE_NUCLEOTIDES)['Guanin'] end |
#handle_fasta(i) ⇒ Object Also known as: assign_fasta, handle_this_fasta_file
#
handle_fasta
Use this method to properly handle a fasta file.
The argument should be the (local) path to a fasta file.
#
9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 |
# File 'lib/bioroebe/shell/shell.rb', line 9011 def handle_fasta(i) if i.nil? if File.exist? fasta_file?.to_s e sfile(fasta_file?.to_s) else show_my_fasta_file # As a reminder. end else i = i.to_s unless i.is_a? String # Need a String past this point. if File.exist?(i) and i.end_with?('.fasta') opnn; erev 'Trying to parse the file `'+sfile(i)+rev+'` next.' parse_fasta_format(i) else fasta_files = Dir['*.fasta'] unless fasta_files.empty? erev 'There seems to be at least one .fasta file in this '\ 'directory ('+sdir(return_pwd)+').' end end end end |
#handle_pdb_files(i) ⇒ Object
#
handle_pdb_files
This method will either show more information about .pdb files or it will simply attempt to download the .pdb file in question.
#
3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 |
# File 'lib/bioroebe/shell/shell.rb', line 3714 def handle_pdb_files(i) if i.nil? or i.empty? # In this case, we show some info. cliner erev '.pdb files are files in the "Protein Data Bank" format.' e erev 'It is a standard for files containing atomic coordinates.' e erev 'Each line in a .pdb file is called a "record".' e erev 'You can pass an ID (a number) and we will attempt to download '\ 'that .pdb file.' e erev 'Example:' e erev ' pdb 333' e erev 'More information can be seen here:' e efancy ' https://www.cgl.ucsf.edu/chimera/docs/UsersGuide/tutorials/pdbintro.html' e print rev cliner else download_this_pdb_file(i) end end |
#handle_this_file(this_file) ⇒ Object
#
handle_this_file
This method can be used to handle a file in general.
#
8612 8613 8614 8615 8616 |
# File 'lib/bioroebe/shell/shell.rb', line 8612 def handle_this_file(this_file) if File.exist? e File.read(this_file) end end |
#highlight_colour? ⇒ Boolean Also known as: yellow
#
highlight_colour?
The highlight colour is primarily the colour that we will use on the commandline, for instance, to denote pretty colours.
#
231 232 233 |
# File 'lib/bioroebe/shell/colours/colours.rb', line 231 def highlight_colour? @highlight_colour end |
#identify_aminoacid(i) ⇒ Object
#
identify_aminoacid
This method will also display the long name of the aminoacid at hand.
Note that you can also identify a batch of aminoacids, by using the '-' character.
Example for this:
identify_aminoacid A-Z
We will ignore invalid aminoacids though.
#
6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 |
# File 'lib/bioroebe/shell/shell.rb', line 6231 def identify_aminoacid(i) if i.is_a? Array i.flatten! if i.any? {|inner_entry| inner_entry.include? '-'} # =================================================================== # # In this case, at the least one entry has a '-' Range component. # So we must substitute there. # =================================================================== # i.map! {|most_inner_entry| if most_inner_entry.include?('-') # =============================================================== # # Assume a Range in this case and prepare it accordingly. # =============================================================== # chars = most_inner_entry.chars start_position = chars.first end_position = chars.last most_inner_entry = (start_position .. end_position).to_a most_inner_entry = strict_filter_away_invalid_aminoacids(most_inner_entry) most_inner_entry end most_inner_entry } end # ===================================================================== # # Recursively call the method if the input is an Array. # ===================================================================== # i.flatten! e; i.each {|entry| identify_aminoacid(entry) }; e else # else assume a String. _ = ::Bioroebe::AMINO_ACIDS_MASS_TABLE if i.empty? |