Method: Bio::GCG::Seq#initialize

Defined in:
lib/bio/appl/gcg/seq.rb

#initialize(str) ⇒ Seq

Creates new instance of this class. str must be a GCG seq formatted string.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/bio/appl/gcg/seq.rb', line 38

def initialize(str)
  @heading = str[/.*/] # '!!NA_SEQUENCE 1.0' or like this
  str = str.sub(/.*/, '')
  str.sub!(/.*\.\.$/m, '')
  @definition = $&.to_s.sub(/^.*\.\.$/, '').to_s
  desc = $&.to_s
  if m = /(.+)\s+Length\:\s+(\d+)\s+(.+)\s+Type\:\s+(\w)\s+Check\:\s+(\d+)/.match(desc) then
    @entry_id = m[1].to_s.strip
    @length   = (m[2] ? m[2].to_i : nil)
    @date     = m[3].to_s.strip
    @seq_type = m[4]
    @checksum = (m[5] ? m[5].to_i : nil)
  end
  @data = str
  @seq = nil
  @definition.strip!
end