Method: Bio::NBRF#initialize

Defined in:
lib/bio/db/nbrf.rb

#initialize(str) ⇒ NBRF

Creates a new NBRF object. It stores the comment and sequence information from one entry of the NBRF/PIR format string. If the argument contains more than one entry, only the first entry is used.



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/bio/db/nbrf.rb', line 45

def initialize(str)
  str = str.sub(/\A[\r\n]+/, '') # remove first void lines
  line1, line2, rest = str.split(/^/, 3)

  rest = rest.to_s
  rest.sub!(/^>.*/m, '') # remove trailing entries for sure
  @entry_overrun = $&
  rest.sub!(/\*\s*\z/, '') # remove last '*' and "\n"
  @data = rest

  @definition = line2.to_s.chomp
  if /^>?([A-Za-z0-9]{2})\;(.*)/ =~ line1.to_s then
    @seq_type = $1
    @entry_id = $2
  end
end