summaryrefslogtreecommitdiff
path: root/lib/compound.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2016-04-14 19:43:24 +0200
committerChristoph Helma <helma@in-silico.ch>2016-04-14 19:43:24 +0200
commit753fcc204d93d86c76860bee6e2f7d0468c3c940 (patch)
tree30fc9980de8b298ee57199c9b540408019a8976c /lib/compound.rb
parent64f1f32ced77afb278bdb7c27397c5299a73675c (diff)
features/toxicities fixed
Diffstat (limited to 'lib/compound.rb')
-rw-r--r--lib/compound.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/compound.rb b/lib/compound.rb
index 7895619..55cd482 100644
--- a/lib/compound.rb
+++ b/lib/compound.rb
@@ -17,8 +17,6 @@ module OpenTox
field :sdf_id, type: BSON::ObjectId
field :fingerprints, type: Hash, default: {}
field :default_fingerprint_size, type: Integer
- # TODO separate between physchem, bio and tox
- field :features, type: Hash, default: {}
index({smiles: 1}, {unique: true})
@@ -291,7 +289,7 @@ module OpenTox
candidate_fingerprint = compound.fingerprint params[:type]
sim = (query_fingerprint & candidate_fingerprint).size/(query_fingerprint | candidate_fingerprint).size.to_f
feature_values = training_dataset.values(compound,prediction_feature)
- neighbors << {"_id" => compound.id, "features" => {prediction_feature.id.to_s => feature_values}, "tanimoto" => sim} if sim >= params[:min_sim]
+ neighbors << {"_id" => compound.id, "toxicities" => {prediction_feature.id.to_s => feature_values}, "tanimoto" => sim} if sim >= params[:min_sim]
end
neighbors.sort!{|a,b| b["tanimoto"] <=> a["tanimoto"]}
end
@@ -332,7 +330,7 @@ module OpenTox
'in' => {'$divide' => ['$$common', {'$subtract' => [{'$add' => [default_fingerprint_size, '$default_fingerprint_size']}, '$$common']}]}
}},
'_id' => 1,
- 'features' => 1,
+ 'toxicities' => 1,
'dataset_ids' => 1
}},
{'$match' => {'tanimoto' => {'$gte' => params[:min_sim]}}},