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
- www.genome.jp/dbget-bin/www_bfind?genome
- www.genome.jp/kegg/catalog/org_list.html

### 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 30
    30:   def initialize(entry)
    31:     super(entry, TAGSIZE)
    32:   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 135
    135:   def chromosomes
    136:     unless @data['CHROMOSOME']
    137:       @data['CHROMOSOME'] = []
    138:       toptag2array(get('CHROMOSOME')).each do |chr|
    139:         hash = Hash.new('')
    140:         subtag2array(chr).each do |field|
    141:           hash[tag_get(field)] = truncate(tag_cut(field))
    142:         end
    143:         @data['CHROMOSOME'].push(hash)
    144:       end
    145:     end
    146:     @data['CHROMOSOME']
    147:   end

comment()

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

[Source]

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

data_source()

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

[Source]

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

definition()

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

[Source]

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

disease()

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

[Source]

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

entry_id()

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

[Source]

        # File lib/bio/db/kegg/genome.rb, line 36
    36:   def entry_id
    37:     field_fetch('ENTRY')[/\S+/]
    38:   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 72
    72:   def lineage
    73:     taxonomy['lineage']
    74:   end

nalen()

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

[Source]

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

name()

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

[Source]

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

num_gene()

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

[Source]

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

num_rna()

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

[Source]

         # File lib/bio/db/kegg/genome.rb, line 195
    195:   def num_rna
    196:     statistics['num_rna']
    197:   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 82
    82:   def original_db
    83:     field_fetch('ORIGINAL_DB')
    84:   end

plasmids()

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

[Source]

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

statistics()

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

[Source]

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

taxid()

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

[Source]

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

taxonomy()

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

[Source]

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

[Validate]