class Bio::GenBank

Description

Parses a GenBank formatted database entry

Example

# entry is a string containing only one entry contents
gb = Bio::GenBank.new(entry)

Public Instance Methods

basecount(base = nil) click to toggle source

BASE COUNT (this field is obsoleted after GenBank release 138.0) – Returns the BASE COUNT as a Hash. When the base is specified, returns count of the base as a Fixnum. The base can be one of 'a', 't', 'g', 'c', and 'o' (others).

    # File lib/bio/db/genbank/genbank.rb
 99 def basecount(base = nil)
100   unless @data['BASE COUNT']
101     hash = Hash.new(0)
102     get('BASE COUNT').scan(/(\d+) (\w)/).each do |c, b|
103       hash[b] = c.to_i
104     end
105     @data['BASE COUNT'] = hash
106   end
107 
108   if base
109     base.downcase!
110     @data['BASE COUNT'][base]
111   else
112     @data['BASE COUNT']
113   end
114 end
circular() click to toggle source
   # File lib/bio/db/genbank/genbank.rb
68 def circular;  locus.circular;  end
classification() click to toggle source

Taxonomy classfication. Returns an array of strings.

    # File lib/bio/db/genbank/genbank.rb
142 def classification
143   self.taxonomy.to_s.sub(/\.\z/, '').split(/\s*\;\s*/)
144 end
date() click to toggle source
   # File lib/bio/db/genbank/genbank.rb
70 def date;      locus.date;      end
date_modified() click to toggle source

modified date. Returns Date object, String or nil.

    # File lib/bio/db/genbank/genbank.rb
133 def date_modified
134   begin
135     Date.parse(self.date)
136   rescue ArgumentError, TypeError, NoMethodError, NameError
137     self.date
138   end
139 end
division() click to toggle source
   # File lib/bio/db/genbank/genbank.rb
69 def division;  locus.division;  end
each_cds() { |feature| ... } click to toggle source

FEATURES – Iterate only for the 'CDS' portion of the Bio::Features.

   # File lib/bio/db/genbank/genbank.rb
77 def each_cds
78   features.each do |feature|
79     if feature.feature == 'CDS'
80       yield(feature)
81     end
82   end
83 end
each_gene() { |feature| ... } click to toggle source

FEATURES – Iterate only for the 'gene' portion of the Bio::Features.

   # File lib/bio/db/genbank/genbank.rb
86 def each_gene
87   features.each do |feature|
88     if feature.feature == 'gene'
89       yield(feature)
90     end
91   end
92 end
entry_id() click to toggle source
   # File lib/bio/db/genbank/genbank.rb
66 def entry_id;  locus.entry_id;  end
length() click to toggle source
   # File lib/bio/db/genbank/genbank.rb
67 def length;    locus.length;    end
Also aliased as: nalen
locus() click to toggle source

Accessor methods for the contents of the LOCUS record.

   # File lib/bio/db/genbank/genbank.rb
62 def locus
63   @data['LOCUS'] ||= Locus.new(get('LOCUS'))
64 end
nalen()
Alias for: length
naseq()
Alias for: seq
natype() click to toggle source
   # File lib/bio/db/genbank/genbank.rb
73 def natype;    locus.natype;    end
seq() click to toggle source

ORIGIN – Returns DNA sequence in the ORIGIN record as a Bio::Sequence::NA object.

    # File lib/bio/db/genbank/genbank.rb
118 def seq
119   unless @data['SEQUENCE']
120     origin
121   end
122   Bio::Sequence::NA.new(@data['SEQUENCE'])
123 end
Also aliased as: naseq
seq_len() click to toggle source

(obsolete???) length of the sequence

    # File lib/bio/db/genbank/genbank.rb
128 def seq_len
129   seq.length
130 end
strand() click to toggle source
   # File lib/bio/db/genbank/genbank.rb
72 def strand;    locus.strand;    end
strandedness() click to toggle source

Strandedness. Returns one of 'single', 'double', 'mixed', or nil.

    # File lib/bio/db/genbank/genbank.rb
147 def strandedness
148   case self.strand.to_s.downcase
149   when 'ss-'; 'single'
150   when 'ds-'; 'double'
151   when 'ms-'; 'mixed'
152   else nil; end
153 end
to_biosequence() click to toggle source

converts Bio::GenBank to Bio::Sequence


Arguments:

Returns

Bio::Sequence object

    # File lib/bio/db/genbank/genbank.rb
159 def to_biosequence
160   Bio::Sequence.adapter(self, Bio::Sequence::Adapter::GenBank)
161 end