Class: EuPathDBGeneInformation
- Inherits:
-
Object
- Object
- EuPathDBGeneInformation
- Defined in:
- lib/eupathdb_gene_information_table.rb
Overview
Each gene in the gene information table is represented by 2 types of information - info and tables. info are 1 line data, whereas tables are tables of data with possibly multiple rows
Instance Method Summary collapse
- #add_information(key, value) ⇒ Object
- #add_table(name, headers, data) ⇒ Object
- #get_info(key) ⇒ Object (also: #[])
- #get_table(table_name) ⇒ Object
- #info ⇒ Object
Instance Method Details
#add_information(key, value) ⇒ Object
141 142 143 144 145 |
# File 'lib/eupathdb_gene_information_table.rb', line 141 def add_information(key, value) @info ||= {} @info[key] = value "Added info #{key}, now is #{@info[key]}" end |
#add_table(name, headers, data) ⇒ Object
147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/eupathdb_gene_information_table.rb', line 147 def add_table(name, headers, data) @tables ||= {} @tables[name] = [] data.each do |row| final = {} row.each_with_index do |cell, i| final[headers[i]] = cell end @tables[name].push final end end |
#get_info(key) ⇒ Object Also known as: []
132 133 134 |
# File 'lib/eupathdb_gene_information_table.rb', line 132 def get_info(key) @info[key] end |
#get_table(table_name) ⇒ Object
137 138 139 |
# File 'lib/eupathdb_gene_information_table.rb', line 137 def get_table(table_name) @tables[table_name] end |
#info ⇒ Object
128 129 130 |
# File 'lib/eupathdb_gene_information_table.rb', line 128 def info @info end |