class Bio::Blast::WU::Report
Bio::Blast::WU::Report
parses WU-BLAST default output and stores information in the data. It may contain a Bio::Blast::WU::Report::Iteration
object. Because it inherits Bio::Blast::Default::Report
, please also refer Bio::Blast::Default::Report
.
Public Instance Methods
Returns the name (filename or title) of the database.
# File lib/bio/appl/blast/wublast.rb 122 def db 123 unless defined?(@db) 124 if /Database *\: *(.*)/m =~ @f0database then 125 a = $1.split(/^/) 126 if a.size > 1 and /\ASearching\..+ done\s*\z/ =~ a[-1] then 127 a.pop 128 end 129 if a.size > 1 and /\A +[\d\,]+ +sequences\; +[\d\,]+ total +letters\.?\s*\z/ =~ a[-1] then 130 a.pop 131 end 132 @db = a.collect { |x| x.sub(/\s+\z/, '') }.join(' ') 133 end 134 end #unless 135 @db 136 end
(WU-BLAST) Returns exit code for the execution. Returns an Integer or nil.
# File lib/bio/appl/blast/wublast.rb 79 def exit_code 80 if defined? @exit_code then 81 @exit_code 82 else 83 nil 84 end 85 end
(WU-BLAST) Returns the message bundled with the exit code output. The message will be shown when WU-BLAST ignores a fatal error due to the command line option “-nonnegok”, “-novalidctxok”, or “-shortqueryok”.
Returns a String or nil.
# File lib/bio/appl/blast/wublast.rb 93 def exit_code_message 94 if defined? @exit_code_message then 95 @exit_code_message 96 else 97 nil 98 end 99 end
Returns e-value threshold specified when BLAST was executed.
# File lib/bio/appl/blast/wublast.rb 50 def expect; parse_parameters; @parameters['E']; end
(WU-BLAST) Returns fatal error information. Returns nil or an array containing String.
# File lib/bio/appl/blast/wublast.rb 113 def fatal_errors 114 if defined? @fatal_errors then 115 @fatal_errors 116 else 117 nil 118 end 119 end
(WU-BLAST) Returns “NOTE:” information. Returns nil or an array containing String.
# File lib/bio/appl/blast/wublast.rb 103 def notes 104 if defined? @notes then 105 @notes 106 else 107 nil 108 end 109 end
Returns notice messages.
# File lib/bio/appl/blast/wublast.rb 62 def notice 63 unless defined?(@notice) 64 @notice = @f0notice.to_s.gsub(/\s+/, ' ').strip 65 end #unless 66 @notice 67 end
Returns parameter matrix (???)
# File lib/bio/appl/blast/wublast.rb 44 def parameter_matrix 45 parse_parameters 46 @parameter_matrix 47 end
Returns parameters (???)
# File lib/bio/appl/blast/wublast.rb 38 def parameters 39 parse_parameters 40 @parameters 41 end
(WU-BLAST) Returns record number of the query. It may only be available for reports with multiple queries. Returns an Integer or nil.
# File lib/bio/appl/blast/wublast.rb 72 def query_record_number 73 format0_parse_query 74 @query_record_number 75 end
Returns warning messages.
# File lib/bio/appl/blast/wublast.rb 53 def warnings 54 unless defined?(@warnings) 55 @warnings = @f0warnings 56 iterations.each { |x| @warnings.concat(x.warnings) } 57 end 58 @warnings 59 end
Private Instance Methods
Parses the query lines (begins with “Query = ”).
# File lib/bio/appl/blast/wublast.rb 140 def format0_parse_query 141 unless defined?(@query_def) 142 sc = StringScanner.new(@f0query) 143 sc.skip(/\s*/) 144 if sc.skip_until(/Query\= */) then 145 q = [] 146 begin 147 q << sc.scan(/.*/) 148 sc.skip(/\s*^ ?/) 149 end until !sc.rest or r = sc.skip(/ *\( *([\,\d]+) *letters *(\; *record *([\,\d]+) *)?\)\s*\z/) 150 @query_len = sc[1].delete(',').to_i if r 151 @query_record_number = sc[3].delete(',').to_i if r and sc[2] 152 @query_def = q.join(' ') 153 end 154 end 155 end
Splits headers.
# File lib/bio/appl/blast/wublast.rb 158 def format0_split_headers(data) 159 @f0header = data.shift 160 @f0references = [] 161 while r = data.first 162 case r 163 when /^Reference\: / 164 @f0references.push data.shift 165 when /^Copyright / 166 @f0copyright = data.shift 167 when /^Notice\: / 168 @f0notice = data.shift 169 when /^Query\= / 170 break 171 else 172 break 173 end 174 end 175 @f0query = data.shift 176 @f0warnings ||= [] 177 while r = data.first 178 case r 179 when /^WARNING\: / 180 @f0warnings << data.shift 181 when /^NOTE\: / 182 @notes ||= [] 183 @notes << data.shift 184 else 185 break #from the above "while" 186 end 187 end 188 return if r = data.first and /\A(Parameters\:|EXIT CODE *\d+)/ =~ r 189 if r = data.first and !(/^Database\: / =~ r) 190 @f0translate_info = data.shift 191 end 192 @f0database = data.shift 193 end
Splits search data.
# File lib/bio/appl/blast/wublast.rb 196 def format0_split_search(data) 197 @f0warnings ||= [] 198 while r = data.first and r =~ /^WARNING\: / 199 @f0warnings << data.shift 200 end 201 [ Iteration.new(data) ] 202 end
Splits statistics parameters.
# File lib/bio/appl/blast/wublast.rb 205 def format0_split_stat_params(data) 206 @f0warnings ||= [] 207 while r = data.first and r =~ /^WARNING\: / 208 @f0warnings << data.shift 209 end 210 @f0wu_params = [] 211 @f0wu_stats = [] 212 ary = @f0wu_params 213 while r = data.shift 214 case r 215 when /\AStatistics\:/ 216 ary = @f0wu_stats 217 when /\AEXIT CODE *(\d+)\s*(.*)$/ 218 @exit_code = $1.to_i 219 if $2 and !$2.empty? then 220 @exit_code_message = r.sub(/\AEXIT CODE *(\d+)\s*/, '') 221 end 222 r = nil 223 when /\AFATAL\: / 224 @fatal_errors ||= [] 225 @fatal_errors.push r 226 r = nil 227 when /\AWARNING\: / 228 @f0warnings ||= [] 229 @f0warnings << r 230 r = nil 231 end 232 ary << r if r 233 end 234 @f0dbstat = F0dbstat.new(@f0wu_stats) 235 itr = @iterations[0] 236 x = @f0dbstat 237 itr.instance_eval { @f0dbstat = x } if itr 238 end
Splits parameters.
# File lib/bio/appl/blast/wublast.rb 241 def parse_parameters 242 unless defined?(@parse_parameters) 243 @parameters = {} 244 @parameter_matrix = [] 245 @f0wu_params.each do |x| 246 if /^ Query/ =~ x then 247 @parameter_matrix << x 248 else 249 x.split(/^/).each do |y| 250 if /\A\s*(.+)\s*\=\s*(.*)\s*/ =~ y then 251 @parameters[$1] = $2 252 elsif /\AParameters\:/ =~ y then 253 ; #ignore this 254 elsif /\A\s*(.+)\s*$/ =~ y then 255 @parameters[$1] = true 256 end 257 end 258 end 259 end 260 if ev = @parameters['E'] then 261 ev = '1' + ev if ev[0] == ?e 262 @parameters['E'] = ev.to_f 263 end 264 @parse_parameters = true 265 end 266 end