Class: Bioroebe::GUI::Gtk::FastaTableWidget
- Inherits:
-
Gtk::Frame
- Object
- Gtk::Frame
- Bioroebe::GUI::Gtk::FastaTableWidget
show all
- Includes:
- Gtk::BaseModule
- Defined in:
- lib/bioroebe/gui/gtk3/fasta_table_widget/fasta_table_widget.rb
Overview
Constant Summary
collapse
- TITLE =
'Fasta Table Widget'
- WIDTH =
'75% or minimum 1000px'
- HEIGHT =
'50% or minimum 500px'
- USE_THIS_FONT =
:dejavu_condensed_20
[
'Local Path',
'File size',
'n nucleotides',
'%GC'
]
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(commandline_arguments = ARGV, run_already = true) ⇒ FastaTableWidget
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/bioroebe/gui/gtk3/fasta_table_widget/fasta_table_widget.rb', line 65
def initialize(
commandline_arguments = ARGV,
run_already = true
)
super(' FASTA files ')
reset
set_commandline_arguments(
commandline_arguments
)
run if run_already
end
|
Class Method Details
.run(i = ARGV) ⇒ Object
307
308
309
310
311
312
313
314
315
316
317
|
# File 'lib/bioroebe/gui/gtk3/fasta_table_widget/fasta_table_widget.rb', line 307
def self.run(
i = ARGV
)
require 'gtk_paradise/run'
_ = ::Bioroebe::GUI::Gtk::FastaTableWidget.new(i)
r = ::Gtk.run
_.set_parent_widget(_)
r << _
r.automatic_size_then_automatic_title
r.top_left_then_run
end
|
Instance Method Details
#append_this_fasta_file(i) ⇒ Object
Also known as:
append_this_file
#
append_this_fasta_file
#
259
260
261
262
263
264
265
|
# File 'lib/bioroebe/gui/gtk3/fasta_table_widget/fasta_table_widget.rb', line 259
def append_this_fasta_file(i)
unless @all_fasta_files.include?(i)
if i.end_with?('.fa','.fasta','.txt','.md')
@all_fasta_files << i
end
end
end
|
#border_size? ⇒ Boolean
110
111
112
|
# File 'lib/bioroebe/gui/gtk3/fasta_table_widget/fasta_table_widget.rb', line 110
def border_size?
0
end
|
#clear_the_old_dataset ⇒ Object
#
clear_the_old_dataset
#
270
271
272
|
# File 'lib/bioroebe/gui/gtk3/fasta_table_widget/fasta_table_widget.rb', line 270
def clear_the_old_dataset
@all_fasta_files.clear
end
|
#connect_skeleton ⇒ Object
#
connect_skeleton (connect tag)
#
217
218
219
220
221
222
223
224
225
226
227
|
# File 'lib/bioroebe/gui/gtk3/fasta_table_widget/fasta_table_widget.rb', line 217
def connect_skeleton
abort_on_exception
set_border_width(15)
populate_the_list_store_with_the_default_dataset
scrolled_window = gtk_scrolled_window(@view) { :always }
scrolled_window.width_height(540, 500)
vbox = gtk_vbox
vbox.minimal(scrolled_window, 14)
add(vbox)
style_the_label_widget
end
|
#create_skeleton ⇒ Object
#
create_skeleton (create tag)
#
141
142
143
|
# File 'lib/bioroebe/gui/gtk3/fasta_table_widget/fasta_table_widget.rb', line 141
def create_skeleton
create_view
end
|
#create_view ⇒ Object
124
125
126
127
128
129
130
131
132
133
134
135
136
|
# File 'lib/bioroebe/gui/gtk3/fasta_table_widget/fasta_table_widget.rb', line 124
def create_view
@list_store = gtk_list_store(String, String, String, String)
@view = gtk_tree_view(@list_store)
@view. = HEADER_TO_USE_FOR_THE_TREE_VIEW
@view.make_sortable
@view.
@view.enable_search
@view.deselect_on_right_click_event
deselect_the_main_treeview
end
|
#deselect_the_main_treeview ⇒ Object
#
deselect_the_main_treeview
#
162
163
164
|
# File 'lib/bioroebe/gui/gtk3/fasta_table_widget/fasta_table_widget.rb', line 162
def deselect_the_main_treeview
@view.deselect
end
|
#handle_CSS_rules ⇒ Object
#
handle_CSS_rules (CSS tag)
#
169
170
171
172
173
174
175
176
177
178
179
180
|
# File 'lib/bioroebe/gui/gtk3/fasta_table_widget/fasta_table_widget.rb', line 169
def handle_CSS_rules
use_gtk_paradise_project_css_file
append_project_css_file
more_CSS_then_apply_it '
treeview.view header button {
color: black;
background-color: oldlace;
border: 1px solid black;
margin: 1px;
}
'
end
|
#list_store? ⇒ Boolean
Also known as:
liststore?
117
118
119
|
# File 'lib/bioroebe/gui/gtk3/fasta_table_widget/fasta_table_widget.rb', line 117
def list_store?
@list_store
end
|
#main_font? ⇒ Boolean
155
156
157
|
# File 'lib/bioroebe/gui/gtk3/fasta_table_widget/fasta_table_widget.rb', line 155
def main_font?
USE_THIS_FONT
end
|
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
|
# File 'lib/bioroebe/gui/gtk3/fasta_table_widget/fasta_table_widget.rb', line 240
def (
i = commandline_arguments?
)
if i.is_a? Array
i.each {|entry| (entry) }
else
if i and File.exist?(i)
clear_the_old_dataset
append_this_fasta_file(i)
end
end
end
|
#padding? ⇒ Boolean
103
104
105
|
# File 'lib/bioroebe/gui/gtk3/fasta_table_widget/fasta_table_widget.rb', line 103
def padding?
2
end
|
#populate_the_list_store_with_the_default_dataset ⇒ Object
#
populate_the_list_store_with_the_default_dataset
#
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
|
# File 'lib/bioroebe/gui/gtk3/fasta_table_widget/fasta_table_widget.rb', line 185
def populate_the_list_store_with_the_default_dataset
array = @all_fasta_files.map {|path|
parse_fasta_object = ::Bioroebe.parse_fasta(path) { :be_quiet }
n_nucleotides = parse_fasta_object.n_nucleotides?
gc_content = parse_fasta_object.gc_content gc_content = gc_content.round(2)
[path, File.size(path), n_nucleotides, gc_content]
}.sort_by {|path, size, n_nucleotides, gc_content|
size
}
@list_store.set_sort_func(1) { |_model, iter1, iter2|
iter2[1].to_s.to_f <=> iter1[1].to_s.to_f
}
@list_store.set_sort_func(2) { |_model, iter1, iter2|
iter2[2].to_s.to_f <=> iter1[2].to_s.to_f
}
populate_this_list_store_with_that_array4(@list_store, array)
end
|
#reset ⇒ Object
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
# File 'lib/bioroebe/gui/gtk3/fasta_table_widget/fasta_table_widget.rb', line 80
def reset
infer_the_namespace
reset_the_internal_variables
@configuration = [true, __dir__, namespace?]
title_width_height_font(TITLE, WIDTH, HEIGHT, main_font?)
@use_this_directory = ::Bioroebe.log_directory?+'fasta/'
@all_fasta_files = Dir[@use_this_directory+'*.fasta']
handle_CSS_rules
infer_the_size_automatically
end
|
#run ⇒ Object
232
233
234
235
|
# File 'lib/bioroebe/gui/gtk3/fasta_table_widget/fasta_table_widget.rb', line 232
def run
super()
end
|
#second_column? ⇒ Boolean
148
149
150
|
# File 'lib/bioroebe/gui/gtk3/fasta_table_widget/fasta_table_widget.rb', line 148
def second_column?
@view.columns?[1]
end
|
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
|
# File 'lib/bioroebe/gui/gtk3/fasta_table_widget/fasta_table_widget.rb', line 277
def style_the_label_widget
_ = hbox
label = text('FASTA files')
label.left_align
label.fonty(main_font?)
label.make_bold
label.css_class('darkblue')
label.pad4px
_.minimal label, 10
event_box = event_box(image_document_open)
event_box.on_clicked {
filename = ::Gtk.select_file(@parent_widget) {{ current_folder: return_pwd,
show_hidden: true,
add_these_shortcut_folders: Bioroebe.fasta_dir?
}}
if filename and File.exist?(filename)
append_this_file(filename)
liststore?.clear
populate_the_list_store_with_the_default_dataset
end
}
_.minimal event_box, 10
self.label_widget = _
end
|