Method: Bio::FastaDefline#id_strings

Defined in:
lib/bio/db/fasta/defline.rb

#id_stringsObject

Shows ID-like strings. Returns an array of strings.



348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
# File 'lib/bio/db/fasta/defline.rb', line 348

def id_strings
  r = []
  @list_ids.each do |a|
    if a.size >= 2 then
      r.concat a[1..-1].find_all { |x| x }
    else
      if a[0].to_s.size > 0 and a[0] =~ /\A[A-Za-z0-9\.\-\_]+\z/
        r << a[0]
      end
    end
  end
  r.concat( words(true, []).find_all do |x|
             x =~ /\A[A-Z][A-Za-z0-9\_]*[0-9]+[A-Za-z0-9\_]+\z/ or
               x =~ /\A[A-Z][A-Z0-9]*\_[A-Z0-9\_]+\z/
           end)
  r
end