class Bio::GenBank::Locus

Parses the LOCUS line and returns contents of the LOCUS record as a Bio::GenBank::Locus object. Locus object is created automatically when Bio::GenBank#locus, #entry_id etc. methods are called.

Attributes

circular[RW]
date[RW]
division[RW]
entry_id[RW]
length[RW]
natype[RW]
strand[RW]

Public Class Methods

new(locus_line) click to toggle source
# File lib/bio/db/genbank/genbank.rb, line 35
def initialize(locus_line)
  if locus_line.empty?
    # do nothing (just for empty or incomplete entry string)
  elsif locus_line.length > 75                      # after Rel 126.0
    @entry_id = locus_line[12..27].strip
    @length   = locus_line[29..39].to_i
    @strand   = locus_line[44..46].strip
    @natype   = locus_line[47..52].strip
    @circular = locus_line[55..62].strip
    @division = locus_line[63..66].strip
    @date     = locus_line[68..78].strip
  else
    @entry_id = locus_line[12..21].strip
    @length   = locus_line[22..29].to_i
    @strand   = locus_line[33..35].strip
    @natype   = locus_line[36..39].strip
    @circular = locus_line[42..51].strip
    @division = locus_line[52..54].strip
    @date     = locus_line[62..72].strip
  end
end