Class: Bio::GenBank::Locus

Inherits:
Object show all
Defined in:
lib/bio/db/genbank/genbank.rb

Overview

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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(locus_line) ⇒ Locus

Returns a new instance of Locus.



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# 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

Instance Attribute Details

#circularObject

Returns the value of attribute circular.



56
57
58
# File 'lib/bio/db/genbank/genbank.rb', line 56

def circular
  @circular
end

#dateObject

Returns the value of attribute date.



56
57
58
# File 'lib/bio/db/genbank/genbank.rb', line 56

def date
  @date
end

#divisionObject

Returns the value of attribute division.



56
57
58
# File 'lib/bio/db/genbank/genbank.rb', line 56

def division
  @division
end

#entry_idObject

Returns the value of attribute entry_id.



56
57
58
# File 'lib/bio/db/genbank/genbank.rb', line 56

def entry_id
  @entry_id
end

#lengthObject

Returns the value of attribute length.



56
57
58
# File 'lib/bio/db/genbank/genbank.rb', line 56

def length
  @length
end

#natypeObject

Returns the value of attribute natype.



56
57
58
# File 'lib/bio/db/genbank/genbank.rb', line 56

def natype
  @natype
end

#strandObject

Returns the value of attribute strand.



56
57
58
# File 'lib/bio/db/genbank/genbank.rb', line 56

def strand
  @strand
end