Class: MS::Sequest::Srf::Header

Inherits:
Object
  • Object
show all
Defined in:
lib/ms/sequest/srf.rb

Constant Summary collapse

Start_byte =
{
  :enzyme => 438,
  :ion_series => 694,
  :model => 950,
  :modifications => 982,
  :raw_filename => 1822,
  :db_filename => 2082,
  :dta_log_filename => 2602,
  :params_filename => 3122,
  :sequest_log_filename => 3382,
}
Byte_length =
{
  :enzyme => 256,
  :ion_series => 256,
  :model => 32,
  :modifications => 840,
  :raw_filename => 260,
  :db_filename => 520,
  :dta_log_filename => 520,
  :params_filename => 260,
  :sequest_log_filename => 262, ## is this really 262?? or should be 260??
}
Byte_length_v32 =

is this really 262?? or should be 260??

{
  :modifications => 456,
}
NEWLINE_OR_NULL_RE =
/[#{__chars_re}]/o

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#combinedObject (readonly)

true if this is a combined file, false if represents a single file this is set by examining the DtaGen object for signs of a single file



368
369
370
# File 'lib/ms/sequest/srf.rb', line 368

def combined
  @combined
end

#db_filenameObject

Returns the value of attribute db_filename.



360
361
362
# File 'lib/ms/sequest/srf.rb', line 360

def db_filename
  @db_filename
end

#dta_genObject

a MS::Sequest::Srf::DtaGen object



354
355
356
# File 'lib/ms/sequest/srf.rb', line 354

def dta_gen
  @dta_gen
end

#dta_log_filenameObject

Returns the value of attribute dta_log_filename.



361
362
363
# File 'lib/ms/sequest/srf.rb', line 361

def dta_log_filename
  @dta_log_filename
end

#enzymeObject

Returns the value of attribute enzyme.



355
356
357
# File 'lib/ms/sequest/srf.rb', line 355

def enzyme
  @enzyme
end

#ion_seriesObject

Returns the value of attribute ion_series.



356
357
358
# File 'lib/ms/sequest/srf.rb', line 356

def ion_series
  @ion_series
end

#modelObject

Returns the value of attribute model.



357
358
359
# File 'lib/ms/sequest/srf.rb', line 357

def model
  @model
end

#modificationsObject

Returns the value of attribute modifications.



358
359
360
# File 'lib/ms/sequest/srf.rb', line 358

def modifications
  @modifications
end

#params_filenameObject

Returns the value of attribute params_filename.



362
363
364
# File 'lib/ms/sequest/srf.rb', line 362

def params_filename
  @params_filename
end

#raw_filenameObject

Returns the value of attribute raw_filename.



359
360
361
# File 'lib/ms/sequest/srf.rb', line 359

def raw_filename
  @raw_filename
end

#sequest_log_filenameObject

Returns the value of attribute sequest_log_filename.



363
364
365
# File 'lib/ms/sequest/srf.rb', line 363

def sequest_log_filename
  @sequest_log_filename
end

#versionObject

Returns the value of attribute version.



352
353
354
# File 'lib/ms/sequest/srf.rb', line 352

def version
  @version
end

Class Method Details

.from_io(fh) ⇒ Object



377
378
379
# File 'lib/ms/sequest/srf.rb', line 377

def self.from_io(fh)
  self.new.from_io(fh)
end

Instance Method Details

#from_io(fh) ⇒ Object

sets fh to 0 and grabs the information it wants



382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
# File 'lib/ms/sequest/srf.rb', line 382

def from_io(fh)
  st = fh.read(4) 
  @version = '3.' + st.unpack('I').first.to_s
  @dta_gen = MS::Sequest::Srf::DtaGen.from_io(fh)
  # if the start_mass end_mass start_scan and end_scan are all zero, its a
  # combined srf file:
  @combined = [0.0, 0.0, 0, 0].zip(%w(start_mass end_mass start_scan end_scan)).all? do |one,two|
    one == @dta_gen.send(two.to_sym)
  end

  ## get the rest of the info
  byte_length = Byte_length.dup
  byte_length.merge! Byte_length_v32 if @version == '3.2'

  fh.pos = Start_byte[:enzyme]
  [:enzyme, :ion_series, :model, :modifications, :raw_filename, :db_filename, :dta_log_filename, :params_filename, :sequest_log_filename].each do |param|
    send("#{param}=".to_sym, get_null_padded_string(fh, byte_length[param], @combined))
  end
  self
end

#num_dta_filesObject



373
374
375
# File 'lib/ms/sequest/srf.rb', line 373

def num_dta_files
  @dta_gen.num_dta_files
end