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
Source
# 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
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 142 def classification 143 self.taxonomy.to_s.sub(/\.\z/, '').split(/\s*\;\s*/) 144 end
Taxonomy classfication. Returns an array of strings.
Source
# 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
modified date. Returns Date object, String or nil.
Source
# 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
FEATURES – Iterate only for the ‘CDS’ portion of the Bio::Features
.
Source
# 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
FEATURES – Iterate only for the ‘gene’ portion of the Bio::Features
.
Source
# File lib/bio/db/genbank/genbank.rb 62 def locus 63 @data['LOCUS'] ||= Locus.new(get('LOCUS')) 64 end
Accessor methods for the contents of the LOCUS record.
Source
# 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
ORIGIN – Returns DNA sequence in the ORIGIN record as a Bio::Sequence::NA
object.
Source
# File lib/bio/db/genbank/genbank.rb 128 def seq_len 129 seq.length 130 end
(obsolete???) length of the sequence
Source
# 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
Strandedness. Returns one of ‘single’, ‘double’, ‘mixed’, or nil.
Source
# File lib/bio/db/genbank/genbank.rb 159 def to_biosequence 160 Bio::Sequence.adapter(self, Bio::Sequence::Adapter::GenBank) 161 end
converts Bio::GenBank
to Bio::Sequence
Arguments:
- Returns
-
Bio::Sequence
object