diff options
author | Christoph Helma <helma@in-silico.ch> | 2016-01-08 11:00:20 +0100 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2016-01-08 11:00:20 +0100 |
commit | d6eced29e104b9bc1923b2ac89b2700a48adf07a (patch) | |
tree | 2323f6d57b172ff40a42a0de0aca648804625fb1 /lib/compound.rb | |
parent | e63e97086ac05e7a86f1a53bdcbc72eec0cabf16 (diff) |
mg-mmol conversion fixed
Diffstat (limited to 'lib/compound.rb')
-rw-r--r-- | lib/compound.rb | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/lib/compound.rb b/lib/compound.rb index d5a4cbb..040fd6f 100644 --- a/lib/compound.rb +++ b/lib/compound.rb @@ -337,30 +337,15 @@ module OpenTox end - # Get mg from logmmol (for nch LOAEL/pTD50 data) - # @return [Float] value in mg - def logmmol_to_mg(value, mw) - mg = (10**(-1.0*value.to_f)*(mw.to_f*1000)) - return mg - end - # Get mg from mmol # @return [Float] value in mg - def mmol_to_mg(value, mw) - mg = (value.to_f)*(mw.to_f) - return mg + def mmol_to_mg mmol + mmol.to_f*molecular_weight end def mg_to_mmol mg mg.to_f/molecular_weight end - - # Get mg from logmg - # @return [Float] value in mg - def logmg_to_mg(value) - mg = 10**value.to_f - return mg - end # Calculate molecular weight of Compound with OB and store it in object # @return [Float] molecular weight @@ -371,7 +356,6 @@ module OpenTox self["molecular_weight"].to_f end - private def self.obconversion(identifier,input_format,output_format,option=nil) |