Method: Ms::Quant::Qspec#run

Defined in:
lib/ms/quant/qspec.rb

#run(normalize = true, opts = {}) ⇒ Object

returns an array of Qspec::Results objects (each object can be considered a row of data)



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/ms/quant/qspec.rb', line 79

def run(normalize=true, opts={})
  puts "normalize: #{normalize}" if $VERBOSE
  tfile = Tempfile.new("qspec")
  write(tfile.path)
  if opts[:keep]
    local_file = File.join(Dir.pwd,File.basename(tfile.path))
    FileUtils.cp(tfile.path, local_file, :verbose => $VERBOSE)
    puts "(copy of) file submitted to qspec: #{local_file}" if $VERBOSE
  end
  qspec_exe = self.class.executable(conditions)
  cmd = [qspec_exe, tfile.path, NBURNIN, NITER, (normalize ? 1 : 0)].join(' ')
  if $VERBOSE
    puts "running #{cmd}" if $VERBOSE
  else
    cmd << " 2>&1"
  end
  reply = `#{cmd}`
  puts reply if $VERBOSE
  outfile = tfile.path + '_' + qspec_exe
  results = self.class.results_array(outfile)
  if opts[:keep]
    local_outfile = File.join(Dir.pwd, File.basename(outfile))
    FileUtils.cp(outfile, local_outfile, :verbose => $VERBOSE)
    puts "(copy of) file returned from qspec: #{outfile}"
  end
  tfile.unlink
  results
end