Sha256: ca7ecb14fad1a54cb134fd6c5a45d6dc9fcbd065892feea8c0f0e6ff13a91e35

Contents?: true

Size: 490 Bytes

Versions: 3

Compression:

Stored size: 490 Bytes

Contents

#!/usr/bin/env ruby
require_relative '../lib/lazar.rb'
include OpenTox
newfile = ARGV[0].sub(/.csv/,"_mmol_log10.csv") 
p newfile
CSV.open(newfile, "wb") do |csv|
  CSV.read(ARGV[0]).each do |line|
    smi,mol = line
    if mol.numeric?
      c = Compound.from_smiles smi
      #delog = 10**(-1*mol.to_f) #if values already -log10 but mol
      mmol = mol.to_f*1000
      log = -Math.log10(mmol)
      csv << [smi, log]
    else
      csv << [smi, mol.gsub(/mol/,'mmol')]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lazar-1.2.1 scripts/mol2mmol-log10.rb
lazar-1.2.0 scripts/mol2mmol-log10.rb
lazar-1.1.3 scripts/mol2mmol-log10.rb