Module: Bioroebe::ColoursForBase

Included in:
Base, CommandlineApplication, CommandlineArguments, ShowNucleotideSequence
Defined in:
lib/bioroebe/base/colours_for_base/colours_for_base.rb

Overview

Bioroebe::ColoursForBase

Constant Summary collapse

ARRAY_HTML_COLOURS_IN_USE =
#

ARRAY_HTML_COLOURS_IN_USE

Next, we will define the KONSOLE Colours:

#
%w(
  burlywood
  cadetblue
  crimson
  cyan
  darkgreen
  darkolivegreen
  deepskyblue
  forestgreen
  gold
  green
  lightblue
  lightgreen
  lightslategray
  lightsteelblue
  mediumslateblue
  mediumvioletred
  mediumturquoise
  mediumspringgreen
  olivedrab
  orangered
  olive
  orange
  orchid
  palevioletred
  palegoldenrod
  powderblue
  plum
  rosybrown
  royalblue
  salmon
  seagreen
  skyblue
  slateblue
  slategrey
  springgreen
  steelblue
  tomato
  mediumorchid
  mediumpurple
  mediumseagreen
  paleturquoise
  palegreen
  peru
  sienna
  teal
  turquoise
  violet
  yellow
  yellowgreen
)

Instance Method Summary collapse

Instance Method Details

#colourize_this_aminoacid_sequence_for_the_commandline(i) ⇒ Object Also known as: colourize_this_aminoacid_sequence

#

colourize_this_aminoacid_sequence_for_the_commandline

#


100
101
102
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 100

def colourize_this_aminoacid_sequence_for_the_commandline(i)
  ::Bioroebe.colourize_this_aminoacid_sequence_for_the_commandline(i)
end

#colourize_this_nucleotide_sequence(i, use_colours = use_colours? ) ⇒ Object Also known as: colourize_dna

#

colourize_this_nucleotide_sequence

This method will colourize the given input-sequence.

Note that for strings that contain escape-codes it is better to first sanitize these strings, and remove these escape codes, before proceeding with this method here.

#


168
169
170
171
172
173
174
175
176
177
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 168

def colourize_this_nucleotide_sequence(
    i, use_colours = use_colours?
  )
  if use_colours
    return return_colour_for_nucleotides+
           i+
           return_colour_for_nucleotides
  end
  return i
end

#disable_colours(be_verbose = false) ⇒ Object

#

disable_colours

If colours-support should be disabled then this method ought to be called.

#


299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 299

def disable_colours(
    be_verbose = false
  )
  case be_verbose
  # ======================================================================= #
  # === :be_quiet
  # ======================================================================= #
  when :be_quiet,
       :be_silent
    be_verbose = false
  end
  e 'Disabling colours.' if be_verbose
  @internal_hash[:use_colours] = false
end

#ecomment(i) ⇒ Object

#

ecomment

#


231
232
233
234
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 231

def ecomment(i)
  return ::Colours.ecomment(i) if use_colours?
  return i
end

#efancy(i) ⇒ Object

#

efancy

#


247
248
249
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 247

def efancy(i)
  e sfancy(i)
end

#egold(i = '') ⇒ Object

#

egold

#


84
85
86
87
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 84

def egold(i = '')
  i = ::Bioroebe.gold(i) if use_colours? and use_colours_within_the_bioroebe_namespace?
  e "#{i}#{rev}"
end

#enable_colours(be_verbose = false) ⇒ Object

#

enable_colours

If the first argument is true, then the method will be verbose.

This may be subject to change, though, so it may be better to pass an explicit argument to this method if you wish to be verbose at all times.

#


278
279
280
281
282
283
284
285
286
287
288
289
290
291
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 278

def enable_colours(
    be_verbose = false
  )
  case be_verbose
  # ======================================================================= #
  # === :be_quiet
  # ======================================================================= #
  when :be_quiet,
       :be_silent
    be_verbose = false
  end
  e 'Enabling colours.' if be_verbose
  @internal_hash[:use_colours] = true
end

#eorange(i = '') ⇒ Object

#

eorange

#


92
93
94
95
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 92

def eorange(i = '')
  i = ::Bioroebe.orange(i) if use_colours? and use_colours_within_the_bioroebe_namespace?
  e "#{i}#{rev}"
end

#eparse(i) ⇒ Object

#

eparse

#


212
213
214
215
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 212

def eparse(i)
  return ::Colours.eparse(i) if use_colours? and use_colours_within_the_bioroebe_namespace?
  return i
end

#erev(i = '') ⇒ Object

#

erev

#


140
141
142
143
144
145
146
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 140

def erev(i = '')
  if use_colours?
    ::Bioroebe.erev(i)
  else
    ::Bioroebe.e i
  end
end

#red(i) ⇒ Object

#

red

#


239
240
241
242
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 239

def red(i)
  return swarn(i) if use_colours_within_the_bioroebe_namespace?
  return i
end

#remove_trailing_escape_part(i) ⇒ Object Also known as: remove_trailing_escape_code, remove_escape_sequence, remove_escape_sequences

#

remove_trailing_escape_part

This method will remove the “closing tag” from Colour-escape codes.

#


153
154
155
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 153

def remove_trailing_escape_part(i)
  ::Colours.remove_trailing_end_from(i)
end

#return_colour_for_nucleotidesObject

#

return_colour_for_nucleotides

#


121
122
123
124
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 121

def return_colour_for_nucleotides
  _ = ::Colours::HtmlColoursMethods.send(USE_THIS_COLOUR_FOR_DNA)
  remove_trailing_escape_part(_)
end

#revObject Also known as: rev?

#

rev

#


129
130
131
132
133
134
135
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 129

def rev
  if use_colours?
    ::Bioroebe.rev # Pointer towards Bioroebe.rev
  else
    ''
  end
end

#sdir(i = '') ⇒ Object

#

sdir

#


182
183
184
185
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 182

def sdir(i = '')
  return Colours.sdir(i) if use_colours? and use_colours_within_the_bioroebe_namespace?
  return i
end

#set_will_we_use_colours(i) ⇒ Object Also known as: set_use_colours

#

set_will_we_use_colours

#


317
318
319
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 317

def set_will_we_use_colours(i)
  @internal_hash[:use_colours] = i
end

#sfancy(i = '', use_colours = use_colours? ) ⇒ Object

#

sfancy

#


254
255
256
257
258
259
260
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 254

def sfancy(
    i           = '',
    use_colours = use_colours?
  )
  return powderblue(i) if use_colours and use_colours_within_the_bioroebe_namespace?
  return i
end

#sfile(i = '', use_colours = use_colours? ) ⇒ Object

#

sfile

#


220
221
222
223
224
225
226
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 220

def sfile(
    i           = '',
    use_colours = use_colours?
  )
  return ::Bioroebe.sfile(i) if use_colours and use_colours_within_the_bioroebe_namespace?
  return i
end

#simp(i = '', use_colours = use_colours? ) ⇒ Object Also known as: simportant

#

simp

#


190
191
192
193
194
195
196
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 190

def simp(
    i           = '',
    use_colours = use_colours?
  )
  return ::Bioroebe.simp(i) if use_colours and use_colours_within_the_bioroebe_namespace?
  return i
end

#swarn(i = '', use_colours = use_colours? ) ⇒ Object

#

swarn

#


201
202
203
204
205
206
207
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 201

def swarn(
    i           = '',
    use_colours = use_colours?
  )
  return Colours.swarn(i) if use_colours and use_colours_within_the_bioroebe_namespace?
  return i
end

#use_colours?Boolean

#

use_colours?

#

Returns:

  • (Boolean)


265
266
267
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 265

def use_colours?
  @internal_hash[:use_colours]
end

#use_colours_within_the_bioroebe_namespace?Boolean

#

use_colours_within_the_bioroebe_namespace?

Query whether we use colours in the whole Bioroebe namespace.

#

Returns:

  • (Boolean)


77
78
79
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 77

def use_colours_within_the_bioroebe_namespace?
  ::Bioroebe.use_colours?
end