Class: Bioroebe::ComplementaryDnaStrand

Inherits:
Object
  • Object
show all
Includes:
CommandlineArguments
Defined in:
lib/bioroebe/nucleotides/complementary_dna_strand.rb

Overview

Bioroebe::ComplementaryDnaStrand

Constant Summary

Constants included from ColoursForBase

Bioroebe::ColoursForBase::ARRAY_HTML_COLOURS_IN_USE

Instance Method Summary collapse

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_use_colours, #sfancy, #sfile, #simp, #swarn, #use_colours?, #use_colours_within_the_bioroebe_namespace?

Constructor Details

#initialize(i = ARGV, run_already = true) ⇒ ComplementaryDnaStrand

#

initialize

#

27
28
29
30
31
32
33
34
# File 'lib/bioroebe/nucleotides/complementary_dna_strand.rb', line 27

def initialize(
    i           = ARGV,
    run_already = true
  )
  reset
  set_commandline_arguments(i)
  run if run_already
end

Instance Method Details

#

menu (menu tag)

#

67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/bioroebe/nucleotides/complementary_dna_strand.rb', line 67

def menu(
    i = commandline_arguments?
  )
  if i and i.is_a?(Array)
    i.each {|entry| menu(entry) }
  else
    case i
    # ===================================================================== #
    # === --trailer
    # ===================================================================== #
    when /^-?-?trailer/i,
         /^-?-?header/i,
         /^-?-?footer/i
      @show_leader_and_trailer = true
    # ===================================================================== #
    # === --help
    # ===================================================================== #
    when /^-?-?help/i
      show_help
      @continue = false
    else
      @continue = true
    end
  end
end

#reportObject

#

report

#

126
127
128
129
130
131
132
# File 'lib/bioroebe/nucleotides/complementary_dna_strand.rb', line 126

def report
  if @show_leader_and_trailer
    e "5'-#{@result}-'3"
  else
    e @result
  end
end

#resetObject

#

reset (reset tag)

#

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/bioroebe/nucleotides/complementary_dna_strand.rb', line 39

def reset
  # ======================================================================= #
  # === @continue
  # ======================================================================= #
  @continue = true
  # ======================================================================= #
  # === @result
  # ======================================================================= #
  @result = nil
  # ======================================================================= #
  # === @show_leader_and_trailer
  #
  # If the following variable is true, then this class will show the
  # leading 5'- and trailing -'3 part.
  # ======================================================================= #
  @show_leader_and_trailer = false
end

#result?Boolean

#

result?

#

Returns:

  • (Boolean)

60
61
62
# File 'lib/bioroebe/nucleotides/complementary_dna_strand.rb', line 60

def result?
  @result
end

#runObject

#

run

#

106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/bioroebe/nucleotides/complementary_dna_strand.rb', line 106

def run
  menu
  if @continue
    _ = first_commandline_argument?
    if _.include?("5′-") or
       _.include?("5'-") or
       _.include?("-3'") or
       _.include?("5-")
      @show_leader_and_trailer = true
    end
    hash = ::Bioroebe.partner_nucleotide_hash
    if _
      @result = _.chars.map {|entry| hash[entry] }.join
    end
  end
end

#show_helpObject

#

show_help

#

96
97
98
99
100
101
# File 'lib/bioroebe/nucleotides/complementary_dna_strand.rb', line 96

def show_help
  erev 'The following options are supported by this class:'
  e
  e
  e
end