Class: Bioroebe::ReportSecondaryStructuresFromThisPdbFile
- Inherits:
-
CommandlineApplication
- Object
- Base
- CommandlineApplication
- Bioroebe::ReportSecondaryStructuresFromThisPdbFile
- Defined in:
- lib/bioroebe/pdb_and_protein_structure/report_secondary_structures_from_this_pdb_file.rb
Overview
Bioroebe::ReportSecondaryStructuresFromThisPdbFile
Constant Summary
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::ReportSecondaryStructuresFromThisPdbFile[] ========================================================================= #.
Instance Method Summary collapse
-
#colourize_this_aminoacid(i) ⇒ Object
# === colourize_this_aminoacid ========================================================================= #.
-
#colourize_this_aminoacid_three_to_one(i) ⇒ Object
# === colourize_this_aminoacid_three_to_one ========================================================================= #.
-
#initialize(commandline_arguments = nil, run_already = true) ⇒ ReportSecondaryStructuresFromThisPdbFile
constructor
# === initialize ========================================================================= #.
-
#left_pad_this_index(index) ⇒ Object
# === left_pad_this_index ========================================================================= #.
-
#report_alpha_helices ⇒ Object
# === report_alpha_helices.
-
#report_beta_sheets ⇒ Object
# === report_beta_sheets.
-
#reset ⇒ Object
# === reset (reset tag) ========================================================================= #.
-
#run ⇒ Object
# === run (run tag) ========================================================================= #.
-
#work_on_this_pdb_file(i) ⇒ Object
# === work_on_this_pdb_file ========================================================================= #.
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(commandline_arguments = nil, run_already = true) ⇒ ReportSecondaryStructuresFromThisPdbFile
#
initialize
#
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/bioroebe/pdb_and_protein_structure/report_secondary_structures_from_this_pdb_file.rb', line 25 def initialize( commandline_arguments = nil, run_already = true ) reset set_commandline_arguments( commandline_arguments ) run if run_already end |
Class Method Details
.[](i = ARGV) ⇒ Object
#
Bioroebe::ReportSecondaryStructuresFromThisPdbFile[]
#
216 217 218 |
# File 'lib/bioroebe/pdb_and_protein_structure/report_secondary_structures_from_this_pdb_file.rb', line 216 def self.[](i = ARGV) new(i) end |
Instance Method Details
#colourize_this_aminoacid(i) ⇒ Object
#
colourize_this_aminoacid
#
191 192 193 |
# File 'lib/bioroebe/pdb_and_protein_structure/report_secondary_structures_from_this_pdb_file.rb', line 191 def colourize_this_aminoacid(i) skyblue(i) end |
#colourize_this_aminoacid_three_to_one(i) ⇒ Object
#
colourize_this_aminoacid_three_to_one
#
198 199 200 201 202 |
# File 'lib/bioroebe/pdb_and_protein_structure/report_secondary_structures_from_this_pdb_file.rb', line 198 def colourize_this_aminoacid_three_to_one(i) colourize_this_aminoacid( three_to_one(i) ) end |
#left_pad_this_index(index) ⇒ Object
#
left_pad_this_index
#
70 71 72 |
# File 'lib/bioroebe/pdb_and_protein_structure/report_secondary_structures_from_this_pdb_file.rb', line 70 def left_pad_this_index(index) (index.to_s+')'.ljust(3)).rjust(5) end |
#report_alpha_helices ⇒ Object
#
report_alpha_helices
An entry may look like this:
HELIX 1 1A GLN A 18 SER A 30 1 13
0 1 2 3 4 5 6 7 8 9 10
#
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/bioroebe/pdb_and_protein_structure/report_secondary_structures_from_this_pdb_file.rb', line 83 def report_alpha_helices @alpha_helices.each_with_index {|line, index| index += 1 splitted = line.split(' ') this_chain = splitted[4] starting_aminoacid = splitted[3] last_aminoacid = splitted[6] start_position = splitted[5].to_i end_position = splitted[8].to_i padded_index = left_pad_this_index(index) e steelblue( padded_index )+ royalblue('Alpha-helix: ')+ 'Starting aminoacid: '+ colourize_this_aminoacid(starting_aminoacid)+ ','+ lightgreen(start_position.to_s.rjust(3))+ ' ('+ colourize_this_aminoacid_three_to_one(last_aminoacid)+ ')'+ ' Last aminoacid: '+colourize_this_aminoacid(last_aminoacid)+ ' Length: '+ mediumpurple( (end_position - (start_position-1)).to_s.rjust(2) )+ ' (chain: '+this_chain+')' } end |
#report_beta_sheets ⇒ Object
#
report_beta_sheets
A line may look like this:
SHEET 1 A 9 ILE A 7 ASN A 11 0 \n
0 1 2 3 4 5 6 7 8 9 10
#
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/bioroebe/pdb_and_protein_structure/report_secondary_structures_from_this_pdb_file.rb', line 121 def report_beta_sheets keep_track_of_this_chain = '' last_end_position = 0 @beta_sheets.each_with_index {|line, index| splitted = line.split(' ') this_chain = splitted[2] starting_aminoacid = splitted[4] last_aminoacid = splitted[7] start_position = splitted[6].to_i end_position = splitted[9].to_i keep_track_of_this_chain = this_chain if keep_track_of_this_chain.empty? keep_track_of_this_chain = this_chain end index += 1 if this_chain == keep_track_of_this_chain if (last_end_position < end_position) # In this case we may display that position. padded_index = left_pad_this_index(index) last_end_position = end_position e steelblue( padded_index )+ royalblue('Beta-sheet: ')+ 'Starting aminoacid: '+ colourize_this_aminoacid(starting_aminoacid)+ ','+lightgreen(start_position.to_s.rjust(3))+ ' ('+colourize_this_aminoacid_three_to_one(starting_aminoacid)+ ')'+ ' Last aminoacid: '+colourize_this_aminoacid(last_aminoacid)+ ','+lightgreen(end_position.to_s.rjust(3))+ ' ('+ colourize_this_aminoacid_three_to_one(last_aminoacid)+ ')'+ ' Length: '+ mediumpurple( (end_position - (start_position-1)).to_s.rjust(2) )+ ' (chain: '+this_chain+')' else # In that case we may not as it is an illogical # result. index -= 1 end else e steelblue( padded_index )+ royalblue('Beta-sheet: ')+ 'Starting aminoacid: '+ colourize_this_aminoacid(starting_aminoacid)+ ','+lightgreen(start_position.to_s.rjust(3))+ ' ('+ colourize_this_aminoacid_three_to_one(starting_aminoacid)+ ')'+ ' Last aminoacid: '+colourize_this_aminoacid(last_aminoacid)+ ','+lightgreen(end_position.to_s.rjust(3))+ ' ('+ colourize_this_aminoacid_three_to_one(starting_aminoacid)+ ')'+ ' Length: '+ (end_position - (start_position-1)).to_s+ ' (chain: '+this_chain+')' end } end |
#reset ⇒ Object
#
reset (reset tag)
#
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/bioroebe/pdb_and_protein_structure/report_secondary_structures_from_this_pdb_file.rb', line 39 def reset super() # ======================================================================= # # === @alpha_helices # ======================================================================= # @alpha_helices = nil # ======================================================================= # # === @beta_sheets # ======================================================================= # @beta_sheets = nil end |
#run ⇒ Object
#
run (run tag)
#
207 208 209 210 211 |
# File 'lib/bioroebe/pdb_and_protein_structure/report_secondary_structures_from_this_pdb_file.rb', line 207 def run commandline_arguments?.each {|this_pdb_file| work_on_this_pdb_file(this_pdb_file) } end |
#work_on_this_pdb_file(i) ⇒ Object
#
work_on_this_pdb_file
#
54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/bioroebe/pdb_and_protein_structure/report_secondary_structures_from_this_pdb_file.rb', line 54 def work_on_this_pdb_file(i) if File.exist? i dataset = File.readlines(i) @alpha_helices = dataset.select {|entry| entry.start_with?('HELIX ') } @beta_sheets = dataset.select {|entry| entry.start_with?('SHEET ') } report_alpha_helices cliner {{ colour: 'steelblue' }} report_beta_sheets else no_file_exists_at(i) end end |