summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorist <ist@ist.opentox.org>2010-10-28 15:42:54 +0200
committerist <ist@ist.opentox.org>2010-10-28 15:42:54 +0200
commitef97aadda700a51384b7a72a63e28fbce116e50c (patch)
treeb42c0de3a78233279f1a11191bf5d0e02dde62a0
parent79e426f4f3723a28a820b85a42924fe4322ab49a (diff)
Completed integration of LAST-PM
-rw-r--r--Rakefile28
-rw-r--r--application.rb2
-rw-r--r--fminer.rb19
m---------libfminer0
4 files changed, 32 insertions, 17 deletions
diff --git a/Rakefile b/Rakefile
index 588236b..0c72015 100644
--- a/Rakefile
+++ b/Rakefile
@@ -9,7 +9,11 @@ namespace "fminer" do
puts `git submodule init`
puts `git submodule update`
Dir.chdir('libfminer/libbbrc')
- puts `git checkout master`
+ puts `git checkout Makefile`
+ #puts `git checkout master`
+ puts `git fetch`
+ puts `git checkout -f -b refactor origin/refactor`
+ puts `git checkout refactor`
puts `git pull`
puts `./configure`
if $? == 0
@@ -20,7 +24,11 @@ namespace "fminer" do
end
puts `make ruby`
Dir.chdir('../liblast')
- puts `git checkout master`
+ puts `git checkout Makefile`
+ #puts `git checkout master`
+ puts `git fetch`
+ puts `git checkout -f -b refactor origin/refactor`
+ puts `git checkout refactor`
puts `git pull`
puts `./configure`
if $? == 0
@@ -32,7 +40,7 @@ namespace "fminer" do
puts `make ruby`
Dir.chdir('../../last-utils')
puts `git fetch`
- puts `git checkout -b experimental origin/experimental`
+ puts `git checkout -f -b experimental origin/experimental`
puts `git pull`
end
@@ -40,7 +48,11 @@ namespace "fminer" do
task :update do
puts `git submodule update`
Dir.chdir('libfminer/libbbrc')
- puts `git checkout master`
+ puts `git checkout Makefile`
+ #puts `git checkout master`
+ puts `git fetch`
+ puts `git checkout -f -b refactor origin/refactor`
+ puts `git checkout refactor`
puts `git pull`
puts `./configure`
if $? == 0
@@ -51,7 +63,11 @@ namespace "fminer" do
end
puts `make ruby`
Dir.chdir('../liblast')
- puts `git checkout master`
+ puts `git checkout Makefile`
+ #puts `git checkout master`
+ puts `git fetch`
+ puts `git checkout -f -b refactor origin/refactor`
+ puts `git checkout refactor`
puts `git pull`
puts `./configure`
if $? == 0
@@ -63,7 +79,7 @@ namespace "fminer" do
puts `make ruby`
Dir.chdir('../../last-utils')
puts `git fetch`
- puts `git checkout -b experimental origin/experimental`
+ puts `git checkout -f -b experimental origin/experimental`
puts `git pull`
end
end
diff --git a/application.rb b/application.rb
index 5aecfbb..3d511d1 100644
--- a/application.rb
+++ b/application.rb
@@ -1,4 +1,6 @@
require 'rubygems'
+require File.join(File.expand_path(File.dirname(__FILE__)), 'libfminer/libbbrc/bbrc') # has to be included before openbabel, otherwise we have strange SWIG overloading problems
+require File.join(File.expand_path(File.dirname(__FILE__)), 'libfminer/liblast/last') # has to be included before openbabel, otherwise we have strange SWIG overloading problems
require File.join(File.expand_path(File.dirname(__FILE__)), 'last-utils/lu.rb') # AM LAST
gem "opentox-ruby-api-wrapper", "= 1.6.5"
require 'opentox-ruby-api-wrapper'
diff --git a/fminer.rb b/fminer.rb
index 8cbf490..b706fb0 100644
--- a/fminer.rb
+++ b/fminer.rb
@@ -19,7 +19,6 @@ end
['/fminer/bbrc/?','/fminer/?'].each do |path| # AM LAST: set bbrc as default
post path do
- require File.join(File.expand_path(File.dirname(__FILE__)), 'libfminer/libbbrc/bbrc') # has to be included before openbabel, otherwise we have strange SWIG overloading problems
@@fminer = Bbrc::Bbrc.new
halt 404, "Please submit a dataset_uri." unless params[:dataset_uri] and !params[:dataset_uri].nil?
halt 404, "Please submit a feature_uri." unless params[:feature_uri] and !params[:feature_uri].nil?
@@ -150,7 +149,7 @@ end
LOGGER.debug "Fminer finished, dataset #{uri} created."
uri
end
- LOGGER.debug "Fimer task started: "+task_uri.to_s
+ LOGGER.debug "Fminer task started: "+task_uri.to_s
response['Content-Type'] = 'text/uri-list'
halt 202,task_uri.to_s+"\n"
end
@@ -158,7 +157,6 @@ end
post '/fminer/last/?' do
- require File.join(File.expand_path(File.dirname(__FILE__)), 'libfminer/liblast/last') # has to be included before openbabel, otherwise we have strange SWIG overloading problems
@@fminer = Last::Last.new
halt 404, "Please submit a dataset_uri." unless params[:dataset_uri] and !params[:dataset_uri].nil?
halt 404, "Please submit a feature_uri." unless params[:feature_uri] and !params[:feature_uri].nil?
@@ -187,7 +185,7 @@ post '/fminer/last/?' do
compounds = []
smi = [] # AM LAST: needed for matching the patterns back
- g_hash = Hash.new# DV: for effect calculation in regression part
+ all_hash = Hash.new# DV: for effect calculation in regression part
@@fminer.Reset
#@@fminer.SetChisqSig(0.99)
LOGGER.debug "Fminer: initialising ..."
@@ -224,7 +222,7 @@ post '/fminer/last/?' do
begin
@@fminer.AddCompound(smiles,id)
@@fminer.AddActivity(activity, id)
- g_hash[id]=activity # DV: insert global information
+ all_hash[id]=activity # DV: insert global information
rescue
LOGGER.warn "Could not add " + smiles + "\t" + act.to_s + " to fminer"
end
@@ -233,8 +231,6 @@ post '/fminer/last/?' do
id += 1
end
end
- g_array=g_hash.values # DV: calculation of global median for effect calculation
- g_median=OpenTox::Utils.median(g_array)
minfreq = (0.02*id).round
#minfreq = 5
@@fminer.SetMinfreq(minfreq)
@@ -254,12 +250,13 @@ post '/fminer/last/?' do
dom=lu.read(xml) # AM LAST: parse GraphML (needs hpricot, @ch: to be included in wrapper!)
smarts=lu.smarts_rb(dom,'msa') # AM LAST: converts patterns to LAST-SMARTS using msa variant (see last-pm.maunz.de)
instances=lu.match_rb(smi,smarts) # AM LAST: creates instantiations
-
instances.each do |smarts, ids|
+ feat_hash = Hash[*(all_hash.select { |k,v| ids.include?(k) }.flatten)] # AM LAST: get activities of feature occurrences; see http://www.softiesonrails.com/2007/9/18/ruby-201-weird-hash-syntax
+ @@fminer.GetRegression() ? p_value = @@fminer.KSTest(all_hash.values, feat_hash.values).to_f : p_value = @@fminer.ChisqTest(all_hash.values, feat_hash.values).to_f
tuple = {
url_for('/fminer#smarts',:full) => smarts,
- url_for('/fminer#p_value',:full) => nil, # AM LAST: TODO
- url_for('/fminer#effect',:full) => nil # AM LAST: TODO
+ url_for('/fminer#p_value',:full) => p_value.abs,
+ url_for('/fminer#effect',:full) => ((p_value>0)?'activating':'deactivating')
}
ids.each do |id|
feature_dataset.data[compounds[id]] = [] unless feature_dataset.data[compounds[id]]
@@ -271,7 +268,7 @@ post '/fminer/last/?' do
LOGGER.debug "Fminer finished, dataset #{uri} created."
uri
end
- LOGGER.debug "Fimer task started: "+task_uri.to_s
+ LOGGER.debug "Fminer task started: "+task_uri.to_s
response['Content-Type'] = 'text/uri-list'
halt 202,task_uri.to_s+"\n"
end
diff --git a/libfminer b/libfminer
-Subproject 00ce7e88f4f1ca16030a9b7bdabf216b5402f9c
+Subproject e0eee431ecb954328ff64e3cc48840c7003a276