Method: Bio::EMBLDB::Common#ref

Defined in:
lib/bio/db/embl/common.rb

#refObject

returns contents in the R lines.

  • Bio::EMBLDB::Common#ref -> [ <refernece information Hash>* ]

where <reference information Hash> is:

{'RN' => '', 'RC' => '', 'RP' => '', 'RX' => '', 
 'RA' => '', 'RT' => '', 'RL' => '', 'RG' => ''}

R Lines

  • RN RC RP RX RA RT RL RG



242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/bio/db/embl/common.rb', line 242

def ref
  unless @data['R']
    ary = Array.new
    get('R').split(/\nRN   /).each do |str|
      raw = {'RN' => '', 'RC' => '', 'RP' => '', 'RX' => '', 
             'RA' => '', 'RT' => '', 'RL' => '', 'RG' => ''}
      str = 'RN   ' + str unless /^RN   / =~ str
      str.split("\n").each do |line|
        if /^(R[NPXARLCTG])   (.+)/ =~ line
          raw[$1] += $2 + ' '
        else
          raise "Invalid format in R lines, \n[#{line}]\n"
        end
      end
      raw.each_value {|v| 
        v.strip! 
        v.sub!(/^"/,'')
        v.sub!(/;$/,'')
        v.sub!(/"$/,'')
      }
      ary.push(raw)
    end
    @data['R'] = ary
  end
  @data['R']
end