Class: Bioroebe::Dotplot
- Inherits:
-
Base
- Object
- Base
- Bioroebe::Dotplot
show all
- Defined in:
- lib/bioroebe/dotplots/dotplot.rb
Overview
Constant Summary
collapse
- DEFAULT_X_AXIS =
14
- DEFAULT_Y_AXIS =
9
Constants inherited
from Base
Base::NAMESPACE
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?, #file_readlines, #infer_the_namespace, #is_on_roebe?, #is_palindrome?, #main_encoding?, #mkdir, #move_file, #mv, #namespace?, #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
#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(x_axis = nil, y_axis = nil, run_already = true) ⇒ Dotplot
#
initialize
First argument is x-axis
#
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/bioroebe/dotplots/dotplot.rb', line 38
def initialize(
x_axis = nil,
y_axis = nil,
run_already = true
)
reset
set_x_axis(x_axis)
set_y_axis(y_axis)
run if run_already
end
|
Instance Method Details
#display_grid ⇒ Object
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
# File 'lib/bioroebe/dotplots/dotplot.rb', line 122
def display_grid
display_x_axis
display_y_axis display_x_axis
print ' ' * (3.0 * @x_axis)+'-> (x axis)'; e
zipped = string1?.zip(string2?)
zipped.each {|first, second|
if first == second
output_match
else increase_indent_level
end
}
run2
end
|
#display_x_axis ⇒ Object
111
112
113
114
115
116
117
|
# File 'lib/bioroebe/dotplots/dotplot.rb', line 111
def display_x_axis
print ' '
@x_axis.times {|entry|
entry += 1
ee "#{entry} "
}; e
end
|
#display_y_axis ⇒ Object
101
102
103
104
105
106
|
# File 'lib/bioroebe/dotplots/dotplot.rb', line 101
def display_y_axis
@y_axis.times {|entry|
entry += 1
e "#{entry}#{N}#{N}"
}
end
|
#increase_indent_level ⇒ Object
#
increase_indent_level
#
160
161
162
|
# File 'lib/bioroebe/dotplots/dotplot.rb', line 160
def increase_indent_level
@indent_level += 2
end
|
#output_match ⇒ Object
167
168
169
170
|
# File 'lib/bioroebe/dotplots/dotplot.rb', line 167
def output_match
ee (' '*@indent_level)+'*'+N increase_indent_level
end
|
#reset ⇒ Object
52
53
54
55
56
57
58
|
# File 'lib/bioroebe/dotplots/dotplot.rb', line 52
def reset
super()
@indent_level = 0
end
|
#run ⇒ Object
175
176
177
|
# File 'lib/bioroebe/dotplots/dotplot.rb', line 175
def run
display_grid
end
|
#run2 ⇒ Object
143
144
145
146
|
# File 'lib/bioroebe/dotplots/dotplot.rb', line 143
def run2
show_x_axis
end
|
#set_x_axis(i = nil) ⇒ Object
63
64
65
66
67
68
69
70
|
# File 'lib/bioroebe/dotplots/dotplot.rb', line 63
def set_x_axis(i = nil)
i = DEFAULT_X_AXIS if i.nil?
i = i.join.strip if i.is_a? Array
@string1 = i
i = i.size if i.is_a? String
i = i.to_i
@x_axis = i
end
|
#set_y_axis(i = nil) ⇒ Object
75
76
77
78
79
80
81
82
|
# File 'lib/bioroebe/dotplots/dotplot.rb', line 75
def set_y_axis(i = nil)
i = DEFAULT_Y_AXIS if i.nil?
i = i.join.strip if i.is_a? Array
@string2 = i
i = i.size if i.is_a? String
i = i.to_i
@y_axis = i
end
|
#show_x_axis ⇒ Object
151
152
153
154
155
|
# File 'lib/bioroebe/dotplots/dotplot.rb', line 151
def show_x_axis
string1?.each {|char|
ee "#{char} "
}
end
|
#string1? ⇒ Boolean
94
95
96
|
# File 'lib/bioroebe/dotplots/dotplot.rb', line 94
def string1?
@string1.chars
end
|
#string2? ⇒ Boolean
87
88
89
|
# File 'lib/bioroebe/dotplots/dotplot.rb', line 87
def string2?
@string2.chars
end
|