class Mspire::Sequest::Sqt::Spectrum
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
Constants
- Leader
Public Class Methods
set_deltacn(spectra)
click to toggle source
# 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)
click to toggle source
assumes the first line starts with an āSā
# 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
Public Instance Methods
from_line(line)
click to toggle source
returns an array -> [the next spectra line (or nil if eof), spectrum]
# 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