Module | Bio::Blast::Remote::DDBJ |
In: |
lib/bio/appl/blast/ddbj.rb
|
Remote BLAST factory using DDBJ Web API for Biology (xml.nig.ac.jp/).
Creates a remote BLAST factory using DDBJ. Returns Bio::Blast object.
Note for future improvement: In the future, it might return Bio::Blast::Remote::DDBJ or other object.
# File lib/bio/appl/blast/ddbj.rb, line 26 26: def self.new(program, db, options = []) 27: Bio::Blast.new(program, db, options, 'ddbj') 28: end
executes BLAST and returns result as a string
# File lib/bio/appl/blast/ddbj.rb, line 95 95: def exec_ddbj(query) 96: options = make_command_line_options 97: opt = Bio::Blast::NCBIOptions.new(options) 98: 99: # SOAP objects are cached 100: @ddbj_remote_blast ||= Bio::DDBJ::XML::Blast.new 101: #@ddbj_request_manager ||= Bio::DDBJ::XML::RequestManager.new 102: # always use REST version to prevent warning messages 103: @ddbj_request_manager ||= Bio::DDBJ::XML::RequestManager::REST.new 104: 105: program = opt.delete('-p') 106: db = opt.delete('-d') 107: optstr = Bio::Command.make_command_line_unix(opt.options) 108: 109: # using searchParamAsync 110: qid = @ddbj_remote_blast.searchParamAsync(program, db, query, optstr) 111: @output = qid 112: 113: sleeptime = 2 114: flag = true 115: while flag 116: if $VERBOSE then 117: $stderr.puts "DDBJ BLAST: ID: #{qid} -- waitng #{sleeptime} sec." 118: end 119: sleep(sleeptime) 120: 121: result = @ddbj_request_manager.getAsyncResult(qid) 122: case result.to_s 123: when /The search and analysis service by WWW is very busy now/ 124: raise result.to_s.strip + '(Alternatively, wrong options may be given.)' 125: when /Your job has not completed yet/ 126: sleeptime = 5 127: else 128: flag = false 129: end 130: end while flag 131: 132: @output = result 133: return @output 134: end