Class: Bio::KEGG::GENOME
- Inherits:
-
Bio::KEGGDB
- Object
- DB
- NCBIDB
- Bio::KEGGDB
- Bio::KEGG::GENOME
- Includes:
- Common::References
- Defined in:
- lib/bio/db/kegg/genome.rb
Overview
Description
Parser for the KEGG GENOME database
References
Constant Summary collapse
- DELIMITER =
RS = "\n///\n"
- TAGSIZE =
12
Instance Method Summary collapse
-
#chromosomes ⇒ Object
CHROMOSOME – Returns contents of the CHROMOSOME records as an Array of Hash.
-
#comment ⇒ Object
COMMENT – Returns contents of the COMMENT record as a String.
-
#data_source ⇒ Object
DATA_SOURCE – Returns contents of the DATA_SOURCE record as a String.
-
#definition ⇒ Object
(also: #organism)
DEFINITION – Returns contents of the DEFINITION record as a String.
-
#disease ⇒ Object
DISEASE – Returns contents of the COMMENT record as a String.
-
#entry_id ⇒ Object
ENTRY – Returns contents of the ENTRY record as a String.
-
#initialize(entry) ⇒ GENOME
constructor
A new instance of GENOME.
-
#lineage ⇒ Object
Returns contents of the TAXONOMY/LINEAGE record as a String.
-
#nalen ⇒ Object
(also: #length)
Returns number of nucleotides from the STATISTICS record as a Fixnum.
-
#name ⇒ Object
NAME – Returns contents of the NAME record as a String.
-
#num_gene ⇒ Object
Returns number of protein genes from the STATISTICS record as a Fixnum.
-
#num_rna ⇒ Object
Returns number of rna from the STATISTICS record as a Fixnum.
-
#original_databases ⇒ Object
Returns ORIGINAL_DB record as an Array containing String objects.
-
#original_db ⇒ Object
ORIGINAL_DB – Returns contents of the ORIGINAL_DB record as a String.
-
#plasmids ⇒ Object
PLASMID – Returns contents of the PLASMID records as an Array of Hash.
-
#references ⇒ Object
REFERENCE – Returns contents of the REFERENCE records as an Array of Bio::Reference objects.
-
#statistics ⇒ Object
STATISTICS – Returns contents of the STATISTICS record as a Hash.
-
#taxid ⇒ Object
Returns NCBI taxonomy ID from the TAXONOMY record as a String.
-
#taxonomy ⇒ Object
TAXONOMY – Returns contents of the TAXONOMY record as a Hash.
Methods inherited from DB
#exists?, #fetch, #get, open, #tags
Constructor Details
Instance Method Details
#chromosomes ⇒ Object
CHROMOSOME – Returns contents of the CHROMOSOME records as an Array of Hash.
140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/bio/db/kegg/genome.rb', line 140 def chromosomes unless @data['CHROMOSOME'] @data['CHROMOSOME'] = [] toptag2array(get('CHROMOSOME')).each do |chr| hash = Hash.new('') subtag2array(chr).each do |field| hash[tag_get(field)] = truncate(tag_cut(field)) end @data['CHROMOSOME'].push(hash) end end @data['CHROMOSOME'] end |
#comment ⇒ Object
COMMENT – Returns contents of the COMMENT record as a String.
134 135 136 |
# File 'lib/bio/db/kegg/genome.rb', line 134 def comment field_fetch('COMMENT') end |
#data_source ⇒ Object
DATA_SOURCE – Returns contents of the DATA_SOURCE record as a String.
106 107 108 |
# File 'lib/bio/db/kegg/genome.rb', line 106 def data_source field_fetch('DATA_SOURCE') end |
#definition ⇒ Object Also known as: organism
DEFINITION – Returns contents of the DEFINITION record as a String.
75 76 77 |
# File 'lib/bio/db/kegg/genome.rb', line 75 def definition field_fetch('DEFINITION') end |
#disease ⇒ Object
DISEASE – Returns contents of the COMMENT record as a String.
129 130 131 |
# File 'lib/bio/db/kegg/genome.rb', line 129 def disease field_fetch('DISEASE') end |
#entry_id ⇒ Object
ENTRY – Returns contents of the ENTRY record as a String.
65 66 67 |
# File 'lib/bio/db/kegg/genome.rb', line 65 def entry_id field_fetch('ENTRY')[/\S+/] end |
#lineage ⇒ Object
Returns contents of the TAXONOMY/LINEAGE record as a String.
101 102 103 |
# File 'lib/bio/db/kegg/genome.rb', line 101 def lineage taxonomy['lineage'] end |
#nalen ⇒ Object Also known as: length
Returns number of nucleotides from the STATISTICS record as a Fixnum.
189 190 191 |
# File 'lib/bio/db/kegg/genome.rb', line 189 def nalen statistics['num_nuc'] end |
#name ⇒ Object
NAME – Returns contents of the NAME record as a String.
70 71 72 |
# File 'lib/bio/db/kegg/genome.rb', line 70 def name field_fetch('NAME') end |
#num_gene ⇒ Object
Returns number of protein genes from the STATISTICS record as a Fixnum.
195 196 197 |
# File 'lib/bio/db/kegg/genome.rb', line 195 def num_gene statistics['num_gene'] end |
#num_rna ⇒ Object
Returns number of rna from the STATISTICS record as a Fixnum.
200 201 202 |
# File 'lib/bio/db/kegg/genome.rb', line 200 def num_rna statistics['num_rna'] end |
#original_databases ⇒ Object
Returns ORIGINAL_DB record as an Array containing String objects.
Arguments:
- Returns
-
Array containing String objects
124 125 126 |
# File 'lib/bio/db/kegg/genome.rb', line 124 def original_databases lines_fetch('ORIGINAL_DB') end |
#original_db ⇒ Object
ORIGINAL_DB – Returns contents of the ORIGINAL_DB record as a String.
111 112 113 114 115 116 117 |
# File 'lib/bio/db/kegg/genome.rb', line 111 def original_db #field_fetch('ORIGINAL_DB') unless defined?(@original_db) @original_db = fetch('ORIGINAL_DB') end @original_db end |
#plasmids ⇒ Object
PLASMID – Returns contents of the PLASMID records as an Array of Hash.
155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/bio/db/kegg/genome.rb', line 155 def plasmids unless @data['PLASMID'] @data['PLASMID'] = [] toptag2array(get('PLASMID')).each do |chr| hash = Hash.new('') subtag2array(chr).each do |field| hash[tag_get(field)] = truncate(tag_cut(field)) end @data['PLASMID'].push(hash) end end @data['PLASMID'] end |
#references ⇒ Object
REFERENCE – Returns contents of the REFERENCE records as an Array of Bio::Reference objects.
35 |
# File 'lib/bio/db/kegg/genome.rb', line 35 def references; super; end |
#statistics ⇒ Object
STATISTICS – Returns contents of the STATISTICS record as a Hash.
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/bio/db/kegg/genome.rb', line 170 def statistics unless @data['STATISTICS'] hash = Hash.new(0.0) get('STATISTICS').each_line do |line| case line when /nucleotides:\s+(\d+)/ hash['num_nuc'] = $1.to_i when /protein genes:\s+(\d+)/ hash['num_gene'] = $1.to_i when /RNA genes:\s+(\d+)/ hash['num_rna'] = $1.to_i end end @data['STATISTICS'] = hash end @data['STATISTICS'] end |
#taxid ⇒ Object
Returns NCBI taxonomy ID from the TAXONOMY record as a String.
96 97 98 |
# File 'lib/bio/db/kegg/genome.rb', line 96 def taxid taxonomy['taxid'] end |
#taxonomy ⇒ Object
TAXONOMY – Returns contents of the TAXONOMY record as a Hash.
81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/bio/db/kegg/genome.rb', line 81 def taxonomy unless @data['TAXONOMY'] taxid, lineage = subtag2array(get('TAXONOMY')) taxid = taxid ? truncate(tag_cut(taxid)) : '' lineage = lineage ? truncate(tag_cut(lineage)) : '' @data['TAXONOMY'] = { 'taxid' => taxid, 'lineage' => lineage, } @data['TAXONOMY'].default = '' end @data['TAXONOMY'] end |