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

#

115
116
117
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 115

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.

#

193
194
195
196
197
198
199
200
201
202
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 193

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_coloursObject

#

disable_colours

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

#

147
148
149
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 147

def disable_colours
  @use_colours = false
end

#ecomment(i) ⇒ Object

#

ecomment

#

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

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

#efancy(i) ⇒ Object

#

efancy

#

270
271
272
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 270

def efancy(i)
  e sfancy(i)
end

#egold(i = '') ⇒ Object

#

egold

#

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

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

#enable_coloursObject

#

enable_colours

#

263
264
265
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 263

def enable_colours
  @use_colours = true
end

#eorange(i = '') ⇒ Object

#

eorange

#

107
108
109
110
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 107

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

#

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

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

#erev(i = '') ⇒ Object

#

erev

#

165
166
167
168
169
170
171
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 165

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

#red(i) ⇒ Object

#

red

#

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

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.

#

178
179
180
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 178

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

#return_colour_for_nucleotidesObject

#

return_colour_for_nucleotides

#

136
137
138
139
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 136

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

#revObject Also known as: rev?

#

rev

#

154
155
156
157
158
159
160
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 154

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

#sdir(i = '') ⇒ Object

#

sdir

#

207
208
209
210
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 207

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

#set_use_colours(i) ⇒ Object

#

set_use_colours

#

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

def set_use_colours(i)
  @use_colours = i
end

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

#

sfancy

#

277
278
279
280
281
282
283
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 277

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) ⇒ Object

#

sfile

#

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

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

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

#

simp

#

215
216
217
218
# File 'lib/bioroebe/base/colours_for_base/colours_for_base.rb', line 215

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

#swarn(i = '') ⇒ Object

#

swarn

#

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

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

#use_colours?Boolean

#

use_colours?

#

Returns:

  • (Boolean)

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

def use_colours?
  @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)

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

def use_colours_within_the_bioroebe_namespace?
  ::Bioroebe.use_colours?
end