Class | Bio::KEGG::GENOME
In: | lib/bio/db/kegg/genome.rb
Parent: | KEGGDB

## Description

Parser for the KEGG GENOME database

## References

- ftp.genome.jp/pub/kegg/genomes/genome

### Methods

chromosomes comment data_source definition disease entry_id length lineage nalen name new num_gene num_rna organism original_db plasmids references statistics taxid taxonomy

### Constants

DELIMITER | = | RS = "\n///\n"
TAGSIZE | = | 12

### Public Class methods

new(entry)

[Source]

        # File lib/bio/db/kegg/genome.rb, line 28
    28:   def initialize(entry)
    29:     super(entry, TAGSIZE)
    30:   end

### Public Instance methods

chromosomes()

CHROMOSOME — Returns contents of the CHROMOSOME records as an Array of Hash.

[Source]

         # File lib/bio/db/kegg/genome.rb, line 133
    133:   def chromosomes
    134:     unless @data['CHROMOSOME']
    135:       @data['CHROMOSOME'] = []
    136:       toptag2array(get('CHROMOSOME')).each do |chr|
    137:         hash = Hash.new('')
    138:         subtag2array(chr).each do |field|
    139:           hash[tag_get(field)] = truncate(tag_cut(field))
    140:         end
    141:         @data['CHROMOSOME'].push(hash)
    142:       end
    143:     end
    144:     @data['CHROMOSOME']
    145:   end

comment()

COMMENT — Returns contents of the COMMENT record as a String.

[Source]

        # File lib/bio/db/kegg/genome.rb, line 90
    90:   def comment
    91:     field_fetch('COMMENT')
    92:   end

data_source()

DATA_SOURCE — Returns contents of the DATA_SOURCE record as a String.

[Source]

        # File lib/bio/db/kegg/genome.rb, line 75
    75:   def data_source
    76:     field_fetch('DATA_SOURCE')
    77:   end

definition()

DEFINITION — Returns contents of the DEFINITION record as a String.

[Source]

        # File lib/bio/db/kegg/genome.rb, line 44
    44:   def definition
    45:     field_fetch('DEFINITION')
    46:   end

disease()

DISEASE — Returns contents of the COMMENT record as a String.

[Source]

        # File lib/bio/db/kegg/genome.rb, line 85
    85:   def disease
    86:     field_fetch('DISEASE')
    87:   end

entry_id()

ENTRY — Returns contents of the ENTRY record as a String.

[Source]

        # File lib/bio/db/kegg/genome.rb, line 34
    34:   def entry_id
    35:     field_fetch('ENTRY')[/\S+/]
    36:   end

length()

Alias for nalen

lineage()

Returns contents of the TAXONOMY/LINEAGE record as a String.

[Source]

        # File lib/bio/db/kegg/genome.rb, line 70
    70:   def lineage
    71:     taxonomy['lineage']
    72:   end

nalen()

Returns number of nucleotides from the STATISTICS record as a Fixnum.

[Source]

         # File lib/bio/db/kegg/genome.rb, line 182
    182:   def nalen
    183:     statistics['num_nuc']
    184:   end

name()

NAME — Returns contents of the NAME record as a String.

[Source]

        # File lib/bio/db/kegg/genome.rb, line 39
    39:   def name
    40:     field_fetch('NAME')
    41:   end

num_gene()

Returns number of protein genes from the STATISTICS record as a Fixnum.

[Source]

         # File lib/bio/db/kegg/genome.rb, line 188
    188:   def num_gene
    189:     statistics['num_gene']
    190:   end

num_rna()

Returns number of rna from the STATISTICS record as a Fixnum.

[Source]

         # File lib/bio/db/kegg/genome.rb, line 193
    193:   def num_rna
    194:     statistics['num_rna']
    195:   end

organism()

Alias for definition

original_db()

ORIGINAL_DB — Returns contents of the ORIGINAL_DB record as a String.

[Source]

        # File lib/bio/db/kegg/genome.rb, line 80
    80:   def original_db
    81:     field_fetch('ORIGINAL_DB')
    82:   end

plasmids()

PLASMID — Returns contents of the PLASMID records as an Array of Hash.

[Source]

         # File lib/bio/db/kegg/genome.rb, line 148
    148:   def plasmids
    149:     unless @data['PLASMID']
    150:       @data['PLASMID'] = []
    151:       toptag2array(get('PLASMID')).each do |chr|
    152:         hash = Hash.new('')
    153:         subtag2array(chr).each do |field|
    154:           hash[tag_get(field)] = truncate(tag_cut(field))
    155:         end
    156:         @data['PLASMID'].push(hash)
    157:       end
    158:     end
    159:     @data['PLASMID']
    160:   end

references()

REFERENCE — Returns contents of the REFERENCE records as an Array of Bio::Reference objects.

[Source]

         # File lib/bio/db/kegg/genome.rb, line 96
     96:   def references
     97:     unless @data['REFERENCE']
     98:       ary = []
     99:       toptag2array(get('REFERENCE')).each do |ref|
    100:         hash = Hash.new('')
    101:         subtag2array(ref).each do |field|
    102:           case tag_get(field)
    103:           when /AUTHORS/
    104:             authors = truncate(tag_cut(field))
    105:             authors = authors.split(', ')
    106:             authors[-1] = authors[-1].split(/\s+and\s+/)
    107:             authors = authors.flatten.map { |a| a.sub(',', ', ') }
    108:             hash['authors']     = authors
    109:           when /TITLE/
    110:             hash['title']       = truncate(tag_cut(field))
    111:           when /JOURNAL/
    112:             journal = truncate(tag_cut(field))
    113:             if journal =~ /(.*) (\d+):(\d+)-(\d+) \((\d+)\) \[UI:(\d+)\]$/
    114:               hash['journal']   = $1
    115:               hash['volume']    = $2
    116:               hash['pages']     = $3
    117:               hash['year']      = $5
    118:               hash['medline']   = $6
    119:             else
    120:               hash['journal'] = journal
    121:             end
    122:           end
    123:         end
    124:         ary.push(Reference.new(hash))
    125:       end
    126:       @data['REFERENCE'] = References.new(ary)
    127:     end
    128:     @data['REFERENCE']
    129:   end

statistics()

STATISTICS — Returns contents of the STATISTICS record as a Hash.

[Source]

         # File lib/bio/db/kegg/genome.rb, line 163
    163:   def statistics
    164:     unless @data['STATISTICS']
    165:       hash = Hash.new(0.0)
    166:       get('STATISTICS').each_line do |line|
    167:         case line
    168:         when /nucleotides:\s+(\d+)/
    169:           hash['num_nuc'] = $1.to_i
    170:         when /protein genes:\s+(\d+)/
    171:           hash['num_gene'] = $1.to_i
    172:         when /RNA genes:\s+(\d+)/
    173:           hash['num_rna'] = $1.to_i
    174:         end
    175:       end
    176:       @data['STATISTICS'] = hash
    177:     end
    178:     @data['STATISTICS']
    179:   end

taxid()

Returns NCBI taxonomy ID from the TAXONOMY record as a String.

[Source]

        # File lib/bio/db/kegg/genome.rb, line 65
    65:   def taxid
    66:     taxonomy['taxid']
    67:   end

taxonomy()

TAXONOMY — Returns contents of the TAXONOMY record as a Hash.

[Source]

        # File lib/bio/db/kegg/genome.rb, line 50
    50:   def taxonomy
    51:     unless @data['TAXONOMY']
    52:       taxid, lineage = subtag2array(get('TAXONOMY'))
    53:       taxid   = taxid   ? truncate(tag_cut(taxid))   : ''
    54:       lineage = lineage ? truncate(tag_cut(lineage)) : ''
    55:       @data['TAXONOMY'] = {
    56:         'taxid' => taxid,
    57:         'lineage'       => lineage,
    58:       }
    59:       @data['TAXONOMY'].default = ''
    60:     end
    61:     @data['TAXONOMY']
    62:   end

[Validate]