Class: Bioroebe::ColourizeHydrophilicAndHydrophobicAminoacids

Inherits:
Base
  • Object
show all
Defined in:
lib/bioroebe/aminoacids/colourize_hydrophilic_and_hydrophobic_aminoacids.rb

Overview

Bioroebe::ColourizeHydrophilicAndHydrophobicAminoacids

Constant Summary collapse

ARRAY_HYROPHILIC_AMINOACIDS =
#

ARRAY_HYROPHILIC_AMINOACIDS

#
%w(
  A G T S N Q D E H R K P
)
ARRAY_HYDROPHOBIC_AMINOACIDS =
#

ARRAY_HYDROPHOBIC_AMINOACIDS

#
%w(
  C M F I L V W Y
)
COLOUR_FOR_HYDROPHILIC_AMINOACIDS =
#

COLOUR_FOR_HYDROPHILIC_AMINOACIDS

#
:royalblue
COLOUR_FOR_HYDROPHOBIC_AMINOACIDS =
#

COLOUR_FOR_HYDROPHOBIC_AMINOACIDS

#
:orangered

Constants inherited from Base

Base::NAMESPACE

Constants included from ColoursForBase

Bioroebe::ColoursForBase::ARRAY_HTML_COLOURS_IN_USE

Instance Method Summary collapse

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 BaseModule

#absolute_path, #default_file_read, #file_readlines

Methods included from InternalHashModule

#internal_hash?, #reset_the_internal_hash

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 included from InferTheNamespaceModule

#infer_the_namespace, #namespace?

Constructor Details

#initialize(this_sequence = ARGV, run_already = true) ⇒ ColourizeHydrophilicAndHydrophobicAminoacids

#

initialize

#


49
50
51
52
53
54
55
56
# File 'lib/bioroebe/aminoacids/colourize_hydrophilic_and_hydrophobic_aminoacids.rb', line 49

def initialize(
    this_sequence = ARGV,
    run_already   = true
  )
  reset
  set_this_sequence(this_sequence)
  run if run_already
end

Instance Method Details

#output_colourized_sequenceObject

#

output_colourized_sequence

#


85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/bioroebe/aminoacids/colourize_hydrophilic_and_hydrophobic_aminoacids.rb', line 85

def output_colourized_sequence
  _ = input?.chars.map {|aminoacid|
    if    ARRAY_HYROPHILIC_AMINOACIDS.include? aminoacid
      ::Colours.send COLOUR_FOR_HYDROPHILIC_AMINOACIDS, aminoacid
    elsif ARRAY_HYDROPHOBIC_AMINOACIDS.include? aminoacid
      ::Colours.send COLOUR_FOR_HYDROPHOBIC_AMINOACIDS, aminoacid
    else
      aminoacid # else we will simply return it without any special colour.
    end
  }
  _ = _.join # Join it back into a String.
  e _
end

#resetObject

#

reset

#


61
62
63
# File 'lib/bioroebe/aminoacids/colourize_hydrophilic_and_hydrophobic_aminoacids.rb', line 61

def reset
  super()
end

#runObject

#

run

#


102
103
104
# File 'lib/bioroebe/aminoacids/colourize_hydrophilic_and_hydrophobic_aminoacids.rb', line 102

def run
  output_colourized_sequence
end

#set_this_sequence(i) ⇒ Object

#

set_this_sequence

#


68
69
70
71
72
73
# File 'lib/bioroebe/aminoacids/colourize_hydrophilic_and_hydrophobic_aminoacids.rb', line 68

def set_this_sequence(i)
  if i.is_a? Array
    i = i.join
  end
  @this_sequence = i
end

#this_sequence?Boolean Also known as: input?

#

this_sequence?

#

Returns:

  • (Boolean)


78
79
80
# File 'lib/bioroebe/aminoacids/colourize_hydrophilic_and_hydrophobic_aminoacids.rb', line 78

def this_sequence?
  @this_sequence
end