diff options
Diffstat (limited to 'scripts/functional-groups.rb')
-rwxr-xr-x | scripts/functional-groups.rb | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/scripts/functional-groups.rb b/scripts/functional-groups.rb index 9da2a18..1dd0e3e 100755 --- a/scripts/functional-groups.rb +++ b/scripts/functional-groups.rb @@ -4,28 +4,22 @@ old = Dataset.from_csv_file File.join(File.dirname(__FILE__),"..","regression"," new = Dataset.from_csv_file File.join(File.dirname(__FILE__),"..","regression","swissRat_chron_LOAEL_mmol.csv") functional_groups = {} -#functional_groups[:old] = {} -#functional_groups[:new] = {} table = [] -#File.open("functional-groups.csv","w+") do |file| - File.open("functional-groups.txt").each_line do |line| - name, smarts = line.chomp.split ": " - if smarts - smarts_feature = Smarts.from_smarts smarts - oldcount = 0 - old.compounds.each do |c| - oldcount += Algorithm::Descriptor.smarts_match(c,smarts_feature).first.to_i - end - newcount = 0 - new.compounds.each do |c| - newcount += Algorithm::Descriptor.smarts_match(c,smarts_feature).first.to_i - end - puts "#{name}, #{oldcount}, #{newcount}" if oldcount > 0 and newcount > 0 - else - p name, smarts +File.open("functional-groups.txt").each_line do |line| + name, smarts = line.chomp.split ": " + if smarts + smarts_feature = Smarts.from_smarts smarts + oldcount = 0 + old.compounds.each do |c| + oldcount += Algorithm::Descriptor.smarts_match(c,smarts_feature).first.to_i end - #table << [name, oldcount, newcount] + newcount = 0 + new.compounds.each do |c| + newcount += Algorithm::Descriptor.smarts_match(c,smarts_feature).first.to_i + end + puts "#{name}, #{oldcount}, #{newcount}" if oldcount > 0 and newcount > 0 + else + p name, smarts end -#end -#print table.to_csv -#old_fp = old.compounds.collect{|c| c.fingerprint("FP4")} + #table << [name, oldcount, newcount] +end |