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

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



375
376
377
# File 'lib/ms/sequest/srf.rb', line 375

def combined
  @combined
end

#db_filenameObject

Returns the value of attribute db_filename.



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

def db_filename
  @db_filename
end

#dta_genObject

a Ms::Sequest::Srf::DTAGen object



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

def dta_gen
  @dta_gen
end

#dta_log_filenameObject

Returns the value of attribute dta_log_filename.



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

def dta_log_filename
  @dta_log_filename
end

#enzymeObject

Returns the value of attribute enzyme.



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

def enzyme
  @enzyme
end

#ion_seriesObject

Returns the value of attribute ion_series.



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

def ion_series
  @ion_series
end

#modelObject

Returns the value of attribute model.



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

def model
  @model
end

#modificationsObject

Returns the value of attribute modifications.



365
366
367
# File 'lib/ms/sequest/srf.rb', line 365

def modifications
  @modifications
end

#params_filenameObject

Returns the value of attribute params_filename.



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

def params_filename
  @params_filename
end

#raw_filenameObject

Returns the value of attribute raw_filename.



366
367
368
# File 'lib/ms/sequest/srf.rb', line 366

def raw_filename
  @raw_filename
end

#sequest_log_filenameObject

Returns the value of attribute sequest_log_filename.



370
371
372
# File 'lib/ms/sequest/srf.rb', line 370

def sequest_log_filename
  @sequest_log_filename
end

#versionObject

Returns the value of attribute version.



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

def version
  @version
end

Instance Method Details

#from_io(fh) ⇒ Object

sets fh to 0 and grabs the information it wants



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

def from_io(fh)
  st = fh.read(4) 
  @version = '3.' + st.unpack('I').first.to_s
  @dta_gen = Ms::Sequest::Srf::DTAGen.new.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



380
381
382
# File 'lib/ms/sequest/srf.rb', line 380

def num_dta_files
  @dta_gen.num_dta_files
end