summaryrefslogtreecommitdiff
path: root/lib/compound.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2016-05-06 12:49:28 +0200
committerChristoph Helma <helma@in-silico.ch>2016-05-06 12:49:28 +0200
commit51f57e2858b60bed74ebcc97189b2188c900c283 (patch)
treea3be50b410e45fad3f33e956bb302c66e0370226 /lib/compound.rb
parentab7b37541b4f8a762be737009631d3eefd898b4a (diff)
dataset tests cleanup
Diffstat (limited to 'lib/compound.rb')
-rw-r--r--lib/compound.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/compound.rb b/lib/compound.rb
index 143c4f2..6cb7f78 100644
--- a/lib/compound.rb
+++ b/lib/compound.rb
@@ -22,6 +22,7 @@ module OpenTox
# Overwrites standard Mongoid method to create fingerprints before database insertion
def self.find_or_create_by params
+ #PhysChem.descriptors # load descriptor features
compound = self.find_or_initialize_by params
compound.default_fingerprint_size = compound.fingerprint(DEFAULT_FINGERPRINT).size
compound.save
@@ -77,7 +78,7 @@ module OpenTox
def physchem descriptors=PhysChem.openbabel_descriptors
# TODO: speedup java descriptors
- calculated_ids = physchem.keys
+ calculated_ids = physchem_descriptors.keys
# BSON::ObjectId instances are not allowed as keys in a BSON document.
new_ids = descriptors.collect{|d| d.id.to_s} - calculated_ids
descs = {}
@@ -90,11 +91,11 @@ module OpenTox
# avoid recalculating Cdk features with multiple values
descs.keys.uniq.each do |k|
descs[k].send(k[0].downcase,k[1],self).each do |n,v|
- physchem[algos[n].id.to_s] = v # BSON::ObjectId instances are not allowed as keys in a BSON document.
+ physchem_descriptors[algos[n].id.to_s] = v # BSON::ObjectId instances are not allowed as keys in a BSON document.
end
end
save
- physchem.select{|id,v| descriptors.collect{|d| d.id.to_s}.include? id}
+ physchem_descriptors.select{|id,v| descriptors.collect{|d| d.id.to_s}.include? id}
end
def smarts_match smarts, count=false