Class: Bioroebe::AdvancedDotplot
- Inherits:
-
CommandlineApplication
- Object
- Base
- CommandlineApplication
- Bioroebe::AdvancedDotplot
- Defined in:
- lib/bioroebe/dotplots/advanced_dotplot.rb
Overview
Bioroebe::AdvancedDotplot
Constant Summary collapse
- DEFAULT_VALUE_FOR_A_MATCH =
#
DEFAULT_VALUE_FOR_A_MATCH
This is the default value to use for a dotplot. We could also use a ‘*’ token of course.
#
'*'
- MATCH =
2
DEFAULT_VALUE_FOR_A_MATCH
- NON_MATCH =
#
NON_MATCH
#
0
- USE_COLOURS_IN_THIS_CLASS =
#
USE_COLOURS_IN_THIS_CLASS
Whether to have this class handle colours on the commandline or not.
#
true
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::AdvancedDotplot.[] ========================================================================= #.
Instance Method Summary collapse
-
#explain_to_the_user_what_the_asterisk_mean ⇒ Object
# === explain_to_the_user_what_the_asterisk_mean.
-
#initialize(string1 = ARGV[0], string2 = nil, run_already = true) ⇒ AdvancedDotplot
constructor
# === initialize ========================================================================= #.
-
#match? ⇒ Boolean
(also: #match)
# === match? ========================================================================= #.
-
#reset ⇒ Object
# === reset (reset tag) ========================================================================= #.
-
#run ⇒ Object
# === run (run tag) ========================================================================= #.
-
#set_match(i = MATCH) ⇒ Object
(also: #set_match_token)
# === set_match.
-
#set_string1(i) ⇒ Object
# === set_string1.
-
#set_string2(i) ⇒ Object
# === set_string2.
-
#string1? ⇒ Boolean
(also: #string1)
# === string1? ========================================================================= #.
-
#string2? ⇒ Boolean
(also: #string2)
# === string2? ========================================================================= #.
-
#top_row ⇒ Object
# === top_row ========================================================================= #.
Methods inherited from CommandlineApplication
#all_aminoacids?, #append_what_into, #at_home?, #be_silent, #be_verbose?, #cat, #ccliner, #change_directory, #cliner, #codon_table_dataset?, #codon_to_aminoacid, #codons_for?, #colourize_this_dna_sequence, #complement, #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?, #leading_five_prime, #load_bioroebe_yaml_file, #log_directory?, #one_letter_to_long_name, #one_to_three, #only_numbers?, #open_in_browser, #opnerev, #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, #runmode?, #set_be_verbose, #set_runmode, #start_codon?, #stop_codons?, #strict_filter_away_invalid_aminoacids, #taxonomy_download_directory?, #three_to_one, #to_rna, #trailing_three_prime, #use_opn?, #verbose_truth, #was_or_were, #without_extname, #write_what_into
Methods included from BaseModule
#absolute_path, #default_file_read, #file_readlines
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, #disable_colours, #ecomment, #efancy, #egold, #enable_colours, #eorange, #eparse, #erev, #red, #remove_trailing_escape_part, #return_colour_for_nucleotides, #rev, #sdir, #set_will_we_use_colours, #sfancy, #sfile, #simp, #swarn, #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?, #is_on_roebe?, #is_palindrome?, #main_encoding?, #mkdir, #move_file, #mv, #no_file_exists_at, #no_newlines, #project_yaml_directory?, #rds, #register_sigint, #return_pwd, #return_the_first_line_of_this_file, #word_wrap, #write_what_into
Methods included from InternalHashModule
#internal_hash?, #reset_the_internal_hash
Methods included from InferTheNamespaceModule
#infer_the_namespace, #namespace?
Constructor Details
#initialize(string1 = ARGV[0], string2 = nil, run_already = true) ⇒ AdvancedDotplot
#
initialize
#
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 |
# File 'lib/bioroebe/dotplots/advanced_dotplot.rb', line 51 def initialize( string1 = ARGV[0], string2 = nil, run_already = true ) reset # ======================================================================= # # If the first argument is an Array, and if it has at the least two # elements, then we need to assign the last element to string2. # ======================================================================= # if string1.is_a?(Array) and (string1.size > 1) and string2.nil? string2 = string1.pop end set_string1(string1) set_string2(string2) if block_given? yielded = yield case yielded # ===================================================================== # # === :use_asterisk # ===================================================================== # when :use_asterisk set_match_token('*') end end run if run_already end |
Class Method Details
.[](i = ARGV) ⇒ Object
#
Bioroebe::AdvancedDotplot.[]
#
201 202 203 |
# File 'lib/bioroebe/dotplots/advanced_dotplot.rb', line 201 def self.[](i = ARGV) new(i) end |
Instance Method Details
#explain_to_the_user_what_the_asterisk_mean ⇒ Object
#
explain_to_the_user_what_the_asterisk_mean
We have to explain to the user what the meaning of this is.
#
164 165 166 167 168 |
# File 'lib/bioroebe/dotplots/advanced_dotplot.rb', line 164 def explain_to_the_user_what_the_asterisk_mean e erev "Note that the #{@match}#{rev} denotes a dot (== match) here." e end |
#match? ⇒ Boolean Also known as: match
#
match?
#
148 149 150 |
# File 'lib/bioroebe/dotplots/advanced_dotplot.rb', line 148 def match? @match end |
#reset ⇒ Object
#
reset (reset tag)
#
82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/bioroebe/dotplots/advanced_dotplot.rb', line 82 def reset super() set_match # Use the default in this case. # ======================================================================= # # === @non_match # ======================================================================= # @non_match = NON_MATCH if USE_COLOURS_IN_THIS_CLASS @non_match = lightgreen(@non_match) end end |
#run ⇒ Object
#
run (run tag)
#
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/bioroebe/dotplots/advanced_dotplot.rb', line 173 def run e e rev+top_row left_side = string1? left_side.each_with_index {|token, index| # ===================================================================== # # Also show that token # ===================================================================== # print rev, token, ' ' # ===================================================================== # # Inner loop # ===================================================================== # string2.each_with_index {|inner_token, inner_index| if inner_token == token print @match else print @non_match end print ' ' } e } explain_to_the_user_what_the_asterisk_mean end |
#set_match(i = MATCH) ⇒ Object Also known as: set_match_token
#
set_match
This method will determine which character is to be used when a match was found. Typically this is the ‘*’ character, but the constant defined on top of this .rb file can be changed to use another character.
#
102 103 104 105 106 107 |
# File 'lib/bioroebe/dotplots/advanced_dotplot.rb', line 102 def set_match(i = MATCH) @match = i if USE_COLOURS_IN_THIS_CLASS # And use colours. @match = orange(@match) end end |
#set_string1(i) ⇒ Object
#
set_string1
string1 is on the left side of the 2d diagramm.
#
114 115 116 117 118 |
# File 'lib/bioroebe/dotplots/advanced_dotplot.rb', line 114 def set_string1(i) i = i.join if i.is_a? Array i = i.chars if i.is_a? String @string1 = i end |
#set_string2(i) ⇒ Object
#
set_string2
string2 is on the top side of the 2d diagramm.
#
125 126 127 128 129 |
# File 'lib/bioroebe/dotplots/advanced_dotplot.rb', line 125 def set_string2(i) i = i.join if i.is_a? Array i = i.chars if i.is_a? String @string2 = i end |
#string1? ⇒ Boolean Also known as: string1
#
string1?
#
141 142 143 |
# File 'lib/bioroebe/dotplots/advanced_dotplot.rb', line 141 def string1? @string1 end |
#string2? ⇒ Boolean Also known as: string2
#
string2?
#
134 135 136 |
# File 'lib/bioroebe/dotplots/advanced_dotplot.rb', line 134 def string2? @string2 end |
#top_row ⇒ Object
#
top_row
#
155 156 157 |
# File 'lib/bioroebe/dotplots/advanced_dotplot.rb', line 155 def top_row " #{string2.join(' ')}" end |