class ExeCppLogReader

Public Class Methods

new(batch_folderpath,sample_index,analyte_name,chromatogram_type, *params) click to toggle source
Calls superclass method CommandLine_Exe::new
# File lib/exe_cpplogreader.rb, line 6
def initialize(batch_folderpath,sample_index,analyte_name,chromatogram_type, *params)

  @batch_folderpath = batch_folderpath
  @sample_index = sample_index
  @analyte_name = analyte_name

  @chromatogram_type =
    case chromatogram_type.downcase
      when 'quantifier','a','quant'
        'Quant'
      when 'qualifier','q','qual'
        'Qual'
      when 'internal standard', 'internalstandard','is'
        'IS'
      else
        chromatogram_type
    end

  super('CppLogReader.py',*params)

end

Public Instance Methods

run() click to toggle source
Calls superclass method CommandLine_Exe#run
# File lib/exe_cpplogreader.rb, line 28
def run
  retcode,rundetails = super(cmd)

  if retcode
    rundetails[:stdout] = JSON.parse(rundetails[:stdout])
  else
    errmsg = "#(rundetails[:cmd]} - #{rundetails[:stdout]}"
    puts errmsg
    $log_detercomp.error errmsg
  end

  return retcode,rundetails
end

Private Instance Methods

cmd() click to toggle source
# File lib/exe_cpplogreader.rb, line 44
def cmd
  "#{@exe_path} -b #{@batch_folderpath} -s #{@sample_index} -a #{@analyte_name} -c #{@chromatogram_type}"
end
log_decisions_to_array(property_description, hashDif) click to toggle source
# File lib/exe_cpplogreader.rb, line 48
def log_decisions_to_array(property_description, hashDif)

  arr = Array.new

  begin
    arr << property_description

    if property_description == 'peak_picked'
      arr << 0
      arr << 0
      arr << 0
      arr << hashDif
      arr << ''
    else

      arr << (hashDif[:percent_diff])
      arr << (hashDif[:baseline_rounded] || hashDif[:baseline]) #.to_s
      arr << (hashDif[:undertest_rounded] || hashDif[:undertest]) #.to_s

      if hashDif[:scale].nil?
        arr << ''
      else
        arr << "#{hashDif[:scale]} (#{hashDif[:min]}-#{hashDif[:max]})"
      end

      if hashDif[:calculation].nil?
        arr << ''
      else
        arr << hashDif[:calculation]
      end

    end
  rescue Exception => e
    $log_detercomp.err "error creating html table for #{property_description}"
  end

  return arr

end