class Bio::KEGG::GENES
Description¶ ↑
References¶ ↑
Constants
- DELIMITER
- TAGSIZE
Public Class Methods
Creates a new Bio::KEGG::GENES object.
Arguments:
-
(required) entry: (String) single entry as a string
- Returns
-
Bio::KEGG::GENES object
# File lib/bio/db/kegg/genes.rb, line 115 def initialize(entry) super(entry, TAGSIZE) end
Public Instance Methods
Returns length of the amino acid sequence described in the AASEQ lines.
- Returns
-
Integer
# File lib/bio/db/kegg/genes.rb, line 393 def aalen fetch('AASEQ')[/\d+/].to_i end
Returns amino acid sequence described in the AASEQ lines.
- Returns
-
Bio::Sequence::AA object
# File lib/bio/db/kegg/genes.rb, line 383 def aaseq unless @data['AASEQ'] @data['AASEQ'] = Bio::Sequence::AA.new(fetch('AASEQ').gsub(/\d+/, '')) end @data['AASEQ'] end
Chromosome described in the POSITION line.
- Returns
-
String or nil
# File lib/bio/db/kegg/genes.rb, line 264 def chromosome if position[/:/] position.sub(/:.*/, '') elsif ! position[/\.\./] position else nil end end
Codon usage data described in the CODON_USAGE lines. (Deprecated: no more exists)
- Returns
# File lib/bio/db/kegg/genes.rb, line 350 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
Codon usage data described in the CODON_USAGE lines as an array.
- Returns
-
Array
# File lib/bio/db/kegg/genes.rb, line 370 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
Returns a Hash of the DB name and an Array of entry IDs in DBLINKS field.
# File lib/bio/db/kegg/genes.rb, line 97 def dblinks_as_hash; super; end
Links to other databases described in the DBLINKS lines.
- Returns
-
Array containing String objects
# File lib/bio/db/kegg/genes.rb, line 332 def dblinks_as_strings lines_fetch('DBLINKS') end
Definition of the entry, described in the DEFINITION line.
- Returns
# File lib/bio/db/kegg/genes.rb, line 199 def definition field_fetch('DEFINITION') end
Division of the entry, described in the ENTRY line.
- Returns
# File lib/bio/db/kegg/genes.rb, line 149 def division entry['division'] # CDS, tRNA etc. end
Enzyme's EC numbers shown in the DEFINITION line.
- Returns
-
Array containing String
# File lib/bio/db/kegg/genes.rb, line 206 def eclinks unless defined? @eclinks ec_list = definition.slice(/\[EC\:([^\]]+)\]/, 1) || definition.slice(/\(EC\:([^\)]+)\)/, 1) ary = ec_list ? ec_list.strip.split(/\s+/) : [] @eclinks = ary end @eclinks end
Returns the “ENTRY” line content as a Hash. For example,
{"organism"=>"E.coli", "division"=>"CDS", "id"=>"b0356"}
- Returns
# File lib/bio/db/kegg/genes.rb, line 125 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
ID of the entry, described in the ENTRY line.
- Returns
# File lib/bio/db/kegg/genes.rb, line 142 def entry_id entry['id'] end
The method will be deprecated. Use entry.names.first
instead.
Returns the first gene name described in the NAME line.
- Returns
# File lib/bio/db/kegg/genes.rb, line 192 def gene genes.first end
Returns CLASS field of the entry.
# File lib/bio/db/kegg/genes.rb, line 242 def keggclass field_fetch('CLASS') end
Returns an Array of biological classes in CLASS field.
# File lib/bio/db/kegg/genes.rb, line 247 def keggclasses keggclass.gsub(/ \[[^\]]+/, '').split(/\] ?/) end
The position in the genome described in the POSITION line as Bio::Locations object.
- Returns
-
Bio::Locations object
# File lib/bio/db/kegg/genes.rb, line 286 def locations Bio::Locations.new(gbposition) end
Motif information described in the MOTIF lines.
- Returns
# File lib/bio/db/kegg/genes.rb, line 300 def motifs_as_hash unless @data['MOTIF'] hash = {} db = nil motifs_as_strings.each do |line| if line[/^\S+:/] db, str = line.split(/:/, 2) 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
Motif information described in the MOTIF lines.
- Returns
-
Strings
# File lib/bio/db/kegg/genes.rb, line 293 def motifs_as_strings lines_fetch('MOTIF') end
Returns the NAME line.
- Returns
# File lib/bio/db/kegg/genes.rb, line 163 def name field_fetch('NAME') end
Names of the entry as an Array, described in the NAME line.
- Returns
-
Array containing String
# File lib/bio/db/kegg/genes.rb, line 171 def names_as_array name.split(', ') end
Returns nucleic acid sequence length.
- Returns
-
Integer
# File lib/bio/db/kegg/genes.rb, line 411 def ntlen fetch('NTSEQ')[/\d+/].to_i end
Returns nucleic acid sequence described in the NTSEQ lines.
- Returns
-
Bio::Sequence::NA object
# File lib/bio/db/kegg/genes.rb, line 400 def ntseq unless @data['NTSEQ'] @data['NTSEQ'] = Bio::Sequence::NA.new(fetch('NTSEQ').gsub(/\d+/, '')) end @data['NTSEQ'] end
Organism name of the entry, described in the ENTRY line.
- Returns
# File lib/bio/db/kegg/genes.rb, line 156 def organism entry['organism'] # H.sapiens etc. end
Returns a Hash of the orthology ID and definition in ORTHOLOGY field.
# File lib/bio/db/kegg/genes.rb, line 107 def orthologs_as_hash; super; end
Returns a Hash of the pathway ID and name in PATHWAY field.
# File lib/bio/db/kegg/genes.rb, line 102 def pathways_as_hash; super; end
The position in the genome described in the POSITION line.
- Returns
# File lib/bio/db/kegg/genes.rb, line 254 def position unless @data['POSITION'] @data['POSITION'] = fetch('POSITION').gsub(/\s/, '') end @data['POSITION'] end
Returns structure ID information described in the STRUCTURE lines.
- Returns
-
Array containing String
# File lib/bio/db/kegg/genes.rb, line 339 def structure unless @data['STRUCTURE'] @data['STRUCTURE'] = fetch('STRUCTURE').sub(/(PDB: )*/,'').split(/\s+/) end @data['STRUCTURE'] # ['PDB:1A9X', ...] end