Method: Bio::Blast::Fastacmd#fetch

Defined in:
lib/bio/io/fastacmd.rb

#fetch(list) ⇒ Object

Get the sequence for a list of IDs in the database.

For example:

p fastacmd.fetch(["sp:1433_SPIOL", "sp:1432_MAIZE"])

This method always returns an array of Bio::FastaFormat objects, even when the result is a single entry.


Arguments:

  • ids: list of IDs to retrieve from the database

Returns

array of Bio::FastaFormat objects



109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/bio/io/fastacmd.rb', line 109

def fetch(list)
  if list.respond_to?(:join)
    entry_id = list.join(",")
  else
    entry_id = list
  end

  cmd = [ @fastacmd, '-d', @database, '-s', entry_id ]
  Bio::Command.call_command(cmd) do |io|
    io.close_write
    Bio::FlatFile.new(Bio::FastaFormat, io).to_a
  end
end