Class: MS::Sequest::Sqt::Spectrum
- Inherits:
-
Object
- Object
- MS::Sequest::Sqt::Spectrum
- Defined in:
- lib/ms/sequest/sqt.rb
Overview
0=first_scan 1=last_scan 2=charge 3=time_to_process 4=node 5=mh 6=total_intensity 7=lowest_sp 8=num_matched_peptides 9=matches
Constant Summary collapse
- Leader =
'S'
Class Method Summary collapse
- .set_deltacn(spectra) ⇒ Object
-
.spectra_from_handle(fh, base_name, percolator_results = false) ⇒ Object
assumes the first line starts with an āSā.
Instance Method Summary collapse
-
#from_line(line) ⇒ Object
returns an array -> [the next spectra line (or nil if eof), spectrum].
Class Method Details
.set_deltacn(spectra) ⇒ Object
276 277 278 279 280 281 282 283 284 285 286 287 288 |
# File 'lib/ms/sequest/sqt.rb', line 276 def self.set_deltacn(spectra) spectra.each do |spec| matches = spec.matches if matches.size > 0 (0...(matches.size-1)).each do |i| matches[i].deltacn = matches[i+1].deltacn_orig end matches[-1].deltacn = 1.1 end end spectra end |
.spectra_from_handle(fh, base_name, percolator_results = false) ⇒ Object
assumes the first line starts with an āSā
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'lib/ms/sequest/sqt.rb', line 235 def self.spectra_from_handle(fh, base_name, percolator_results=false) peptides = [] spectra = [] while line = fh.gets case line[0,1] when MS::Sequest::Sqt::Spectrum::Leader spectrum = MS::Sequest::Sqt::Spectrum.new.from_line( line ) spectra << spectrum matches = [] spectrum.matches = matches when MS::Sequest::Sqt::Match::Leader match_klass = if percolator_results MS::Sequest::Sqt::Match::Percolator else MS::Sequest::Sqt::Match end match = match_klass.new.from_line( line ) #match[10,3] = spectrum[0,3] # structs cannot set multiple values at a time :( match[10] = spectrum[0] match[11] = spectrum[1] match[12] = spectrum[2] match[15] = base_name matches << match peptides << match loci = [] match.loci = loci matches << match when MS::Sequest::Sqt::Locus::Leader line.chomp! key = line.split(MS::Sequest::Sqt::Delimiter)[1] locus = MS::Sequest::Sqt::Locus.from_line( line ) loci << locus end end # set the deltacn: set_deltacn(spectra) [spectra, peptides] end |
Instance Method Details
#from_line(line) ⇒ Object
returns an array -> [the next spectra line (or nil if eof), spectrum]
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
# File 'lib/ms/sequest/sqt.rb', line 292 def from_line(line) line.chomp! ar = line.split(MS::Sequest::Sqt::Delimiter) self[0] = ar[1].to_i self[1] = ar[2].to_i self[2] = ar[3].to_i self[3] = ar[4].to_f self[4] = ar[5] self[5] = ar[6].to_f self[6] = ar[7].to_f self[7] = ar[8].to_f self[8] = ar[9].to_i self[9] = [] self end |