| Class | Bio::KEGG::GENES |
| In: |
lib/bio/db/kegg/genes.rb
(CVS)
|
| Parent: | KEGGDB |
| DELIMITER | = | RS = "\n///\n" |
| TAGSIZE | = | 12 |
# File lib/bio/db/kegg/genes.rb, line 233 def aaseq unless @data['AASEQ'] @data['AASEQ'] = Bio::Sequence::AA.new(fetch('AASEQ').gsub(/\d+/, '')) end @data['AASEQ'] end
# File lib/bio/db/kegg/genes.rb, line 158 def chromosome if position[/:/] position.sub(/:.*/, '') elsif ! position[/\.\./] position else nil end end
# File lib/bio/db/kegg/genes.rb, line 206 def codon_usage(codon = nil) unless @data['CODON_USAGE'] hash = Hash.new list = cu_list base = %w(t c a g) base.each_with_index do |x, i| base.each_with_index do |y, j| base.each_with_index do |z, k| hash["#{x}#{y}#{z}"] = list[i*16 + j*4 + k] end end end @data['CODON_USAGE'] = hash end @data['CODON_USAGE'] end
# File lib/bio/db/kegg/genes.rb, line 223 def cu_list ary = [] get('CODON_USAGE').sub(/.*/,'').each_line do |line| # cut 1st line line.chomp.sub(/^.{11}/, '').scan(/..../) do |cu| ary.push(cu.to_i) end end return ary end
# File lib/bio/db/kegg/genes.rb, line 194 def dblinks unless @data['DBLINKS'] hash = {} get('DBLINKS').scan(/(\S+):\s*(.*)\n?/).each do |db, str| id_array = str.strip.split(/\s+/) hash[db] = id_array end @data['DBLINKS'] = hash end @data['DBLINKS'] # Hash of Array of IDs in DBLINKS end
# File lib/bio/db/kegg/genes.rb, line 130 def eclinks ec_list = definition.slice(/\[EC:(.*?)\]/, 1) if ec_list ec_list.strip.split(/\s+/) else [] end end
# File lib/bio/db/kegg/genes.rb, line 88 def entry unless @data['ENTRY'] hash = Hash.new('') if get('ENTRY').length > 30 e = get('ENTRY') hash['id'] = e[12..29].strip hash['division'] = e[30..39].strip hash['organism'] = e[40..80].strip end @data['ENTRY'] = hash end @data['ENTRY'] end
# File lib/bio/db/kegg/genes.rb, line 176 def motif unless @data['MOTIF'] hash = {} db = nil lines_fetch('MOTIF').each do |line| if line[/^\S+:/] db, str = line.split(/:/) else str = line end hash[db] ||= [] hash[db] += str.strip.split(/\s+/) end @data['MOTIF'] = hash end @data['MOTIF'] # Hash of Array of IDs in MOTIF end
# File lib/bio/db/kegg/genes.rb, line 244 def ntseq unless @data['NTSEQ'] @data['NTSEQ'] = Bio::Sequence::NA.new(fetch('NTSEQ').gsub(/\d+/, '')) end @data['NTSEQ'] end