From d6eced29e104b9bc1923b2ac89b2700a48adf07a Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Fri, 8 Jan 2016 11:00:20 +0100 Subject: mg-mmol conversion fixed --- lib/compound.rb | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'lib/compound.rb') 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) -- cgit v1.2.3