summaryrefslogtreecommitdiff
path: root/lib/algorithm.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.de>2009-12-20 19:16:25 +0100
committerChristoph Helma <helma@in-silico.de>2009-12-20 19:16:25 +0100
commit89bc8a67e63cf8e752f3b89aa52f7db87ce7ea7f (patch)
tree7bcb8dbabc70d5d026c7811fae700a803653cdc3 /lib/algorithm.rb
parentfbee9fbf8ce286a1264ef4ce8f3dfb77d048d067 (diff)
model adapted to OWL-DL, dataset predictions added
Diffstat (limited to 'lib/algorithm.rb')
-rw-r--r--lib/algorithm.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/algorithm.rb b/lib/algorithm.rb
index a32a462..7fe08fa 100644
--- a/lib/algorithm.rb
+++ b/lib/algorithm.rb
@@ -14,6 +14,10 @@ module OpenTox
"Feature URI for dependent variable" => { :scope => "mandatory", :value => "feature_uri" }
}
end
+
+ def self.create_feature_dataset(params)
+ RestClient.post params[:feature_generation_uri], :dataset_uri => params[:dataset_uri], :feature_uri => params[:feature_uri]
+ end
end
class Lazar #< OpenTox
@@ -35,5 +39,23 @@ module OpenTox
end
end
+ class Similarity
+
+ def self.weighted_tanimoto(fp_a,fp_b,p)
+ common_features = fp_a & fp_b
+ all_features = fp_a + fp_b
+ common_p_sum = 0.0
+ if common_features.size > 0
+ common_features.each{|f| common_p_sum += p[f]}
+ all_p_sum = 0.0
+ all_features.each{|f| all_p_sum += p[f]}
+ common_p_sum/all_p_sum
+ else
+ 0.0
+ end
+ end
+
+ end
+
end
end