Class: Mspire::Sequest::Sqt::Spectrum
- Inherits:
-
Object
- Object
- Mspire::Sequest::Sqt::Spectrum
- Defined in:
- lib/mspire/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
274 275 276 277 278 279 280 281 282 283 284 285 286 |
# File 'lib/mspire/sequest/sqt.rb', line 274 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’
233 234 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 |
# File 'lib/mspire/sequest/sqt.rb', line 233 def self.spectra_from_handle(fh, base_name, percolator_results=false) peptides = [] spectra = [] while line = fh.gets case line[0,1] when Mspire::Sequest::Sqt::Spectrum::Leader spectrum = Mspire::Sequest::Sqt::Spectrum.new.from_line( line ) spectra << spectrum matches = [] spectrum.matches = matches when Mspire::Sequest::Sqt::Match::Leader match_klass = if percolator_results Mspire::Sequest::Sqt::Match::Percolator else Mspire::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 Mspire::Sequest::Sqt::Locus::Leader line.chomp! key = line.split(Mspire::Sequest::Sqt::Delimiter)[1] locus = Mspire::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]
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
# File 'lib/mspire/sequest/sqt.rb', line 290 def from_line(line) line.chomp! ar = line.split(Mspire::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 |