class Bio::KEGG::GENOME

Description

Parser for the KEGG GENOME database

References

Constants

DELIMITER
TAGSIZE

Public Class Methods

new(entry) click to toggle source
Calls superclass method Bio::NCBIDB.new
# File lib/bio/db/kegg/genome.rb, line 38
def initialize(entry)
  super(entry, TAGSIZE)
end

Public Instance Methods

chromosomes() click to toggle source

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

# 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() click to toggle source

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

# File lib/bio/db/kegg/genome.rb, line 134
def comment
  field_fetch('COMMENT')
end
data_source() click to toggle source

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

# File lib/bio/db/kegg/genome.rb, line 106
def data_source
  field_fetch('DATA_SOURCE')
end
definition() click to toggle source

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

# File lib/bio/db/kegg/genome.rb, line 75
def definition
  field_fetch('DEFINITION')
end
Also aliased as: organism
disease() click to toggle source

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

# File lib/bio/db/kegg/genome.rb, line 129
def disease
  field_fetch('DISEASE')
end
entry_id() click to toggle source

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

# File lib/bio/db/kegg/genome.rb, line 65
def entry_id
  field_fetch('ENTRY')[/\S+/]
end
length()
Alias for: nalen
lineage() click to toggle source

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

# File lib/bio/db/kegg/genome.rb, line 101
def lineage
  taxonomy['lineage']
end
nalen() click to toggle source

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

# File lib/bio/db/kegg/genome.rb, line 189
def nalen
  statistics['num_nuc']
end
Also aliased as: length
name() click to toggle source

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

# File lib/bio/db/kegg/genome.rb, line 70
def name
  field_fetch('NAME')
end
num_gene() click to toggle source

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

# File lib/bio/db/kegg/genome.rb, line 195
def num_gene
  statistics['num_gene']
end
num_rna() click to toggle source

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

# File lib/bio/db/kegg/genome.rb, line 200
def num_rna
  statistics['num_rna']
end
organism()
Alias for: definition
original_databases() click to toggle source

Returns ORIGINAL_DB record as an Array containing String objects.


Arguments:

Returns

Array containing String objects

# File lib/bio/db/kegg/genome.rb, line 124
def original_databases
  lines_fetch('ORIGINAL_DB')
end
original_db() click to toggle source

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

# 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() click to toggle source

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

# 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() click to toggle source

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

# File lib/bio/db/kegg/genome.rb, line 35
def references; super; end
statistics() click to toggle source

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

# 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() click to toggle source

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

# File lib/bio/db/kegg/genome.rb, line 96
def taxid
  taxonomy['taxid']
end
taxonomy() click to toggle source

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

# 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