Class | Bio::GenBank
In: | lib/bio/db/genbank/genbank.rb
Parent: | NCBIDB

## Description

Parses a GenBank formatted database entry

## Example

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

### Methods

basecount circular classification date date_modified division each_cds each_gene entry_id length locus nalen naseq natype seq seq_len strand strandedness to_biosequence

### Included Modules

Bio::NCBIDB::Common

### Classes and Modules

Class Bio::GenBank::Locus

### Public Instance methods

basecount(base = nil)

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).

[Source]

         # File lib/bio/db/genbank/genbank.rb, line 99
     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()

[Source]

        # File lib/bio/db/genbank/genbank.rb, line 68
    68:   def circular;  locus.circular;  end

classification()

Taxonomy classfication. Returns an array of strings.

[Source]

         # File lib/bio/db/genbank/genbank.rb, line 142
    142:   def classification
    143:     self.taxonomy.to_s.sub(/\.\z/, '').split(/\s*\;\s*/)
    144:   end

date()

[Source]

        # File lib/bio/db/genbank/genbank.rb, line 70
    70:   def date;      locus.date;      end

date_modified()

modified date. Returns Date object, String or nil.

[Source]

         # File lib/bio/db/genbank/genbank.rb, line 133
    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()

[Source]

        # File lib/bio/db/genbank/genbank.rb, line 69
    69:   def division;  locus.division;  end

each_cds() {|feature| ...}

FEATURES — Iterate only for the ‘CDS’ portion of the Bio::Features.

[Source]

        # File lib/bio/db/genbank/genbank.rb, line 77
    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| ...}

FEATURES — Iterate only for the ‘gene’ portion of the Bio::Features.

[Source]

        # File lib/bio/db/genbank/genbank.rb, line 86
    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()

[Source]

        # File lib/bio/db/genbank/genbank.rb, line 66
    66:   def entry_id;  locus.entry_id;  end

length()

[Source]

        # File lib/bio/db/genbank/genbank.rb, line 67
    67:   def length;    locus.length;    end

locus()

Accessor methods for the contents of the LOCUS record.

[Source]

        # File lib/bio/db/genbank/genbank.rb, line 62
    62:   def locus
    63:     @data['LOCUS'] ||= Locus.new(get('LOCUS'))
    64:   end

nalen()

Alias for length

naseq()

Alias for seq

natype()

[Source]

        # File lib/bio/db/genbank/genbank.rb, line 73
    73:   def natype;    locus.natype;    end

seq()

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

[Source]

         # File lib/bio/db/genbank/genbank.rb, line 118
    118:   def seq
    119:     unless @data['SEQUENCE']
    120:       origin
    121:     end
    122:     Bio::Sequence::NA.new(@data['SEQUENCE'])
    123:   end

seq_len()

(obsolete???) length of the sequence

[Source]

         # File lib/bio/db/genbank/genbank.rb, line 128
    128:   def seq_len
    129:     seq.length
    130:   end

strand()

[Source]

        # File lib/bio/db/genbank/genbank.rb, line 72
    72:   def strand;    locus.strand;    end

strandedness()

Strandedness. Returns one of ‘single’, ‘double’, ‘mixed’, or nil.

[Source]

         # File lib/bio/db/genbank/genbank.rb, line 147
    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()

converts Bio::GenBank to Bio::Sequence

Arguments:

Returns: | Bio::Sequence object

[Source]

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

[Validate]