Class | Bio::KEGG::GENOME |
In: |
lib/bio/db/kegg/genome.rb
|
Parent: | KEGGDB |
DELIMITER | = | RS = "\n///\n" |
TAGSIZE | = | 12 |
# File lib/bio/db/kegg/genome.rb, line 30 30: def initialize(entry) 31: super(entry, TAGSIZE) 32: end
CHROMOSOME — Returns contents of the CHROMOSOME records as an Array of Hash.
# 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
Returns number of nucleotides from the STATISTICS record as a Fixnum.
# File lib/bio/db/kegg/genome.rb, line 184 184: def nalen 185: statistics['num_nuc'] 186: end
Returns number of protein genes from the STATISTICS record as a Fixnum.
# File lib/bio/db/kegg/genome.rb, line 190 190: def num_gene 191: statistics['num_gene'] 192: end
Returns number of rna from the STATISTICS record as a Fixnum.
# File lib/bio/db/kegg/genome.rb, line 195 195: def num_rna 196: statistics['num_rna'] 197: end
PLASMID — Returns contents of the PLASMID records as an Array of Hash.
# 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
REFERENCE — Returns contents of the REFERENCE records as an Array of Bio::Reference objects.
# 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 — Returns contents of the STATISTICS record as a Hash.
# 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
TAXONOMY — Returns contents of the TAXONOMY record as a Hash.
# 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