Method: Bio::TogoWS::REST#entry
- Defined in:
- lib/bio/io/togows.rb
#entry(database, ids, format = nil, field = nil) ⇒ Object
Retrieves entries corresponding to the specified IDs.
Example:
t = Bio::TogoWS::REST.new
kuma = t.entry('ncbi-nucleotide', 'AF237819')
# multiple IDs at a time
misc = t.entry('ncbi-nucleotide', [ 'AF237819', 'AF237820' ])
# with format change
p53 = t.entry('uniprot', 'P53_HUMAN', 'fasta')
Arguments:
-
(required) database: (String) database name
-
(required) ids: (String) an entry ID, or (Array containing String) IDs. Note that strings containing “,” are regarded as multiple IDs.
-
(optional) format: (String) format. nil means the default format (differs depending on the database).
-
(optional) field: (String) gets only the specified field if not nil
- Returns
-
String or nil
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
# File 'lib/bio/io/togows.rb', line 241 def entry(database, ids, format = nil, field = nil) begin a = ids.to_ary rescue NoMethodError ids = ids.to_s end arg = [ 'entry', database ] if a then b = a.dup (a.size - 1).downto(1) { |i| b.insert(i, :",") } arg.concat b else arg.push ids end arg.push field if field arg[-1] = "#{arg[-1]}.#{format}" if format response = get(*arg) prepare_return_value(response) end |