module Bio::Blast::Remote::GenomeNet::Information
Information
for GenomeNet
BLAST search.
Private Instance Methods
_parse_databases()
click to toggle source
gets information from remote host and parses database information
# File lib/bio/appl/blast/genomenet.rb 97 def _parse_databases 98 if defined? @parse_databases 99 return nil if @parse_databases 100 end 101 databases = {} 102 dbdescs = {} 103 key = nil 104 host = Bio::Blast::Remote::Genomenet::Host 105 http = Bio::Command.new_https(host) 106 result = http.get('/tools/blast/') 107 #p result.body 108 result.body.each_line do |line| 109 case line 110 when /\"set\_dbtype\(this\.form\,\'(prot|nucl)\'\)\"/ 111 key = $1 112 databases[key] ||= [] 113 dbdescs[key] ||= {} 114 when /\<input *type\=\"radio\" *name\=\"dbname\" *value\=\"([^\"]+)\"[^\>]*\>([^\<\>]+)/ 115 db = $1.freeze 116 desc = $2.strip.freeze 117 databases[key].push db 118 dbdescs[key][db] = desc 119 end 120 end 121 122 # mine-aa and mine-nt should be removed 123 [ 'prot', 'nucl' ].each do |mol| 124 ary = databases[mol] || [] 125 hash = dbdescs[mol] || {} 126 [ 'mine-aa', 'mine-nt' ].each do |k| 127 ary.delete(k) 128 hash.delete(k) 129 end 130 databases[mol] = ary.freeze 131 dbdescs[mol] = hash 132 end 133 134 [ databases, dbdescs ].each do |h| 135 prot = h['prot'] 136 nucl = h['nucl'] 137 h.delete('prot') 138 h.delete('nucl') 139 h['blastp'] = prot 140 h['blastx'] = prot 141 h['blastn'] = nucl 142 h['tblastn'] = nucl 143 h['tblastx'] = nucl 144 end 145 146 @databases = databases 147 @database_descriptions = dbdescs 148 @parse_databases = true 149 true 150 end